Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: vgdb |
| 3 | .\" Author: [see the "Author" section] |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 4 | .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/> |
| 5 | .\" Date: 06/15/2017 |
| 6 | .\" Manual: Release 3.13.0 |
| 7 | .\" Source: Release 3.13.0 |
Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame] | 8 | .\" Language: English |
| 9 | .\" |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 10 | .TH "VGDB" "1" "06/15/2017" "Release 3.13.0" "Release 3.13.0" |
Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame] | 11 | .\" ----------------------------------------------------------------- |
| 12 | .\" * Define some portability stuff |
| 13 | .\" ----------------------------------------------------------------- |
| 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 | .\" http://bugs.debian.org/507673 |
| 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 | .ie \n(.g .ds Aq \(aq |
| 19 | .el .ds Aq ' |
| 20 | .\" ----------------------------------------------------------------- |
| 21 | .\" * set default formatting |
| 22 | .\" ----------------------------------------------------------------- |
| 23 | .\" disable hyphenation |
| 24 | .nh |
| 25 | .\" disable justification (adjust text to left margin only) |
| 26 | .ad l |
| 27 | .\" ----------------------------------------------------------------- |
| 28 | .\" * MAIN CONTENT STARTS HERE * |
| 29 | .\" ----------------------------------------------------------------- |
| 30 | .SH "NAME" |
| 31 | vgdb \- intermediary between Valgrind and GDB or a shell |
| 32 | .SH "SYNOPSIS" |
| 33 | .HP \w'\fBvgdb\fR\ 'u |
| 34 | \fBvgdb\fR [\fIoptions\fR] |
| 35 | .SH "DESCRIPTION" |
| 36 | .PP |
| 37 | \fBvgdb\fR |
| 38 | ("Valgrind to GDB") is used as an intermediary between Valgrind and GDB or a shell\&. It has two usage modes: |
| 39 | .sp |
| 40 | .RS 4 |
| 41 | .ie n \{\ |
| 42 | \h'-04' 1.\h'+01'\c |
| 43 | .\} |
| 44 | .el \{\ |
| 45 | .sp -1 |
| 46 | .IP " 1." 4.2 |
| 47 | .\} |
| 48 | As a standalone utility, it is used from a shell command line to send monitor commands to a process running under Valgrind\&. For this usage, the vgdb OPTION(s) must be followed by the monitor command to send\&. To send more than one command, separate them with the |
| 49 | \fB\-c\fR |
| 50 | option\&. |
| 51 | .RE |
| 52 | .sp |
| 53 | .RS 4 |
| 54 | .ie n \{\ |
| 55 | \h'-04' 2.\h'+01'\c |
| 56 | .\} |
| 57 | .el \{\ |
| 58 | .sp -1 |
| 59 | .IP " 2." 4.2 |
| 60 | .\} |
| 61 | In combination with GDB "target remote |" command, it is used as the relay application between GDB and the Valgrind gdbserver\&. For this usage, only OPTION(s) can be given, but no COMMAND can be given\&. |
| 62 | .RE |
| 63 | .SH "OPTIONS" |
| 64 | .PP |
| 65 | \fB\-\-pid=<number>\fR |
| 66 | .RS 4 |
| 67 | Specifies the PID of the process to which vgdb must connect to\&. This option is useful in case more than one Valgrind gdbserver can be connected to\&. If the |
| 68 | \fB\-\-pid\fR |
| 69 | argument is not given and multiple Valgrind gdbserver processes are running, vgdb will report the list of such processes and then exit\&. |
| 70 | .RE |
| 71 | .PP |
| 72 | \fB\-\-vgdb\-prefix\fR |
| 73 | .RS 4 |
| 74 | Must be given to both Valgrind and vgdb if you want to change the default prefix for the FIFOs (named pipes) used for communication between the Valgrind gdbserver and vgdb\&. |
| 75 | .RE |
| 76 | .PP |
| 77 | \fB\-\-wait=<number>\fR |
| 78 | .RS 4 |
| 79 | Instructs vgdb to search for available Valgrind gdbservers for the specified number of seconds\&. This makes it possible start a vgdb process before starting the Valgrind gdbserver with which you intend the vgdb to communicate\&. This option is useful when used in conjunction with a |
| 80 | \fB\-\-vgdb\-prefix\fR |
| 81 | that is unique to the process you want to wait for\&. Also, if you use the |
| 82 | \fB\-\-wait\fR |
| 83 | argument in the GDB "target remote" command, you must set the GDB remotetimeout to a value bigger than the \-\-wait argument value\&. See option |
| 84 | \fB\-\-max\-invoke\-ms\fR |
| 85 | (just below) for an example of setting the remotetimeout value\&. |
| 86 | .RE |
| 87 | .PP |
| 88 | \fB\-\-max\-invoke\-ms=<number>\fR |
| 89 | .RS 4 |
| 90 | Gives the number of milliseconds after which vgdb will force the invocation of gdbserver embedded in Valgrind\&. The default value is 100 milliseconds\&. A value of 0 disables forced invocation\&. The forced invocation is used when vgdb is connected to a Valgrind gdbserver, and the Valgrind process has all its threads blocked in a system call\&. |
| 91 | .sp |
| 92 | If you specify a large value, you might need to increase the GDB "remotetimeout" value from its default value of 2 seconds\&. You should ensure that the timeout (in seconds) is bigger than the |
| 93 | \fB\-\-max\-invoke\-ms\fR |
| 94 | value\&. For example, for |
| 95 | \fB\-\-max\-invoke\-ms=5000\fR, the following GDB command is suitable: |
| 96 | .sp |
| 97 | .if n \{\ |
| 98 | .RS 4 |
| 99 | .\} |
| 100 | .nf |
| 101 | (gdb) set remotetimeout 6 |
| 102 | |
| 103 | .fi |
| 104 | .if n \{\ |
| 105 | .RE |
| 106 | .\} |
| 107 | .sp |
| 108 | .RE |
| 109 | .PP |
| 110 | \fB\-\-cmd\-time\-out=<number>\fR |
| 111 | .RS 4 |
| 112 | Instructs a standalone vgdb to exit if the Valgrind gdbserver it is connected to does not process a command in the specified number of seconds\&. The default value is to never time out\&. |
| 113 | .RE |
| 114 | .PP |
| 115 | \fB\-\-port=<portnr>\fR |
| 116 | .RS 4 |
| 117 | Instructs vgdb to use tcp/ip and listen for GDB on the specified port nr rather than to use a pipe to communicate with GDB\&. Using tcp/ip allows to have GDB running on one computer and debugging a Valgrind process running on another target computer\&. Example: |
| 118 | .sp |
| 119 | .if n \{\ |
| 120 | .RS 4 |
| 121 | .\} |
| 122 | .nf |
| 123 | # On the target computer, start your program under valgrind using |
| 124 | valgrind \-\-vgdb\-error=0 prog |
| 125 | # and then in another shell, run: |
| 126 | vgdb \-\-port=1234 |
| 127 | .fi |
| 128 | .if n \{\ |
| 129 | .RE |
| 130 | .\} |
| 131 | .sp |
| 132 | On the computer which hosts GDB, execute the command: |
| 133 | .sp |
| 134 | .if n \{\ |
| 135 | .RS 4 |
| 136 | .\} |
| 137 | .nf |
| 138 | gdb prog |
| 139 | (gdb) target remote targetip:1234 |
| 140 | .fi |
| 141 | .if n \{\ |
| 142 | .RE |
| 143 | .\} |
| 144 | .sp |
| 145 | where targetip is the ip address or hostname of the target computer\&. |
| 146 | .RE |
| 147 | .PP |
| 148 | \fB\-c\fR |
| 149 | .RS 4 |
| 150 | To give more than one command to a standalone vgdb, separate the commands by an option |
| 151 | \fB\-c\fR\&. Example: |
| 152 | .sp |
| 153 | .if n \{\ |
| 154 | .RS 4 |
| 155 | .\} |
| 156 | .nf |
| 157 | vgdb v\&.set log_output \-c leak_check any |
| 158 | .fi |
| 159 | .if n \{\ |
| 160 | .RE |
| 161 | .\} |
| 162 | .RE |
| 163 | .PP |
| 164 | \fB\-l\fR |
| 165 | .RS 4 |
| 166 | Instructs a standalone vgdb to report the list of the Valgrind gdbserver processes running and then exit\&. |
| 167 | .RE |
| 168 | .PP |
| 169 | \fB\-D\fR |
| 170 | .RS 4 |
| 171 | Instructs a standalone vgdb to show the state of the shared memory used by the Valgrind gdbserver\&. vgdb will exit after having shown the Valgrind gdbserver shared memory state\&. |
| 172 | .RE |
| 173 | .PP |
| 174 | \fB\-d\fR |
| 175 | .RS 4 |
| 176 | Instructs vgdb to produce debugging output\&. Give multiple |
| 177 | \fB\-d\fR |
| 178 | args to increase the verbosity\&. When giving |
| 179 | \fB\-d\fR |
| 180 | to a relay vgdb, you better redirect the standard error (stderr) of vgdb to a file to avoid interaction between GDB and vgdb debugging output\&. |
| 181 | .RE |
| 182 | .SH "SEE ALSO" |
| 183 | .PP |
| 184 | valgrind(1), |
| 185 | $INSTALL/share/doc/valgrind/html/index\&.html |
| 186 | or |
| 187 | http://www\&.valgrind\&.org/docs/manual/index\&.html, |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 188 | \m[blue]\fBDebugging your program using Valgrind\*(Aqs gdbserver and GDB\fR\m[]\&\s-2\u[1]\d\s+2 |
| 189 | \m[blue]\fBvgdb\fR\m[]\&\s-2\u[2]\d\s+2, |
Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame] | 190 | \m[blue]\fBValgrind monitor commands\fR\m[]\&\s-2\u[3]\d\s+2\&. |
| 191 | .SH "AUTHOR" |
| 192 | .PP |
| 193 | Philippe Waroquiers\&. |
| 194 | .SH "NOTES" |
| 195 | .IP " 1." 4 |
| 196 | Debugging your program using Valgrind's gdbserver and GDB |
| 197 | .RS 4 |
| 198 | \%http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver |
| 199 | .RE |
| 200 | .IP " 2." 4 |
| 201 | vgdb |
| 202 | .RS 4 |
| 203 | \%http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.vgdb |
| 204 | .RE |
| 205 | .IP " 3." 4 |
| 206 | Valgrind monitor commands |
| 207 | .RS 4 |
| 208 | \%http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.valgrind-monitor-commands |
| 209 | .RE |