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/26813] DW_FORM_rnglistx and DW_FORM_loclistx not fully supported Date: Tue, 02 Feb 2021 15:43:04 +0000 [thread overview] Message-ID: <bug-26813-4717-1LA5ITaMzS@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-26813-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=26813 --- Comment #10 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Simon Marchi <simark@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a1c4010369aaa3ead33b7a5c248be9693d51b856 commit a1c4010369aaa3ead33b7a5c248be9693d51b856 Author: Simon Marchi <simon.marchi@efficios.com> Date: Tue Feb 2 10:40:51 2021 -0500 gdb/dwarf: read correct rnglist/loclist header in read_{rng,loc}list_index When loading the binary from PR 26813 in GDB, we get: DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array [in module /home/simark/build/binutils-gdb/gdb/MagicPurse] ... and the symbols fail to load. In read_rnglist_index and read_loclist_index, we read the header (documented in sections 7.28 and 7.29 of DWARF 5) of the CU's contribution to the .debug_rnglists / .debug_loclists sections to validate that the index we want to read makes sense. However, we always read the header at the beginning of the section, rather than the header for the contribution from which we want to read the index. To illustrate, here's what the binary from PR 26813 contains. There are two compile units: 0x0000000c: DW_TAG_compile_unit 1 DW_AT_ranges [DW_FORM_rnglistx]: 0x0 DW_AT_rnglists_base [DW_FORM_sec_offset]: 0xC 0x00003ec9: DW_TAG_compile_unit 2 DW_AT_ranges [DW_FORM_rnglistx]: 0xB DW_AT_rnglists_base [DW_FORM_sec_offset]: 0x85 The layout of the .debug_rnglists is the following: [0x00, 0x0B]: header for CU 1's contribution [0x0C, 0x0F]: list of offsets for CU 1 (1 element) [0x10, 0x78]: range lists data for CU 1 [0x79, 0x84]: header for CU 2's contribution [0x85, 0xB4]: list of offsets for CU 2 (12 elements) [0xB5, 0xBD7]: range lists data for CU 2 The DW_AT_rnglists_base attrbute points to the beginning of the list of offsets for that CU, relative to the start of the .debug_rnglists section. That's right after the header for that contribution. When we try to read the DW_AT_ranges attribute for CU 2, read_rnglist_index reads the header for CU 1 instead of the one for CU 2. Since there's only one element in CU 1's offset list, it believes (wrongfully) that the index 0xB is out of range. Fix it by reading the header just before where DW_AT_rnglists_base points to. With this patch, I am able to load GDB built with clang-11 and -gdwarf-5 in itself, with and without -readnow. gdb/ChangeLog: PR gdb/26813 * dwarf2/read.c (read_loclists_rnglists_header): Add header_offset parameter and use it. (read_loclist_index): Read header of the current contribution, not the one at the beginning of the section. (read_rnglist_index): Likewise. Change-Id: Ie53ff8251af8c1556f0a83a31aa8572044b79e3d -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-02-02 15:43 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-29 17:30 [Bug symtab/26813] New: " zoran.zaric at amd dot com 2020-10-29 17:33 ` [Bug symtab/26813] " zoran.zaric at amd dot com 2020-10-29 18:08 ` simark at simark dot ca 2020-10-30 14:22 ` tromey at sourceware dot org 2020-10-30 15:03 ` zoran.zaric at amd dot com 2020-10-30 18:21 ` simark at simark dot ca 2020-10-30 18:22 ` simark at simark dot ca 2020-10-30 19:03 ` simark at simark dot ca 2020-10-30 21:19 ` simark at simark dot ca 2020-11-02 15:57 ` simark at simark dot ca 2021-01-20 9:26 ` mliska at suse dot cz 2021-02-02 15:42 ` cvs-commit at gcc dot gnu.org 2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org [this message] 2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org 2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org 2021-02-02 15:43 ` simark at simark dot ca 2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org 2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org 2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org 2022-05-15 12:13 ` jeanmichael.celerier at gmail dot com 2022-05-15 14:33 ` tromey at sourceware dot org 2022-05-15 14:55 ` jeanmichael.celerier at gmail dot com 2022-05-15 15:09 ` tromey at sourceware dot org 2022-05-16 1:12 ` simark at simark dot ca
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-26813-4717-1LA5ITaMzS@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).