aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/thread-pool.h
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-04-29 23:21:18 +0100
committerPedro Alves <pedro@palves.net>2022-05-10 14:16:21 +0100
commitc7d029ea9cc566b8d3c50b08ef12d98394adf1b1 (patch)
treeb764ed0b4568b7b62539f699a1549a452b8d1760 /gdbsupport/thread-pool.h
parent1c6fbf42e5bd3045a41ad32c5efbc2ab8ca5e941 (diff)
downloadgdb-c7d029ea9cc566b8d3c50b08ef12d98394adf1b1.zip
gdb-c7d029ea9cc566b8d3c50b08ef12d98394adf1b1.tar.gz
gdb-c7d029ea9cc566b8d3c50b08ef12d98394adf1b1.tar.bz2
Fix "b f(std::string)" when current language is C
If you try to set a breakpoint at a function such as "b f(std::string)", and the current language is C, the breakpoint fails to be set, like so: (gdb) set language c break f(std::string) Function "f(std::string)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) The problem is that the code in GDB that expands the std::string typedef hits this in c-typeprint.c: /* If we have "typedef struct foo {. . .} bar;" do we want to print it as "struct foo" or as "bar"? Pick the latter for C++, because C++ folk tend to expect things like "class5 *foo" rather than "struct class5 *foo". We rather arbitrarily choose to make language_minimal work in a C-like way. */ if (language == language_c || language == language_minimal) { if (type->code () == TYPE_CODE_UNION) gdb_printf (stream, "union "); else if (type->code () == TYPE_CODE_STRUCT) { if (type->is_declared_class ()) gdb_printf (stream, "class "); else gdb_printf (stream, "struct "); } else if (type->code () == TYPE_CODE_ENUM) gdb_printf (stream, "enum "); } I.e., std::string is expanded to "class std::..." instead of just "std::...", and then the "f(class std::..." symbol doesn't exist. Fix this by making cp-support.c:inspect_type print the expanded typedef type using the language of the symbol whose type we're expanding the typedefs for -- in the example in question, the "std::string" typedef symbol, which is a C++ symbol. Use type_print_raw_options as it seems to me that in this scenario we always want raw types, to match the real symbol names. Adjust the gdb.cp/break-f-std-string.exp testcase to try setting a breakpoint at "f(std::string)" in both C and C++. Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
Diffstat (limited to 'gdbsupport/thread-pool.h')
0 files changed, 0 insertions, 0 deletions