Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Problem with breakpoint addresses
@ 2006-10-12 17:54 Andrew STUBBS
  2006-10-12 19:50 ` Michael Snyder
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew STUBBS @ 2006-10-12 17:54 UTC (permalink / raw)
  To: GDB List

Hi,

I have a problem setting breakpoints from addresses stored in registers.

Here's an example:

(gdb) set $r1 = 0x80000000
(gdb) b *$r1
Breakpoint 2 at 0x80000000

The breakpoint looks like it is set correctly, but actually, if it is to 
work, I have to set it like this:

(gdb) b *($r1 & ~0U)
Breakpoint 3 at 0x80000000

This shows the difference:

(gdb) info breakpoints
Num Type           Disp Enb Address    What
2   breakpoint     keep y   0xffffffff80000000
3   breakpoint     keep y   0x80000000

The address has been sign extended. Note that there is no problem with 
registers of unsigned type. This is with an sh-elf target hosted on 
i686-pc-linux-gnu and using 'target sim'.

The effect of this is that the breakpoint is placed correctly, but, once 
hit, the program cannot continue or step any further.

The problem appears to be that the 32 bit address is used to set the 
breakpoint (i.e. the 64 bit address is truncated somewhere in the 
system), but when it is hit GDB does the address comparison and the 
addresses are not the same so the breakpoint is not recognised.

My question is: what is the _correct_ fix for this issue?

Should it never do sign extension? Should it always do sign extension? 
Is there some way to identify when it is intended and when not? Or 
perhaps the true problem is elsewhere entirely?

Andrew Stubbs


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-10-30 17:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-12 17:54 Problem with breakpoint addresses Andrew STUBBS
2006-10-12 19:50 ` Michael Snyder
2006-10-13  8:29   ` Andrew STUBBS
2006-10-13 13:19     ` Daniel Jacobowitz
2006-10-30 16:18       ` Andrew STUBBS
2006-10-30 16:44         ` Daniel Jacobowitz
2006-10-30 16:55           ` Andrew STUBBS
2006-10-30 17:07             ` Daniel Jacobowitz
2006-10-13 18:39     ` Michael Snyder
2006-10-15 20:00       ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox