This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: disassembly options


On 08 September 2007 05:15, Robin Getz wrote:

>      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.

  I guess it depends on the sort of code the compiler tends to generate on your target.  Depending how scheduled it is, it might well be the case that you almost always get the right answer.  So I reckon it's still useful, but maybe you want to make it a --verbose option, and slap a medium-sized health warning on the docs.
 
> 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?).

  Well, if you're going for a linear analysis, you might as well keep a last-known P2 value kicking around, mightn't you.  It could get confused if somebody's not disassembling in a straight line, but we're only hoping for an approximation anyway.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]