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/28200] DW_AT_ranges handling in partial_die_info::read does not handle discontinuous ranges
Date: Tue, 14 Sep 2021 12:41:31 +0000	[thread overview]
Message-ID: <bug-28200-4717-ur1q0K9TY4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28200-4717@http.sourceware.org/bugzilla/>

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

--- Comment #14 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=211aafd18d10b7739a16df5cc637952fd3f508e8

commit 211aafd18d10b7739a16df5cc637952fd3f508e8
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 14 14:41:27 2021 +0200

    [gdb/symtab] Fix function range handling in psymtabs

    Consider the test-case from this patch.

    We run into:
    ...
    (gdb) PASS: gdb.dwarf2/dw2-ranges-psym-warning.exp: continue
    bt^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
    warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in
symtab.)^M
    ^M
      read in psymtab, but not in symtab.)^M
    ^M
    )^M
    (gdb) FAIL: gdb.dwarf2/dw2-ranges-psym-warning.exp: bt
    ...

    This happens as follows.

    The function foo:
    ...
     <1><31>: Abbrev Number: 4 (DW_TAG_subprogram)
        <33>   DW_AT_name        : foo
        <37>   DW_AT_ranges      : 0x0
    ...
    has these ranges:
    ...
        00000000 00000000004004c1 00000000004004d2
        00000000 00000000004004ae 00000000004004af
        00000000 <End of list>
    ...
    which have a hole at at [0x4004af,0x4004c1).

    However, the address map of the partial symtabs incorrectly maps addresses
    in the hole (such as 0x4004b6 in the backtrace) to the foo CU.

    The address map of the full symbol table of the foo CU however does not
    contain the addresses in the hole, which is what the warning / internal
error
    complains about.

    Fix this by making sure that ranges of functions are read correctly.

    The patch adds a bit to struct partial_die_info, in this hole (shown for
    x86_64-linux):
    ...
    /*   11: 7   |     4 */    unsigned int canonical_name : 1;
    /* XXX  4-byte hole  */
    /*   16      |     8 */    const char *raw_name;
    ...
    So there's no increase in size for 64-bit, but AFAIU there will be an
increase
    for 32-bit.

    Tested on x86_64-linux.

    gdb/ChangeLog:

    2021-08-10  Tom de Vries  <tdevries@suse.de>

            PR symtab/28200
            * dwarf2/read.c (struct partial_die_info): Add has_range_info and
            range_offset field.
            (add_partial_subprogram): Handle pdi->has_range_info.
            (partial_die_info::read): Set pdi->has_range_info.

    gdb/testsuite/ChangeLog:

    2021-08-10  Tom de Vries  <tdevries@suse.de>

            PR symtab/28200
            * gdb.dwarf2/dw2-ranges-psym-warning-main.c: New test.
            * gdb.dwarf2/dw2-ranges-psym-warning.c: New test.
            * gdb.dwarf2/dw2-ranges-psym-warning.exp: New file.

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

  parent reply	other threads:[~2021-09-14 12:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 11:03 [Bug symtab/28200] New: " vries at gcc dot gnu.org
2021-08-06 11:04 ` [Bug symtab/28200] " vries at gcc dot gnu.org
2021-08-06 11:18 ` vries at gcc dot gnu.org
2021-08-06 11:57 ` vries at gcc dot gnu.org
2021-08-06 13:18 ` simark at simark dot ca
2021-08-06 14:23 ` vries at gcc dot gnu.org
2021-08-06 14:28 ` vries at gcc dot gnu.org
2021-08-06 15:44 ` simark at simark dot ca
2021-08-06 15:57 ` vries at gcc dot gnu.org
2021-08-06 16:46 ` simark at simark dot ca
2021-08-10 13:38 ` vries at gcc dot gnu.org
2021-08-10 15:06 ` vries at gcc dot gnu.org
2021-08-10 15:06 ` vries at gcc dot gnu.org
2021-08-24 14:29 ` brobecker at gnat dot com
2021-08-24 14:58 ` vries at gcc dot gnu.org
2021-09-14 12:41 ` cvs-commit at gcc dot gnu.org [this message]
2021-09-14 12:56 ` 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-28200-4717-ur1q0K9TY4@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).