Current location: Home >> Programming Technology | Copyright Description
gdb basic usage 2004-04-23 15:18 pm Author: The author is from: Linux knowledge base Contact: unknown related sites http://www.jimmy-lam.com/studyarea/goldencat/debug.htmhttp://phi. Sinica.edu.tw/~tyuan/pcfarm.old/manuals/gnu/gdb_basic.htmlgdb Using the User When the program is wrong and generates the fast positioning error function, the Core file name (generally Core, may also be CORE) .xxxx) The key R Run running used by the debugger. The program has not run using C Cuntinue before running. After running the interrupt, continue to run q Exit Kill Termination debugging program h help help
Setup and clearing 1. Setup breakpoints (instructions are BREAK, you can abbreviate (b), format: (GDB) Break filename.c: 30 => 310 lines in FileName.c Stop execution. (GDB) Break function => Execute the execution of the interrupt program when entering the function. (GDB) Break filename.c: function => Sets the breakpoint at the function function in the program code file filename.c. (GDB) Break => In the next command sets breakpoints. (GDB) Break ... if Cond => Only interrupt when Cond is established. Conden must be written in the C language. 2. Show each breakpoint Information. (GDB) Info Break3. Clear breakpoint (command is clear), format with break. For example: (gdb) Clear filename.c: 304. Clear breakpoint, NUM is the breakpoint number displayed in INFO BREAK. (GDB) DELETE NUM full-speed and step-by-step execution procedure 1. Execute the program from the beginning until the breakpoint is executed or the program is executed. (GDB) Run2. After the program is interrupted, the full-speed execution program to the next breakpoint Or the end of the program (Continue instructions can be discolished as c). (GDB) Continue3. Execute a row. If the call function, the program code is considered to be a row (NEXT instructions can be short-written). (GDB). NEXT4. Execute a row of programs. If the call function, enter the function progress line (STEP instructions can be short-handed as s). (GDB) Step5. Execute a row, if the program is in the final program is the last program One line, the first line of the loop has been executed until the first line of the loop is stopped (Until instructions can be short-written as u). (GDB) Until6. Perform the current program to return to the previous layer. (GDB) FINISH review and change the variable Value 1. Print describes the results of the description (Print instructions can be short-handed as P). For example, (GDB) Print A => Displays the content of the A variable. (GDB) Print sizeof (a) => Display a variable length .2. DISPLAY describes the narrative value, each breakpoint or one step is executed. Such as (GDB) Display A3. Change Variable: (GDB) Print (a = 10) => The value of the amount A is set to 10. Viewing the program execution status 1. When the program is executed, it is a program (BACKTRACE instruction to be a BT), which is to view the function call stack. (GDB) BackTrace Reads Core File Information 1. Reads in Program and Program.core files to view the program variable value and program flow status when Core Dump. GDB Program Core Description: The 'Core' file is executed by the Program file, and the Core file name generated when Core Dump is encountered. If you still need this CORE file, we recommend that you change the file name to Program.core. After entering the above command, you can read the status of the program core DUMP with the view variable value provided by GDB and the program execution status.
Add a little (recently I just used GDB, I feel is not bad, but when I am still added with printf, I will use the GDB direct debugger, not the coreGDB executable file name (enter GDB environment) SET AGS -? (set the parameters, the program to you want to debug) In addition, you can set the breakpoint with Break FunctionName and Break Linenum to see the current breakpoint information to clear the breakpoint with CLEAR. Companies If the breakpoint set by FunctionName can only use the breakpoint set by LINENUM with LINENUM, you can only use Clear LineNumbtw: You can go to www.sunfreeWare.com to download GDB or more experience I have learned GDB in recent days, All I have made mistakes I hope to help with the GDB rookies that are equal to me. If you can use the DDD graphical differential, you can use the delete breakpoint to remove the breakpoint. You can use INFO BREAK to get me to talk about my experience: R (the parameters of the program) can set up the runtime The parameter shell runs things that run the shell environment, such as Shell Make, after completion of the RWP, you can run the parameters that have been added last time, no need to knock the parameters B file name: The line number is very useful,嘿嘿 Info B See the breakpoint information Disable break point Suspension a breakpoint Enable break point number launches a breakpoint Delete Delete a breakpoint, does not break the point, all delete the X / 32uxb pointer 16 Enter the 32-byte data indicted by the pointer, but I still don't use core debug, huh, 全 completely all categories 1:
Non-technical class 2:
Basic knowledge 3:
Directive Daquan 4:
Shell5:
Installation start 6:
XWindow7:
KDE8:
gnome9:
Input French 10:
Beautifying Chinese 11:
Network configuration 12:
Storage backup 13:
Miscellaneous Tool 14:
Programming Technology 15:
Network security 16:
Kernel Technology 17:
Speed optimization 18:
Apache19:
Email20:
FTP Service 21:
CVS Service 22:
Agent Service 23:
Samba24:
Domain Name Service 25:
Network filtering 26:
Other Services 27:
NFS28:
Oracle29:
DHCP30:
MySQL31:
PHP32:
LDAP
Copyright © 2005 Linux Knowledge Baolo 者 者者 究者.
Powered by: Linux Knowledge Baolo Version 1.0.0