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 symtab/26046] Missing breakpoint location without -readnow
Date: Wed, 03 Jun 2020 21:50:20 +0000	[thread overview]
Message-ID: <bug-26046-4717-yQIlGVEuef@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26046-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 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=f9b5d5ea18a3878ca48c1b747e35d456133858bc

commit f9b5d5ea18a3878ca48c1b747e35d456133858bc
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Jun 3 23:50:16 2020 +0200

    [gdb/symtab] Fix missing breakpoint location for inlined function

    Consider the test-case contained in this patch.

    With -readnow, we have two breakpoint locations:
    ...
    $ gdb -readnow -batch breakpoint-locs -ex "b N1::C1::baz" -ex "info break"
    Breakpoint 1 at 0x4004cb: N1::C1::baz. (2 locations)
    Num     Type           Disp Enb Address            What
    1       breakpoint     keep y   <MULTIPLE>
    1.1                         y   0x00000000004004cb in N1::C1::baz() \
                                                         at breakpoint-locs.h:6
    1.2                         y   0x00000000004004f0 in N1::C1::baz() \
                                                         at breakpoint-locs.h:6
    ...

    But without -readnow, we have instead only one breakpoint location:
    ...
    $ gdb -batch breakpoint-locs -ex "b N1::C1::baz" -ex "info break"
    Breakpoint 1 at 0x4004f0: file breakpoint-locs.h, line 6.
    Num     Type           Disp Enb Address            What
    1       breakpoint     keep y   0x00000000004004f0 in N1::C1::baz() \
                                                         at breakpoint-locs.h:6
    ...

    The relevant dwarf is this bit:
    ...
     <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit)
        <d8>   DW_AT_name        : breakpoint-locs.cc
     <1><f4>: Abbrev Number: 2 (DW_TAG_namespace)
        <f5>   DW_AT_name        : N1
     <2><fe>: Abbrev Number: 3 (DW_TAG_class_type)
        <ff>   DW_AT_name        : C1
     <3><109>: Abbrev Number: 4 (DW_TAG_subprogram)
        <10a>   DW_AT_name        : baz
        <110>   DW_AT_linkage_name: _ZN2N12C13bazEv
     <2><116>: Abbrev Number: 5 (DW_TAG_subprogram)
        <117>   DW_AT_name        : foo
        <11d>   DW_AT_linkage_name: _ZN2N13fooEv
     <1><146>: Abbrev Number: 8 (DW_TAG_subprogram)
        <147>   DW_AT_specification: <0x116>
        <14b>   DW_AT_low_pc      : 0x4004c7
        <153>   DW_AT_high_pc     : 0x10
     <2><161>: Abbrev Number: 9 (DW_TAG_inlined_subroutine)
        <162>   DW_AT_abstract_origin: <0x194>
        <166>   DW_AT_low_pc      : 0x4004cb
        <16e>   DW_AT_high_pc     : 0x9
     <1><194>: Abbrev Number: 12 (DW_TAG_subprogram)
        <195>   DW_AT_specification: <0x109>
        <199>   DW_AT_inline      : 3       (declared as inline and inlined)
    ...

    The missing breakpoint location is specified by DIE 0x161, which is ignored
by
    the partial DIE reader because it's a child of a DW_TAG_subprogram DIE (at
    0x146, for foo).

    Fix this by not ignoring the DIE during partial DIE reading.

    Tested on x86_64-linux.

    gdb/ChangeLog:

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

            PR symtab/26046
            * dwarf2/read.c (scan_partial_symbols): Recurse into
DW_TAG_subprogram
            children for C++.
            (load_partial_dies): Don't skip DW_TAG_inlined_subroutine child of
            DW_TAG_subprogram.

    gdb/testsuite/ChangeLog:

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

            PR symtab/26046
            * gdb.cp/breakpoint-locs-2.cc: New test.
            * gdb.cp/breakpoint-locs.cc: New test.
            * gdb.cp/breakpoint-locs.exp: New file.
            * gdb.cp/breakpoint-locs.h: New test.

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

  parent reply	other threads:[~2020-06-03 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 15:38 [Bug symtab/26046] New: " vries at gcc dot gnu.org
2020-05-26 17:38 ` [Bug symtab/26046] " vries at gcc dot gnu.org
2020-05-27 10:39 ` vries at gcc dot gnu.org
2020-06-03 21:50 ` cvs-commit at gcc dot gnu.org [this message]
2020-06-03 21:51 ` 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-26046-4717-yQIlGVEuef@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).