Discussion:
[Bug symtab/16842] New: crash on info addr DW_AT_const variable
jan.kratochvil at redhat dot com
2014-04-13 19:17:26 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Bug ID: 16842
Summary: crash on info addr DW_AT_const variable
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: jan.kratochvil at redhat dot com
Target: x86_64-linux-gnu

g++ -Wall -g
gdb ./a.out -ex 'b func<3>()' -ex r -ex 'info addr i'

GNU gdb (GDB) 7.7.50.20140413-cvs
Program received signal SIGSEGV, Segmentation fault.
0x00000000007332be in address_info (exp=0x7fffffffdd50 "i", from_tty=1) at
./printcmd.c:1258
1258 gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
(gdb) p sym->symtab
$1 = (struct symtab *) 0x0

------------------------------------------------------------------------------
// from GCC testsuite: g++.dg/debug/dwarf2/template-params-2.C
template <int i>
int
func()
{
int j = i;
return j;
}
const int foo = 1;
const int bar = 2;
int main()
{
return func<foo+bar>();
}
--
You are receiving this mail because:
You are on the CC list for the bug.
jan.kratochvil at redhat dot com
2014-04-13 19:39:03 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |jan.kratochvil at redhat dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Created attachment 7552
--> https://sourceware.org/bugzilla/attachment.cgi?id=7552&action=edit
consumer fix; but maybe dwarf2read.c producer should be fixed
--
You are receiving this mail because:
You are on the CC list for the bug.
weimin.pan at oracle dot com
2018-07-19 01:16:00 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

weimin.pan at oracle dot com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |weimin.pan at oracle dot com

--- Comment #2 from weimin.pan at oracle dot com ---
The crash problem was indirectly fixed by:

commit 08be3fe322244a3684d007d9282e225fc215f5d8
Author: Doug Evans <***@gmail.com>
Date: Tue Dec 23 07:21:10 2014 -0800

Replace some symbol accessor macros with functions.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-19 09:51:42 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
It still crashes for me with gdb 8.2 and git master:

(gdb) info addr i
Segmentation fault (core dumped)
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-19 11:57:30 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-08-02 22:18:53 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3e1d3d8c2494c021718ba957e83395958ee08a0f

commit 3e1d3d8c2494c021718ba957e83395958ee08a0f
Author: Tom Tromey <***@tromey.com>
Date: Thu Jul 19 11:24:49 2018 -0600

Allow "info address" of a template parameter

PR symtab/16842 shows that gdb will crash when the user tries to
invoke "info address" of a template parameter.

The bug here is that dwarf2read.c does not set the symtab on the
template parameter symbols. This is pedantically correct, given that
the template symbols do not appear in a symtab. However, gdb
primarily uses the symtab backlink to find the symbol's objfile. So,
this patch simply sets the symtab on these symbols.

Tested by the buildbot.

gdb/ChangeLog
2018-08-02 Tom Tromey <***@tromey.com>

PR symtab/16842.
* dwarf2read.c (read_func_scope): Set symtab on template parameter
symbols.
(process_structure_scope): Likewise.

gdb/testsuite/ChangeLog
2018-08-02 Tom Tromey <***@tromey.com>

PR symtab/16842.
* gdb.cp/temargs.exp: Test "info address" of a template
parameter.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-08-02 22:21:33 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
Fixed in 8.3.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-08-10 15:26:37 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=16842

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.3
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...