public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
@ 2020-04-17  8:58 ` vries at gcc dot gnu.org
  2021-01-29 20:34 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-04-17  8:58 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|SIGSEGV in                  |[cc-with-gdb-index] SIGSEGV
                   |write_one_signatured_type   |in
                   |with cc-with-gdb-index in   |write_one_signatured_type
                   |fission-reread              |in fission-reread

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
  2020-04-17  8:58 ` [Bug gdb/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread vries at gcc dot gnu.org
@ 2021-01-29 20:34 ` vries at gcc dot gnu.org
  2021-02-01 10:20 ` [Bug symtab/24620] " vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-29 20:34 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
This fixes it:
...
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.S
b/gdb/testsuite/gdb.dwarf2/fiss
ion-reread.S
index 92087aa7ad9..c0d8545969c 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.S
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.S
@@ -143,7 +143,7 @@ SYMBOL(main):
        .4byte  0       /* Offset to Type DIE */
        .uleb128 0x2    /* (DIE (0) DW_TAG_type_unit) */
        .ascii "/tmp/src/gdb/testsuite\0"       /* DW_AT_comp_dir */
-       .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */
+       .ascii "outputs/gdb.dwarf2/fission-reread/fission-reread.dwo\0" /*
DW_AT_GNU_
dwo_name */
        .4byte  .Ldebug_pubnames0       /* DW_AT_GNU_pubnames */
        .4byte  .Ldebug_pubtypes0       /* DW_AT_GNU_pubtypes */
        .4byte  .Ldebug_addr0   /* DW_AT_GNU_addr_base */
@@ -214,7 +214,7 @@ SYMBOL(main):
        .4byte  .Letext0-.Ltext0        /* DW_AT_high_pc */
        .4byte  .Ldebug_line0   /* DW_AT_stmt_list */
        .ascii "/tmp/src/gdb/testsuite\0"       /* DW_AT_comp_dir */
-       .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */
+       .ascii "outputs/gdb.dwarf2/fission-reread/fission-reread.dwo\0" /*
DW_AT_GNU_
dwo_name */
        .4byte  .Ldebug_pubnames0       /* DW_AT_GNU_pubnames */
        .4byte  .Ldebug_pubtypes0       /* DW_AT_GNU_pubtypes */
        .4byte  .Ldebug_addr0   /* DW_AT_GNU_addr_base */
...

Basically commit c2b2ccc5edd "Make more robust when run in parallel mode"
strips the directory from DW_AT_GNU_dwo_name, and counteracts this using "set
debug-file-directory".

That setting is not active however during
build_executable_from_fission_assembler, which (when using target board
cc-with-gdb-index) is when gdb is called to generate gdb-index.

So, we try to generate a gdb-index for an executable which links to a .dwo file
that we can't find, and we run into the segfault.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
  2020-04-17  8:58 ` [Bug gdb/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread vries at gcc dot gnu.org
  2021-01-29 20:34 ` vries at gcc dot gnu.org
@ 2021-02-01 10:20 ` vries at gcc dot gnu.org
  2021-02-01 14:44 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01 10:20 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |symtab

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-02-01 10:20 ` [Bug symtab/24620] " vries at gcc dot gnu.org
@ 2021-02-01 14:44 ` vries at gcc dot gnu.org
  2021-02-01 14:45 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01 14:44 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch fixing assert submitted:
https://sourceware.org/pipermail/gdb-patches/2021-February/175664.html

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-02-01 14:44 ` vries at gcc dot gnu.org
@ 2021-02-01 14:45 ` vries at gcc dot gnu.org
  2021-02-02  7:37 ` cvs-commit at gcc dot gnu.org
  2021-02-02  7:40 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01 14:45 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> This fixes it:
> ...
> diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.S
> b/gdb/testsuite/gdb.dwarf2/fiss
> ion-reread.S
> index 92087aa7ad9..c0d8545969c 100644
> --- a/gdb/testsuite/gdb.dwarf2/fission-reread.S
> +++ b/gdb/testsuite/gdb.dwarf2/fission-reread.S
> @@ -143,7 +143,7 @@ SYMBOL(main):
>         .4byte  0       /* Offset to Type DIE */
>         .uleb128 0x2    /* (DIE (0) DW_TAG_type_unit) */
>         .ascii "/tmp/src/gdb/testsuite\0"       /* DW_AT_comp_dir */
> -       .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */
> +       .ascii "outputs/gdb.dwarf2/fission-reread/fission-reread.dwo\0" /*
> DW_AT_GNU_
> dwo_name */
>         .4byte  .Ldebug_pubnames0       /* DW_AT_GNU_pubnames */
>         .4byte  .Ldebug_pubtypes0       /* DW_AT_GNU_pubtypes */
>         .4byte  .Ldebug_addr0   /* DW_AT_GNU_addr_base */
> @@ -214,7 +214,7 @@ SYMBOL(main):
>         .4byte  .Letext0-.Ltext0        /* DW_AT_high_pc */
>         .4byte  .Ldebug_line0   /* DW_AT_stmt_list */
>         .ascii "/tmp/src/gdb/testsuite\0"       /* DW_AT_comp_dir */
> -       .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */
> +       .ascii "outputs/gdb.dwarf2/fission-reread/fission-reread.dwo\0" /*
> DW_AT_GNU_
> dwo_name */
>         .4byte  .Ldebug_pubnames0       /* DW_AT_GNU_pubnames */
>         .4byte  .Ldebug_pubtypes0       /* DW_AT_GNU_pubtypes */
>         .4byte  .Ldebug_addr0   /* DW_AT_GNU_addr_base */
> ...
> 
> Basically commit c2b2ccc5edd "Make more robust when run in parallel mode"
> strips the directory from DW_AT_GNU_dwo_name, and counteracts this using
> "set debug-file-directory".
> 
> That setting is not active however during
> build_executable_from_fission_assembler, which (when using target board
> cc-with-gdb-index) is when gdb is called to generate gdb-index.
> 
> So, we try to generate a gdb-index for an executable which links to a .dwo
> file that we can't find, and we run into the segfault.

Patch fixing test-cases submitted:
https://sourceware.org/pipermail/gdb-patches/2021-February/175665.html

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-02-01 14:45 ` vries at gcc dot gnu.org
@ 2021-02-02  7:37 ` cvs-commit at gcc dot gnu.org
  2021-02-02  7:40 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-02  7:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 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=2bd3e4b8d2580839a457e221d4e1e09105248215

commit 2bd3e4b8d2580839a457e221d4e1e09105248215
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Feb 2 08:37:45 2021 +0100

    [gdb/symtab] Fix assert in write_one_signatured_type

    When running test-case gdb.dwarf2/fission-reread.exp with target board
    cc-with-gdb-index, we run into an abort during the generation of the
gdb-index
    by cc-with-tweaks.sh:
    ...
    build/gdb/testsuite/cache/gdb.sh: line 1: 27275 Aborted  (core dumped)
    ...

    This can be reproduced on the command line like this:
    ...
    $ gdb -batch ./outputs/gdb.dwarf2/fission-reread/fission-reread \
      -ex 'save gdb-index  ./outputs/gdb.dwarf2/fission-reread'
    warning: Could not find DWO TU fission-reread.dwo(0x9022f1ceac7e8b19) \
      referenced by TU at offset 0x0 [in module fission-reread]
    warning: Could not find DWO CU fission-reread.dwo(0x807060504030201) \
      referenced by CU at offset 0x561 [in module fission-reread]
    Aborted (core dumped)
    ...

    The abort is a segfault due to a using a nullptr psymtab in
    write_one_signatured_type.

    The problem is that we're trying to write index entries for the type unit
    with signature:
    ...
    (gdb) p /x entry->signature
    $2 = 0x9022f1ceac7e8b19
    ...
    which is a skeleton type unit:
    ...
    Contents of the .debug_types section:

      Compilation Unit @ offset 0x0:
       Length:        0x4a (32-bit)
       Version:       4
       Abbrev Offset: 0x165
       Pointer Size:  4
       Signature:     0x9022f1ceac7e8b19
       Type Offset:   0x0
     <0><17>: Abbrev Number: 2 (DW_TAG_type_unit)
        <18>   DW_AT_comp_dir    : /tmp/src/gdb/testsuite
        <2f>   DW_AT_GNU_dwo_name: fission-reread.dwo
        <42>   DW_AT_GNU_pubnames: 0x0
        <46>   DW_AT_GNU_pubtypes: 0x0
        <4a>   DW_AT_GNU_addr_base: 0x0
    ...
    referring to a .dwo file, but as the warnings show, the .dwo file is not
    found.

    Fix this by skipping the type unit in write_one_signatured_type if
    psymtab == nullptr.

    Tested on x86_64-linux.

    gdb/ChangeLog:

    2021-02-02  Tom de Vries  <tdevries@suse.de>

            PR symtab/24620
            * dwarf2/index-write.c (write_one_signatured_type): Skip if
            psymtab == nullptr.

    gdb/testsuite/ChangeLog:

    2021-02-02  Tom de Vries  <tdevries@suse.de>

            PR symtab/24620
            * gdb.dwarf2/fission-reread.exp: Add test-case.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread
       [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-02-02  7:37 ` cvs-commit at gcc dot gnu.org
@ 2021-02-02  7:40 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-02  7:40 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |11.1
         Resolution|---                         |FIXED

--- Comment #7 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] 7+ messages in thread

end of thread, other threads:[~2021-02-02  7:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-24620-4717@http.sourceware.org/bugzilla/>
2020-04-17  8:58 ` [Bug gdb/24620] [cc-with-gdb-index] SIGSEGV in write_one_signatured_type in fission-reread vries at gcc dot gnu.org
2021-01-29 20:34 ` vries at gcc dot gnu.org
2021-02-01 10:20 ` [Bug symtab/24620] " vries at gcc dot gnu.org
2021-02-01 14:44 ` vries at gcc dot gnu.org
2021-02-01 14:45 ` vries at gcc dot gnu.org
2021-02-02  7:37 ` cvs-commit at gcc dot gnu.org
2021-02-02  7:40 ` 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).