|
From: Philippe W. <phi...@sk...> - 2012-04-14 15:52:16
|
Thanks for the precise information you have put in your question,
it helps to see what is going on.
> ==6164== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-6164-by-???-on-???
> ==6164== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-6164-by-???-on-???
> ==6164== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-6164-by-???-on-???
The above is the FIFOs and shared mem created by the Valgrind gdbserver.
They are created in the environment in which valgrind is launched.
>From the ls command below, we see that these files belongs to the user apache:
> prw-r--r--. 1 apache apache 0 Apr 14 13:18 vgdb-pipe-from-vgdb-to-6164-by-???-on-???
> -rw-r--r--. 1 apache apache 48 Apr 14 13:18 vgdb-pipe-shared-mem-vgdb-6164-by-???-on-???
> prw-r--r--. 1 apache apache 0 Apr 14 13:18 vgdb-pipe-to-vgdb-from-6164-by-???-on-???
>From the below, it looks like gdb and vgdb are launched by the user plug.
> (gdb) target remote | vgdb --pid=6164
> Remote debugging using | vgdb --pid=6164
> syscall failed: No such file or directory
> error opening /tmp/vgdb-pipe-shared-mem-vgdb-6164-by-plug-on-playground.fc16
> shared memory file
> Remote communication error. Target disconnected.: Connection reset by peer.
> (gdb)
The FIFOs and shared mem used by vgdb are based on the user name and the host name.
The logic to find the user name is:
First try the env variable LOGNAME
if not set, try the env variable USER
if still not set, then take ???.
For the host name, the variables examined are:
HOST
then HOSTNAME
then ???
You should start your gdb and vgdb in the same "context/environment" as the gdbserver
you are trying to connect to. Then both the Valgrind gdbserver and vgdb should agree
on user and host, and use the same vgdb-pipe files.
If you cannot do that for one reason or another, you might try the following
(without guarantee :) :
export LOGNAME="???"
export HOST="???"
and then launch gdb+vgdb.
If you launch your gdb/vgdb under another account, the launched vgdb will not have
rw access to the vgdb-pipe* files. To change the permissions, you will have
to one way or another let the apache user either chmod a+rw these files
or else use apache user to launch gdb and vgdb
(or maybe use root ?).
Hope this helps ...
Philippe
|