[RFA/m32r] Fix breakpoint bug

Andrew Cagney cagney@gnu.org
Thu Nov 4 00:21:00 GMT 2004


Kei Sakamoto wrote:
 >Daniel wrote:
>>I'm curious about the little endian case:
>>
>>+  else /* little-endian */
>>+    {
>>+      if ((addr & 3) == 0)
>>+ {
>>+   buf[0] = contents_cache[0];
>>+   buf[1] = contents_cache[1] & 0x7f;
>>+   buf[2] = bp_entry[1];
>>+   buf[3] = bp_entry[0];
>>  }
>>
>>Shouldn't the breakpoint be placed at buf[0] here rather than buf[2]?
> 
> 
> For most of architectures - yes, it shold be at buf[0]. But the little endian
> mode of M32R is a kind of unique.
> 
> In other architectures, two 16-bit instructions, A and B, are placed as
> the following:
> 
> Big endian:
> A0 A1 B0 B1
> 
> Little endian:
> A1 A0  B1 B0
> 
> In M32R, they are placed like this:
> 
> Big endian:
> A0 A1 B0 B1
> 
> Little endian:
> B1 B0 A1 A0
> 
> This is because M32R always fetches instructions in 32-bit.
> So the breakpoint should be placed at buf[2].

Then this is ok (mainline and 6.3).  I'd add a comment explaining the 
above before committing though.

sorry for the delay,
Andrew



More information about the Gdb-patches mailing list