H
Hitesh Patel
hi friends,
I am using backtrace() and backtrace_symbols() functions from execinfo.h.
when I print backtrace I get only hex address of every function call. I know
that to get functions names, binary format of executable file must be ELF.
I set -rdynamic option during compilation but I don't get functions names.
is there any other otion we have to set?
pls help me.
my code is as follows
void *btArray[128];
int btSize;
char** btSymbols;
cout << endl << "########## Backtrace ##########" << endl;
btSize = backtrace(btArray, sizeof(btArray) / sizeof(void *));
cout << "Number of elements in backtrace: " << btSize << endl;
if (btSize > 0) {
btSymbols = backtrace_symbols(btArray, btSize);
if (btSymbols) {
for (int i = btSize - 1; i >= 0; --i) {
cout << btSymbols << endl;
}
}
}
I am using
gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)
Thanks in advance.
I am using backtrace() and backtrace_symbols() functions from execinfo.h.
when I print backtrace I get only hex address of every function call. I know
that to get functions names, binary format of executable file must be ELF.
I set -rdynamic option during compilation but I don't get functions names.
is there any other otion we have to set?
pls help me.
my code is as follows
void *btArray[128];
int btSize;
char** btSymbols;
cout << endl << "########## Backtrace ##########" << endl;
btSize = backtrace(btArray, sizeof(btArray) / sizeof(void *));
cout << "Number of elements in backtrace: " << btSize << endl;
if (btSize > 0) {
btSymbols = backtrace_symbols(btArray, btSize);
if (btSymbols) {
for (int i = btSize - 1; i >= 0; --i) {
cout << btSymbols << endl;
}
}
}
I am using
gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)
Thanks in advance.