473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

glibc backtrace() gives line no off by one

The backtrace() provides complete stacktrace. Using
backtrace_symbols(), stacktrace can be printed as:

./build/gtest(func1_name+0x129) [0x80484bd]
./build/gtest(func2_name+0x193) [0x8048527]
/lib/libc.so.6(__libc_start_main+0xbd) [0x400483c1]

here,
the first part:name of the binary
func1_name: mangelled func name in case of C++
0x129: is the offset in the function
0x80484bd: Actual address

if 0x80484bd is passed to addr2line, it returns filename:line no.

However, line no. is always the next line from the call.

so, if

23 foo()
24
25 int i=0;

I am expecting line no. of foo(), but it returns line on if int i=0;

Interestingly, gdb also provides same actual address and correct line
no. Therefore, it seems backtrace() is returning correct address. We
need to do something more to get correct line no.

Let me know if you have any ideas about how to get correct line no.
from backtrace() and addr2line.

Thanks,
Vinayak
Apr 2 '07 #1
0 1216

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: dsclements | last post by:
>Description: I'm running mysql in a 3 server configuration, with 2 servers being slaves to the first. I'm running vpopmail, which means a connection every incoming mail and every check. I woke up...
4
by: Stian Karlsen | last post by:
Hi. I'm getting an error in my program. It doesn't occur each time even if the same things happend in my program each time I run it. There will however be different values used for calculations in...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
4
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
3
by: cgable2003 | last post by:
I copied this code fragment from http://www.gnu.org/software/libc/manual/html_node/Backtraces.html #include <execinfo.h> #include <stdio.h> #include <stdlib.h> /* Obtain a backtrace and print...
1
by: shiznit | last post by:
I made a program that finds a minimum spanning tree. In my main I created kruskal k; and called k.findMST(); void kruskal :: findMST(){
5
by: sriramsreenivasan | last post by:
I am a beginner in c i have written a linked list program and it shows a error after two successions please help me to find the error and to solveit #include<stdio.h> #include<stdlib.h>...
18
by: sophia | last post by:
Dear all, can any one suggest ways of implementing a backtrace function in ANSI/ standard C as given in the following link ? ...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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
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,...
0
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...

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.