Friday, April 7, 2017

Debugging segmentation Fault using GDB

                       GDB:
It is a general debugger and is the recommended tool to analyze problems in user land.


First we have to compile our source code with below option:

1. gcc -g -O0 test.c
2.  gdb a.out
gdb -x gdb_cmd_for_processid  : --> Run gdb using dump file

below are the some basic command which we use while debugging:

$(gdb) bt  : command for the call stack for selected thread
$(gdb) bt full : commands for the call stack with values of the local variables
$(gdb) info threads : to show the list of threads
$(gdb) info th[reads] [<thread number>]: to show the particular thread
$(gdb) frame[<number>]: show current frame
$(gdb) info lo[cals] : to show local variable in current frame
$(gdb) info ar[gs]: to show parameters to current frame
$(gdb) disas[semble]: disassemble current function or specified function.
$(gdb) wha[tis]<variable> : show type for a variable/function
$(gdb) print <expr> : to print the value of the expression or variable.
$(gdb) help<command> : to get more information on the commmadns use help

No comments:

Post a Comment

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews