Your message dated Mon, 04 Aug 2025 13:16:36 -0400
with message-id <[email protected]>
and subject line Closing bug
has caused the Debian Bug report #188627,
regarding gdb: problems demangling vtable symbols
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
188627: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=188627
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gdb
Version: 5.3-2
Severity: important
gdb fails to demangle vtables when multiple C++ ABIs are in use in the
same application.
It is possible for a single application to use multiple stdc++ libraries
with different ABIs as long as the objects using the different
ABIs/libraries are seperated by a dlopen() call. I encountered this
situation when an application I was working on was compiled with
g++-2.95 and a library was doing a dlopen of a library that depended on
xlibmesa3-dev, which was compiled with g++-3.2
gdb emits lots of errors like the following and occasionally crashes in
"call" and "print" commands that require correct resolution of a vtable:
warning: can't find linker symbol for virtual table for `Derived' value
warning: can't find linker symbol for virtual table for `Derived' value
warning: can't find linker symbol for virtual table for `Derived' value
To reproduce:
#!/bin/bash
cat <<END_OF_Makefile >Makefile
default: main
mylib.o: mylib.cpp
g++-3.2 -g -c -fPIC -o mylib.o mylib.cpp
libmylib.so: mylib.o
g++-3.2 -shared -o libmylib.so mylib.o
main.o: main.cpp
g++-2.95 -g -c -o main.o main.cpp
main: main.o libmylib.so
g++-2.95 -rdynamic -ldl -o main main.o
clean:
rm -f main.o mylib.o main libmylib.so
END_OF_makefile
cat <<END_OF_mylib >mylib.cpp
#include <iostream>
extern "C" void print()
{
std::cout << "print() at " << __FILE__ << ":" << __LINE__ <<
std::endl;
}
END_OF_mylib
cat <<END_OF_main >main.cpp
#include <iostream>
#include <dlfcn.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
class Base {
public:
explicit Base(int value = 0) : baseData(value) {}
virtual ~Base();
int get_base() const { return baseData; }
private:
int baseData;
};
class Derived : public Base {
public:
explicit Derived(int value, int base_value = 0)
: Base(base_value), derivedData(value) {}
virtual ~Derived();
void print() const;
private:
int derivedData;
};
Base::~Base()
{ cout << "~Base()" << endl; }
Derived::~Derived()
{ cout << "~Derived()" << endl; }
void Derived::print() const {
cout << get_base() << " " << derivedData << endl;
}
void* load_lib()
{
char buffer[PATH_MAX];
getcwd( buffer, PATH_MAX );
strncat( buffer, "/libmylib.so", PATH_MAX );
void* handle = dlopen( buffer, RTLD_NOW );
if ( !handle ) {
cout << dlerror() << endl;
exit(1);
}
return handle;
}
typedef void(*void_func)(void);
int main()
{
Derived object(5);
void* handle = load_lib();
void_func f_ptr = (void_func)dlsym( handle, "print" );
f_ptr();
object.print();
return 0;
}
END_OF_main
make
gdb main <<END_OF_gdb
b Derived::print
r
p derivedData
END_OF_gdb
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux rincewind 2.4.20-686-smp #1 SMP Mon Jan 13 23:06:41 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gdb depends on:
ii libc6 2.3.1-16 GNU C Library: Shared libraries an
ii libncurses5 5.3.20021109-2 Shared libraries for terminal hand
ii libreadline4 4.3-4 GNU readline and history libraries
--- End Message ---
--- Begin Message ---
I can't reproduce this with GDB 16.3:
--8<---------------cut here---------------start------------->8---
(gdb) b Derived::print() const
Breakpoint 1 at 0x22da: file main.cpp, line 35.
(gdb) r
Starting program: /root/main
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
print() at mylib.cpp:5
Breakpoint 1, Derived::print (this=0x7fffffffea90) at main.cpp:35
35 cout << get_base() << " " << derivedData << endl;
(gdb) p derivedData
$1 = 5
--8<---------------cut here---------------end--------------->8---
Closing the bug.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/
signature.asc
Description: PGP signature
--- End Message ---