Hello, I ran into a rather bad issue, as I am remote debugging without having symbols from all libraries. gdb segfaults on some occasions when the debuginfo is missing. I am pretty much unable to debug via IDE while using the std libraries, hence the critical severity (sorry if that's not fitting). tested on debian "buster" x64 with gdb 8.3 and gcc 8.3 aswell as gcc 9.1. ------- execute these cat << 'EOF' > test.cpp #include <string_view> #pragma GCC optimize("O0") extern "C" int main(int argc, char **pargv) { std::string_view name(pargv[0]); return argc + name.size(); } EOF g++ --std=gnu++17 -O2 -g2 -o test test.cpp gdb -nx -iex 'set auto-solib-add off' test ------- then run those commands b main info locals
Commands should be: b main run info locals
I tried and got: (gdb) info locals name = { static npos = <error reading variable: Missing ELF symbol "std::basic_string_view<char, std::char_traits<char> >::npos".>, _M_len = 140737488346224, _M_str = 0x0} That message means this is a dup of bug #20020. *** This bug has been marked as a duplicate of bug 20020 ***
Are you using gdb 8.3 or the master branch? I am beginning to believe this only happens if libstdc++' pretty printers are *not* loaded.
I used git master. My build isn't picking up the pretty-printers. Can you try a newer gdb? That "Missing ELF symbol" comes from the fix for 20020, which is why I think this is a dup of that.
(In reply to Tom Tromey from comment #4) > I used git master. My build isn't picking up the pretty-printers. > > Can you try a newer gdb? That "Missing ELF symbol" comes from > the fix for 20020, which is why I think this is a dup of that. Yeah, running 8.3.50.20190629 fixes the issue. I could not deduce from your comment or the 3 year old bug report where this was (supposed to be) fixed. On my end, loading the pretty-printers probably did replace the "normal" access that triggers the bug.