Advertisement Jump to content
Sign in to follow this  

Function Backtrace

This topic is 4930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

with out using a debugger does any one know how to get a function backtrace? or know of an article talking about how this is done? i'm using devcpp and c++ but all my debuggers are crap and i want to have this done within my program ps any one know a good debugger?

Share this post

Link to post
Share on other sites
There is an interesting article at C/C++ User's Journal (
ELF which logs exceptions for you and provides a backtracing option. Interesting article. Tho you will need an account to actually read it all Oo.

Share this post

Link to post
Share on other sites
I use Eclipse with the CDT plugin which has a great debugger. It runs atop the same compiler as DevC++ (the MinGW port of GCC). You can even use the debugger directly:

void crash() {
int * invalid = 0;
*invalid = 3; //access 0x00000000 to cause a segfault/access violation

int main () {

**** Incremental build of configuration Debug for project test.28 ****

make -k all
'Building file: ../'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ../
'Finished building: ../'
' '
'Building target: test.28.exe'
g++ -o test.28.exe main.o
'Finished building: test.28.exe'
Build complete for project test.28

Key flags here: -O0 turns off optimizations, -g3 turns on full line/function debugging info.

C:\eclipse\workspace\test.28>gdb Debug\test.28
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) run
Starting program: C:\eclipse\workspace\test.28/Debug\test.28.exe

Program received signal SIGSEGV, Segmentation fault.
0x004012e0 in crash() () at ../ # "address in function at file:line"
3 *invalid = 3;
(gdb) bt # This prints out a full backtrace
#0 0x004012e0 in crash() () at ../
#1 0x00401317 in main () at ../
(gdb) quit
The program is running. Exit anyway? (y or n) y


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!