User Tools

Site Tools


user:mgardne8:portfolio:debug

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:mgardne8:portfolio:debug [2014/10/02 12:38] mgardne8user:mgardne8:portfolio:debug [2014/10/07 09:01] (current) mgardne8
Line 1: Line 1:
-{{  :opus:fall2014:mgardne8:compiler_complaint.png|Ouch!  }} 
 ====== Debugging with GDB ====== ====== Debugging with GDB ======
 +de·bug
  
-???What is BDB+/dēˈbəɡ/ 
-!!!GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed[(http://www.gnu.org/software/gdb/)].+ 
 +verb 
 +identify and remove errors from (a computer program).   
 +[(http://dictionary.reference.com/browse/debug?s=t)] 
 + 
 +{{:opus:fall2014:mgardne8:compiler_complaint.png|Ouch!}} 
 +???What is GDB
 +!!!GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.[(http://www.gnu.org/software/gdb/)]
  
 GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act: GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:
Line 14: Line 21:
 !!! Debugging is something that can't be avoided. Every programmer will at one point in their programming career have to debug a section of code. There are many ways to go about debugging, from printing out messages to the screen, using a debugger, or just thinking about what the program is doing and making an educated guess as to what the problem is. !!! Debugging is something that can't be avoided. Every programmer will at one point in their programming career have to debug a section of code. There are many ways to go about debugging, from printing out messages to the screen, using a debugger, or just thinking about what the program is doing and making an educated guess as to what the problem is.
  
-Before a bug can be fixed, the source of the bug must be located. For example, with segmentation faults, it is useful to know on which line of code the seg fault is occuring. Once the line of code in question has been found, it is useful to know about the values in that method, who called the method, and why (specifically) the error is occuring. Using a debugger makes finding all of this information very simple.+Before a bug can be fixed, the source of the bug must be located. For example, with segmentation faults, it is useful to know on which line of code the seg fault is occuring. Once the line of code in question has been found, it is useful to know about the values in that method, who called the method, and why (specifically) the error is occuring. Using a debugger makes finding all of this information very simple.[(http://www.cs.cmu.edu/~gilpin/tutorial/)] 
 + 
 +====== 2 ===== 
 +==== a ==== 
 +==== b ==== 
 +====== 3 ===== 
 +==== a ===== 
 +==== b ===== 
 +====== 4 ===== 
  
-Go ahead and make the program for this tutorial, and run the program. The program will print out some messages, and then it will print that it has received a segmentation fault signal, resulting in a program crash. Given the information on the screen at this point, it is near impossible to determine why the program crashed, much less how to fix the problem. We will now begin to debug this program.[(http://www.cs.cmu.edu/~gilpin/tutorial/)] 
 ~~REFNOTES~~ ~~REFNOTES~~
user/mgardne8/portfolio/debug.1412267903.txt.gz · Last modified: 2014/10/02 12:38 by mgardne8