This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/16343] New: GDB can't display static class members of a dynamically linked library
- From: "be.gentner at googlemail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 18 Dec 2013 16:26:21 +0000
- Subject: [Bug gdb/16343] New: GDB can't display static class members of a dynamically linked library
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16343
Bug ID: 16343
Summary: GDB can't display static class members of a
dynamically linked library
Product: gdb
Version: 7.6
Status: NEW
Severity: critical
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: be.gentner at googlemail dot com
GDB can't display contents/adresses of static class members which are compiled
into shared libraries and used from an executable as a dynamically linked
library.
Below an example which demonstrates the problem. The StaticData::x is a pointer
and after the assignment of the int variable it still holds the adress 0x0. GDB
can't dereference the pointer.
There are no problems if getters/setters are used for accessing static class
members or if the static class members aren't linked dynamically in a library.
program.cpp:
#include <iostream>
#include "static.h"
int main(int argc, char* argv[])
{
int i = 15;
StaticData::x = &i;
std::cout << *StaticData::x;
return 0;
}
static.h
class StaticData
{
public:
static int * x;
};
static.cpp
#include "static.h"
int * StaticData::x = 0;
GCC compile options:
// Build shared library
g++ -shared -fPIC -o liblib.so static.cpp -g
g++ -o program program.cpp -L./ -llib -Wl,-rpath,... -g
Program output:
15
--
You are receiving this mail because:
You are on the CC list for the bug.