1 /* Thread management interface, for the remote server for GDB.
2 Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
5 Contributed by MontaVista Software.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "linux-low.h"
26 extern int debug_threads
;
28 static int thread_db_use_events
;
30 #include "gdb_proc_service.h"
31 #include "../gdb_thread_db.h"
33 #ifndef USE_LIBTHREAD_DB_DIRECTLY
43 /* Structure that identifies the child process for the
44 <proc_service.h> interface. */
45 struct ps_prochandle proc_handle
;
47 /* Connection to the libthread_db library. */
48 td_thragent_t
*thread_agent
;
50 /* If this flag has been set, we've already asked GDB for all
51 symbols we might need; assume symbol cache misses are
53 int all_symbols_looked_up
;
55 #ifndef USE_LIBTHREAD_DB_DIRECTLY
56 /* Handle of the libthread_db from dlopen. */
60 /* Thread creation event breakpoint. The code at this location in
61 the child process will be called by the pthread library whenever
62 a new thread is created. By setting a special breakpoint at this
63 location, GDB can detect when a new thread is created. We obtain
64 this location via the td_ta_event_addr call. Note that if the
65 running kernel supports tracing clones, then we don't need to use
66 (and in fact don't use) this magic thread event breakpoint to
67 learn about threads. */
68 struct breakpoint
*td_create_bp
;
70 /* Addresses of libthread_db functions. */
71 td_err_e (*td_ta_new_p
) (struct ps_prochandle
* ps
, td_thragent_t
**ta
);
72 td_err_e (*td_ta_event_getmsg_p
) (const td_thragent_t
*ta
,
74 td_err_e (*td_ta_set_event_p
) (const td_thragent_t
*ta
,
75 td_thr_events_t
*event
);
76 td_err_e (*td_ta_event_addr_p
) (const td_thragent_t
*ta
,
77 td_event_e event
, td_notify_t
*ptr
);
78 td_err_e (*td_ta_map_lwp2thr_p
) (const td_thragent_t
*ta
, lwpid_t lwpid
,
80 td_err_e (*td_thr_get_info_p
) (const td_thrhandle_t
*th
,
82 td_err_e (*td_thr_event_enable_p
) (const td_thrhandle_t
*th
, int event
);
83 td_err_e (*td_ta_thr_iter_p
) (const td_thragent_t
*ta
,
84 td_thr_iter_f
*callback
, void *cbdata_p
,
85 td_thr_state_e state
, int ti_pri
,
86 sigset_t
*ti_sigmask_p
,
87 unsigned int ti_user_flags
);
88 td_err_e (*td_thr_tls_get_addr_p
) (const td_thrhandle_t
*th
,
90 size_t offset
, psaddr_t
*address
);
91 const char ** (*td_symbol_list_p
) (void);
94 static char *libthread_db_search_path
;
96 static int find_one_thread (ptid_t
);
97 static int find_new_threads_callback (const td_thrhandle_t
*th_p
, void *data
);
100 thread_db_err_str (td_err_e err
)
107 return "generic 'call succeeded'";
109 return "generic error";
111 return "no thread to satisfy query";
113 return "no sync handle to satisfy query";
115 return "no LWP to satisfy query";
117 return "invalid process handle";
119 return "invalid thread handle";
121 return "invalid synchronization handle";
123 return "invalid thread agent";
125 return "invalid key";
127 return "no event message for getmsg";
129 return "FPU register set not available";
131 return "application not linked with libthread";
133 return "requested event is not supported";
135 return "capability not available";
137 return "debugger service failed";
139 return "operation not applicable to";
141 return "no thread-specific data for this thread";
143 return "malloc failed";
145 return "only part of register set was written/read";
147 return "X register set not available for this thread";
148 #ifdef HAVE_TD_VERSION
150 return "version mismatch between libthread_db and libpthread";
153 xsnprintf (buf
, sizeof (buf
), "unknown thread_db error '%d'", err
);
160 thread_db_state_str (td_thr_state_e state
)
167 return "stopped by debugger";
176 case TD_THR_STOPPED_ASLEEP
:
177 return "stopped by debugger AND blocked";
179 xsnprintf (buf
, sizeof (buf
), "unknown thread_db state %d", state
);
186 thread_db_create_event (CORE_ADDR where
)
190 struct lwp_info
*lwp
;
191 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
193 if (thread_db
->td_ta_event_getmsg_p
== NULL
)
194 fatal ("unexpected thread_db->td_ta_event_getmsg_p == NULL");
197 fprintf (stderr
, "Thread creation event.\n");
199 /* FIXME: This assumes we don't get another event.
200 In the LinuxThreads implementation, this is safe,
201 because all events come from the manager thread
202 (except for its own creation, of course). */
203 err
= thread_db
->td_ta_event_getmsg_p (thread_db
->thread_agent
, &msg
);
205 fprintf (stderr
, "thread getmsg err: %s\n",
206 thread_db_err_str (err
));
208 /* If we do not know about the main thread yet, this would be a good time to
209 find it. We need to do this to pick up the main thread before any newly
211 lwp
= get_thread_lwp (current_inferior
);
212 if (lwp
->thread_known
== 0)
213 find_one_thread (lwp
->head
.id
);
215 /* msg.event == TD_EVENT_CREATE */
217 find_new_threads_callback (msg
.th_p
, NULL
);
223 thread_db_enable_reporting (void)
225 td_thr_events_t events
;
228 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
230 if (thread_db
->td_ta_set_event_p
== NULL
231 || thread_db
->td_ta_event_addr_p
== NULL
232 || thread_db
->td_ta_event_getmsg_p
== NULL
)
233 /* This libthread_db is missing required support. */
236 /* Set the process wide mask saying which events we're interested in. */
237 td_event_emptyset (&events
);
238 td_event_addset (&events
, TD_CREATE
);
240 err
= thread_db
->td_ta_set_event_p (thread_db
->thread_agent
, &events
);
243 warning ("Unable to set global thread event mask: %s",
244 thread_db_err_str (err
));
248 /* Get address for thread creation breakpoint. */
249 err
= thread_db
->td_ta_event_addr_p (thread_db
->thread_agent
, TD_CREATE
,
253 warning ("Unable to get location for thread creation breakpoint: %s",
254 thread_db_err_str (err
));
257 thread_db
->td_create_bp
258 = set_breakpoint_at ((CORE_ADDR
) (unsigned long) notify
.u
.bptaddr
,
259 thread_db_create_event
);
265 find_one_thread (ptid_t ptid
)
270 struct thread_info
*inferior
;
271 struct lwp_info
*lwp
;
272 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
273 int lwpid
= ptid_get_lwp (ptid
);
275 inferior
= (struct thread_info
*) find_inferior_id (&all_threads
, ptid
);
276 lwp
= get_thread_lwp (inferior
);
277 if (lwp
->thread_known
)
280 /* Get information about this thread. */
281 err
= thread_db
->td_ta_map_lwp2thr_p (thread_db
->thread_agent
, lwpid
, &th
);
283 error ("Cannot get thread handle for LWP %d: %s",
284 lwpid
, thread_db_err_str (err
));
286 err
= thread_db
->td_thr_get_info_p (&th
, &ti
);
288 error ("Cannot get thread info for LWP %d: %s",
289 lwpid
, thread_db_err_str (err
));
292 fprintf (stderr
, "Found thread %ld (LWP %d)\n",
293 ti
.ti_tid
, ti
.ti_lid
);
295 if (lwpid
!= ti
.ti_lid
)
297 warning ("PID mismatch! Expected %ld, got %ld",
298 (long) lwpid
, (long) ti
.ti_lid
);
302 if (thread_db_use_events
)
304 err
= thread_db
->td_thr_event_enable_p (&th
, 1);
306 error ("Cannot enable thread event reporting for %d: %s",
307 ti
.ti_lid
, thread_db_err_str (err
));
310 /* If the new thread ID is zero, a final thread ID will be available
311 later. Do not enable thread debugging yet. */
315 lwp
->thread_known
= 1;
321 /* Attach a thread. Return true on success. */
324 attach_thread (const td_thrhandle_t
*th_p
, td_thrinfo_t
*ti_p
)
326 struct lwp_info
*lwp
;
329 fprintf (stderr
, "Attaching to thread %ld (LWP %d)\n",
330 ti_p
->ti_tid
, ti_p
->ti_lid
);
331 linux_attach_lwp (ti_p
->ti_lid
);
332 lwp
= find_lwp_pid (pid_to_ptid (ti_p
->ti_lid
));
335 warning ("Could not attach to thread %ld (LWP %d)\n",
336 ti_p
->ti_tid
, ti_p
->ti_lid
);
340 lwp
->thread_known
= 1;
343 if (thread_db_use_events
)
346 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
348 err
= thread_db
->td_thr_event_enable_p (th_p
, 1);
350 error ("Cannot enable thread event reporting for %d: %s",
351 ti_p
->ti_lid
, thread_db_err_str (err
));
357 /* Attach thread if we haven't seen it yet.
358 Increment *COUNTER if we have attached a new thread.
359 Return false on failure. */
362 maybe_attach_thread (const td_thrhandle_t
*th_p
, td_thrinfo_t
*ti_p
,
365 struct lwp_info
*lwp
;
367 lwp
= find_lwp_pid (pid_to_ptid (ti_p
->ti_lid
));
371 if (!attach_thread (th_p
, ti_p
))
381 find_new_threads_callback (const td_thrhandle_t
*th_p
, void *data
)
385 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
387 err
= thread_db
->td_thr_get_info_p (th_p
, &ti
);
389 error ("Cannot get thread info: %s", thread_db_err_str (err
));
391 /* Check for zombies. */
392 if (ti
.ti_state
== TD_THR_UNKNOWN
|| ti
.ti_state
== TD_THR_ZOMBIE
)
395 if (!maybe_attach_thread (th_p
, &ti
, (int *) data
))
397 /* Terminate iteration early: we might be looking at stale data in
398 the inferior. The thread_db_find_new_threads will retry. */
406 thread_db_find_new_threads (void)
409 ptid_t ptid
= ((struct inferior_list_entry
*) current_inferior
)->id
;
410 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
413 /* This function is only called when we first initialize thread_db.
414 First locate the initial thread. If it is not ready for
415 debugging yet, then stop. */
416 if (find_one_thread (ptid
) == 0)
419 /* Require 4 successive iterations which do not find any new threads.
420 The 4 is a heuristic: there is an inherent race here, and I have
421 seen that 2 iterations in a row are not always sufficient to
422 "capture" all threads. */
423 for (loop
= 0, iteration
= 0; loop
< 4; ++loop
, ++iteration
)
425 int new_thread_count
= 0;
427 /* Iterate over all user-space threads to discover new threads. */
428 err
= thread_db
->td_ta_thr_iter_p (thread_db
->thread_agent
,
429 find_new_threads_callback
,
432 TD_THR_LOWEST_PRIORITY
,
433 TD_SIGNO_MASK
, TD_THR_ANY_USER_FLAGS
);
435 fprintf (stderr
, "Found %d threads in iteration %d.\n",
436 new_thread_count
, iteration
);
438 if (new_thread_count
!= 0)
440 /* Found new threads. Restart iteration from beginning. */
445 error ("Cannot find new threads: %s", thread_db_err_str (err
));
448 /* Cache all future symbols that thread_db might request. We can not
449 request symbols at arbitrary states in the remote protocol, only
450 when the client tells us that new symbols are available. So when
451 we load the thread library, make sure to check the entire list. */
454 thread_db_look_up_symbols (void)
456 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
457 const char **sym_list
;
460 for (sym_list
= thread_db
->td_symbol_list_p (); *sym_list
; sym_list
++)
461 look_up_one_symbol (*sym_list
, &unused
, 1);
463 /* We're not interested in any other libraries loaded after this
464 point, only in symbols in libpthread.so. */
465 thread_db
->all_symbols_looked_up
= 1;
469 thread_db_look_up_one_symbol (const char *name
, CORE_ADDR
*addrp
)
471 struct thread_db
*thread_db
= current_process ()->private->thread_db
;
472 int may_ask_gdb
= !thread_db
->all_symbols_looked_up
;
474 /* If we've passed the call to thread_db_look_up_symbols, then
475 anything not in the cache must not exist; we're not interested
476 in any libraries loaded after that point, only in symbols in
477 libpthread.so. It might not be an appropriate time to look
478 up a symbol, e.g. while we're trying to fetch registers. */
479 return look_up_one_symbol (name
, addrp
, may_ask_gdb
);
483 thread_db_get_tls_address (struct thread_info
*thread
, CORE_ADDR offset
,
484 CORE_ADDR load_module
, CORE_ADDR
*address
)
488 struct lwp_info
*lwp
;
489 struct thread_info
*saved_inferior
;
490 struct process_info
*proc
;
491 struct thread_db
*thread_db
;
493 proc
= get_thread_process (thread
);
494 thread_db
= proc
->private->thread_db
;
496 /* If the thread layer is not (yet) initialized, fail. */
497 if (!thread_db
->all_symbols_looked_up
)
500 if (thread_db
->td_thr_tls_get_addr_p
== NULL
)
503 lwp
= get_thread_lwp (thread
);
504 if (!lwp
->thread_known
)
505 find_one_thread (lwp
->head
.id
);
506 if (!lwp
->thread_known
)
509 saved_inferior
= current_inferior
;
510 current_inferior
= thread
;
511 /* Note the cast through uintptr_t: this interface only works if
512 a target address fits in a psaddr_t, which is a host pointer.
513 So a 32-bit debugger can not access 64-bit TLS through this. */
514 err
= thread_db
->td_thr_tls_get_addr_p (&lwp
->th
,
515 (psaddr_t
) (uintptr_t) load_module
,
517 current_inferior
= saved_inferior
;
520 *address
= (CORE_ADDR
) (uintptr_t) addr
;
527 #ifdef USE_LIBTHREAD_DB_DIRECTLY
530 thread_db_load_search (void)
533 struct thread_db
*tdb
;
534 struct process_info
*proc
= current_process ();
536 if (proc
->private->thread_db
!= NULL
)
537 fatal ("unexpected: proc->private->thread_db != NULL");
539 tdb
= xcalloc (1, sizeof (*tdb
));
540 proc
->private->thread_db
= tdb
;
542 tdb
->td_ta_new_p
= &td_ta_new
;
544 /* Attempt to open a connection to the thread library. */
545 err
= tdb
->td_ta_new_p (&tdb
->proc_handle
, &tdb
->thread_agent
);
549 fprintf (stderr
, "td_ta_new(): %s\n", thread_db_err_str (err
));
551 proc
->private->thread_db
= NULL
;
555 tdb
->td_ta_map_lwp2thr_p
= &td_ta_map_lwp2thr
;
556 tdb
->td_thr_get_info_p
= &td_thr_get_info
;
557 tdb
->td_ta_thr_iter_p
= &td_ta_thr_iter
;
558 tdb
->td_symbol_list_p
= &td_symbol_list
;
560 /* This is required only when thread_db_use_events is on. */
561 tdb
->td_thr_event_enable_p
= &td_thr_event_enable
;
563 /* These are not essential. */
564 tdb
->td_ta_event_addr_p
= &td_ta_event_addr
;
565 tdb
->td_ta_set_event_p
= &td_ta_set_event
;
566 tdb
->td_ta_event_getmsg_p
= &td_ta_event_getmsg
;
567 tdb
->td_thr_tls_get_addr_p
= &td_thr_tls_get_addr
;
575 try_thread_db_load_1 (void *handle
)
578 struct thread_db
*tdb
;
579 struct process_info
*proc
= current_process ();
581 if (proc
->private->thread_db
!= NULL
)
582 fatal ("unexpected: proc->private->thread_db != NULL");
584 tdb
= xcalloc (1, sizeof (*tdb
));
585 proc
->private->thread_db
= tdb
;
587 tdb
->handle
= handle
;
589 /* Initialize pointers to the dynamic library functions we will use.
590 Essential functions first. */
592 #define CHK(required, a) \
598 fprintf (stderr, "dlsym: %s\n", dlerror ()); \
602 proc->private->thread_db = NULL; \
609 CHK (1, tdb
->td_ta_new_p
= dlsym (handle
, "td_ta_new"));
611 /* Attempt to open a connection to the thread library. */
612 err
= tdb
->td_ta_new_p (&tdb
->proc_handle
, &tdb
->thread_agent
);
616 fprintf (stderr
, "td_ta_new(): %s\n", thread_db_err_str (err
));
618 proc
->private->thread_db
= NULL
;
622 CHK (1, tdb
->td_ta_map_lwp2thr_p
= dlsym (handle
, "td_ta_map_lwp2thr"));
623 CHK (1, tdb
->td_thr_get_info_p
= dlsym (handle
, "td_thr_get_info"));
624 CHK (1, tdb
->td_ta_thr_iter_p
= dlsym (handle
, "td_ta_thr_iter"));
625 CHK (1, tdb
->td_symbol_list_p
= dlsym (handle
, "td_symbol_list"));
627 /* This is required only when thread_db_use_events is on. */
628 CHK (thread_db_use_events
,
629 tdb
->td_thr_event_enable_p
= dlsym (handle
, "td_thr_event_enable"));
631 /* These are not essential. */
632 CHK (0, tdb
->td_ta_event_addr_p
= dlsym (handle
, "td_ta_event_addr"));
633 CHK (0, tdb
->td_ta_set_event_p
= dlsym (handle
, "td_ta_set_event"));
634 CHK (0, tdb
->td_ta_event_getmsg_p
= dlsym (handle
, "td_ta_event_getmsg"));
635 CHK (0, tdb
->td_thr_tls_get_addr_p
= dlsym (handle
, "td_thr_tls_get_addr"));
644 /* Lookup a library in which given symbol resides.
645 Note: this is looking in the GDBSERVER process, not in the inferior.
646 Returns library name, or NULL. */
649 dladdr_to_soname (const void *addr
)
653 if (dladdr (addr
, &info
) != 0)
654 return info
.dli_fname
;
661 try_thread_db_load (const char *library
)
666 fprintf (stderr
, "Trying host libthread_db library: %s.\n",
668 handle
= dlopen (library
, RTLD_NOW
);
672 fprintf (stderr
, "dlopen failed: %s.\n", dlerror ());
677 if (debug_threads
&& strchr (library
, '/') == NULL
)
681 td_init
= dlsym (handle
, "td_init");
684 const char *const libpath
= dladdr_to_soname (td_init
);
687 fprintf (stderr
, "Host %s resolved to: %s.\n",
693 if (try_thread_db_load_1 (handle
))
696 /* This library "refused" to work on current inferior. */
702 thread_db_load_search (void)
705 const char *search_path
;
708 if (libthread_db_search_path
== NULL
)
709 libthread_db_search_path
= xstrdup (LIBTHREAD_DB_SEARCH_PATH
);
711 search_path
= libthread_db_search_path
;
714 const char *end
= strchr (search_path
, ':');
717 size_t len
= end
- search_path
;
718 if (len
+ 1 + strlen (LIBTHREAD_DB_SO
) + 1 > sizeof (path
))
720 char *cp
= xmalloc (len
+ 1);
721 memcpy (cp
, search_path
, len
);
723 warning ("libthread_db_search_path component too long, "
726 search_path
+= len
+ 1;
729 memcpy (path
, search_path
, len
);
731 search_path
+= len
+ 1;
735 size_t len
= strlen (search_path
);
737 if (len
+ 1 + strlen (LIBTHREAD_DB_SO
) + 1 > sizeof (path
))
739 warning ("libthread_db_search_path component too long,"
740 " ignored: %s.", search_path
);
743 memcpy (path
, search_path
, len
+ 1);
747 strcat (path
, LIBTHREAD_DB_SO
);
749 fprintf (stderr
, "thread_db_load_search trying %s\n", path
);
750 if (try_thread_db_load (path
))
757 rc
= try_thread_db_load (LIBTHREAD_DB_SO
);
760 fprintf (stderr
, "thread_db_load_search returning %d\n", rc
);
764 #endif /* USE_LIBTHREAD_DB_DIRECTLY */
767 thread_db_init (int use_events
)
769 struct process_info
*proc
= current_process ();
771 /* FIXME drow/2004-10-16: This is the "overall process ID", which
772 GNU/Linux calls tgid, "thread group ID". When we support
773 attaching to threads, the original thread may not be the correct
774 thread. We would have to get the process ID from /proc for NPTL.
775 For LinuxThreads we could do something similar: follow the chain
776 of parent processes until we find the highest one we're attached
777 to, and use its tgid.
779 This isn't the only place in gdbserver that assumes that the first
780 process in the list is the thread group leader. */
782 thread_db_use_events
= use_events
;
784 if (thread_db_load_search ())
786 if (use_events
&& thread_db_enable_reporting () == 0)
788 /* Keep trying; maybe event reporting will work later. */
789 thread_db_mourn (proc
);
792 thread_db_find_new_threads ();
793 thread_db_look_up_symbols ();
801 any_thread_of (struct inferior_list_entry
*entry
, void *args
)
805 if (ptid_get_pid (entry
->id
) == *pid_p
)
812 switch_to_process (struct process_info
*proc
)
814 int pid
= pid_of (proc
);
817 (struct thread_info
*) find_inferior (&all_threads
,
818 any_thread_of
, &pid
);
821 /* Disconnect from libthread_db and free resources. */
824 disable_thread_event_reporting (struct process_info
*proc
)
826 struct thread_db
*thread_db
= proc
->private->thread_db
;
829 td_err_e (*td_ta_clear_event_p
) (const td_thragent_t
*ta
,
830 td_thr_events_t
*event
);
832 #ifndef USE_LIBTHREAD_DB_DIRECTLY
833 td_ta_clear_event_p
= dlsym (thread_db
->handle
, "td_ta_clear_event");
835 td_ta_clear_event_p
= &td_ta_clear_event
;
838 if (td_ta_clear_event_p
!= NULL
)
840 struct thread_info
*saved_inferior
= current_inferior
;
841 td_thr_events_t events
;
843 switch_to_process (proc
);
845 /* Set the process wide mask saying we aren't interested
846 in any events anymore. */
847 td_event_fillset (&events
);
848 (*td_ta_clear_event_p
) (thread_db
->thread_agent
, &events
);
850 current_inferior
= saved_inferior
;
856 remove_thread_event_breakpoints (struct process_info
*proc
)
858 struct thread_db
*thread_db
= proc
->private->thread_db
;
860 if (thread_db
->td_create_bp
!= NULL
)
862 struct thread_info
*saved_inferior
= current_inferior
;
864 switch_to_process (proc
);
866 delete_breakpoint (thread_db
->td_create_bp
);
867 thread_db
->td_create_bp
= NULL
;
869 current_inferior
= saved_inferior
;
874 thread_db_detach (struct process_info
*proc
)
876 struct thread_db
*thread_db
= proc
->private->thread_db
;
880 disable_thread_event_reporting (proc
);
881 remove_thread_event_breakpoints (proc
);
885 /* Disconnect from libthread_db and free resources. */
888 thread_db_mourn (struct process_info
*proc
)
890 struct thread_db
*thread_db
= proc
->private->thread_db
;
893 td_err_e (*td_ta_delete_p
) (td_thragent_t
*);
895 #ifndef USE_LIBTHREAD_DB_DIRECTLY
896 td_ta_delete_p
= dlsym (thread_db
->handle
, "td_ta_delete");
898 td_ta_delete_p
= &td_ta_delete
;
901 if (td_ta_delete_p
!= NULL
)
902 (*td_ta_delete_p
) (thread_db
->thread_agent
);
904 #ifndef USE_LIBTHREAD_DB_DIRECTLY
905 dlclose (thread_db
->handle
);
906 #endif /* USE_LIBTHREAD_DB_DIRECTLY */
909 proc
->private->thread_db
= NULL
;
913 /* Handle "set libthread-db-search-path" monitor command and return 1.
914 For any other command, return 0. */
917 thread_db_handle_monitor_command (char *mon
)
919 if (strncmp (mon
, "set libthread-db-search-path ", 29) == 0)
921 const char *cp
= mon
+ 29;
923 if (libthread_db_search_path
!= NULL
)
924 free (libthread_db_search_path
);
926 /* Skip leading space (if any). */
927 while (isspace (*cp
))
930 libthread_db_search_path
= xstrdup (cp
);
932 monitor_output ("libthread-db-search-path set to `");
933 monitor_output (libthread_db_search_path
);
934 monitor_output ("'\n");
938 /* Tell server.c to perform default processing. */