LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-12-2007, 03:54 PM   #1
jph4599
LQ Newbie
 
Registered: Jan 2007
Posts: 1

Rep: Reputation: 0
mtrace / addr2line not resolving address to file + line number


I am attempting to use mtrace to do some memory leak detection but am unable to get it to resolve addresses to file names with line numbers. I have been working at this for at least 2 days now and am out of ideas. I hope someone at this forum may be able to offer some assistance.

I have created a very simple c++ file to test with:
Code:
linuxcom-04> cat leak.cc
#include <mcheck.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    mtrace();
    cout << "hello world" << endl;
    char* str = new char[20];
}
I have set the environment variable:
Code:
linuxcom-04> echo $MALLOC_TRACE
leak.out
And compiled with debugging:
Code:
linuxcom-04> g++ -g leak.cc
linuxcom-04> ls
a.out  leak.cc
Ran the program once and got the mtrace output file
Code:
linuxcom-04> ./a.out
hello world

linuxcom-04> ls
a.out  leak.cc  leak.out
Ran mtrace with the executable name and the log file
Code:
linuxcom-04> mtrace a.out leak.out

Memory not freed:
-----------------
   Address     Size     Caller
0x0949a378     0x14  at 0x92b86e
and only got the address of the caller. I believe mtrace uses addr2line so I figured I would attempt using that directly, but it was no help:
Code:
linuxcom-04> addr2line -e a.out 0x92b86e
??:0
linuxcom-04> addr2line --version
GNU addr2line 2.17.50.0.3 20060715

linuxcom-04> mtrace --version
mtrace (GNU libc) 2.3.2

I have tried on both ppc and i386-linux systems with different executables. I have updated binutils. I've done a mess of other little things trying to find out what the problem could possibly be.

I really hope someone here will be able to offer some assistance and end my suffering.

Thank you for your time,
-Jesse Harvey
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
highlight text of a file from specified line number tanveer Linux - General 9 12-06-2006 10:27 PM
Getting Line Number in Error Log File kushalkoolwal Programming 6 10-17-2005 12:50 PM
Display line number n from a file doctorwebbox Linux - Newbie 2 01-05-2005 02:06 PM
Print line number X of a file (in shell) rheza Programming 4 01-04-2005 05:55 PM
Count number of line in a file. philipina Programming 7 03-18-2004 05:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration