This is the mail archive of the mailing list for the GDB 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: bfinish writes to random addresses.

On Tue, Jul 25, 2006 at 05:01:30PM +0100, Greg Law wrote:
> I guess one option would be to use a hardware breakpoint when setting 
> breakpoints based on such "derived" addresses.  At least that way it's 
> non-destructive if gdb gets it wrong.

Every address where GDB sets any breakpoint is "derived" in that sense.
And there aren't very many hardware breakpoints, if any.

> Having gdb check the return address looks like a sensible code address 
> might also be worthwhile.  Of course this will not fix all cases, 
> especially if the calculated return address happens to point into the 
> middle of an instruction.  But hopefully in reality most things that 
> look like pointers to code will actually be pointers to code, and so 
> properly aligned, and the breakpoint will just go to the wrong place, 
> rather than clobbering random data.

... Properly aligned?  You're talking about %ebp so I assume you're
talking about x86, and instructions have no alignment on this

Warning when returning from something with a symbol to something
without a symbol is an interesting suggestion.  Does anyone else have
comments?  Should this warn?

(gdb) bt
#0 foo()
#1 0x4000000 in ???
(gdb) finish

Daniel Jacobowitz

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