This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/8] Break at each iteration for breakpoints placed on a while statement
- From: Doug Evans <xdje42 at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Kevin Buettner <kevinb at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 30 Sep 2015 21:09:34 -0700
- Subject: Re: [PATCH 3/8] Break at each iteration for breakpoints placed on a while statement
- Authentication-results: sourceware.org; auth=none
- References: <20150818235334 dot 1afb0c85 at pinnacle dot lan> <20150819000334 dot 62f7a867 at pinnacle dot lan> <55DC5B13 dot 6030501 at redhat dot com> <20150917185751 dot 22fe2937 at pinnacle dot lan> <560BD2B7 dot 9010706 at redhat dot com>
On Wed, Sep 30, 2015 at 5:16 AM, Pedro Alves <palves@redhat.com> wrote:
> Hi Kevin,
>
> Sorry for the delay.
>
> On 09/18/2015 02:57 AM, Kevin Buettner wrote:
>
>> If I place a breakpoint on the Loop 5 line, it ends up on on 0x4005cc,
>> which is a nop. It appears that gcc has rewritten this code so that
>> the the comparison comes first, which exactly the opposite of what
>> happens when one writes a while loop.
>>
>> The presence of the nop means that things work as expected when we
>> place a breakpoint on that line. It will stop just once on the
>> statement instead of once for each time through the loop.
>>
>> This was an interesting exercise, but it doesn't really answer the
>> question of what would happen if gcc would instead place an
>> actual branch at the beginning. I would expect my patch
>> to cause the breakpoint to be placed within the loop instead
>> of at the beginning of the statement. I don't think this is
>> desirable, but I can't think of a way (within the current work) to
>> stop it from happening.
>
> Yeah, me neither. This is always going to be brittle. :-/
> Really the best would be DWARF is_stmt.
I hate to enter into this late, but holy cow,
is this really what the dwarf committee and gcc developers
expect gdb to do?
Assuming, for the moment, that dwarf handles this just fine,
can't we push back on gcc?