1VGDB(1) vgdb VGDB(1)
2
3
4
6 vgdb - intermediary between Valgrind and GDB or a shell
7
9 vgdb [options]
10
12 vgdb ("Valgrind to GDB") is used as an intermediary between Valgrind
13 and GDB or a shell. It has two usage modes:
14
15 1. As a standalone utility, it is used from a shell command line to
16 send monitor commands to a process running under Valgrind. For this
17 usage, the vgdb OPTION(s) must be followed by the monitor command
18 to send. To send more than one command, separate them with the -c
19 option.
20
21 2. In combination with GDB "target remote |" command, it is used as
22 the relay application between GDB and the Valgrind gdbserver. For
23 this usage, only OPTION(s) can be given, but no COMMAND can be
24 given.
25
27 --pid=<number>
28 Specifies the PID of the process to which vgdb must connect to.
29 This option is useful in case more than one Valgrind gdbserver can
30 be connected to. If the --pid argument is not given and multiple
31 Valgrind gdbserver processes are running, vgdb will report the list
32 of such processes and then exit.
33
34 --vgdb-prefix
35 Must be given to both Valgrind and vgdb if you want to change the
36 default prefix for the FIFOs (named pipes) used for communication
37 between the Valgrind gdbserver and vgdb.
38
39 --wait=<number>
40 Instructs vgdb to search for available Valgrind gdbservers for the
41 specified number of seconds. This makes it possible start a vgdb
42 process before starting the Valgrind gdbserver with which you
43 intend the vgdb to communicate. This option is useful when used in
44 conjunction with a --vgdb-prefix that is unique to the process you
45 want to wait for. Also, if you use the --wait argument in the GDB
46 "target remote" command, you must set the GDB remotetimeout to a
47 value bigger than the --wait argument value. See option
48 --max-invoke-ms (just below) for an example of setting the
49 remotetimeout value.
50
51 --max-invoke-ms=<number>
52 Gives the number of milliseconds after which vgdb will force the
53 invocation of gdbserver embedded in Valgrind. The default value is
54 100 milliseconds. A value of 0 disables forced invocation. The
55 forced invocation is used when vgdb is connected to a Valgrind
56 gdbserver, and the Valgrind process has all its threads blocked in
57 a system call.
58
59 If you specify a large value, you might need to increase the GDB
60 "remotetimeout" value from its default value of 2 seconds. You
61 should ensure that the timeout (in seconds) is bigger than the
62 --max-invoke-ms value. For example, for --max-invoke-ms=5000, the
63 following GDB command is suitable:
64
65 (gdb) set remotetimeout 6
66
67
68
69 --cmd-time-out=<number>
70 Instructs a standalone vgdb to exit if the Valgrind gdbserver it is
71 connected to does not process a command in the specified number of
72 seconds. The default value is to never time out.
73
74 --port=<portnr>
75 Instructs vgdb to use tcp/ip and listen for GDB on the specified
76 port nr rather than to use a pipe to communicate with GDB. Using
77 tcp/ip allows to have GDB running on one computer and debugging a
78 Valgrind process running on another target computer. Example:
79
80 # On the target computer, start your program under valgrind using
81 valgrind --vgdb-error=0 prog
82 # and then in another shell, run:
83 vgdb --port=1234
84
85 On the computer which hosts GDB, execute the command:
86
87 gdb prog
88 (gdb) target remote targetip:1234
89
90 where targetip is the ip address or hostname of the target
91 computer.
92
93 -c
94 To give more than one command to a standalone vgdb, separate the
95 commands by an option -c. Example:
96
97 vgdb v.set log_output -c leak_check any
98
99 -l
100 Instructs a standalone vgdb to report the list of the Valgrind
101 gdbserver processes running and then exit.
102
103 -T
104 Instructs vgdb to add timestamps to vgdb information messages.
105
106 -D
107 Instructs a standalone vgdb to show the state of the shared memory
108 used by the Valgrind gdbserver. vgdb will exit after having shown
109 the Valgrind gdbserver shared memory state.
110
111 -d
112 Instructs vgdb to produce debugging output. Give multiple -d args
113 to increase the verbosity. When giving -d to a relay vgdb, you
114 better redirect the standard error (stderr) of vgdb to a file to
115 avoid interaction between GDB and vgdb debugging output.
116
118 valgrind(1), $INSTALL/share/doc/valgrind/html/index.html or
119 http://www.valgrind.org/docs/manual/index.html,
120
121 Debugging your program using Valgrind's gdbserver and GDB[1] vgdb[2],
122 Valgrind monitor commands[3].
123
125 Philippe Waroquiers.
126
128 1. Debugging your program using Valgrind's gdbserver and GDB
129 http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
130
131 2. vgdb
132 http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.vgdb
133
134 3. Valgrind monitor commands
135 http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.valgrind-monitor-commands
136
137
138
139Release 3.18.0 10/15/2021 VGDB(1)