* [Bug gdb/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
@ 2023-04-15 3:28 ` yangyibiao at nju dot edu.cn
2023-04-15 8:29 ` vries at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2023-04-15 3:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
Yibiao Yang <yangyibiao at nju dot edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org,
| |vries at gcc dot gnu.org,
| |yangyibiao at nju dot edu.cn
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug gdb/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
2023-04-15 3:28 ` [Bug gdb/30357] " yangyibiao at nju dot edu.cn
@ 2023-04-15 8:29 ` vries at gcc dot gnu.org
2023-04-16 6:34 ` vries at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-15 8:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-04-15
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Confirmed on openSUSE Tumbleweed, using:
...
gcc version 13.0.1 20230314 (experimental) [revision
42630fadbe248717859d61c0244c821c32b4e52c] (SUSE Linux)
...
Happens here:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...) at
/data/vries/gdb/src/gdb/dwarf2/read.c:18716
18716 if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
...
because:
...
(gdb) p filename
$1 = 0x0
...
It's probably triggered by an empty file name in the file name table:
...
The File Name Table (offset 0x219, lines 2, columns 2):
Entry Dir Name
0 0 (indirect line string, offset: 0x3c):
1 0 (indirect line string, offset: 0x14d): test.c
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug gdb/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
2023-04-15 3:28 ` [Bug gdb/30357] " yangyibiao at nju dot edu.cn
2023-04-15 8:29 ` vries at gcc dot gnu.org
@ 2023-04-16 6:34 ` vries at gcc dot gnu.org
2023-04-16 13:23 ` yangyibiao at nju dot edu.cn
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-16 6:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by:
...
diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
index 9d74c8fe75b..d59b63588d0 100644
--- a/gdb/dwarf2/line-header.c
+++ b/gdb/dwarf2/line-header.c
@@ -51,6 +51,9 @@ line_header::add_file_name (const char *name,
file_name_index index
= version >= 5 ? file_names_size (): file_names_size () + 1;
+ if (name == nullptr)
+ name = "";
+
if (dwarf_line_debug >= 2)
gdb_printf (gdb_stdlog, "Adding file %d: %s\n", index, name);
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug gdb/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (2 preceding siblings ...)
2023-04-16 6:34 ` vries at gcc dot gnu.org
@ 2023-04-16 13:23 ` yangyibiao at nju dot edu.cn
2023-04-16 13:51 ` tromey at sourceware dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2023-04-16 13:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #3 from Yibiao Yang <yangyibiao at nju dot edu.cn> ---
(In reply to Tom de Vries from comment #2)
> Fixed by:
> ...
> diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
> index 9d74c8fe75b..d59b63588d0 100644
> --- a/gdb/dwarf2/line-header.c
> +++ b/gdb/dwarf2/line-header.c
> @@ -51,6 +51,9 @@ line_header::add_file_name (const char *name,
> file_name_index index
> = version >= 5 ? file_names_size (): file_names_size () + 1;
>
> + if (name == nullptr)
> + name = "";
> +
> if (dwarf_line_debug >= 2)
> gdb_printf (gdb_stdlog, "Adding file %d: %s\n", index, name);
> ...
Thanks. I will update gdb to the latest version.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug gdb/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (3 preceding siblings ...)
2023-04-16 13:23 ` yangyibiao at nju dot edu.cn
@ 2023-04-16 13:51 ` tromey at sourceware dot org
2023-04-17 8:25 ` [Bug symtab/30357] " vries at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2023-04-16 13:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
read_direct_string replaces "" with NULL, which seems a little weird.
Anyway maybe read_formatted_entries should undo this.
Or perhaps there should be a non-transforming variant of read_direct_string.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (4 preceding siblings ...)
2023-04-16 13:51 ` tromey at sourceware dot org
@ 2023-04-17 8:25 ` vries at gcc dot gnu.org
2023-04-17 8:29 ` vries at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-17 8:25 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
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] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (5 preceding siblings ...)
2023-04-17 8:25 ` [Bug symtab/30357] " vries at gcc dot gnu.org
@ 2023-04-17 8:29 ` vries at gcc dot gnu.org
2023-04-17 8:36 ` vries at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-17 8:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14830
--> https://sourceware.org/bugzilla/attachment.cgi?id=14830&action=edit
Tentative patch
Currently testing.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (6 preceding siblings ...)
2023-04-17 8:29 ` vries at gcc dot gnu.org
@ 2023-04-17 8:36 ` vries at gcc dot gnu.org
2023-04-17 9:18 ` vries at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-17 8:36 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #4)
> Anyway maybe read_formatted_entries should undo this.
With the tentative patch taking this approach.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (7 preceding siblings ...)
2023-04-17 8:36 ` vries at gcc dot gnu.org
@ 2023-04-17 9:18 ` vries at gcc dot gnu.org
2023-04-17 16:09 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-17 9:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-April/198908.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (8 preceding siblings ...)
2023-04-17 9:18 ` vries at gcc dot gnu.org
@ 2023-04-17 16:09 ` cvs-commit at gcc dot gnu.org
2023-04-17 16:12 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-17 16:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #8 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=fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9
commit fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9
Author: Tom de Vries <tdevries@suse.de>
Date: Mon Apr 17 18:09:32 2023 +0200
[gdb/symtab] Handle empty file name in .debug_line section
With DWARF 5, it's possible to produce an empty file name in the File Name
Table of the .debug_line section:
...
The File Name Table (offset 0x112, lines 1, columns 2):
Entry Dir Name
0 1 (indirect line string, offset: 0x2d):
...
Currently, when gdb reads an exec containing such debug info, it segfaults:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...)
at \
gdb/dwarf2/read.c:18716
18716 if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
...
because read_direct_string transforms "" into a nullptr, and we end up
dereferencing the nullptr.
Note that the behaviour of read_direct_string has been present since repo
creation.
Fix this in read_formatted_entries, by transforming nullptr filenames in to
""
filenames.
Tested on x86_64-linux.
Reviewed-By: Tom Tromey <tom@tromey.com>
PR symtab/30357
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (9 preceding siblings ...)
2023-04-17 16:09 ` cvs-commit at gcc dot gnu.org
@ 2023-04-17 16:12 ` vries at gcc dot gnu.org
2023-04-18 3:47 ` cvs-commit at gcc dot gnu.org
2023-04-18 3:48 ` vries at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-17 16:12 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.1
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (10 preceding siblings ...)
2023-04-17 16:12 ` vries at gcc dot gnu.org
@ 2023-04-18 3:47 ` cvs-commit at gcc dot gnu.org
2023-04-18 3:48 ` vries at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-18 3:47 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--- Comment #10 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-13-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=69eedc8e312685d9c0055098e9c461b95a2e832f
commit 69eedc8e312685d9c0055098e9c461b95a2e832f
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Apr 18 05:47:21 2023 +0200
[gdb/symtab] Handle empty file name in .debug_line section
With DWARF 5, it's possible to produce an empty file name in the File Name
Table of the .debug_line section:
...
The File Name Table (offset 0x112, lines 1, columns 2):
Entry Dir Name
0 1 (indirect line string, offset: 0x2d):
...
Currently, when gdb reads an exec containing such debug info, it segfaults:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...)
at \
gdb/dwarf2/read.c:18716
18716 if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
...
because read_direct_string transforms "" into a nullptr, and we end up
dereferencing the nullptr.
Note that the behaviour of read_direct_string has been present since repo
creation.
Fix this in read_formatted_entries, by transforming nullptr filenames in to
""
filenames.
Tested on x86_64-linux.
Reviewed-By: Tom Tromey <tom@tromey.com>
PR symtab/30357
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30357
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30357] Segmentation fault for the 'start' command
2023-04-15 3:28 [Bug gdb/30357] New: Segmentation fault for the 'start' command yangyibiao at nju dot edu.cn
` (11 preceding siblings ...)
2023-04-18 3:47 ` cvs-commit at gcc dot gnu.org
@ 2023-04-18 3:48 ` vries at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-18 3:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30357
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.1 |13.2
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread