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.h | |
parent | 9f7393d8fc8b79a92b027cd8ac6fda9441d3fff9 (diff) | |
download | gdb-users/simark/template-suffix.zip gdb-users/simark/template-suffix.tar.gz gdb-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.h')
-rw-r--r-- | gdb/valprint.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/valprint.h b/gdb/valprint.h index f005c31..248d930 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -92,6 +92,10 @@ struct value_print_options /* If nonzero, when printing a pointer, print the symbol to which it points, if any. */ int symbol_print; + + /* If true, print the integer suffixes (u for unsigned, l for long, ll for + long long). */ + bool print_suffix; }; /* The global print options set by the user. In general this should |