blob: bdaacd65c13c34e4631c36c4c9c648d3a25bb6f1 [file] [log] [blame]
Elliott Hughesa0664b92017-04-18 17:46:52 -07001'\" t
2.\" Title: vgdb
3.\" Author: [see the "Author" section]
Elliott Hughesed398002017-06-21 14:41:24 -07004.\" 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 Hughesa0664b92017-04-18 17:46:52 -07008.\" Language: English
9.\"
Elliott Hughesed398002017-06-21 14:41:24 -070010.TH "VGDB" "1" "06/15/2017" "Release 3.13.0" "Release 3.13.0"
Elliott Hughesa0664b92017-04-18 17:46:52 -070011.\" -----------------------------------------------------------------
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"
31vgdb \- 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.\}
48As 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
50option\&.
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.\}
61In 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
67Specifies 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
69argument 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
74Must 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
79Instructs 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
81that is unique to the process you want to wait for\&. Also, if you use the
82\fB\-\-wait\fR
83argument 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
90Gives 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
92If 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
94value\&. 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
112Instructs 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
117Instructs 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
124valgrind \-\-vgdb\-error=0 prog
125# and then in another shell, run:
126vgdb \-\-port=1234
127.fi
128.if n \{\
129.RE
130.\}
131.sp
132On the computer which hosts GDB, execute the command:
133.sp
134.if n \{\
135.RS 4
136.\}
137.nf
138gdb prog
139(gdb) target remote targetip:1234
140.fi
141.if n \{\
142.RE
143.\}
144.sp
145where targetip is the ip address or hostname of the target computer\&.
146.RE
147.PP
148\fB\-c\fR
149.RS 4
150To 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
157vgdb 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
166Instructs 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
171Instructs 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
176Instructs vgdb to produce debugging output\&. Give multiple
177\fB\-d\fR
178args to increase the verbosity\&. When giving
179\fB\-d\fR
180to 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
184valgrind(1),
185$INSTALL/share/doc/valgrind/html/index\&.html
186or
187http://www\&.valgrind\&.org/docs/manual/index\&.html,
Elliott Hughesed398002017-06-21 14:41:24 -0700188\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 Hughesa0664b92017-04-18 17:46:52 -0700190\m[blue]\fBValgrind monitor commands\fR\m[]\&\s-2\u[3]\d\s+2\&.
191.SH "AUTHOR"
192.PP
193Philippe Waroquiers\&.
194.SH "NOTES"
195.IP " 1." 4
196Debugging 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
201vgdb
202.RS 4
203\%http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.vgdb
204.RE
205.IP " 3." 4
206Valgrind monitor commands
207.RS 4
208\%http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.valgrind-monitor-commands
209.RE