Skip to content

Commit

Permalink
Debugger: Fix some format warnings in udis86.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Jun 17, 2018
1 parent 6592c62 commit 82dc4c0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ext/udis86/syn.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <inttypes.h>
#include "types.h" #include "types.h"
#include "decode.h" #include "decode.h"
#include "syn.h" #include "syn.h"
Expand Down Expand Up @@ -137,14 +138,14 @@ ud_syn_print_addr(struct ud *u, uint64_t addr)
name = u->sym_resolver(u, addr, &offset); name = u->sym_resolver(u, addr, &offset);
if (name) { if (name) {
if (offset) { if (offset) {
ud_asmprintf(u, "%s%+" FMT64 "d", name, offset); ud_asmprintf(u, "%s%+" PRId64, name, offset);
} else { } else {
ud_asmprintf(u, "%s", name); ud_asmprintf(u, "%s", name);
} }
return; return;
} }
} }
ud_asmprintf(u, "0x%" FMT64 "x", addr); ud_asmprintf(u, "0x%" PRIx64, addr);
} }




Expand All @@ -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 */ 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 uint64_t
Expand All @@ -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; case 64: v = op->lval.uqword; break;
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
} }
ud_asmprintf(u, "0x%" FMT64 "x", v); ud_asmprintf(u, "0x%" PRIx64, v);
} else { } else {
int64_t v; int64_t v;
UD_ASSERT(op->offset != 64); UD_ASSERT(op->offset != 64);
Expand All @@ -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) { if (op->base == UD_R_RIP) {
ud_syn_print_addr(u, ud_syn_rip_target(u, op)); ud_syn_print_addr(u, ud_syn_rip_target(u, op));
} else if (v < 0) { } else if (v < 0) {
ud_asmprintf(u, "-0x%" FMT64 "x", -v); ud_asmprintf(u, "-0x%" PRIx64, -v);
} else if (v > 0) { } else if (v > 0) {
ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v); ud_asmprintf(u, "%s0x%" PRIx64, sign? "+" : "", v);
} }
} }
} }
Expand Down

0 comments on commit 82dc4c0

Please sign in to comment.