Permalink
Browse files

Debugger: Fix some format warnings in udis86.

  • Loading branch information...
unknownbrackets committed Jun 17, 2018
1 parent 6592c62 commit 82dc4c0b726c2c175d530d7eae9ea4caf80a80e6
Showing with 7 additions and 6 deletions.
  1. +7 −6 ext/udis86/syn.c
@@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <inttypes.h>
#include "types.h"
#include "decode.h"
#include "syn.h"
@@ -137,14 +138,14 @@ ud_syn_print_addr(struct ud *u, uint64_t addr)
name = u->sym_resolver(u, addr, &offset);
if (name) {
if (offset) {
ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
ud_asmprintf(u, "%s%+" PRId64, name, offset);
} else {
ud_asmprintf(u, "%s", name);
}
return;
}
}
ud_asmprintf(u, "0x%" FMT64 "x", addr);
ud_asmprintf(u, "0x%" PRIx64, addr);
}
@@ -171,7 +172,7 @@ ud_syn_print_imm(struct ud* u, const struct ud_operand *op)
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
}
}
ud_asmprintf(u, "0x%" FMT64 "x", v);
ud_asmprintf(u, "0x%" PRIx64, v);
}
uint64_t
@@ -193,7 +194,7 @@ ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
case 64: v = op->lval.uqword; break;
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
}
ud_asmprintf(u, "0x%" FMT64 "x", v);
ud_asmprintf(u, "0x%" PRIx64, v);
} else {
int64_t v;
UD_ASSERT(op->offset != 64);
@@ -206,9 +207,9 @@ ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
if (op->base == UD_R_RIP) {
ud_syn_print_addr(u, ud_syn_rip_target(u, op));
} else if (v < 0) {
ud_asmprintf(u, "-0x%" FMT64 "x", -v);
ud_asmprintf(u, "-0x%" PRIx64, -v);
} else if (v > 0) {
ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
ud_asmprintf(u, "%s0x%" PRIx64, sign? "+" : "", v);
}
}
}

0 comments on commit 82dc4c0

Please sign in to comment.