public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug symtab/29367] New: [gdb, debug-types, gdb-index] Bad CU index complaint not triggered Date: Thu, 14 Jul 2022 13:35:02 +0000 [thread overview] Message-ID: <bug-29367-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29367 Bug ID: 29367 Summary: [gdb, debug-types, gdb-index] Bad CU index complaint not triggered 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: --- [ .gdb_index variant of PR29336. ] Do this change in the test-suite: ... diff --git a/gdb/testsuite/gdb.ada/access_tagged_param.exp b/gdb/testsuite/gdb.ada/access_t agged_param.exp index 2b8e8ef172f..9c2b1871819 100644 --- a/gdb/testsuite/gdb.ada/access_tagged_param.exp +++ b/gdb/testsuite/gdb.ada/access_tagged_param.exp @@ -22,7 +22,7 @@ if { [skip_ada_tests] } { return -1 } standard_ada_testfile foo -if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-fdebug-types-section]] != "" } { return -1 } ... and run the test-case with target board cc-with-gdb-index. Verify that there are no complaints: ... $ gdb -q -batch -iex "set complaints 100" ./outputs/gdb.ada/access_tagged_param/foo -ex "b foo" Breakpoint 1 at 0x4023f4: file /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb, line 17. ... Observe using readelf -w that nr_cus == 56 and nr_tus == 10. Now hack gdb: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e554bc4f642..b3f0f5506c8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2996,6 +2996,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter, int attrs_valid = (index.version >= 7 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE); + cu_index = 56; /* Don't crash on bad data. */ if (cu_index >= per_objfile->per_bfd->all_comp_units.size (CUTU)) { ... Try again to see any complaints. Still none. Now do: ... /* Don't crash on bad data. */ - if (cu_index >= per_objfile->per_bfd->all_comp_units.size (CUTU)) + if (cu_index >= per_objfile->per_bfd->all_comp_units.size (CU)) ... [ assuming tentative patch for PR29336. ] Try again: ... $ gdb -q -batch -iex "set complaints 100" ./outputs/gdb.ada/access_tagged_param/foo -ex "b foo" During symbol reading: .gdb_index entry has bad CU index [in module /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_tagged_param/foo] During symbol reading: .gdb_index entry has bad CU index [in module /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_tagged_param/foo] Breakpoint 1 at 0x4023f4: file /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb, line 17. ... Bingo. Now the question: is this change correct? I can't figure out how a type in a .debug_types section would be addressed from the index. Maybe 56 is the correct way to address TU 0 ? I can't tell from the readelf output. Looking at the first type in .debug_types, ada_main__local_interrupt_states___PAD, we find it back in the index here: ... [2574] ada_main__local_interrupt_states___PAD: 0 [static, type] ... It's says zero here, but how is CU id 0 distinguished from TU id 0? -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-07-14 13:35 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-14 13:35 vries at gcc dot gnu.org [this message] 2022-07-21 9:00 ` [Bug symtab/29367] " 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-29367-4717@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: linkBe 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).