This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: breakpoint for accessing memory location
On Tue, Oct 24, 2006 at 01:36:52PM -0400, Eli Zaretskii wrote:
> > Date: Tue, 24 Oct 2006 08:57:09 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: Jim Blandy <jimb@codesourcery.com>, rodney.bates@wichita.edu,
> > gdb@sourceware.org
> > >
> > > Does the debug info tell us enough to do that?
> >
> > Sometimes, but not reliably.
>
> If so, I don't think GDB can do better than we do now, since only the
> compiler knows the true scope of a variable. Right?
We can work out the scope from the debug info, in most cases; I was
thinking about the wrong data in my previous message. But it's not
clear what we can _do_ with it.
DWARF-2 represents the PC ranges of lexical blocks at the source level.
You can see exactly where a variable ought to be in scope from that.
But unless you confine yourself to single-stepping, you won't know when
you leave that range. You can't set a breakpoint at the end of it,
because it may contain jumps.
> > Another problem with watchpoints is that we don't support any kind of
> > location lists for local variables
>
> Again, does the debug info include such location lists?
Yes. It may say "0x4-0x12 var in %eax, 0x12-0x40 var in 8(%ebp),
otherwise var has no value".
--
Daniel Jacobowitz
CodeSourcery