Results 1 to 7 of 7
how do i trace a program in gcc????...
- 09-08-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 70
tracing in gcc
how do i trace a program in gcc????
- 09-08-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Hi,
You can use gdb, install it with your Synaptic Package Manager or with apt-get.
Here you can find documentation about it:
GDB: The GNU Project Debugger
Regards
- 09-09-2007 #3Just Joined!
- Join Date
- Sep 2007
- Posts
- 70
hey franklin when i inserted the Ubuntu cd it showed new packages but its not showin again and i didnt install any new packages at tat time....and am not able to install GDB.....i tried apt-get install GDB it says no packages found....plz help....its urgent
- 09-09-2007 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Don't use capital letters, it's gdb not GDB.
Regards
- 09-09-2007 #5Just Joined!
- Join Date
- Sep 2007
- Posts
- 70
hey thanks franklin i actually recognised tat mistake of mine...it was already installed....apt-cache policy gdb.....can u jus help me how to use it???please....
- 09-09-2007 #6
Googling for "gdb tutorial" brings up some good hits. I suggest you check them out.
The basic usage is that you compile your program with the '-g' flag to gcc, and then you run "gdb < EXECUTABLE NAME >". You can now set breakpoints, step through the code line by line, print out variables as you go, etc.
The other main usage is to run the command "ulimit -c unlimited". This will cause programs that crash to produce coredumps. So you run your program (again, compiled with '-g'), let it crash, then run "gdb < EXECUTABLE NAME > <COREDUMP>", and you can do a backtrace on the coredump, and check the status of the program at various points.
For the record, the '-g' flag to gcc causes gcc to put in "debugging symbols". These symbols help gdb integrate with the program a bit better, and give you more information on the status of the program.DISTRO=Arch
Registered Linux User #388732
- 09-09-2007 #7Just Joined!
- Join Date
- Sep 2007
- Posts
- 70
thanks..will try out.....


Reply With Quote