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/27981] New: [gdb/symtab] CU importing itself causes gdb to segfault
Date: Mon, 14 Jun 2021 14:56:44 +0000	[thread overview]
Message-ID: <bug-27981-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 27981
           Summary: [gdb/symtab] CU importing itself causes gdb to
                    segfault
           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: ---

With a test-case containing the following CU:
...
  Compilation Unit @ offset 0xc7:
   Length:        0x38 (32-bit)
   Version:       4
   Abbrev Offset: 0x64
   Pointer Size:  8
 <0><d2>: Abbrev Number: 2 (DW_TAG_compile_unit)
    <d3>   DW_AT_language    : 2        (non-ANSI C)
    <d4>   DW_AT_name        : main.c
 <1><db>: Abbrev Number: 3 (DW_TAG_imported_unit)
    <dc>   DW_AT_import      : <0xd2>   [Abbrev Number: 2
(DW_TAG_compile_unit)]
 <1><e0>: Abbrev Number: 4 (DW_TAG_base_type)
    <e1>   DW_AT_byte_size   : 4
    <e2>   DW_AT_encoding    : 5        (signed)
    <e3>   DW_AT_name        : int
 <1><e7>: Abbrev Number: 5 (DW_TAG_subprogram)
    <e8>   DW_AT_name        : main
    <ed>   DW_AT_low_pc      : 0x4004a7
    <f5>   DW_AT_high_pc     : 0x4004b2
    <fd>   DW_AT_type        : <0xe0>
    <101>   DW_AT_external    : 1
 <1><102>: Abbrev Number: 0
...
we get GDB to crash
...
$ gdb -q -batch outputs/gdb.dwarf2/import-cycle/import-cycle -ex "p main"
Aborted (core dumped)
...

In more detail, we run out of stack with a sigsegv:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x00000000008e0366 in recursively_search_psymtabs(partial_symtab *, objfile *,
block_search_flags, domain_enum, search_domain, const lookup_name_info &,
gdb::function_view<bool(char const*)>) (ps=0x218bc90, objfile=0x1ad0140,
search_flags=..., domain=VAR_DOMAIN, 
    search=ALL_DOMAIN, 
    lookup_name=<error reading variable: Cannot access memory at address
0x7fffff7feff8>, 
...

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

             reply	other threads:[~2021-06-14 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 14:56 vries at gcc dot gnu.org [this message]
2021-06-14 14:59 ` [Bug symtab/27981] " vries at gcc dot gnu.org
2022-06-29 14:53 ` vries at gcc dot gnu.org
2022-06-29 15:29 ` vries at gcc dot gnu.org
2022-07-04 18:35 ` tromey at sourceware dot org
2022-07-04 18:36 ` tromey at sourceware dot 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-27981-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: 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).