When I try to debug my cross compiled application with GDB, I can not get local variables and line numbers.
So I tried to check if something with debug info format and got this (I trunked output):
(gdb) set complaints 10000
(gdb) file camera-bot
Reading symbols from camera-bot...
During symbol reading: unexpected demangled name 'operator<=><char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
During symbol reading: unexpected demangled name 'operator<=><long long, std::ratio<1ll, 1000ll>, long long, std::ratio<1ll, 1000ll> >(std::chrono::duration<long long, std::ratio<1ll, 1000ll> > const&, std::chrono::duration<long long, std::ratio<1ll, 1000ll> > const&)'
During symbol reading: unexpected demangled name 'operator<=><long long, std::ratio<1ll, 1000000ll>, long long, std::ratio<1ll, 1000000ll> >(std::chrono::duration<long long, std::ratio<1ll, 1000000ll> > const&, std::chrono::duration<long long, std::ratio<1ll, 1000000ll> > const&)'
During symbol reading: unexpected demangled name '((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#1}))<((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#2}))) std::less<void>::operator()<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
During symbol reading: unexpected demangled name 'decltype (((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#1}))<((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#2}))) std::less<void>::operator()<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
During symbol reading: unexpected demangled name 'operator<=><char*, std::vector<char, std::allocator<char> > >(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > const&, __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > const&)'
During symbol reading: unexpected demangled name '((forward<char const (&) [19]>)({parm#1}))<((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#2}))) std::less<void>::operator()<char const (&) [19], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(char const (&) [19], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
During symbol reading: unexpected demangled name 'decltype (((forward<char const (&) [19]>)({parm#1}))<((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#2}))) std::less<void>::operator()<char const (&) [19], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(char const (&) [19], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
During symbol reading: unexpected demangled name '((forward<char const (&) [18]>)({parm#1}))<((forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)({parm#2}))) std::less<void>::operator()<char const (&) [18], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(char const (&) [18], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
GDB version on device:
pi@raspberrypi:~ $ gdb --version
GNU gdb (Raspbian 13.1-3) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pi@raspbe
Compiler version on Linux machine:
developer@e3d48b122fbf:/workspaces/RaspberryCamera$ /home/developer/opt/x-tools/armv6-rpi-linux-gnueabihf/bin/armv6-rpi-linux-gnueabihf-g++ --version
armv6-rpi-linux-gnueabihf-g++ (crosstool-NG UNKNOWN - tttapa/docker-arm-cross-toolchain:armv6-rpi) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Debug info inside my file:
pi@raspberrypi:~ $ readelf -S camera-bot | grep -i debug
[32] .debug_aranges PROGBITS 00000000 37a088 001890 00 0 0 8
[33] .debug_info PROGBITS 00000000 37b918 2b3db9 00 0 0 1
[34] .debug_abbrev PROGBITS 00000000 62f6d1 02f1a8 00 0 0 1
[35] .debug_line PROGBITS 00000000 65e879 0e5d3d 00 0 0 1
[36] .debug_frame PROGBITS 00000000 7445b8 01df34 00 0 0 4
[37] .debug_str PROGBITS 00000000 7624ec 073658 01 MS 0 0 1
[38] .debug_line_str PROGBITS 00000000 7d5b44 0000f7 01 MS 0 0 1
[39] .debug_loclists PROGBITS 00000000 7d5c3b 11396d 00 0 0 1
[40] .debug_rnglists PROGBITS 00000000 8e95a8 01cf4a 00 0 0 1
How to solve GDB unexpected demangled name?
The complaint (which is really a warning that something else might not work later on) is coming from gdb/cp-support.c
. Your version appears to not know how to deal with operator<=>()
, which is a C++20
feature.
Your version of GDB: 13.1 was released on 2023-02-19; I am not terribly surprised that it doesn't support <=>
. You should try the latest GDB (15.2 released on 2024-09-29), and if that still complains file a bug in GDB bugzilla.
Or you could build with -std=c++17
and not use the spaceship operator.
P.S. I just tried GDB built from current git, and it didn't produce a complaint. This patch may be the fix here.