From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: Re: [PATCH] gdb: Don't skip prologue for explicit line breakpoints in assembler
Date: Thu, 20 Jun 2019 01:11:00 -0000 [thread overview]
Message-ID: <20190619181147.69974f43@f29-4.lan> (raw)
In-Reply-To: <20190612123403.14348-1-andrew.burgess@embecosm.com>
On Wed, 12 Jun 2019 13:34:03 +0100
Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> It was observed that in some cases, placing a breakpoint in an
> assembler file using filename:line-number syntax would result in the
> breakpoint being placed at a different line within the file.
>
> For example, consider this x86-64 assembler:
>
> test:
> push %rbp /* Break here. */
> mov %rsp, %rbp
> nop /* Stops here. */
>
> The user places the breakpoint using file:line notation targeting the
> line marked 'Break here', GDB actually stops at the line marked 'Stops
> here'.
>
> The reason is that the label 'test' is identified as the likely start
> of a function, and the call to symtab.c:skip_prologue_sal causes GDB
> to skip forward over the instructions that GDB believes to be part of
> the prologue.
>
> I believe however, that when debugging assembler code, where the user
> has instruction-by-instruction visibility, if they ask for a specific
> line, GDB should (as far as possible) stop on that line, and not
> perform any prologue skipping. I don't believe that the behaviour of
> higher level languages should change, in these cases skipping the
> prologue seems like the correct thing to do.
I agree with all of this.
> In order to implement this change I needed to extend our current
> tracking of when the user has requested an explicit line number. We
> already tracked this in some cases, but not in others (see the changes
> in linespec.c). However, once I did this I started to see some
> additional failures (in tests gdb.base/break-include.exp
> gdb.base/ending-run.exp gdb.mi/mi-break.exp gdb.mi/mi-reverse.exp
> gdb.mi/mi-simplerun.exp) where we currently expected a breakpoint
> placed at one file and line number to be updated to reference a
> different line number, this was fixed by removing some code in
> symtab.c:skip_prologue_sal. My concern here is that removing this
> check didn't cause anything else to fail.
Did you investigate the reason for the failures with this hunk
left in place?...
> @@ -3812,12 +3821,6 @@ skip_prologue_sal (struct symtab_and_line *sal)
>
> sal->pc = pc;
> sal->section = section;
> -
> - /* Unless the explicit_line flag was set, update the SAL line
> - and symtab to correspond to the modified PC location. */
> - if (sal->explicit_line)
> - return;
> -
> sal->symt> FAIL: gdb.base/break-include.exp: break break-include.c:53
ab = start_sal.symtab;
> sal->line = start_sal.line;
> sal->end = start_sal.end;
The rest of the patch looks fine to me. Deleting those lines might
be okay also, but I'd like to understand why adding additional
explicit line number tracking caused these failures:
FAIL: gdb.base/break-include.exp: break break-include.c:53
FAIL: gdb.base/ending-run.exp: Cleared 2 by line
FAIL: gdb.base/ending-run.exp: clear 2 by default
Kevin
next prev parent reply other threads:[~2019-06-20 1:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 12:34 Andrew Burgess
2019-06-20 1:11 ` Kevin Buettner [this message]
2019-06-20 20:58 ` Andrew Burgess
2019-06-20 23:23 ` Andrew Burgess
2019-06-21 3:20 ` Kevin Buettner
2019-06-21 13:43 ` Pedro Alves
2019-06-22 11:06 ` Andrew Burgess
2019-06-22 11:23 ` Andrew Burgess
2019-06-24 19:16 ` Pedro Alves
2019-06-24 19:54 ` [PROTOTYPE] Make "info breakpoints" show breakpoint's specs (Re: [PATCH] gdb: Don't skip prologue for explicit line breakpoints in assembler) Pedro Alves
2019-07-03 22:37 ` Pedro Alves
2019-06-24 19:16 ` [PATCH] gdb: Don't skip prologue for explicit line breakpoints in assembler Pedro Alves
2019-07-01 17:12 ` Andrew Burgess
2019-07-01 18:03 ` [PATCHv2 2/2] " Andrew Burgess
2019-07-03 22:13 ` Pedro Alves
2019-07-01 18:03 ` [PATCHv2 1/2] gdb: Remove unneeded parameter from set_breakpoint_location_function Andrew Burgess
2019-07-03 22:13 ` Pedro Alves
2019-07-01 18:03 ` [PATCHv2 0/2] Changes for explicit_line tracking, and prologue skipping Andrew Burgess
2019-07-01 18:21 ` [PATCH] gdb: Don't skip prologue for explicit line breakpoints in assembler Pedro Alves
2019-07-02 8:28 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190619181147.69974f43@f29-4.lan \
--to=kevinb@redhat.com \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox