concrete hints on debugging C++ code (compiled with GCC) using GDB (Linux) ?
Basile Starynkevitch <[email protected]> Sat, 24 Jan 2026 21:34:18 +0100
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
In relation to https://github.com/RefPerSys/RefPerSys/issues/30
what are concrete hints to debug such kind of bugs?
How should I configure then compile GCC 16 (e.g. gcc-16-20260118 recent snapshot, symlinked as gcc-16snap)
I did configure it as (in an external build tree, '/usr/src/Lang/_BuildGcc16') with
/usr/src/Lang/gcc-16snap/configure '-v' '--prefix=/usr/local' '--with-gcc-major-version-only' '--program-suffix=-16' '--enable-shared' '--enable-plugin' '--enable-default-pie' '--with-system-zlib' '--disable-multilib' '--with-tune=native' '--enable-checking=release' '--enable-host-shared' '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--target=x86_64-linux-gnu' 'CFLAGS=-g -O2' 'CXXFLAGS=-g -O2' '--enable-werror' 'build_alias=x86_64-linux-gnu'
'host_alias=x86_64-linux-gnu' 'target_alias=x86_64-linux-gnu' '--enable-languages=c,c++,jit,lto' : '/usr/src/Lang/gcc-16snap/configure' '-v' '--prefix=/usr/local' '--with-gcc-major-version-only' '--program-suffix=-16' '--enable-shared' '--enable-plugin' '--enable-default-pie' '--with-system-zlib' '--disable-multilib' '--with-tune=native' '--enable-checking=release' '--enable-host-shared' '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--target=x86_64-
linux-gnu' 'CFLAGS=-g -O2' 'CXXFLAGS=-g -O2' '--enable-werror' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'target_alias=x86_64-linux-gnu' '--enable-languages=c,c++,jit,lto'
How should I configure GDB 17.1 (perhaps also compile it)?
In particular, I want GDB to be able to print/display nicely instances of std::string
(and maybe even instances of templates like std::map<std::string,int>....)
Your advice is very appreciated!
Regards
--
Basile STARYNKEVITCH basile AT starynkevitch DOT net
8 rue de la Faïencerie http://starynkevitch.net/Basile/
92340 Bourg-la-Reine https://github.com/bstarynk
France https://github.com/RefPerSys/RefPerSys
https://orcid.org/0000-0003-0908-5250