This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Designs for better debug info in GCC


On Wed, Dec 19, 2007 at 10:00:38AM -0800, Ian Lance Taylor wrote:
> int f(int x, int y) {
>   int i = 0, j = 0;
> 
>   probe1();
>   i = x;
>   j = y;
>   probe2();

> Of course there are no actual instructions between the calls to
> probe1() and probe2().  If I use gdb's "finish" command out of
> probe1(), what values should I see for 'i' and 'j' at that point?
> Arguably I am now before the assignment statements, and should see '0'
> and '0', the values that 'i' and 'j' have before they are changed.  Of
> course, this is the same location as the breakpoint before probe2(),
> and we can't see both '0'/'0' and 'x'/'y'.  So it seems to me that
> this situation is actually somewhat ambiguous.  I don't see an
> obviously correct answer.

For once, I do.  As far as a debugger dares to distinguish, any
location is always the beginning of the next instruction, not the end
of the preceeding instruction.  If you want to see the zeroes, stop in
probe1 and say "up" instead of "finish".

A hypothetical -Og which placed observation points between statements
would probably need a minimum of one nop per source line.  Similarly
for observation points at sequence points.

-- 
Daniel Jacobowitz
CodeSourcery


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