diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-19 11:24:49 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-08-02 16:12:42 -0600 |
commit | 3e1d3d8c2494c021718ba957e83395958ee08a0f (patch) | |
tree | b0836b010bf5cb9f9d70729a404725cd44ec36dc /gdb/testsuite/gdb.cp/temargs.exp | |
parent | 1584354913285389063622a39f845851f332eb9a (diff) | |
download | gdb-3e1d3d8c2494c021718ba957e83395958ee08a0f.zip gdb-3e1d3d8c2494c021718ba957e83395958ee08a0f.tar.gz gdb-3e1d3d8c2494c021718ba957e83395958ee08a0f.tar.bz2 |
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 <tom@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 <tom@tromey.com>
PR symtab/16842.
* gdb.cp/temargs.exp: Test "info address" of a template
parameter.
Diffstat (limited to 'gdb/testsuite/gdb.cp/temargs.exp')
-rw-r--r-- | gdb/testsuite/gdb.cp/temargs.exp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp index 8c87872..5a10910 100644 --- a/gdb/testsuite/gdb.cp/temargs.exp +++ b/gdb/testsuite/gdb.cp/temargs.exp @@ -133,6 +133,10 @@ gdb_test "ptype T" "unsigned char" "test type of T in func" if $have_older_template_gcc { setup_xfail "*-*-*" } gdb_test "print I" " = 91" "test value of I in func" +# PR symtab/16842 - gdb used to crash here. +if $have_older_template_gcc { setup_xfail "*-*-*" } +gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m" + if $have_older_template_gcc { setup_xfail "*-*-*" } gdb_test "print P == &a_global" " = true" "test value of P in func" @@ -151,6 +155,10 @@ gdb_test "ptype T" "double" "test type of T in templ_m" if $have_older_template_gcc { setup_xfail "*-*-*" } gdb_test "print I" " = 23" "test value of I in templ_m" +# PR symtab/16842 - gdb used to crash here. +if $have_older_template_gcc { setup_xfail "*-*-*" } +gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m" + if $have_older_template_gcc { setup_xfail "*-*-*" } gdb_test "print P == &a_global" " = true" "test value of P in templ_m" |