Difference between revisions of "Creating a Backtrace with GDB"

From Lazarus wiki
Jump to navigationJump to search
(Just started, not finished yet)
 
m (changed to hardcoded numbers)
Line 20: Line 20:
  
 
'''Windows Users:'''
 
'''Windows Users:'''
# Open a MS-DOS prompt
+
 
# Change to the drive you have your exe on:  
+
1. Open a MS-DOS prompt
 +
 
 +
2. Change to the drive you have your exe on:  
 
  C: {press enter}
 
  C: {press enter}
# Change to the directory containing the exe:
+
3. Change to the directory containing the exe:
 
  cd \myprograms\Project1 {press enter}
 
  cd \myprograms\Project1 {press enter}
# Run the program using gdb:  
+
4. Run the program using gdb:  
 
  gdb Project1.exe
 
  gdb Project1.exe
  
 
'''Linux/BSD Users:'''
 
'''Linux/BSD Users:'''

Revision as of 15:44, 23 February 2005

Reasons to create a backtrace

Bug Reports

Backtraces can be very helpfull when submitting bug reports. They will no doubt increase the chances of the bug getting fixed sooner.

Help yourself find a problem

A backtrace can really take the pain out of finding a problem with your own program. Often exposing the problem immediately.

Just plain fun!!

Okay this might be a stretch, but making backtraces is just plain fun!

Seriously though, if you can think of another reason to create a backtrace add it here.

Creating a Backtrace

To create a backtrace with gdb(gnu debugger):

  1. You must have the program gdb
  2. gdb must be in the PATH enviornment variable
  3. The program you wish to debug MUST have debugging info included in the executable. If you have used "strip", "upx", compiled with "TODO what are the fpc options to strip debugging info" or some other exe shrinker/compressor this won't work!

Windows Users:

1. Open a MS-DOS prompt

2. Change to the drive you have your exe on:

C: {press enter}

3. Change to the directory containing the exe:

cd \myprograms\Project1 {press enter}

4. Run the program using gdb:

gdb Project1.exe

Linux/BSD Users: