}
static void
-s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UShort i3),
- UChar m1, UShort i2, UShort i3)
+s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UInt i3),
+ UChar m1, UShort i2, UInt i3)
{
const HChar *mnm;
if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
S390_DISASM(MNM(mnm), UINT(m1), PCREL((Int)((Short)(i2 << 4) >> 4)),
- PCREL((Int)(Short)i3));
+ PCREL((Int)(i3 << 8) >> 8));
}
static void
}
static const HChar *
-s390_irgen_BPRP(UChar m1, UShort i2, UShort i3)
+s390_irgen_BPRP(UChar m1, UShort i2, UInt i3)
{
/* Treat as a no-op */
return "bprp";
char *dis_insn = p;
- /* Remove symbolic jump targets, if any. E.g. change
- 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0 <puts@plt> to
- 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0
- */
- p = strchr(p, '<');
- if (p) {
- *p-- = '\0';
- while (isspace(*p)) // remove trailing white space
- *p-- = '\0';
- }
-
if (strncmp(dis_insn, mark, strlen(mark)) == 0) {
if (marker_seen)
break; // we're done
const char *p2 = from_vex;
while (42) {
+ while (isspace(*p1))
+ ++p1;
+ while (isspace(*p2))
+ ++p2;
if (*p1 == '\0' && *p2 == '\0')
return 1;
if (*p1 == '\0' || *p2 == '\0')
return 0;
+
+ if (*p1 == *p2) {
+ ++p1;
+ ++p2;
+ continue;
+ }
+
+ /* Consider the case where the VEX disassembly has ".+integer"
+ or ".-integer" and the objdump disassembly has an hex address
+ possibly followed by a symbolic address, e.g. <main+0xe>. */
+ if (*p2++ != '.') return 0;
+
+ long long offset_in_bytes = 0;
+ unsigned long long target_address = 0;
+
+ while (isxdigit(*p1)) {
+ target_address *= 16;
+ if (isdigit(*p1))
+ target_address += *p1 - '0';
+ else {
+ int c = tolower(*p1);
+ if (c >= 'a' && c <= 'f')
+ target_address += 10 + c - 'a';
+ else
+ return 0; // error
+ }
+ ++p1;
+ }
while (isspace(*p1))
++p1;
- while (isspace(*p2))
+ if (*p1 == '<') {
+ while (*p1++ != '>')
+ ;
+ }
+
+ int is_negative = 0;
+ if (*p2 == '-') {
+ is_negative = 1;
+ ++p2;
+ } else if (*p2 == '+')
+ ++p2;
+ while (isdigit(*p2)) {
+ offset_in_bytes *= 10;
+ offset_in_bytes += *p2 - '0';
++p2;
- if (*p1 != *p2) {
- long long offset_in_bytes;
- unsigned long long target_address;
-
- /* Consider the case where the VEX disassembly has ".+integer"
- or ".-integer" and the objdump disassembly has an
- address. */
- if (*p2++ != '.') return 0;
- if (sscanf(p2, "%lld", &offset_in_bytes) != 1) return 0;
- if (sscanf(p1, "%llx", &target_address) != 1) return 0;
- return address + offset_in_bytes == target_address;
}
- ++p1;
- ++p2;
+ if (is_negative)
+ offset_in_bytes *= -1;
+
+ if (address + offset_in_bytes != target_address) return 0;
}
}