From 84e578fbe67910f19ed0bbbc4e8aebd0f87c462a Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 10 May 2011 16:53:23 +0000 Subject: * 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. --- gdb/gdbserver/thread-db.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gdb/gdbserver/thread-db.c') diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 529516e..872151e 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -916,9 +916,14 @@ thread_db_mourn (struct process_info *proc) int 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) free (libthread_db_search_path); @@ -927,6 +932,8 @@ thread_db_handle_monitor_command (char *mon) while (isspace (*cp)) ++cp; + if (*cp == '\0') + cp = LIBTHREAD_DB_SEARCH_PATH; libthread_db_search_path = xstrdup (cp); monitor_output ("libthread-db-search-path set to `"); -- cgit v1.1