|
GDB allows you to see what your application is doing programmatically while it runs. GDB can be an invaluable tool to trace the execution of an application in order to find the cause of an encountered problem, and to let developers know where their code is failing. This Note is directed at quality assurance engineers who do not have any experience with GDB. For more information on the GNU compiler collection, including getting started using the GNU debugger in more detail, see Using the GNU Compiler Collection on Mac OS X.
You must know the path of the application you are going to debug. As an example, we will use the fictitious application located at:
Foo.app is actually a bundle, or a folder that contains the binary
executable as well as the resources for the application. GDB will see the above
path as a folder, rather than an executable, thus in the above example, the
actual executable is located at:
Useful GDB CommandsHere is a list of a few GDB commands you will find extremely useful while doing quality assurance. |
|
STACK BACKTRACE At the prompt you may enter 'bt' to see the last few instructions the application executed. This is called a stack backtrace. You can copy the backtrace from the terminal and paste it into a text document. Stack back traces contain useful debugging information and should be included with your bug report. PAUSE It is possible to pause execution of an application from the GDB terminal by hitting both the control and c keys. You can then capture a stack backtrace. CONTINUE To continue execution, enter 'c' at the GDB prompt. KILL To kill a process, enter 'k' from the GDB prompt. QUIT You may quit GDB by typing 'q' from the GDB prompt. HELP GDB has fairly extensive help information on the many other debugger commands available. Type help at the GDB prompt to access this information. |
Additional Notes & CommentsIt is always good practice to leave the Console window open, either by selecting it from the Tools menu in Workspace Manager, or by the key combination <command-shift-C>. Error messages are often directed to the Console. You should always include a stack backtrace with any crashing bug report. It is possible to debug an application from a remote computer through a telnet session. Programmer oriented resources |