Harald> Hi, does anyone have a patch for gdb which would allow to
Harald> display the sybmolic destination of a JSR like this
Harald> a77db248 ldq t12, -19896(gp)
Harald> 6b5b6c2a jsr ra, (t12), 0x12004c0e4
Harald> and other accesses via (gp) for the disassebmle or x/i
Harald> instruction for a running process ?
In general, this can't be done reliably since the bits in the jsr
instruction are a hint only. And the hint is so small that many times
the target address you'd get based on the hint would be wrong.
Displaying a wrong hint can be very confusing and is IMHO worse than
saying nothing at all.
In object files, you can do it since there is relocation entry for the
jsr-hint giving the full address, but if the relocation information is
gone, you'd have to emulate the code far enough to know what the value
of the destination register is. Certainly nothing that can be done in
general. Notice that even in the code above you're not guaranteed
that t12 has the value of *(-19896(gp)) since the jsr instruction
itself could be a destination of a branch itself.
Is it doable for the common case? Probably so. Is it it worthwhile?
I'm not sure.
--david