473,507 Members | 3,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to print function names in stacktrace

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[i] << 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.
Jul 22 '05 #1
2 5577
"Hitesh Patel" <hi*********@rediffmail.com> wrote...
I am using backtrace() and backtrace_symbols() functions from execinfo.h.
[...]


Neither 'backtrace' nor 'backtrace_symbols' is a standard function.
Perhaps you should ask in a newsgroup where they would be on topic,
like gnu.gcc.help or the newsgroup for FreeBDS.

Jul 22 '05 #2
"Victor Bazarov" <v.********@comAcast.net> wrote in message news:<RH2Ab.429984$HS4.3395724@attbi_s01>...
"Hitesh Patel" <hi*********@rediffmail.com> wrote...
I am using backtrace() and backtrace_symbols() functions from execinfo.h.
[...]


Neither 'backtrace' nor 'backtrace_symbols' is a standard function.
Perhaps you should ask in a newsgroup where they would be on topic,
like gnu.gcc.help or the newsgroup for FreeBDS.


I found one utility named addr2line in freeBSD. which gives function name,
file name and line number if code is compiled in debug mode. otherwise only
give function name.

Hitesh Patel
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2378
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
2
2687
by: kgould | last post by:
I'm trying to use XMLStarlet to pull a value out of Microsoft's mssecure.xml file for patch availability. I'm an XML newb, so I'm struggling here. I want to pull the @Summary field value- I'm...
0
7359
by: Pankaj Jain | last post by:
Hi All, I have a class A which is derived from ServicesComponent to participate in automatic transaction with falg Transaction.Required. Class A is exposed to client through remoting on Http...
11
21891
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
1
2313
by: A Traveler | last post by:
Hello, i am having this problem. The exact error message is: "Unable to generate code for a value of type 'System.Web.UI.Page'. This error occurred while trying to generate the property value for...
6
17925
by: Prashant Bhuptani | last post by:
Hi Guys, I am trying to use a C++ dll in VB.NET code. I have imported the dll in the following manner: <code> Imports System.Runtime.InteropServices
2
3130
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
5
1314
by: Li Pang | last post by:
Hi, I built many classes to be used. One function can call one or more other functions. If any of these functions have an error I add the error description into a log file. My problem is to...
3
1726
by: AWasilenko | last post by:
I'm still in the process of learning python via a handful of books I bought. One book I am reading just introduced Base Class Methods. I found that I needed more understanding on this concept and...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.