1 /* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
2 Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This module implements a sort of half target that sits between the
22 machine-independent parts of GDB and the /proc interface (procfs.c) to
23 provide access to the Solaris user-mode thread implementation.
25 Solaris threads are true user-mode threads, which are invoked via the thr_*
26 and pthread_* (native and Posix respectivly) interfaces. These are mostly
27 implemented in user-space, with all thread context kept in various
28 structures that live in the user's heap. These should not be confused with
29 lightweight processes (LWPs), which are implemented by the kernel, and
30 scheduled without explicit intervention by the process.
32 Just to confuse things a little, Solaris threads (both native and Posix) are
33 actually implemented using LWPs. In general, there are going to be more
34 threads than LWPs. There is no fixed correspondence between a thread and an
35 LWP. When a thread wants to run, it gets scheduled onto the first available
36 LWP and can therefore migrate from one LWP to another as time goes on. A
37 sleeping thread may not be associated with an LWP at all!
39 To make it possible to mess with threads, Sun provides a library called
40 libthread_db.so.1 (not to be confused with libthread_db.so.0, which doesn't
41 have a published interface). This interface has an upper part, which it
42 provides, and a lower part which I provide. The upper part consists of the
43 td_* routines, which allow me to find all the threads, query their state,
44 etc... The lower part consists of all of the ps_*, which are used by the
45 td_* routines to read/write memory, manipulate LWPs, lookup symbols, etc...
46 The ps_* routines actually do most of their work by calling functions in
51 #include <proc_service.h>
52 #include <thread_db.h>
53 #include "gdbthread.h"
61 extern struct target_ops sol_thread_ops
; /* Forward declaration */
62 extern struct target_ops sol_core_ops
; /* Forward declaration */
64 /* place to store core_ops before we overwrite it */
65 static struct target_ops orig_core_ops
;
67 struct target_ops sol_thread_ops
;
68 struct target_ops sol_core_ops
;
70 extern int procfs_suppress_run
;
71 extern struct target_ops procfs_ops
; /* target vector for procfs.c */
72 extern struct target_ops core_ops
; /* target vector for corelow.c */
73 extern char *procfs_pid_to_str
PARAMS ((int pid
));
75 /* Note that these prototypes differ slightly from those used in procfs.c
76 for of two reasons. One, we can't use gregset_t, as that's got a whole
77 different meaning under Solaris (also, see above). Two, we can't use the
78 pointer form here as these are actually arrays of ints (for Sparc's at
79 least), and are automatically coerced into pointers to ints when used as
80 parameters. That makes it impossible to avoid a compiler warning when
81 passing pr{g fp}regset_t's from a parameter to an argument of one of
84 extern void supply_gregset
PARAMS ((const prgregset_t
));
85 extern void fill_gregset
PARAMS ((prgregset_t
, int));
86 extern void supply_fpregset
PARAMS ((const prfpregset_t
*));
87 extern void fill_fpregset
PARAMS ((prfpregset_t
*, int));
89 /* This struct is defined by us, but mainly used for the proc_service interface.
90 We don't have much use for it, except as a handy place to get a real pid
91 for memory accesses. */
104 static struct ps_prochandle main_ph
;
105 static td_thragent_t
*main_ta
;
106 static int sol_thread_active
= 0;
108 static struct cleanup
*save_inferior_pid
PARAMS ((void));
109 static void restore_inferior_pid
PARAMS ((void *pid
));
110 static char *td_err_string
PARAMS ((td_err_e errcode
));
111 static char *td_state_string
PARAMS ((td_thr_state_e statecode
));
112 static int thread_to_lwp
PARAMS ((int thread_id
, int default_lwp
));
113 static void sol_thread_resume
PARAMS ((int pid
, int step
,
114 enum target_signal signo
));
115 static int lwp_to_thread
PARAMS ((int lwp
));
116 static int sol_thread_alive
PARAMS ((int pid
));
117 static void sol_core_close
PARAMS ((int quitting
));
119 static void init_sol_thread_ops
PARAMS ((void));
120 static void init_sol_core_ops
PARAMS ((void));
122 #define THREAD_FLAG 0x80000000
123 #define is_thread(ARG) (((ARG) & THREAD_FLAG) != 0)
124 #define is_lwp(ARG) (((ARG) & THREAD_FLAG) == 0)
125 #define GET_LWP(LWP_ID) (TIDGET(LWP_ID))
126 #define GET_THREAD(THREAD_ID) (((THREAD_ID) >> 16) & 0x7fff)
127 #define BUILD_LWP(LWP_ID, PID) ((LWP_ID) << 16 | (PID))
128 #define BUILD_THREAD(THREAD_ID, PID) (THREAD_FLAG | BUILD_LWP (THREAD_ID, PID))
130 /* Pointers to routines from lithread_db resolved by dlopen() */
133 (*p_td_log
) (const int on_off
);
135 (*p_td_ta_new
) (const struct ps_prochandle
* ph_p
, td_thragent_t
** ta_pp
);
137 (*p_td_ta_delete
) (td_thragent_t
* ta_p
);
141 (*p_td_ta_get_ph
) (const td_thragent_t
* ta_p
, struct ps_prochandle
** ph_pp
);
143 (*p_td_ta_get_nthreads
) (const td_thragent_t
* ta_p
, int *nthread_p
);
145 (*p_td_ta_tsd_iter
) (const td_thragent_t
* ta_p
, td_key_iter_f
* cb
, void *cbdata_p
);
147 (*p_td_ta_thr_iter
) (const td_thragent_t
* ta_p
, td_thr_iter_f
* cb
, void *cbdata_p
, td_thr_state_e state
,
148 int ti_pri
, sigset_t
* ti_sigmask_p
, unsigned ti_user_flags
);
150 (*p_td_thr_validate
) (const td_thrhandle_t
* th_p
);
152 (*p_td_thr_tsd
) (const td_thrhandle_t
* th_p
, const thread_key_t key
, void **data_pp
);
154 (*p_td_thr_get_info
) (const td_thrhandle_t
* th_p
, td_thrinfo_t
* ti_p
);
156 (*p_td_thr_getfpregs
) (const td_thrhandle_t
* th_p
, prfpregset_t
* fpregset
);
158 (*p_td_thr_getxregsize
) (const td_thrhandle_t
* th_p
, int *xregsize
);
160 (*p_td_thr_getxregs
) (const td_thrhandle_t
* th_p
, const caddr_t xregset
);
162 (*p_td_thr_sigsetmask
) (const td_thrhandle_t
* th_p
, const sigset_t ti_sigmask
);
164 (*p_td_thr_setprio
) (const td_thrhandle_t
* th_p
, const int ti_pri
);
166 (*p_td_thr_setsigpending
) (const td_thrhandle_t
* th_p
, const uchar_t ti_pending_flag
, const sigset_t ti_pending
);
168 (*p_td_thr_setfpregs
) (const td_thrhandle_t
* th_p
, const prfpregset_t
* fpregset
);
170 (*p_td_thr_setxregs
) (const td_thrhandle_t
* th_p
, const caddr_t xregset
);
172 (*p_td_ta_map_id2thr
) (const td_thragent_t
* ta_p
, thread_t tid
, td_thrhandle_t
* th_p
);
174 (*p_td_ta_map_lwp2thr
) (const td_thragent_t
* ta_p
, lwpid_t lwpid
, td_thrhandle_t
* th_p
);
176 (*p_td_thr_getgregs
) (const td_thrhandle_t
* th_p
, prgregset_t regset
);
178 (*p_td_thr_setgregs
) (const td_thrhandle_t
* th_p
, const prgregset_t regset
);
184 td_err_string - Convert a thread_db error code to a string
188 char * td_err_string (errcode)
192 Return the thread_db error string associated with errcode. If errcode
193 is unknown, then return a message.
198 td_err_string (errcode
)
201 static struct string_map
204 {TD_OK
, "generic \"call succeeded\""},
205 {TD_ERR
, "generic error."},
206 {TD_NOTHR
, "no thread can be found to satisfy query"},
207 {TD_NOSV
, "no synch. variable can be found to satisfy query"},
208 {TD_NOLWP
, "no lwp can be found to satisfy query"},
209 {TD_BADPH
, "invalid process handle"},
210 {TD_BADTH
, "invalid thread handle"},
211 {TD_BADSH
, "invalid synchronization handle"},
212 {TD_BADTA
, "invalid thread agent"},
213 {TD_BADKEY
, "invalid key"},
214 {TD_NOMSG
, "td_thr_event_getmsg() called when there was no message"},
215 {TD_NOFPREGS
, "FPU register set not available for given thread"},
216 {TD_NOLIBTHREAD
, "application not linked with libthread"},
217 {TD_NOEVENT
, "requested event is not supported"},
218 {TD_NOCAPAB
, "capability not available"},
219 {TD_DBERR
, "Debugger service failed"},
220 {TD_NOAPLIC
, "Operation not applicable to"},
221 {TD_NOTSD
, "No thread specific data for this thread"},
222 {TD_MALLOC
, "Malloc failed"},
223 {TD_PARTIALREG
, "Only part of register set was writen/read"},
224 {TD_NOXREGS
, "X register set not available for given thread"}
226 const int td_err_size
= sizeof td_err_table
/ sizeof (struct string_map
);
230 for (i
= 0; i
< td_err_size
; i
++)
231 if (td_err_table
[i
].num
== errcode
)
232 return td_err_table
[i
].str
;
234 sprintf (buf
, "Unknown thread_db error code: %d", errcode
);
243 td_state_string - Convert a thread_db state code to a string
247 char * td_state_string (statecode)
251 Return the thread_db state string associated with statecode. If
252 statecode is unknown, then return a message.
257 td_state_string (statecode
)
258 td_thr_state_e statecode
;
260 static struct string_map
261 td_thr_state_table
[] =
263 {TD_THR_ANY_STATE
, "any state"},
264 {TD_THR_UNKNOWN
, "unknown"},
265 {TD_THR_STOPPED
, "stopped"},
267 {TD_THR_ACTIVE
, "active"},
268 {TD_THR_ZOMBIE
, "zombie"},
269 {TD_THR_SLEEP
, "sleep"},
270 {TD_THR_STOPPED_ASLEEP
, "stopped asleep"}
272 const int td_thr_state_table_size
= sizeof td_thr_state_table
/ sizeof (struct string_map
);
276 for (i
= 0; i
< td_thr_state_table_size
; i
++)
277 if (td_thr_state_table
[i
].num
== statecode
)
278 return td_thr_state_table
[i
].str
;
280 sprintf (buf
, "Unknown thread_db state code: %d", statecode
);
289 thread_to_lwp - Convert a Posix or Solaris thread id to a LWP id.
293 int thread_to_lwp (thread_id, default_lwp)
297 This function converts a Posix or Solaris thread id to a lightweight
298 process id. If thread_id is non-existent, that's an error. If it's
299 an inactive thread, then we return default_lwp.
303 This function probably shouldn't call error()...
308 thread_to_lwp (thread_id
, default_lwp
)
316 if (is_lwp (thread_id
))
317 return thread_id
; /* It's already an LWP id */
319 /* It's a thread. Convert to lwp */
321 val
= p_td_ta_map_id2thr (main_ta
, GET_THREAD (thread_id
), &th
);
323 return -1; /* thread must have terminated */
324 else if (val
!= TD_OK
)
325 error ("thread_to_lwp: td_ta_map_id2thr %s", td_err_string (val
));
327 val
= p_td_thr_get_info (&th
, &ti
);
329 return -1; /* thread must have terminated */
330 else if (val
!= TD_OK
)
331 error ("thread_to_lwp: td_thr_get_info: %s", td_err_string (val
));
333 if (ti
.ti_state
!= TD_THR_ACTIVE
)
335 if (default_lwp
!= -1)
337 error ("thread_to_lwp: thread state not active: %s",
338 td_state_string (ti
.ti_state
));
341 return BUILD_LWP (ti
.ti_lid
, PIDGET (thread_id
));
348 lwp_to_thread - Convert a LWP id to a Posix or Solaris thread id.
352 int lwp_to_thread (lwp_id)
356 This function converts a lightweight process id to a Posix or Solaris
357 thread id. If thread_id is non-existent, that's an error.
361 This function probably shouldn't call error()...
374 return lwp
; /* It's already a thread id */
376 /* It's an lwp. Convert it to a thread id. */
378 if (!sol_thread_alive (lwp
))
379 return -1; /* defunct lwp */
381 val
= p_td_ta_map_lwp2thr (main_ta
, GET_LWP (lwp
), &th
);
383 return -1; /* thread must have terminated */
384 else if (val
!= TD_OK
)
385 error ("lwp_to_thread: td_ta_map_lwp2thr: %s.", td_err_string (val
));
387 val
= p_td_thr_validate (&th
);
389 return lwp
; /* libthread doesn't know about it, just return lwp */
390 else if (val
!= TD_OK
)
391 error ("lwp_to_thread: td_thr_validate: %s.", td_err_string (val
));
393 val
= p_td_thr_get_info (&th
, &ti
);
395 return -1; /* thread must have terminated */
396 else if (val
!= TD_OK
)
397 error ("lwp_to_thread: td_thr_get_info: %s.", td_err_string (val
));
399 return BUILD_THREAD (ti
.ti_tid
, PIDGET (lwp
));
406 save_inferior_pid - Save inferior_pid on the cleanup list
407 restore_inferior_pid - Restore inferior_pid from the cleanup list
411 struct cleanup *save_inferior_pid ()
412 void restore_inferior_pid (int pid)
416 These two functions act in unison to restore inferior_pid in
421 inferior_pid is a global variable that needs to be changed by many of
422 these routines before calling functions in procfs.c. In order to
423 guarantee that inferior_pid gets restored (in case of errors), you
424 need to call save_inferior_pid before changing it. At the end of the
425 function, you should invoke do_cleanups to restore it.
430 static struct cleanup
*
433 return make_cleanup (restore_inferior_pid
, (void *) inferior_pid
);
437 restore_inferior_pid (pid
)
440 inferior_pid
= (int) pid
;
444 /* Most target vector functions from here on actually just pass through to
445 procfs.c, as they don't need to do anything specific for threads. */
450 sol_thread_open (arg
, from_tty
)
454 procfs_ops
.to_open (arg
, from_tty
);
457 /* Attach to process PID, then initialize for debugging it
458 and wait for the trace-trap that results from attaching. */
461 sol_thread_attach (args
, from_tty
)
465 procfs_ops
.to_attach (args
, from_tty
);
466 /* Must get symbols from solibs before libthread_db can run! */
467 SOLIB_ADD ((char *) 0, from_tty
, (struct target_ops
*) 0);
468 if (sol_thread_active
)
470 printf_filtered ("sol-thread active.\n");
471 main_ph
.pid
= inferior_pid
; /* Save for xfer_memory */
472 push_target (&sol_thread_ops
);
473 inferior_pid
= lwp_to_thread (inferior_pid
);
474 if (inferior_pid
== -1)
475 inferior_pid
= main_ph
.pid
;
477 add_thread (inferior_pid
);
479 /* XXX - might want to iterate over all the threads and register them. */
482 /* Take a program previously attached to and detaches it.
483 The program resumes execution and will no longer stop
484 on signals, etc. We'd better not have left any breakpoints
485 in the program or it'll die when it hits one. For this
486 to work, it may be necessary for the process to have been
487 previously attached. It *might* work if the program was
488 started via the normal ptrace (PTRACE_TRACEME). */
491 sol_thread_detach (args
, from_tty
)
495 unpush_target (&sol_thread_ops
);
496 procfs_ops
.to_detach (args
, from_tty
);
499 /* Resume execution of process PID. If STEP is nozero, then
500 just single step it. If SIGNAL is nonzero, restart it with that
501 signal activated. We may have to convert pid from a thread-id to an LWP id
505 sol_thread_resume (pid
, step
, signo
)
508 enum target_signal signo
;
510 struct cleanup
*old_chain
;
512 old_chain
= save_inferior_pid ();
514 inferior_pid
= thread_to_lwp (inferior_pid
, main_ph
.pid
);
515 if (inferior_pid
== -1)
516 inferior_pid
= procfs_first_available ();
522 pid
= thread_to_lwp (pid
, -2);
523 if (pid
== -2) /* Inactive thread */
524 error ("This version of Solaris can't start inactive threads.");
525 if (info_verbose
&& pid
== -1)
526 warning ("Specified thread %d seems to have terminated",
527 GET_THREAD (save_pid
));
530 procfs_ops
.to_resume (pid
, step
, signo
);
532 do_cleanups (old_chain
);
535 /* Wait for any threads to stop. We may have to convert PID from a thread id
536 to a LWP id, and vice versa on the way out. */
539 sol_thread_wait (pid
, ourstatus
)
541 struct target_waitstatus
*ourstatus
;
545 struct cleanup
*old_chain
;
547 save_pid
= inferior_pid
;
548 old_chain
= save_inferior_pid ();
550 inferior_pid
= thread_to_lwp (inferior_pid
, main_ph
.pid
);
551 if (inferior_pid
== -1)
552 inferior_pid
= procfs_first_available ();
558 pid
= thread_to_lwp (pid
, -2);
559 if (pid
== -2) /* Inactive thread */
560 error ("This version of Solaris can't start inactive threads.");
561 if (info_verbose
&& pid
== -1)
562 warning ("Specified thread %d seems to have terminated",
563 GET_THREAD (save_pid
));
566 rtnval
= procfs_ops
.to_wait (pid
, ourstatus
);
568 if (ourstatus
->kind
!= TARGET_WAITKIND_EXITED
)
570 /* Map the LWP of interest back to the appropriate thread ID */
571 rtnval
= lwp_to_thread (rtnval
);
575 /* See if we have a new thread */
576 if (is_thread (rtnval
)
577 && rtnval
!= save_pid
578 && !in_thread_list (rtnval
))
580 printf_filtered ("[New %s]\n", target_pid_to_str (rtnval
));
585 /* During process initialization, we may get here without the thread package
586 being initialized, since that can only happen after we've found the shared
589 do_cleanups (old_chain
);
595 sol_thread_fetch_registers (regno
)
599 td_thrhandle_t thandle
;
602 prfpregset_t fpregset
;
608 if (!is_thread (inferior_pid
))
609 { /* LWP: pass the request on to procfs.c */
610 if (target_has_execution
)
611 procfs_ops
.to_fetch_registers (regno
);
613 orig_core_ops
.to_fetch_registers (regno
);
617 /* Solaris thread: convert inferior_pid into a td_thrhandle_t */
619 thread
= GET_THREAD (inferior_pid
);
622 error ("sol_thread_fetch_registers: thread == 0");
624 val
= p_td_ta_map_id2thr (main_ta
, thread
, &thandle
);
626 error ("sol_thread_fetch_registers: td_ta_map_id2thr: %s",
627 td_err_string (val
));
629 /* Get the integer regs */
631 val
= p_td_thr_getgregs (&thandle
, gregset
);
633 && val
!= TD_PARTIALREG
)
634 error ("sol_thread_fetch_registers: td_thr_getgregs %s",
635 td_err_string (val
));
637 /* For the sparc, TD_PARTIALREG means that only i0->i7, l0->l7, pc and sp
638 are saved (by a thread context switch). */
640 /* And, now the fp regs */
642 val
= p_td_thr_getfpregs (&thandle
, &fpregset
);
644 && val
!= TD_NOFPREGS
)
645 error ("sol_thread_fetch_registers: td_thr_getfpregs %s",
646 td_err_string (val
));
648 /* Note that we must call supply_{g fp}regset *after* calling the td routines
649 because the td routines call ps_lget* which affect the values stored in the
652 supply_gregset (gregset
);
653 supply_fpregset (&fpregset
);
656 /* thread_db doesn't seem to handle this right */
657 val
= td_thr_getxregsize (&thandle
, &xregsize
);
658 if (val
!= TD_OK
&& val
!= TD_NOXREGS
)
659 error ("sol_thread_fetch_registers: td_thr_getxregsize %s",
660 td_err_string (val
));
664 xregset
= alloca (xregsize
);
665 val
= td_thr_getxregs (&thandle
, xregset
);
667 error ("sol_thread_fetch_registers: td_thr_getxregs %s",
668 td_err_string (val
));
674 sol_thread_store_registers (regno
)
678 td_thrhandle_t thandle
;
681 prfpregset_t fpregset
;
687 if (!is_thread (inferior_pid
))
688 { /* LWP: pass the request on to procfs.c */
689 procfs_ops
.to_store_registers (regno
);
693 /* Solaris thread: convert inferior_pid into a td_thrhandle_t */
695 thread
= GET_THREAD (inferior_pid
);
697 val
= p_td_ta_map_id2thr (main_ta
, thread
, &thandle
);
699 error ("sol_thread_store_registers: td_ta_map_id2thr %s",
700 td_err_string (val
));
703 { /* Not writing all the regs */
704 /* save new register value */
705 char old_value
[REGISTER_SIZE
];
706 memcpy (old_value
, ®isters
[REGISTER_BYTE (regno
)], REGISTER_SIZE
);
708 val
= p_td_thr_getgregs (&thandle
, regset
);
710 error ("sol_thread_store_registers: td_thr_getgregs %s",
711 td_err_string (val
));
712 val
= p_td_thr_getfpregs (&thandle
, &fpregset
);
714 error ("sol_thread_store_registers: td_thr_getfpregs %s",
715 td_err_string (val
));
717 /* restore new register value */
718 memcpy (®isters
[REGISTER_BYTE (regno
)], old_value
, REGISTER_SIZE
);
721 /* thread_db doesn't seem to handle this right */
722 val
= td_thr_getxregsize (&thandle
, &xregsize
);
723 if (val
!= TD_OK
&& val
!= TD_NOXREGS
)
724 error ("sol_thread_store_registers: td_thr_getxregsize %s",
725 td_err_string (val
));
729 xregset
= alloca (xregsize
);
730 val
= td_thr_getxregs (&thandle
, xregset
);
732 error ("sol_thread_store_registers: td_thr_getxregs %s",
733 td_err_string (val
));
738 fill_gregset (regset
, regno
);
739 fill_fpregset (&fpregset
, regno
);
741 val
= p_td_thr_setgregs (&thandle
, regset
);
743 error ("sol_thread_store_registers: td_thr_setgregs %s",
744 td_err_string (val
));
745 val
= p_td_thr_setfpregs (&thandle
, &fpregset
);
747 error ("sol_thread_store_registers: td_thr_setfpregs %s",
748 td_err_string (val
));
751 /* thread_db doesn't seem to handle this right */
752 val
= td_thr_getxregsize (&thandle
, &xregsize
);
753 if (val
!= TD_OK
&& val
!= TD_NOXREGS
)
754 error ("sol_thread_store_registers: td_thr_getxregsize %s",
755 td_err_string (val
));
757 /* Should probably do something about writing the xregs here, but what are
762 /* Get ready to modify the registers array. On machines which store
763 individual registers, this doesn't need to do anything. On machines
764 which store all the registers in one fell swoop, this makes sure
765 that registers contains all the registers from the program being
769 sol_thread_prepare_to_store ()
771 procfs_ops
.to_prepare_to_store ();
775 sol_thread_xfer_memory (memaddr
, myaddr
, len
, dowrite
, target
)
780 struct target_ops
*target
; /* ignored */
783 struct cleanup
*old_chain
;
785 old_chain
= save_inferior_pid ();
787 if (is_thread (inferior_pid
) || /* A thread */
788 !target_thread_alive (inferior_pid
)) /* An lwp, but not alive */
789 inferior_pid
= procfs_first_available (); /* Find any live lwp. */
790 /* Note: don't need to call switch_to_thread; we're just reading memory. */
792 if (target_has_execution
)
793 retval
= procfs_ops
.to_xfer_memory (memaddr
, myaddr
, len
, dowrite
, target
);
795 retval
= orig_core_ops
.to_xfer_memory (memaddr
, myaddr
, len
,
798 do_cleanups (old_chain
);
803 /* Print status information about what we're accessing. */
806 sol_thread_files_info (ignore
)
807 struct target_ops
*ignore
;
809 procfs_ops
.to_files_info (ignore
);
813 sol_thread_kill_inferior ()
815 procfs_ops
.to_kill ();
819 sol_thread_notice_signals (pid
)
822 procfs_ops
.to_notice_signals (PIDGET (pid
));
825 /* Fork an inferior process, and start debugging it with /proc. */
828 sol_thread_create_inferior (exec_file
, allargs
, env
)
833 procfs_ops
.to_create_inferior (exec_file
, allargs
, env
);
835 if (sol_thread_active
&& inferior_pid
!= 0)
837 main_ph
.pid
= inferior_pid
; /* Save for xfer_memory */
839 push_target (&sol_thread_ops
);
841 inferior_pid
= lwp_to_thread (inferior_pid
);
842 if (inferior_pid
== -1)
843 inferior_pid
= main_ph
.pid
;
845 add_thread (inferior_pid
);
849 /* This routine is called whenever a new symbol table is read in, or when all
850 symbol tables are removed. libthread_db can only be initialized when it
851 finds the right variables in libthread.so. Since it's a shared library,
852 those variables don't show up until the library gets mapped and the symbol
856 sol_thread_new_objfile (objfile
)
857 struct objfile
*objfile
;
863 sol_thread_active
= 0;
868 /* don't do anything if init failed to resolve the libthread_db library */
869 if (!procfs_suppress_run
)
872 /* Now, initialize the thread debugging library. This needs to be done after
873 the shared libraries are located because it needs information from the
874 user's thread library. */
878 error ("target_new_objfile: td_init: %s", td_err_string (val
));
880 val
= p_td_ta_new (&main_ph
, &main_ta
);
881 if (val
== TD_NOLIBTHREAD
)
883 else if (val
!= TD_OK
)
884 error ("target_new_objfile: td_ta_new: %s", td_err_string (val
));
886 sol_thread_active
= 1;
889 /* Clean up after the inferior dies. */
892 sol_thread_mourn_inferior ()
894 unpush_target (&sol_thread_ops
);
895 procfs_ops
.to_mourn_inferior ();
898 /* Mark our target-struct as eligible for stray "run" and "attach" commands. */
901 sol_thread_can_run ()
903 return procfs_suppress_run
;
910 sol_thread_alive - test thread for "aliveness"
914 static bool sol_thread_alive (int pid);
918 returns true if thread still active in inferior.
923 sol_thread_alive (pid
)
926 if (is_thread (pid
)) /* non-kernel thread */
931 pid
= GET_THREAD (pid
);
932 if ((val
= p_td_ta_map_id2thr (main_ta
, pid
, &th
)) != TD_OK
)
933 return 0; /* thread not found */
934 if ((val
= p_td_thr_validate (&th
)) != TD_OK
)
935 return 0; /* thread not valid */
936 return 1; /* known thread: return true */
939 /* kernel thread (LWP): let procfs test it */
941 if (target_has_execution
)
942 return procfs_ops
.to_thread_alive (pid
);
944 return orig_core_ops
.to_thread_alive (pid
);
951 procfs_ops
.to_stop ();
954 /* These routines implement the lower half of the thread_db interface. Ie: the
957 /* Various versions of <proc_service.h> have slightly
958 different function prototypes. In particular, we have
961 struct ps_prochandle * const struct ps_prochandle *
966 Which one you have depends on solaris version and what
967 patches you've applied. On the theory that there are
968 only two major variants, we have configure check the
969 prototype of ps_pdwrite (), and use that info to make
970 appropriate typedefs here. */
972 #ifdef PROC_SERVICE_IS_OLD
973 typedef const struct ps_prochandle
*gdb_ps_prochandle_t
;
974 typedef char *gdb_ps_read_buf_t
;
975 typedef char *gdb_ps_write_buf_t
;
976 typedef int gdb_ps_size_t
;
978 typedef struct ps_prochandle
*gdb_ps_prochandle_t
;
979 typedef void *gdb_ps_read_buf_t
;
980 typedef const void *gdb_ps_write_buf_t
;
981 typedef size_t gdb_ps_size_t
;
985 /* The next four routines are called by thread_db to tell us to stop and stop
986 a particular process or lwp. Since GDB ensures that these are all stopped
987 by the time we call anything in thread_db, these routines need to do
991 ps_pstop (gdb_ps_prochandle_t ph
)
997 ps_pcontinue (gdb_ps_prochandle_t ph
)
1003 ps_lstop (gdb_ps_prochandle_t ph
, lwpid_t lwpid
)
1009 ps_lcontinue (gdb_ps_prochandle_t ph
, lwpid_t lwpid
)
1015 ps_pglobal_lookup (gdb_ps_prochandle_t ph
, const char *ld_object_name
,
1016 const char *ld_symbol_name
, paddr_t
* ld_symbol_addr
)
1018 struct minimal_symbol
*ms
;
1020 ms
= lookup_minimal_symbol (ld_symbol_name
, NULL
, NULL
);
1025 *ld_symbol_addr
= SYMBOL_VALUE_ADDRESS (ms
);
1030 /* Common routine for reading and writing memory. */
1033 rw_common (int dowrite
, const struct ps_prochandle
*ph
, paddr_t addr
,
1034 char *buf
, int size
)
1036 struct cleanup
*old_chain
;
1038 old_chain
= save_inferior_pid ();
1040 if (is_thread (inferior_pid
) || /* A thread */
1041 !target_thread_alive (inferior_pid
)) /* An lwp, but not alive */
1042 inferior_pid
= procfs_first_available (); /* Find any live lwp. */
1043 /* Note: don't need to call switch_to_thread; we're just reading memory. */
1049 if (target_has_execution
)
1050 cc
= procfs_ops
.to_xfer_memory (addr
, buf
, size
, dowrite
, &procfs_ops
);
1052 cc
= orig_core_ops
.to_xfer_memory (addr
, buf
, size
, dowrite
, &core_ops
);
1057 print_sys_errmsg ("rw_common (): read", errno
);
1059 print_sys_errmsg ("rw_common (): write", errno
);
1061 do_cleanups (old_chain
);
1069 do_cleanups (old_chain
);
1075 ps_pdread (gdb_ps_prochandle_t ph
, paddr_t addr
,
1076 gdb_ps_read_buf_t buf
, gdb_ps_size_t size
)
1078 return rw_common (0, ph
, addr
, buf
, size
);
1082 ps_pdwrite (gdb_ps_prochandle_t ph
, paddr_t addr
,
1083 gdb_ps_write_buf_t buf
, gdb_ps_size_t size
)
1085 return rw_common (1, ph
, addr
, (char *) buf
, size
);
1089 ps_ptread (gdb_ps_prochandle_t ph
, paddr_t addr
,
1090 gdb_ps_read_buf_t buf
, gdb_ps_size_t size
)
1092 return rw_common (0, ph
, addr
, buf
, size
);
1096 ps_ptwrite (gdb_ps_prochandle_t ph
, paddr_t addr
,
1097 gdb_ps_write_buf_t buf
, gdb_ps_size_t size
)
1099 return rw_common (1, ph
, addr
, (char *) buf
, size
);
1102 /* Get integer regs */
1105 ps_lgetregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
,
1106 prgregset_t gregset
)
1108 struct cleanup
*old_chain
;
1110 old_chain
= save_inferior_pid ();
1112 inferior_pid
= BUILD_LWP (lwpid
, PIDGET (inferior_pid
));
1114 if (target_has_execution
)
1115 procfs_ops
.to_fetch_registers (-1);
1117 orig_core_ops
.to_fetch_registers (-1);
1118 fill_gregset (gregset
, -1);
1120 do_cleanups (old_chain
);
1125 /* Set integer regs */
1128 ps_lsetregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
,
1129 const prgregset_t gregset
)
1131 struct cleanup
*old_chain
;
1133 old_chain
= save_inferior_pid ();
1135 inferior_pid
= BUILD_LWP (lwpid
, PIDGET (inferior_pid
));
1137 supply_gregset (gregset
);
1138 if (target_has_execution
)
1139 procfs_ops
.to_store_registers (-1);
1141 orig_core_ops
.to_store_registers (-1);
1143 do_cleanups (old_chain
);
1149 ps_plog (const char *fmt
,...)
1153 va_start (args
, fmt
);
1155 vfprintf_filtered (gdb_stderr
, fmt
, args
);
1158 /* Get size of extra register set. Currently a noop. */
1161 ps_lgetxregsize (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, int *xregsize
)
1168 val
= get_lwp_fd (ph
, lwpid
, &lwp_fd
);
1172 if (ioctl (lwp_fd
, PIOCGXREGSIZE
, ®size
))
1174 if (errno
== EINVAL
)
1175 return PS_NOFREGS
; /* XXX Wrong code, but this is the closest
1176 thing in proc_service.h */
1178 print_sys_errmsg ("ps_lgetxregsize (): PIOCGXREGSIZE", errno
);
1186 /* Get extra register set. Currently a noop. */
1189 ps_lgetxregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, caddr_t xregset
)
1195 val
= get_lwp_fd (ph
, lwpid
, &lwp_fd
);
1199 if (ioctl (lwp_fd
, PIOCGXREG
, xregset
))
1201 print_sys_errmsg ("ps_lgetxregs (): PIOCGXREG", errno
);
1209 /* Set extra register set. Currently a noop. */
1212 ps_lsetxregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, caddr_t xregset
)
1218 val
= get_lwp_fd (ph
, lwpid
, &lwp_fd
);
1222 if (ioctl (lwp_fd
, PIOCSXREG
, xregset
))
1224 print_sys_errmsg ("ps_lsetxregs (): PIOCSXREG", errno
);
1232 /* Get floating-point regs. */
1235 ps_lgetfpregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
,
1236 prfpregset_t
* fpregset
)
1238 struct cleanup
*old_chain
;
1240 old_chain
= save_inferior_pid ();
1242 inferior_pid
= BUILD_LWP (lwpid
, PIDGET (inferior_pid
));
1244 if (target_has_execution
)
1245 procfs_ops
.to_fetch_registers (-1);
1247 orig_core_ops
.to_fetch_registers (-1);
1248 fill_fpregset (fpregset
, -1);
1250 do_cleanups (old_chain
);
1255 /* Set floating-point regs. */
1258 ps_lsetfpregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
,
1259 const prfpregset_t
* fpregset
)
1261 struct cleanup
*old_chain
;
1263 old_chain
= save_inferior_pid ();
1265 inferior_pid
= BUILD_LWP (lwpid
, PIDGET (inferior_pid
));
1267 supply_fpregset (fpregset
);
1268 if (target_has_execution
)
1269 procfs_ops
.to_store_registers (-1);
1271 orig_core_ops
.to_store_registers (-1);
1273 do_cleanups (old_chain
);
1278 #ifdef TM_I386SOL2_H
1280 /* Get local descriptor table. */
1282 #include <sys/procfs.h>
1283 #include <sys/reg.h>
1284 #include <sys/sysi86.h>
1286 static int nldt_allocated
= 0;
1287 static struct ssd
*ldt_bufp
= NULL
;
1290 ps_lgetLDT (gdb_ps_prochandle_t ph
, lwpid_t lwpid
,
1299 /* Get procfs file descriptor for the LWP. */
1300 lwp_fd
= procfs_get_pid_fd (BUILD_LWP (lwpid
, PIDGET (inferior_pid
)));
1304 /* Fetch registers und LDT descriptors. */
1305 if (ioctl (lwp_fd
, PIOCGREG
, &gregset
) == -1)
1308 if (ioctl (lwp_fd
, PIOCNLDT
, &nldt
) == -1)
1311 if (nldt_allocated
< nldt
)
1314 = (struct ssd
*) xrealloc (ldt_bufp
, (nldt
+ 1) * sizeof (struct ssd
));
1315 nldt_allocated
= nldt
;
1318 if (ioctl (lwp_fd
, PIOCLDT
, ldt_bufp
) == -1)
1321 /* Search LDT for the LWP via register GS. */
1322 for (i
= 0; i
< nldt
; i
++)
1324 if (ldt_bufp
[i
].sel
== (gregset
[GS
] & 0xffff))
1326 *pldt
= ldt_bufp
[i
];
1331 /* LDT not found. */
1334 #endif /* TM_I386SOL2_H */
1336 /* Convert a pid to printable form. */
1339 solaris_pid_to_str (pid
)
1342 static char buf
[100];
1344 /* in case init failed to resolve the libthread_db library */
1345 if (!procfs_suppress_run
)
1346 return procfs_pid_to_str (pid
);
1348 if (is_thread (pid
))
1352 lwp
= thread_to_lwp (pid
, -2);
1355 sprintf (buf
, "Thread %d (defunct)", GET_THREAD (pid
));
1357 sprintf (buf
, "Thread %d (LWP %d)", GET_THREAD (pid
), GET_LWP (lwp
));
1359 sprintf (buf
, "Thread %d ", GET_THREAD (pid
));
1361 else if (GET_LWP (pid
) != 0)
1362 sprintf (buf
, "LWP %d ", GET_LWP (pid
));
1364 sprintf (buf
, "process %d ", PIDGET (pid
));
1370 /* Worker bee for find_new_threads
1371 Callback function that gets called once per USER thread (i.e., not
1375 sol_find_new_threads_callback (th
, ignored
)
1376 const td_thrhandle_t
*th
;
1383 if ((retval
= p_td_thr_get_info (th
, &ti
)) != TD_OK
)
1387 pid
= BUILD_THREAD (ti
.ti_tid
, PIDGET (inferior_pid
));
1388 if (!in_thread_list (pid
))
1395 sol_find_new_threads ()
1397 /* don't do anything if init failed to resolve the libthread_db library */
1398 if (!procfs_suppress_run
)
1401 if (inferior_pid
== -1)
1403 printf_filtered ("No process.\n");
1406 p_td_ta_thr_iter (main_ta
, sol_find_new_threads_callback
, (void *) 0,
1407 TD_THR_ANY_STATE
, TD_THR_LOWEST_PRIORITY
,
1408 TD_SIGNO_MASK
, TD_THR_ANY_USER_FLAGS
);
1412 sol_core_open (filename
, from_tty
)
1416 orig_core_ops
.to_open (filename
, from_tty
);
1420 sol_core_close (quitting
)
1423 orig_core_ops
.to_close (quitting
);
1427 sol_core_detach (args
, from_tty
)
1431 unpush_target (&core_ops
);
1432 orig_core_ops
.to_detach (args
, from_tty
);
1436 sol_core_files_info (t
)
1437 struct target_ops
*t
;
1439 orig_core_ops
.to_files_info (t
);
1442 /* Worker bee for info sol-thread command. This is a callback function that
1443 gets called once for each Solaris thread (ie. not kernel thread) in the
1444 inferior. Print anything interesting that we can think of. */
1448 const td_thrhandle_t
*th
;
1453 struct minimal_symbol
*msym
;
1455 if ((ret
= p_td_thr_get_info (th
, &ti
)) == TD_OK
)
1457 printf_filtered ("%s thread #%d, lwp %d, ",
1458 ti
.ti_type
== TD_THR_SYSTEM
? "system" : "user ",
1459 ti
.ti_tid
, ti
.ti_lid
);
1460 switch (ti
.ti_state
)
1463 case TD_THR_UNKNOWN
:
1464 printf_filtered ("<unknown state>");
1466 case TD_THR_STOPPED
:
1467 printf_filtered ("(stopped)");
1470 printf_filtered ("(run) ");
1473 printf_filtered ("(active) ");
1476 printf_filtered ("(zombie) ");
1479 printf_filtered ("(asleep) ");
1481 case TD_THR_STOPPED_ASLEEP
:
1482 printf_filtered ("(stopped asleep)");
1485 /* Print thr_create start function: */
1486 if (ti
.ti_startfunc
!= 0)
1487 if (msym
= lookup_minimal_symbol_by_pc (ti
.ti_startfunc
))
1488 printf_filtered (" startfunc: %s\n", SYMBOL_NAME (msym
));
1490 printf_filtered (" startfunc: 0x%08x\n", ti
.ti_startfunc
);
1492 /* If thread is asleep, print function that went to sleep: */
1493 if (ti
.ti_state
== TD_THR_SLEEP
)
1494 if (msym
= lookup_minimal_symbol_by_pc (ti
.ti_pc
))
1495 printf_filtered (" - Sleep func: %s\n", SYMBOL_NAME (msym
));
1497 printf_filtered (" - Sleep func: 0x%08x\n", ti
.ti_startfunc
);
1499 /* Wrap up line, if necessary */
1500 if (ti
.ti_state
!= TD_THR_SLEEP
&& ti
.ti_startfunc
== 0)
1501 printf_filtered ("\n"); /* don't you hate counting newlines? */
1504 warning ("info sol-thread: failed to get info for thread.");
1509 /* List some state about each Solaris user thread in the inferior. */
1512 info_solthreads (args
, from_tty
)
1516 p_td_ta_thr_iter (main_ta
, info_cb
, args
,
1517 TD_THR_ANY_STATE
, TD_THR_LOWEST_PRIORITY
,
1518 TD_SIGNO_MASK
, TD_THR_ANY_USER_FLAGS
);
1522 ignore (addr
, contents
)
1531 init_sol_thread_ops ()
1533 sol_thread_ops
.to_shortname
= "solaris-threads";
1534 sol_thread_ops
.to_longname
= "Solaris threads and pthread.";
1535 sol_thread_ops
.to_doc
= "Solaris threads and pthread support.";
1536 sol_thread_ops
.to_open
= sol_thread_open
;
1537 sol_thread_ops
.to_close
= 0;
1538 sol_thread_ops
.to_attach
= sol_thread_attach
;
1539 sol_thread_ops
.to_detach
= sol_thread_detach
;
1540 sol_thread_ops
.to_resume
= sol_thread_resume
;
1541 sol_thread_ops
.to_wait
= sol_thread_wait
;
1542 sol_thread_ops
.to_fetch_registers
= sol_thread_fetch_registers
;
1543 sol_thread_ops
.to_store_registers
= sol_thread_store_registers
;
1544 sol_thread_ops
.to_prepare_to_store
= sol_thread_prepare_to_store
;
1545 sol_thread_ops
.to_xfer_memory
= sol_thread_xfer_memory
;
1546 sol_thread_ops
.to_files_info
= sol_thread_files_info
;
1547 sol_thread_ops
.to_insert_breakpoint
= memory_insert_breakpoint
;
1548 sol_thread_ops
.to_remove_breakpoint
= memory_remove_breakpoint
;
1549 sol_thread_ops
.to_terminal_init
= terminal_init_inferior
;
1550 sol_thread_ops
.to_terminal_inferior
= terminal_inferior
;
1551 sol_thread_ops
.to_terminal_ours_for_output
= terminal_ours_for_output
;
1552 sol_thread_ops
.to_terminal_ours
= terminal_ours
;
1553 sol_thread_ops
.to_terminal_info
= child_terminal_info
;
1554 sol_thread_ops
.to_kill
= sol_thread_kill_inferior
;
1555 sol_thread_ops
.to_load
= 0;
1556 sol_thread_ops
.to_lookup_symbol
= 0;
1557 sol_thread_ops
.to_create_inferior
= sol_thread_create_inferior
;
1558 sol_thread_ops
.to_mourn_inferior
= sol_thread_mourn_inferior
;
1559 sol_thread_ops
.to_can_run
= sol_thread_can_run
;
1560 sol_thread_ops
.to_notice_signals
= sol_thread_notice_signals
;
1561 sol_thread_ops
.to_thread_alive
= sol_thread_alive
;
1562 sol_thread_ops
.to_find_new_threads
= sol_find_new_threads
;
1563 sol_thread_ops
.to_stop
= sol_thread_stop
;
1564 sol_thread_ops
.to_stratum
= process_stratum
;
1565 sol_thread_ops
.to_has_all_memory
= 1;
1566 sol_thread_ops
.to_has_memory
= 1;
1567 sol_thread_ops
.to_has_stack
= 1;
1568 sol_thread_ops
.to_has_registers
= 1;
1569 sol_thread_ops
.to_has_execution
= 1;
1570 sol_thread_ops
.to_has_thread_control
= tc_none
;
1571 sol_thread_ops
.to_sections
= 0;
1572 sol_thread_ops
.to_sections_end
= 0;
1573 sol_thread_ops
.to_magic
= OPS_MAGIC
;
1578 init_sol_core_ops ()
1580 sol_core_ops
.to_shortname
= "solaris-core";
1581 sol_core_ops
.to_longname
= "Solaris core threads and pthread.";
1582 sol_core_ops
.to_doc
= "Solaris threads and pthread support for core files.";
1583 sol_core_ops
.to_open
= sol_core_open
;
1584 sol_core_ops
.to_close
= sol_core_close
;
1585 sol_core_ops
.to_attach
= sol_thread_attach
;
1586 sol_core_ops
.to_detach
= sol_core_detach
;
1587 /* sol_core_ops.to_resume = 0; */
1588 /* sol_core_ops.to_wait = 0; */
1589 sol_core_ops
.to_fetch_registers
= sol_thread_fetch_registers
;
1590 /* sol_core_ops.to_store_registers = 0; */
1591 /* sol_core_ops.to_prepare_to_store = 0; */
1592 sol_core_ops
.to_xfer_memory
= sol_thread_xfer_memory
;
1593 sol_core_ops
.to_files_info
= sol_core_files_info
;
1594 sol_core_ops
.to_insert_breakpoint
= ignore
;
1595 sol_core_ops
.to_remove_breakpoint
= ignore
;
1596 /* sol_core_ops.to_terminal_init = 0; */
1597 /* sol_core_ops.to_terminal_inferior = 0; */
1598 /* sol_core_ops.to_terminal_ours_for_output = 0; */
1599 /* sol_core_ops.to_terminal_ours = 0; */
1600 /* sol_core_ops.to_terminal_info = 0; */
1601 /* sol_core_ops.to_kill = 0; */
1602 /* sol_core_ops.to_load = 0; */
1603 /* sol_core_ops.to_lookup_symbol = 0; */
1604 sol_core_ops
.to_create_inferior
= sol_thread_create_inferior
;
1605 sol_core_ops
.to_stratum
= core_stratum
;
1606 sol_core_ops
.to_has_all_memory
= 0;
1607 sol_core_ops
.to_has_memory
= 1;
1608 sol_core_ops
.to_has_stack
= 1;
1609 sol_core_ops
.to_has_registers
= 1;
1610 sol_core_ops
.to_has_execution
= 0;
1611 sol_core_ops
.to_has_thread_control
= tc_none
;
1612 sol_core_ops
.to_sections
= 0;
1613 sol_core_ops
.to_sections_end
= 0;
1614 sol_core_ops
.to_magic
= OPS_MAGIC
;
1617 /* we suppress the call to add_target of core_ops in corelow because
1618 if there are two targets in the stratum core_stratum, find_core_target
1619 won't know which one to return. see corelow.c for an additonal
1620 comment on coreops_suppress_target. */
1621 int coreops_suppress_target
= 1;
1624 _initialize_sol_thread ()
1628 init_sol_thread_ops ();
1629 init_sol_core_ops ();
1631 dlhandle
= dlopen ("libthread_db.so.1", RTLD_NOW
);
1635 #define resolve(X) \
1636 if (!(p_##X = dlsym (dlhandle, #X))) \
1640 resolve (td_ta_new
);
1641 resolve (td_ta_delete
);
1643 resolve (td_ta_get_ph
);
1644 resolve (td_ta_get_nthreads
);
1645 resolve (td_ta_tsd_iter
);
1646 resolve (td_ta_thr_iter
);
1647 resolve (td_thr_validate
);
1648 resolve (td_thr_tsd
);
1649 resolve (td_thr_get_info
);
1650 resolve (td_thr_getfpregs
);
1651 resolve (td_thr_getxregsize
);
1652 resolve (td_thr_getxregs
);
1653 resolve (td_thr_sigsetmask
);
1654 resolve (td_thr_setprio
);
1655 resolve (td_thr_setsigpending
);
1656 resolve (td_thr_setfpregs
);
1657 resolve (td_thr_setxregs
);
1658 resolve (td_ta_map_id2thr
);
1659 resolve (td_ta_map_lwp2thr
);
1660 resolve (td_thr_getgregs
);
1661 resolve (td_thr_setgregs
);
1663 add_target (&sol_thread_ops
);
1665 procfs_suppress_run
= 1;
1667 add_cmd ("sol-threads", class_maintenance
, info_solthreads
,
1668 "Show info on Solaris user threads.\n", &maintenanceinfolist
);
1670 memcpy (&orig_core_ops
, &core_ops
, sizeof (struct target_ops
));
1671 memcpy (&core_ops
, &sol_core_ops
, sizeof (struct target_ops
));
1672 add_target (&core_ops
);
1678 fprintf_unfiltered (gdb_stderr
, "[GDB will not be able to debug user-mode threads: %s]\n", dlerror ());
1683 /* allow the user to debug non-threaded core files */
1684 add_target (&core_ops
);