DrDebug : Linux* Command Line Usage

ID 659351
Updated 2/5/2015
Version Latest
Public

author-image

By

Using DrDebug requires following two phases
1. recording and 2. replaying.


Pre-requisites

  1. GDB version 7.4 or higher with Python support
  2. PinPlay/DrDebug kit (Linux)

Setup 

Unpack the latest PinPlay/DrDebug kit:

tar -zxf  <kit_tar_gz>

tcsh/csh
 setenv PIN_ROOT <path-to-DrDeubug-kit>
 setenv PATH $PIN_ROOT/extras/pinplay/scripts/:$PATH

bash/sh
 export PIN_ROOT=<path-to-DrDeubug-kit>
 export PATH=$PIN_ROOT/extras/pinplay/scripts/:$PATH


Recording

CAUTION: Recording causes a major (100x or so) slow-down [see PinPlay FAQ], so it is highly recommended that you narrow down the execution region where the bug appears (both 'root cause' and 'symptom') and only record the 'buggy region'. Best alternative is to use 'gdb_record' to first go to the beginning of your region of interest and then turn on recording. Using the 'attach' mode (either 'record' or 'gdb_record') is another good alternative. You can also specify a region to 'record' using some 'controller switches' (e.g. '-log:start_address'/'-log:stop_address' etc.). See documentation on region specification.

With GDB

Script to use: gdb_record

Usage : gdb_record <options>  -- bin args
OR gdb_record --pid=XXXX <options> -- bin #no args

options:Type 'gdb_record --help' for a full list of options.  

Example:
% gdb_record --pinball=region.pb/log -- bread-demo
(gdb) b 113
Breakpoint 1 at 0x401908: file bread-demo.cpp, line 113.
(gdb) c
Continuing.
Breakpoint 1, main (argc=1, argv=0x7fffffffd5b8) at bread-demo. cpp:113 
113         Go = true;
(gdb) pin record on 
monitor record on
Started recording region number 0
(gdb) b 149
Breakpoint 2 at 0x401b67: file bread-demo.cpp, line 149.
(gdb) c
Continuing.
Breakpoint 2, main (argc=1, argv=0x7fffffffd5b8) at bread-demo.cpp:149 
149         std::cout << "\n";
(gdb) pin record off 
monitor record off
Stopped recording region number 0.
 Move forward before turning recording on again.
(gdb) c
Continuing.

From command line (without GDB)

Script to use: record

Usage : record <options> -- bin args
OR record --pid=XXXX <options> -- bin #no args

options:Type 'record --help' for a full list of options. 

Example:
% record --pinball=myregion.pb/log --pintool_options="-log:start_address 0x401908 -log:stop_address 0x401b67" -- bread-demo


Replaying

With GDB

Script to use: gdb_replay

Usage : gdb_replay <options>  -- pinball-basename program-binary
options:Type 'gdb_replay --help' for a full list of options. 

Example:
% gdb_replay -- region.pb/log_0 bread-demo

(gdb) b 141
Breakpoint 1 at 0x401ae3: file bread-demo.cpp, line 141.
(gdb) c
Continuing.
 Breakpoint 1, main (argc=1, argv=0x7fffffffd5b8) at bread-demo.cpp:141 
141         std::cout << "Total revenue: $" << std::setprecision(2) << std::fix
ed << revenue;
(gdb) print revenue
$1 = 21975.129998207092
(gdb) c
Continuing.

From command line (without GDB)

Script to use: replay

Usage : replay <options> -- pinball-basename
options:Type 'replay --help' for a full list of options.

Example:
% replay -- myregion.pb/log_0

Navigate to: PinPlay  | DrDebug