BackTrace


 
Thread Tools Search this Thread
Top Forums Programming BackTrace
# 1  
Old 09-30-2005
Question BackTrace

i need to know how one can get the backtrace of a program in c++
as you find in gdb or dbx on doing a ctrl c (or any signal to the os)

do help
# 2  
Old 09-30-2005
you can use gdb's bt command when you debug the program.
or and extra code in the place of you function entry to record the function call trace.
# 3  
Old 10-03-2005
Re

I want to write a code which prints the backtrace as gdb's bt command prints
& not use gdb to get the backtrace
can you give me compile time options which is should need to provide to get the back trace which the binary itself prints when the user does a cntrl + c

i want to use this code in an binary which when it gets a SIGINT OR SIGQUIT should print the backtrace itself & not use gdb to get the backtrace

the information which it needs t print is line number ,cpp file & the function name

g++ -g i already know but thats for gdb

please help
# 4  
Old 10-03-2005
It's FAR more complex than you might think because you have to trace stack frames in memory, which is hardware and OS platform-specific.

You need to download the source for your platform for gdb, and spend some time reading over the code.
# 5  
Old 10-04-2005
Re

Can you give me links to such sites where in i can learn about such programming

BTW i knows its difficult & thats why i want to learn it

Thanks anywayz
# 6  
Old 10-04-2005
Use google to search for the source code of GDB.

Here is the first link that came up when gdb source code was given... Current GDB


vino
# 7  
Old 10-04-2005
Just be sure the code you download is for your system and OS.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Programming

Gdb backtrace

Hi, all I try to understand the output from gdb Program received signal SIGABRT, Aborted. *** glibc detected *** /home/sys_cbo/dev/zif/bin/Debug/zifd: free(): invalid pointer: 0x00007fffac04d3d0 *** how should i read this? (gdb) backtrace #0 0x0000003015e32925 in raise () from... (1 Reply)
Discussion started by: huvcbo
1 Replies

2. Programming

MIPS backtrace

Hi, I'm working in a MIPS processor and, since the function backtrace() is not implemented for this architecture, I would like to know if there is another way to do a stack backtrace in this processor. Thanks a lot!!! (3 Replies)
Discussion started by: lagigliaivan
3 Replies

3. Linux

how to backtrace a shared library file (.so)

I have a shared library file (.so) and I need to know some information 1. By which GCC version was this .so built? 2. Was this .so built in 32 bits mode or 64 bits mode Any command / tools to backtrace such kind of information? Thanks in advance! (2 Replies)
Discussion started by: princelinux
2 Replies

4. Programming

printing a stack trace with backtrace

I am trying to print a stack trace programatically using backtrace and backtrace_symbols. The problem is that the stack being printed in a mangled format. Is there a way to get the output in more of a human readable form? I am using Red Hat and the program is written in c++. (2 Replies)
Discussion started by: dmirza
2 Replies
Login or Register to Ask a Question