Reputation: 20129
Im doing a project that works with ELF files. Right now Im using the following as a sample input -
class C {
public:
C();
C(int x, int y);
int getX();
private:
int x;
int y;
};
class SubC : public C {
int z;
};
int f() {return 0;}
C c;
SubC subC;
int i;
double d;
I then run
gcc test.cpp -g -c -o test.o
and I get test.o as expected. I then feed test.o into a library I found called peter-dwarf. My problem is that the library says "no section .debug_str found in test.o"
Am I doing something wrong during compilation? Or is the library not working?
Edit: should have been a -g in there
Upvotes: 0
Views: 1503
Reputation: 16070
Use -g
in gcc to generate the debug symbols. You may also refer to the documentation of debugging options of gcc here.
The -g
alone might not include DWARF information if your system is configured in some way. There is a number of switches related to DWARF specifically, so if -g
alone does not work, you may need to go there and mangle with other switches.
Upvotes: 1
Reputation: 8468
Probably you need to compile with debugging information enabled. Try:
gcc -g test.cpp -c -o test.o
Upvotes: 0