disassembly options
Robin Getz
rgetz@blackfin.uclinux.org
Sat Sep 8 04:14:00 GMT 2007
On Fri 7 Sep 2007 10:59, Dave Korn pondered:
> On 07 September 2007 15:52, Nick Clifton wrote:
>
> > Hi Robin,
> >
> >> It would be nice to have something that automatically told me that the
> >> MMR at 0xffc00000 == "PLL_CTL", (the name actually means something -
> >> and is referenced in the standard processor documentation), and get
> >> something that looks like:
> >>
> >> 20e4: 4a e1 c0 ff P2.H = 0xffc0 /* 0xffc01f24 */;
> >> 20e8: 0a e1 00 00 P2.L = 0x0 /* 0xffc00000 */;
> >> 20ec: 10 95 R0 = W[P2] (Z) /* PLL_CTL */;
> >
> > I think that this would be useful.
> >
> > You may find however that implementing it in a nice generic way will mean
> > that you will have to rewrite the symbol/address decoding part of the
> > disassembler. Not that this would be a bad thing, it could certainly use
> > a tidy up.
>
> Won't the real tricky bit be in performing the data flow analysis?
Yes - my first example sucked/was wrong. It would be nice to do it with flow,
but at the present, I don't think that is possible in objdump, as everything
is linear.
A better/actually possible idea is:
P2.L = 0x1f24 /* P2=0x12f4 */
bunch of instructions
P2.H = 0xffc0 /* P2=0xffc01f24(MDMA1_D0_CURR_ADDR) */;
P2.L = 0x0 /* P2=0xffc00000(PLL_CTL) */;
bunch of instructions
R0 = W[P2] (Z);
The First load, since the address 12f4 is not a label, nor a MMR, it doesn't
print anything.
The next time the high part is loaded, P2=ffc01f24, which is a valid MMR, so it
prints out the name.
The P2 load half load is P2=0xffc00000, which again is a valid MMR, (PLL_CTL),
so it prints the name.
It is up to the human reading the code to look back and see what P2 really is,
for the exact code flow reasons you mentioned. Otherwise - you might as well
do it in a simulator (which wasn't my intention).
I think doing it like I was thinking before might provide 80% of the right
answers, but for those 20% where it is wrong, it could confuse the casual
reader, and lead them down the wrong path during a debugging session.
What I was hoping to do was be able to handle instructions like:
R0 = W[P2 + 4] (Z);
and be able to identify which register was being read, but I don't think this
is possible. (Unless someone has a smarter idea than I?).
-Robin
More information about the Binutils
mailing list