public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/26046] New: Missing breakpoint location without -readnow
@ 2020-05-26 15:38 vries at gcc dot gnu.org
2020-05-26 17:38 ` [Bug symtab/26046] " vries at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-26 15:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26046
Bug ID: 26046
Summary: Missing breakpoint location without -readnow
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider the following test-case (based on the test-case from PR15646):
...
$ cat foo.h
namespace N1
{
class C1
{
public:
static void __attribute__((always_inline)) baz () { volatile unsigned i;
i++; }
};
}
$ cat foo.cc
#include "foo.h"
namespace N1
{
void foo () { C1::baz (); }
}
extern void N1_bar (void);
int
main ()
{
N1::foo ();
N1_bar ();
return 0;
}
$ cat foo-2.cc
#include "foo.h"
namespace N1
{
void bar () { C1::baz (); }
}
void
N1_bar (void)
{
N1::bar ();
}
...
Compiled like this:
...
$ g++ foo.cc foo-2.cc -g
...
With -readnow, we set two breakpoint locations for N1::C1::baz:
...
$ gdb -readnow a.out -ex "b N1::C1::baz" -ex "info break"
Reading symbols from a.out...
Expanding full symbols from a.out...
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 foo.h:6
1.2 y 0x00000000004004f0 in N1::C1::baz() at foo.h:6
...
However, without -readnow, using partial symbols, we only get one breakpoint
location:
...
$ gdb a.out -ex "b N1::C1::baz" -ex "info break"
Reading symbols from a.out...
Breakpoint 1 at 0x4004f0: file foo.h, line 6.
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000004004f0 in N1::C1::baz() at foo.h:6
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/26046] Missing breakpoint location without -readnow
2020-05-26 15:38 [Bug symtab/26046] New: Missing breakpoint location without -readnow vries at gcc dot gnu.org
@ 2020-05-26 17:38 ` vries at gcc dot gnu.org
2020-05-27 10:39 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-26 17:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26046
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ec3844188e..bbd57325f5 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8054,6 +8054,8 @@ scan_partial_symbols (struct partial_die_info *first_die,
CORE_ADDR *lowpc,
case DW_TAG_subprogram:
case DW_TAG_inlined_subroutine:
add_partial_subprogram (pdi, lowpc, highpc, set_addrmap, cu);
+ scan_partial_symbols (pdi->die_child, lowpc, highpc,
+ set_addrmap, cu);
break;
case DW_TAG_constant:
case DW_TAG_variable:
@@ -18125,7 +18127,8 @@ load_partial_dies (const struct die_reader_specs
*reader,
if (!load_all
&& cu->language == language_cplus
&& parent_die != NULL
- && parent_die->tag == DW_TAG_subprogram)
+ && parent_die->tag == DW_TAG_subprogram
+ && abbrev->tag != DW_TAG_inlined_subroutine)
{
info_ptr = skip_one_die (reader, info_ptr + bytes_read, abbrev);
continue;
@@ -18300,9 +18303,7 @@ load_partial_dies (const struct die_reader_specs
*reader,
|| last_die->tag == DW_TAG_module
|| last_die->tag == DW_TAG_enumeration_type
|| (cu->language == language_cplus
- && last_die->tag == DW_TAG_subprogram
- && (last_die->name == NULL
- || strchr (last_die->name, '<') == NULL))
+ && last_die->tag == DW_TAG_subprogram)
|| (cu->language != language_c
&& (last_die->tag == DW_TAG_class_type
|| last_die->tag == DW_TAG_interface_type
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/26046] Missing breakpoint location without -readnow
2020-05-26 15:38 [Bug symtab/26046] New: Missing breakpoint location without -readnow 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
2020-06-03 21:51 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-27 10:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26046
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
submitted patch:
https://sourceware.org/pipermail/gdb-patches/2020-May/169055.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/26046] Missing breakpoint location without -readnow
2020-05-26 15:38 [Bug symtab/26046] New: Missing breakpoint location without -readnow 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
2020-06-03 21:51 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-03 21:50 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/26046] Missing breakpoint location without -readnow
2020-05-26 15:38 [Bug symtab/26046] New: Missing breakpoint location without -readnow vries at gcc dot gnu.org
` (2 preceding siblings ...)
2020-06-03 21:50 ` cvs-commit at gcc dot gnu.org
@ 2020-06-03 21:51 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-06-03 21:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26046
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
patch with test-case committed, marking resolved-fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-03 21:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 15:38 [Bug symtab/26046] New: Missing breakpoint location without -readnow 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
2020-06-03 21:51 ` vries at gcc dot gnu.org
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).