* linux-thread-db.c (set_libthread_db_search_path): New function.

(_initialize_thread_db): Add setter for libthread-db-search-path.

	gdbserver/
	* thread-db.c (thread_db_handle_monitor_command): Handle elided path.

	doc/
	* gdb.texinfo (Threads): If an empty path is provided for
	libthread-db-search-path it is reset to its default value.
	(Server): Ditto.
This commit is contained in:
Doug Evans 2011-05-10 16:53:23 +00:00
parent 7e665af3af
commit 84e578fbe6
6 changed files with 41 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2011-05-10 Doug Evans <dje@google.com>
* linux-thread-db.c (set_libthread_db_search_path): New function.
(_initialize_thread_db): Add setter for libthread-db-search-path.
2011-05-09 Doug Evans <dje@google.com> 2011-05-09 Doug Evans <dje@google.com>
* NEWS: Mention --with-iconv-bin. * NEWS: Mention --with-iconv-bin.

View File

@ -1,3 +1,9 @@
2011-05-10 Doug Evans <dje@google.com>
* gdb.texinfo (Threads): If an empty path is provided for
libthread-db-search-path it is reset to its default value.
(Server): Ditto.
2011-05-09 Doug Evans <dje@google.com> 2011-05-09 Doug Evans <dje@google.com>
* gdb.texinfo (Requirements): Fix typo. Mention --with-iconv-bin. * gdb.texinfo (Requirements): Fix typo. Mention --with-iconv-bin.

View File

@ -2855,7 +2855,7 @@ watchpoints in programs with multiple threads.
If this variable is set, @var{path} is a colon-separated list of If this variable is set, @var{path} is a colon-separated list of
directories @value{GDBN} will use to search for @code{libthread_db}. directories @value{GDBN} will use to search for @code{libthread_db}.
If you omit @var{path}, @samp{libthread-db-search-path} will be reset to If you omit @var{path}, @samp{libthread-db-search-path} will be reset to
an empty list. its default value.
On @sc{gnu}/Linux and Solaris systems, @value{GDBN} uses a ``helper'' On @sc{gnu}/Linux and Solaris systems, @value{GDBN} uses a ``helper''
@code{libthread_db} library to obtain information about threads in the @code{libthread_db} library to obtain information about threads in the
@ -16369,7 +16369,7 @@ protocol (@pxref{Remote Protocol}).
When this command is issued, @var{path} is a colon-separated list of When this command is issued, @var{path} is a colon-separated list of
directories to search for @code{libthread_db} (@pxref{Threads,,set directories to search for @code{libthread_db} (@pxref{Threads,,set
libthread-db-search-path}). If you omit @var{path}, libthread-db-search-path}). If you omit @var{path},
@samp{libthread-db-search-path} will be reset to an empty list. @samp{libthread-db-search-path} will be reset to its default value.
@item monitor exit @item monitor exit
Tell gdbserver to exit immediately. This command should be followed by Tell gdbserver to exit immediately. This command should be followed by

View File

@ -1,3 +1,7 @@
2011-05-10 Doug Evans <dje@google.com>
* thread-db.c (thread_db_handle_monitor_command): Handle elided path.
2011-05-04 Doug Evans <dje@google.com> 2011-05-04 Doug Evans <dje@google.com>
* linux-low.c (linux_join): Skip process lookup. * linux-low.c (linux_join): Skip process lookup.

View File

@ -916,9 +916,14 @@ thread_db_mourn (struct process_info *proc)
int int
thread_db_handle_monitor_command (char *mon) thread_db_handle_monitor_command (char *mon)
{ {
if (strncmp (mon, "set libthread-db-search-path ", 29) == 0) const char *cmd = "set libthread-db-search-path";
size_t cmd_len = strlen (cmd);
if (strncmp (mon, cmd, cmd_len) == 0
&& (mon[cmd_len] == '\0'
|| mon[cmd_len] == ' '))
{ {
const char *cp = mon + 29; const char *cp = mon + cmd_len;
if (libthread_db_search_path != NULL) if (libthread_db_search_path != NULL)
free (libthread_db_search_path); free (libthread_db_search_path);
@ -927,6 +932,8 @@ thread_db_handle_monitor_command (char *mon)
while (isspace (*cp)) while (isspace (*cp))
++cp; ++cp;
if (*cp == '\0')
cp = LIBTHREAD_DB_SEARCH_PATH;
libthread_db_search_path = xstrdup (cp); libthread_db_search_path = xstrdup (cp);
monitor_output ("libthread-db-search-path set to `"); monitor_output ("libthread-db-search-path set to `");

View File

@ -75,6 +75,17 @@
static char *libthread_db_search_path; static char *libthread_db_search_path;
static void
set_libthread_db_search_path (char *ignored, int from_tty,
struct cmd_list_element *c)
{
if (*libthread_db_search_path == '\0')
{
xfree (libthread_db_search_path);
libthread_db_search_path = xstrdup (LIBTHREAD_DB_SEARCH_PATH);
}
}
/* If non-zero, print details of libthread_db processing. */ /* If non-zero, print details of libthread_db processing. */
static int libthread_db_debug; static int libthread_db_debug;
@ -1719,8 +1730,10 @@ _initialize_thread_db (void)
Set search path for libthread_db."), _("\ Set search path for libthread_db."), _("\
Show the current search path or libthread_db."), _("\ Show the current search path or libthread_db."), _("\
This path is used to search for libthread_db to be loaded into \ This path is used to search for libthread_db to be loaded into \
gdb itself."), gdb itself.\n\
NULL, Its value is a colon (':') separate list of directories to search.\n\
Setting the search path to an empty list resets it to its default value."),
set_libthread_db_search_path,
NULL, NULL,
&setlist, &showlist); &setlist, &showlist);