Re: breaking at for-loop test line

Andrew Cagney
2004-08-03T20:09:12Z

> On Fri, Jul 30, 2004 at 01:43:28PM +0200, Eli Zaretskii wrote:
>
>>>> > Date: Thu, 29 Jul 2004 11:29:40 -0400
>>>> > From: Daniel Jacobowitz <drow@false.org>
>>>> >
>>>> > I've been thinking for a while about a better interface for this, but I
>>>> > haven't come up with one yet.
>>
>>>
>>> Does GCC tell us in any way (via the debug info) that a single source
>>> line has more than a single statement?
>>>
>>> If not, the only way for GDB to figure that out is to parse the source
>>> code by itself.
>
>
> No, it doesn't, but there is more information available from the
> machine code than there is from the source code. For "for" statements,
> it's conceivable to work out that there are multiple places in the
> statement which serve as branch targets, via assembly analysis. Better
> would be to record this in the debug info; there's no way to do it,
> yet, but someone was bouncing around a proposal to record it in the
> line table.

Does dwarf3 include column information? That would let us break:

for (i ; i < 10 ; i++)

into:

for (i ;
i < 10 ;
i++)

which, at least on a graphics device, could be very effectively
represented to the user - the section of code to next be executed could
be highlighted.

Andrew

>>>> > GDB could also make it much easier to figure out where the condition is
>>>> > than it does now...
>>
>>>
>>> How?
>
>
> By providing a version of "info line" which described all the ranges of
> code belonging to a line instead of just the first one, or by a command
> which disassembled an entire line.
>