|
From: <sv...@va...> - 2013-08-06 20:45:30
|
philippe 2013-08-06 21:45:20 +0100 (Tue, 06 Aug 2013)
New Revision: 13485
Log:
fix --vgdb-prefix no / character interpreted differently by V gdbsrv and vgdb
When --vgdb-prefix contains no / character,
the Valgrind gdbsrv is interpreting the prefix value as the filename
prefix in the current directory, while vgdb interprets this as
a directory to be opened in the current directory.
Cbange vgdb.c so that it uses the same interpretation as V gdbsrv
Modified files:
trunk/coregrind/vgdb.c
Modified: trunk/coregrind/vgdb.c (+13 -12)
===================================================================
--- trunk/coregrind/vgdb.c 2013-08-03 21:57:49 +01:00 (rev 13484)
+++ trunk/coregrind/vgdb.c 2013-08-06 21:45:20 +01:00 (rev 13485)
@@ -2067,7 +2067,7 @@
" \n"
" --pid arg must be given if multiple Valgrind gdbservers are found.\n"
" --vgdb-prefix arg must be given to both Valgrind and vgdb utility\n"
-" if you want to change the default prefix for the FIFOs communication\n"
+" if you want to change the prefix (default %s) for the FIFOs communication\n"
" between the Valgrind gdbserver and vgdb.\n"
" --wait (default 0) tells vgdb to check during the specified number\n"
" of seconds if a Valgrind gdbserver can be found.\n"
@@ -2083,7 +2083,7 @@
"\n"
" -h --help shows this message\n"
" To get help from the Valgrind gdbserver, use vgdb help\n"
-"\n"
+"\n", vgdb_prefix_default()
);
ptrace_restrictions_msg();
}
@@ -2128,15 +2128,16 @@
strcpy (vgdb_format, vgdb_prefix);
strcat (vgdb_format, suffix);
- strcpy (vgdb_dir_name, vgdb_prefix);
-
- for (is = strlen(vgdb_prefix) - 1; is >= 0; is--)
- if (vgdb_dir_name[is] == '/') {
- vgdb_dir_name[is+1] = '\0';
- break;
- }
- if (strlen(vgdb_dir_name) == 0)
- strcpy (vgdb_dir_name, "./");
+ if (strchr(vgdb_prefix, '/') != NULL) {
+ strcpy (vgdb_dir_name, vgdb_prefix);
+ for (is = strlen(vgdb_prefix) - 1; is >= 0; is--)
+ if (vgdb_dir_name[is] == '/') {
+ vgdb_dir_name[is+1] = '\0';
+ break;
+ }
+ } else {
+ strcpy (vgdb_dir_name, "");
+ }
DEBUG(1, "searching pid in directory %s format %s\n",
vgdb_dir_name, vgdb_format);
@@ -2154,7 +2155,7 @@
/* wait one second before checking again */
sleep(1);
- vgdb_dir = opendir (vgdb_dir_name);
+ vgdb_dir = opendir (strlen (vgdb_dir_name) ? vgdb_dir_name : "./");
if (vgdb_dir == NULL)
XERROR (errno,
"vgdb error: opening directory %s searching vgdb fifo\n",
|