Geep Gdb Basics 24thfeb08

  • Uploaded by: Neependra Khare
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Geep Gdb Basics 24thfeb08 as PDF for free.

More details

  • Words: 401
  • Pages: 14
Using the GNU Debugger (GDB) Pranav Peshwe

Techzemplary Pvt.Ltd February 24th 2008

Some background about GDB... ●

Started by RMS in 1986



Ported to all major OSes thereafter



Has support for almost all popular architectures



Supports symbolic debugging



Primarily used for debugging C/C++



Supports remote debugging



Work being done on bringing in 'Reversible debugging'

Getting ready... ●

Compiling with debug information



Side effects of debug information



Readying multi-file projects for debugging



Nifty utililies – file, nm, objdump, strip etc

A typical debug workflow ●

Run



Backtrace



Break



Step



Inspect



Change



Continue

Preliminary usage ●

The GDB executable - /usr/bin/gdb



To start – gdb [program-name]



To quit – quit



Select a program to run – file <prog-name>



Run a program in gdb - run



Kill a prog in gdb – kill <prog-name>



Getting help – GDB manual and online help

Zeroing on the function ●

Backtracing ­ bt



Moving between frames – up, down and frame



Viewing arguments' addresses – info args



Other information about the frame – info frame

Looking at the source ●

Specifying the source file(s) – directory



Listing the source – the many variants of list



Searching the source – search

Breaking into the code ●

Breakpoint on a function – b func_name, continue



Breakpoint on a source line – b [filename:]line_no



Listing current breakpoints – info b



Break only the first time – tbreak



Ignore, disable and delete breakpoints



Watchpoints

Moving ahead...one step at a time ●

Single stepping – step, next



'finish'ing a function



Forcing a return

Inspecting data ●

Global variables – info variables



Local variables – info locals



Examining values of variables – print



Viewing arrays



Automatic display

Inspecting data contd... ●

Examining memory - x



Viewing registers – info registers



Listing functions



Listing variables in scope of a function

On­site debugging ?? ●

Get the pid of the process



Attach to a running process – attach



Loading symbol table from an external file



Detach from a running process – detach

Miscellaneous stuff ●

Getting runtime information



Redirecting output



Logging



Shell commands



Graphical front-ends to GDB



Delta debugging B)

END OF PART I Questions welcome...

Related Documents

Geep Gdb Basics 24thfeb08
November 2019 17
Gdb
November 2019 18
Gdb
July 2020 11
Gdb
May 2020 19
Gdb
June 2020 8
Gdb Quickref
August 2019 18

More Documents from ""

Effective Use Of Gdb
November 2019 19
Linux-mm
November 2019 15
Kvm-way
November 2019 20
Geep Gdb Basics 24thfeb08
November 2019 17
Linux Kernel Programming
November 2019 26
Linux Threads
November 2019 12