diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-02-04 13:10:28 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-02-04 22:21:08 -0500 |
commit | e61b4af73de761ca2b877b09c1ad710f44ba0f54 (patch) | |
tree | b82ac5f4a15dca00cd1231e162d73176af548b8a /gdb/valprint.c | |
parent | 9f7393d8fc8b79a92b027cd8ac6fda9441d3fff9 (diff) | |
download | binutils-users/simark/template-suffix.zip binutils-users/simark/template-suffix.tar.gz binutils-users/simark/template-suffix.tar.bz2 |
Don't trust templates from DW_AT_nameusers/simark/template-suffix
With gcc 8 (and clang?) the non-type template arguments (constants)
don't include the integer suffixes anymore. For example, with
template <unsigned int X>
class foo
{
...
};
foo<10u>
used to generate foo<10u> as the DW_AT_name, now it generates foo<10>.
This is a problem when things look up "foo<10u>" and don't find it. For
example, when trying to print an instance of that class through a base
class pointer, GDB would first demangle the symbol for that class'
vtable, which would give "vtable for foo<10u>". GDB would then take the
"foo<10u>" from that string and try to look up the type. With the new
DW_AT_name, it would fail to look it up, and fail to print the value.
This patch makes it so GDB doesn't trust the templates contained in
DW_AT_name. Instead, it re-builds the name from the DW_AT_template_*
DIES in the format that it expects (with the integer suffixes).
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index 3104e0b..0105cde 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -109,7 +109,8 @@ struct value_print_options user_print_options = 1, /* pascal_static_field_print */ 0, /* raw */ 0, /* summary */ - 1 /* symbol_print */ + 1, /* symbol_print */ + false, /* print_suffix */ }; /* Initialize *OPTS to be a copy of the user print options. */ |