OpenSolaris

You are not signed in. Sign in or register.

Heads-up: changes to disassembler in dis, mdb, kmdb

Date: Wed, 31 May 2006 14:22:21 -0700
From: Dan Mick <dan dot mick at sun dot com>
To: onnv-gate at onnv dot eng dot sun dot com
Subject: Heads-up: changes to disassembler in dis, mdb, kmdb

I just integrated a set of changes to libdisasm:

6251453 dis should decode rip-relative memory accesses
6279427 mdb's x64 disassembler doesn't decode %rip-relative addresses for
data access
6427698 mdb/kmdb/dis should look up symbols for immediate operands
6428349 mdb/kmdb/dis (libdisasm) show odd offset for x86 IP-relative
instructions

which changes the x86/x64 disassembly in dis, mdb and kmdb in the following
ways, some of which you'll probably like a lot, but this is just to let you
know that the change is expected:

1) RIP-relative instructions now do symbol lookup, so all the amd64 code
that says things like

main+0xaf:      leaq   0x1f08c1(%rip),%r13
main+0xb6:      movq   0x1f08ba(%rip),%r8

will now report

main+0xaf:      leaq   +0x1f08c1(%rip),%r13     <init_tbl>
main+0xb6:      movq   +0x1f08ba(%rip),%r8      <init_tbl>

yay!  (If there's no symbol available, the full 64-bit effective address is
printed as a hint; this happens for static variables, for instance.)

2) Immediate values will now be looked up and symbols printed; this had
fallen off the shelf somehow in the transition to mdb/kmdb.  (This mostly
affects 32-bit disassembly, as most immediates are rip-relative on amd64.)

3) "Old-style" IP-relative displacements will always print as signed
offsets, and now from "next IP", the way the instruction is actually coded.
So, for example, "jmp" will always have "+/- offset", and "jump to next
instruction" is now disassembled as "jmp +0x0".  (of course symbols are
printed if a lookup succeeds, as always.)

4) Because of 3), the heuristic for "when to print a negative number" has
been relaxed; now an immediate with its sign bit set and absolute value <=
255 is printed as a negative value.  When a negative is printed, the
properly-sized unsigned value is also printed as a hint, in
case that's what the code intended.