gdb - the Gnu Debugger The purpose of these notes is to quickly introduce just a few useful features of gdb, the interactive debugger that goes with the Gnu piler (gcc). The notes are for impatient folks who have an immediate problem to solve and don't want to take the time to read more than the bare essentials. This debugger has many powerful features, and is especially convenient to call from inside the Gnu emacs text editor. If you want to learn all about gdb you should read more. Finding Where your Program Dies Suppose your program has died with a discouraging error message from the shell like "Segmentation fault" or "Bus error". These messages generally indicate that your program has tried to use an invalid pointer or array index. To fix the error you need to find out where the program was executing when it died. That is easy to do with gdb. First make sure piled all your code using the "-g" option of the piler. This is necessary for you to be able to use symbolic names of subprograms, variables, etc. in gdb. Suppose the name of the program you are debugging is prog4 . Now, run gdb as follows: gdb prog4 You will see a e message and prompt from gdb, something like this: GNU gdb Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are e to change it and/or distribute copies of it under certain conditions.
gdb - the gnu debugger 来自淘豆网m.daumloan.com转载请标明出处.