This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/8] Break at each iteration for breakpoints placed on a while statement
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org, Luis Machado <lgustavo at codesourcery dot com>, <palves at redhat dot com>
- Date: Fri, 15 Apr 2016 12:48:32 -0700
- Subject: Re: [PATCH 0/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> <86zit9nzac dot fsf at gmail dot com> <570FC5BB dot 6060103 at codesourcery dot com> <86zisvkrqg dot fsf at gmail dot com>
On Fri, 15 Apr 2016 12:59:19 +0100
Yao Qi <qiyaoltc@gmail.com> wrote:
> Luis Machado <lgustavo@codesourcery.com> writes:
>
> > Thinking about the series, isn't this problem related to the compiler
> > optimizing things and/or presenting an imprecise addr/line information
> > as opposed to GDB doing the wrong thing.
>
> I think the address/line information is correct, and compiler does
> nothing wrong in this case. The first instruction of for loop is
> branch/jmp, which is correctly mapped to the right line. GDB should
> insert breakpoint at the place which can be hit in every iteration of
> loop on that line, rather than the first instruction of the loop (or line).
If the compiler could arrange to set `is_stmt' to false for that
inital branch, we could more easily arrange for GDB to not place a
break on that initial branch. It might even "just work" without any
additional coding on our part.
One of my colleagues within Red Hat looked at this and came up with a
gcc patch, but it turned out to cause breakage elsewhere. I still
think it makes sense to try to tackle this problem from the compiler
side though.
Kevin