public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/26546] [pie] Setting breakpoint on missing label sets breakpoint at offset 0 in NULL section
Date: Thu, 03 Sep 2020 10:30:14 +0000	[thread overview]
Message-ID: <bug-26546-4717-vM5kQTtuFc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26546-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26546

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8f5c6526ebbd8b5749dd2f348796b53f3e2b25ee

commit 8f5c6526ebbd8b5749dd2f348796b53f3e2b25ee
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Sep 3 12:30:10 2020 +0200

    [gdb/breakpoint, PIE] Handle setting breakpoint on label without address

    When adding:
    ...
    if ![runto_main] then {
        fail "can't run to main"
        return 0
    }
    ...
    to test-case gdb.base/label-without-address.exp and running it with target
    board unix/-fPIE/-pie, we run into:
    ...
    (gdb) break main:L1^M
    Breakpoint 2 at 0x555555554000: file label-without-address.c, line 22.^M
    ...
    That is, for a label with optimized-out address, we set a breakpoint at the
    relocation base.

    The root cause is that the dwarf reader, despite finding that attribute
    DW_AT_low_pc is missing, still tags the L1 symbol as having LOC_LABEL,
which
    means it has a valid address, which defaults to 0.

    Fix this by instead tagging the L1 symbol with LOC_OPTIMIZED_OUT.

    Tested on x86_64-linux.

    gdb/ChangeLog:

    2020-09-03  Tom de Vries  <tdevries@suse.de>

            PR breakpoint/26546
            * dwarf2/read.c (new_symbol): Tag label symbol without DW_AT_low_pc
as
            LOC_OPTIMIZED_OUT instead of LOC_LABEL.

    gdb/testsuite/ChangeLog:

    2020-09-03  Tom de Vries  <tdevries@suse.de>

            PR breakpoint/26546
            * gdb.base/label-without-address.exp: Runto main first.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-09-03 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 10:27 [Bug breakpoints/26546] New: " vries at gcc dot gnu.org
2020-08-28 11:33 ` [Bug breakpoints/26546] " vries at gcc dot gnu.org
2020-09-03 10:30 ` cvs-commit at gcc dot gnu.org [this message]
2020-09-03 10:31 ` vries at gcc dot gnu.org

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=bug-26546-4717-vM5kQTtuFc@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).