|
From: Philippe W. <phi...@sk...> - 2023-04-15 17:58:27
|
On Thu, 2023-04-13 at 22:09 +0000, Mark Wielaard wrote: > +* The vgdb utility now supports extended-remote protocol when > + invoked with --multi. In this mode the GDB run command is > + supported. Which means you don't need to run gdb and valgrind > + from different terminals. So for example to start you program > + in gdb and run it under valgrind you can do: > + $ gdb prog > + (gdb) set remote exec-file prog > + (gdb) set sysroot / > + (gdb) target extended-remote | vgdb --multi > + (gdb) start Thanks to Mark and Alexandra for this work (and sorry for the lack of earlier feedback about this). I did some tests: philippe@md:gdbserver_tests$ gdb sleepers GNU gdb (GDB) 14.0.50.20230402-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Loaded DUEL.py 0.9.6, high level data exploration language Reading symbols from sleepers... (gdb) set remote exec-file sleepers (gdb) set sysroot / (gdb) target extended-remote | vgdb --multi Remote debugging using | vgdb --multi (gdb) start Temporary breakpoint 1 at 0x16fc: file sleepers.c, line 138. Starting program: /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers valgrind: sleepers: command not found syscall failed: No such file or directory error opening /tmp/vgdb-pipe-shared-mem-vgdb-52790-by-philippe-on-md shared memory file Remote communication error. Target disconnected.: Connection reset by peer. (gdb) The problem is solved by giving an absolute path for the remote exec-file: (gdb) set remote exec-file /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers So, it looks like gdb knows the absolute path of the program to launch, but does not pass it to valgrind. It might be possible to have the full path given to vgdb ? The vgdb --help output is missing the --valgrind and the --vargs in the OPTIONS summary: OPTIONS are [--pid=<number>] [--vgdb-prefix=<prefix>] [--wait=<number>] [--max-invoke-ms=<number>] [--port=<portnr> [--cmd-time-out=<number>] [-l] [-T] [-D] [-d] [--multi] The vgdb --help is missing \n after the --vargs description: --vargs everything that follows is an argument for valgrind. -l arg tells to show the list of running Valgrind gdbserver and then exit. For --valgrind, pass the path to valgrind to use. If not specified, the system valgrind will be launched. Wouldn't it better (if possible) to by default launch the valgrind found at the same place as where vgdb is found ? Finally, once giving an absolute remote exec-file and an absolute path to the valgrind to launch, I cannot have it working: gdb sleepers GNU gdb (GDB) 14.0.50.20230402-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Loaded DUEL.py 0.9.6, high level data exploration language Reading symbols from sleepers... (gdb) set remote exec-file /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers (gdb) set sysroot / (gdb) target extended-remote | vgdb --multi --valgrind=/home/philippe/valgrind/git/trunk_untouched/Inst/bin/valgrind Remote debugging using | vgdb --multi --valgrind=/home/philippe/valgrind/git/trunk_untouched/Inst/bin/valgrind (gdb) start Temporary breakpoint 1 at 0x16fc: file sleepers.c, line 138. Starting program: /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers ==100738== Memcheck, a memory error detector ==100738== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==100738== Using Valgrind-3.21.0.RC1 and LibVEX; rerun with -h for copyright info ==100738== Command: /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers ==100738== relaying data between gdb and process 100738 syscall failed: Resource temporarily unavailable error reading static buf readchar syscall failed: Resource temporarily unavailable readchar no ack mode: unexpected buflen -1, buf Unknown remote qXfer reply: 1 (gdb) quit Not too sure what is going wrong/what I am doing wrong ... (tested with 53834800424510b177c59d097c3a51a66bbaf659) Thanks Philippe |