1 /* Low level interface for debugging UnixWare user-mode threads for
4 Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
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 2 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, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
25 /* Like many systems, UnixWare implements two classes of threads:
26 kernel-mode threads, which are scheduled by the kernel; and
27 user-mode threads, which are scheduled by a library. UnixWare
28 calls these two classes lightweight processes (LWPs) and threads,
31 This module deals with user-mode threads. It calls procfs_ops
32 functions to deal with LWPs and processes and core_ops functions to
35 As of this writing, the user-mode thread debugging interface is not
36 documented beyond the comments in <thread.h>. The following
37 description has been gleaned from experience and from information
40 libthread.so, against which all UnixWare user-mode thread programs
41 link, provides a global thread_debug structure named _thr_debug.
44 (1) thr_map is a pointer to a pointer to an element of a
45 thread_map ring. A thread_map contains a single thread's id
46 number, state, LWP pointer, recent register state, and other
49 (2) thr_brk is a pointer to a stub function that libthread.so
50 calls when it changes a thread's state, e.g. by creating it,
51 switching it to an LWP, or causing it to exit.
53 (3) thr_debug_on controls whether libthread.so calls thr_brk().
55 Debuggers are able to track thread activity by setting a private
56 breakpoint on thr_brk() and setting thr_debug_on to 1.
58 thr_brk() receives two arguments:
60 (1) a pointer to a thread_map describing the thread being
63 (2) an enum thread_change specifying one of the following
67 thread_create thread has just been created
68 thread_exit thread has just exited
69 switch_begin thread will be switched to an LWP
70 switch_complete thread has been switched to an LWP
71 cancel_complete thread wasn't switched to an LWP
72 thread_suspend thread has been thr_suspend()ed
73 thread_suspend_pending thread will be thr_suspend()ed
74 thread_continue thread has been thr_continue()d
76 The thread_map argument to thr_brk() is NULL under the following
79 - The main thread is being acted upon. The main thread always
80 has id 1, so its thread_map is easy to find by scanning through
83 - A "switch_complete" change is occurring, which means that the
84 thread specified in the most recent "switch_begin" change has
87 - A "cancel_complete" change is occurring, which means that the
88 thread specified in the most recent "switch_begin" change has
89 not moved to an LWP after all.
91 - A spurious "switch_begin" change is occurring after a
94 Between switch_begin and switch_complete or cancel_complete, the
95 affected thread's LWP pointer is not reliable. It is possible that
96 other parts of the thread's thread_map are also unreliable during
101 #include "gdbthread.h"
103 #include "inferior.h"
104 #include "regcache.h"
107 /* <thread.h> includes <sys/priocntl.h>, which requires boolean_t from
108 <sys/types.h>, which doesn't typedef boolean_t with gcc. */
110 #define boolean_t int
114 #include <synch.h> /* for UnixWare 2.x */
116 /* Prototypes for supply_gregset etc. */
119 /* Whether to emit debugging output. */
123 /* Default debugging output file, overridden by envvar UWTHR_DEBUG. */
125 #define DEBUG_FILE "/dev/tty"
127 /* #if DEBUG, write string S to the debugging output channel. */
130 # define DBG(fmt_and_args)
131 # define DBG2(fmt_and_args)
133 # define DBG(fmt_and_args) dbg fmt_and_args
134 # define DBG2(fmt_and_args)
137 /* Back end to CALL_BASE() and TRY_BASE(): evaluate CALL, then convert
138 inferior_pid to a composite thread/process id. */
140 #define CALL_BASE_1(call) \
142 DBG2(("CALL_BASE(" #call ")")); \
144 do_cleanups (infpid_cleanup); \
147 /* If inferior_pid can be converted to a composite lwp/process id, do so,
148 evaluate base_ops function CALL, and then convert inferior_pid back to a
149 composite thread/process id.
151 Otherwise, issue an error message and return nonlocally. */
153 #define CALL_BASE(call) \
155 if (!lwp_infpid ()) \
156 error ("uw-thread: no lwp"); \
157 CALL_BASE_1 (call); \
160 /* Like CALL_BASE(), but instead of returning nonlocally on error, set
161 *CALLED to whether the inferior_pid conversion was successful. */
163 #define TRY_BASE(call, called) \
165 if ((*(called) = lwp_infpid ())) \
166 CALL_BASE_1 (call); \
169 /* Information passed by thread_iter() to its callback parameter. */
172 struct thread_map map;
177 /* Private thread data for the thread_info struct. */
179 struct private_thread_info {
180 int stable; /* 0 if libthread.so is modifying thread map */
181 int thrid; /* thread id assigned by libthread.so */
182 int lwpid; /* thread's lwp if .stable, 0 means no lwp */
183 CORE_ADDR mapp; /* address of thread's map structure */
187 /* procfs.c's target-specific operations. */
188 extern struct target_ops procfs_ops;
190 /* Flag to prevent procfs.c from starting inferior processes. */
191 extern int procfs_suppress_run;
193 /* This module's target-specific operations. */
194 static struct target_ops uw_thread_ops;
196 /* Copy of the target over which uw_thread_ops is pushed. This is
197 more convenient than a pointer to procfs_ops or core_ops, because
198 they lack current_target's default callbacks. */
199 static struct target_ops base_ops;
201 /* Saved pointer to previous owner of target_new_objfile_hook. */
202 static void (*target_new_objfile_chain)(struct objfile *);
204 /* Whether we are debugging a user-space thread program. This isn't
205 set until after libthread.so is loaded by the program being
208 Except for module one-time intialization and where otherwise
209 documented, no functions in this module get called when
210 !uw_thread_active. */
211 static int uw_thread_active;
213 /* For efficiency, cache the addresses of libthread.so's _thr_debug
214 structure, its thr_brk stub function, and the main thread's map. */
215 static CORE_ADDR thr_debug_addr;
216 static CORE_ADDR thr_brk_addr;
217 static CORE_ADDR thr_map_main;
219 /* Remember the thread most recently marked as switching. Necessary because
220 libthread.so passes null map when calling stub with tc_*_complete. */
221 static struct thread_info *switchto_thread;
223 /* Cleanup chain for safely restoring inferior_pid after CALL_BASE. */
224 static struct cleanup *infpid_cleanup;
228 /* Helper function for DBG() macro: if printf-style FMT is non-null, format it
229 with args and display the result on the debugging output channel. */
234 static int fd = -1, len;
244 path = getenv ("UWTHR_DEBUG");
247 if ((fd = open (path, O_WRONLY | O_CREAT | O_TRUNC, 0664)) < 0)
248 error ("can't open %s\n", path);
251 va_start (args, fmt);
252 vsprintf (buf, fmt, args);
257 (void)write (fd, buf, len + 1);
261 /* Return a string representing composite PID's components. */
266 static char *buf, buf1[80], buf2[80];
267 if (!buf || buf == buf2)
273 sprintf (buf, "%d", pid);
275 sprintf (buf, "%s %d/%d", ISTID (pid) ? "thr" : "lwp",
276 TIDGET (pid), PIDGET (pid));
281 /* Return a string representing thread state CHANGE. */
284 dbgchange (enum thread_change change)
287 case tc_invalid: return "invalid";
288 case tc_thread_create: return "thread_create";
289 case tc_thread_exit: return "thread_exit";
290 case tc_switch_begin: return "switch_begin";
291 case tc_switch_complete: return "switch_complete";
292 case tc_cancel_complete: return "cancel_complete";
293 case tc_thread_suspend: return "thread_suspend";
294 case tc_thread_suspend_pending: return "thread_suspend_pending";
295 case tc_thread_continue: return "thread_continue";
296 default: return "unknown";
300 /* Return a string representing thread STATE. */
306 case TS_ONPROC: return "running";
307 case TS_SLEEP: return "sleeping";
308 case TS_RUNNABLE: return "runnable";
309 case TS_ZOMBIE: return "zombie";
310 case TS_SUSPENDED: return "suspended";
312 case TS_FORK: return "forking";
314 default: return "confused";
321 /* Read the contents of _thr_debug into *DEBUGP. Return success. */
324 read_thr_debug (struct thread_debug *debugp)
326 return base_ops.to_xfer_memory (thr_debug_addr, (char *)debugp,
327 sizeof (*debugp), 0, NULL, &base_ops);
330 /* Read into MAP the contents of the thread map at inferior process address
331 MAPP. Return success. */
334 read_map (CORE_ADDR mapp, struct thread_map *map)
336 return base_ops.to_xfer_memory ((CORE_ADDR)THR_MAP (mapp), (char *)map,
337 sizeof (*map), 0, NULL, &base_ops);
340 /* Read into LWP the contents of the lwp decriptor at inferior process address
341 LWPP. Return success. */
344 read_lwp (CORE_ADDR lwpp, __lwp_desc_t *lwp)
346 return base_ops.to_xfer_memory (lwpp, (char *)lwp,
347 sizeof (*lwp), 0, NULL, &base_ops);
350 /* Iterate through all user threads, applying FUNC(<map>, <lwp>, DATA) until
351 (a) FUNC returns nonzero,
352 (b) FUNC has been applied to all threads, or
354 where <map> is the thread's struct thread_map and <lwp> if non-null is the
355 thread's current __lwp_desc_t.
357 If a call to FUNC returns nonzero, return that value; otherwise, return 0. */
360 thread_iter (int (*func)(iter_t *, void *), void *data)
362 struct thread_debug debug;
363 CORE_ADDR first, mapp;
367 if (!read_thr_debug (&debug))
369 if (!base_ops.to_xfer_memory ((CORE_ADDR)debug.thr_map, (char *)&mapp,
370 sizeof (mapp), 0, NULL, &base_ops))
377 if (!read_map (mapp, &iter.map))
380 if (iter.map.thr_lwpp)
381 if (!read_lwp ((CORE_ADDR)iter.map.thr_lwpp, &iter.lwp))
385 if ((ret = func (&iter, data)))
388 mapp = (CORE_ADDR)iter.map.thr_next;
394 /* Deactivate user-mode thread support. */
397 deactivate_uw_thread (void)
399 remove_thread_event_breakpoints ();
400 uw_thread_active = 0;
401 unpush_target (&uw_thread_ops);
404 /* Return the composite lwp/process id corresponding to composite
405 id PID. If PID is a thread with no lwp, return 0. */
410 struct thread_info *info;
415 else if (!(info = find_thread_pid (pid)))
417 else if (!info->private->lwpid)
420 lid = MKLID (pid, info->private->lwpid);
422 DBG2((" thr_to_lwp(%s) = %s", dbgpid (pid), dbgpid (lid)));
426 /* find_thread_lwp() callback: return whether TP describes a thread
427 associated with lwp id DATA. */
430 find_thread_lwp_callback (struct thread_info *tp, void *data)
432 int lwpid = (int)data;
434 if (!ISTID (tp->pid))
436 if (!tp->private->stable)
438 if (lwpid != tp->private->lwpid)
445 /* If a thread is associated with lwp id LWPID, return the corresponding
446 member of the global thread list; otherwise, return null. */
448 static struct thread_info *
449 find_thread_lwp (int lwpid)
451 return iterate_over_threads (find_thread_lwp_callback, (void *)lwpid);
454 /* Return the composite thread/process id corresponding to composite
455 id PID. If PID is an lwp with no thread, return PID. */
460 struct thread_info *info;
461 int tid = pid, lwpid;
465 if (!(lwpid = LIDGET (pid)))
467 if (!(info = find_thread_lwp (lwpid)))
469 tid = MKTID (pid, info->private->thrid);
472 DBG2((ISTID (tid) ? NULL : "lwp_to_thr: no thr for %s", dbgpid (pid)));
476 /* do_cleanups() callback: convert inferior_pid to a composite
477 thread/process id after having made a procfs call. */
480 thr_infpid (void *unused)
482 int pid = lwp_to_thr (inferior_pid);
483 DBG2((" inferior_pid from procfs: %s => %s",
484 dbgpid (inferior_pid), dbgpid (pid)));
488 /* If possible, convert inferior_pid to a composite lwp/process id in
489 preparation for making a procfs call. Return success. */
494 int pid = thr_to_lwp (inferior_pid);
495 DBG2((" inferior_pid to procfs: %s => %s",
496 dbgpid (inferior_pid), dbgpid (pid)));
502 infpid_cleanup = make_cleanup (thr_infpid, NULL);
506 /* Add to the global thread list a new user-mode thread with system id THRID,
507 lwp id LWPID, map address MAPP, and composite thread/process PID. */
510 add_thread_uw (int thrid, int lwpid, CORE_ADDR mapp, int pid)
512 struct thread_info *newthread;
514 if ((newthread = add_thread (pid)) == NULL)
515 error ("failed to create new thread structure");
517 newthread->private = xmalloc (sizeof (struct private_thread_info));
518 newthread->private->stable = 1;
519 newthread->private->thrid = thrid;
520 newthread->private->lwpid = lwpid;
521 newthread->private->mapp = mapp;
523 if (target_has_execution)
524 printf_unfiltered ("[New %s]\n", target_pid_to_str (pid));
527 /* notice_threads() and find_main() callback: if the thread list doesn't
528 already contain the thread described by ITER, add it if it's the main
529 thread or if !DATA. */
532 notice_thread (iter_t *iter, void *data)
534 int thrid = iter->map.thr_tid;
535 int lwpid = !iter->map.thr_lwpp ? 0 : iter->lwp.lwp_id;
536 int pid = MKTID (inferior_pid, thrid);
538 if (!find_thread_pid (pid) && (!data || thrid == 1))
539 add_thread_uw (thrid, lwpid, iter->mapp, pid);
544 /* Add to the thread list any threads it doesn't already contain. */
547 notice_threads (void)
549 thread_iter (notice_thread, NULL);
552 /* Return the address of the main thread's map. On error, return 0. */
559 struct thread_info *info;
560 thread_iter (notice_thread, (void *)1);
561 if ((info = find_thread_pid (MKTID (inferior_pid, 1))))
562 thr_map_main = info->private->mapp;
567 /* Attach to process specified by ARGS, then initialize for debugging it
568 and wait for the trace-trap that results from attaching.
570 This function only gets called with uw_thread_active == 0. */
573 uw_thread_attach (char *args, int from_tty)
575 procfs_ops.to_attach (args, from_tty);
576 if (uw_thread_active)
580 /* Detach from the process attached to by uw_thread_attach(). */
583 uw_thread_detach (char *args, int from_tty)
585 deactivate_uw_thread ();
586 base_ops.to_detach (args, from_tty);
589 /* Tell the inferior process to continue running thread PID if >= 0
590 and all threads otherwise. */
593 uw_thread_resume (int pid, int step, enum target_signal signo)
595 if (pid > 0 && !(pid = thr_to_lwp (pid)))
598 CALL_BASE (base_ops.to_resume (pid, step, signo));
601 /* If the trap we just received from lwp PID was due to a breakpoint
602 on the libthread.so debugging stub, update this module's state
606 libthread_stub (int pid)
608 CORE_ADDR sp, mapp, mapp_main;
609 enum thread_change change;
610 struct thread_map map;
613 struct thread_info *info;
615 /* Check for stub breakpoint. */
616 if (read_pc_pid (pid) - DECR_PC_AFTER_BREAK != thr_brk_addr)
619 /* Retrieve stub args. */
620 sp = read_register_pid (SP_REGNUM, pid);
621 if (!base_ops.to_xfer_memory (sp + SP_ARG0, (char *)&mapp,
622 sizeof (mapp), 0, NULL, &base_ops))
624 if (!base_ops.to_xfer_memory (sp + SP_ARG0 + sizeof (mapp), (char *)&change,
625 sizeof (change), 0, NULL, &base_ops))
628 /* create_inferior() may not have finished yet, so notice the main
629 thread to ensure that it's displayed first by add_thread(). */
630 mapp_main = find_main ();
632 /* Notice thread creation, deletion, or stability change. */
634 case tc_switch_begin:
635 if (!mapp) /* usually means main thread */
639 case tc_thread_create:
643 if (!read_map (mapp, &map))
645 tid = MKTID (pid, map.thr_tid);
648 case tc_thread_create: /* new thread */
651 else if (!read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
655 add_thread_uw (map.thr_tid, lwpid, mapp, tid);
658 case tc_thread_exit: /* thread has exited */
659 printf_unfiltered ("[Exited %s]\n", target_pid_to_str (tid));
661 if (tid == inferior_pid)
665 case tc_switch_begin: /* lwp is switching threads */
668 if (!(switchto_thread = find_thread_pid (tid)))
670 switchto_thread->private->stable = 0;
678 case tc_switch_complete: /* lwp has switched threads */
679 case tc_cancel_complete: /* lwp didn't switch threads */
680 if (!switchto_thread)
683 if (change == tc_switch_complete)
685 /* If switchto_thread is the main thread, then (a) the corresponding
686 tc_switch_begin probably received a null map argument and therefore
687 (b) it may have been a spurious switch following a tc_thread_exit.
689 Therefore, explicitly query the thread's lwp before caching it in
690 its thread list entry. */
692 if (!read_map (switchto_thread->private->mapp, &map))
696 if (!read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
698 if ((info = find_thread_lwp (lwp.lwp_id)))
699 info->private->lwpid = 0;
700 switchto_thread->private->lwpid = lwp.lwp_id;
704 switchto_thread->private->stable = 1;
705 switchto_thread = NULL;
709 case tc_thread_suspend:
710 case tc_thread_suspend_pending:
711 case tc_thread_continue:
713 DBG(("unexpected condition in libthread_stub()"));
717 DBG2(("libthread_stub(%s): %s %s %s", dbgpid (pid), dbgpid (tid),
718 dbgchange (change), tid ? dbgstate (map.thr_state) : ""));
721 /* Wait for thread/lwp/process ID if >= 0 or for any thread otherwise. */
724 uw_thread_wait (int pid, struct target_waitstatus *status)
727 pid = thr_to_lwp (pid);
728 CALL_BASE (pid = base_ops.to_wait (pid > 0 ? pid : -1, status));
730 if (status->kind == TARGET_WAITKIND_STOPPED &&
731 status->value.sig == TARGET_SIGNAL_TRAP)
732 libthread_stub (pid);
734 return lwp_to_thr (pid);
737 /* Tell gdb about the registers in the thread/lwp/process specified by
741 uw_thread_fetch_registers (int regno)
744 struct thread_info *info;
745 struct thread_map map;
747 TRY_BASE (base_ops.to_fetch_registers (regno), &called);
751 if (!(info = find_thread_pid (inferior_pid)))
753 if (!read_map (info->private->mapp, &map))
756 supply_gregset (&map.thr_ucontext.uc_mcontext.gregs);
757 supply_fpregset (&map.thr_ucontext.uc_mcontext.fpregs);
760 /* Store gdb's current view of the register set into the thread/lwp/process
761 specified by inferior_pid. */
764 uw_thread_store_registers (int regno)
766 CALL_BASE (base_ops.to_store_registers (regno));
769 /* Prepare to modify the registers array. */
772 uw_thread_prepare_to_store (void)
774 CALL_BASE (base_ops.to_prepare_to_store ());
777 /* Fork an inferior process and start debugging it.
779 This function only gets called with uw_thread_active == 0. */
782 uw_thread_create_inferior (char *exec_file, char *allargs, char **env)
784 if (uw_thread_active)
785 deactivate_uw_thread ();
787 procfs_ops.to_create_inferior (exec_file, allargs, env);
788 if (uw_thread_active)
795 /* Kill and forget about the inferior process. */
798 uw_thread_kill (void)
803 /* Clean up after the inferior exits. */
806 uw_thread_mourn_inferior (void)
808 deactivate_uw_thread ();
809 base_ops.to_mourn_inferior ();
812 /* Return whether this module can attach to and run processes.
814 This function only gets called with uw_thread_active == 0. */
817 uw_thread_can_run (void)
819 return procfs_suppress_run;
822 /* Return whether thread PID is still valid. */
825 uw_thread_alive (int pid)
828 return base_ops.to_thread_alive (pid);
830 /* If it's in the thread list, it's valid, because otherwise
831 libthread_stub() would have deleted it. */
832 return in_thread_list (pid);
835 /* Add to the thread list any threads and lwps it doesn't already contain. */
838 uw_thread_find_new_threads (void)
840 CALL_BASE (if (base_ops.to_find_new_threads)
841 base_ops.to_find_new_threads ());
845 /* Return a string for pretty-printing PID in "info threads" output.
846 This may be called by either procfs.c or by generic gdb. */
849 uw_thread_pid_to_str (int pid)
851 #define FMT "Thread %d"
852 static char buf[sizeof (FMT) + 3 * sizeof (pid)];
855 /* core_ops says "process foo", so call procfs_ops explicitly. */
856 return procfs_ops.to_pid_to_str (pid);
858 sprintf (buf, FMT, TIDGET (pid));
863 /* Return a string displaying INFO state information in "info threads"
867 uw_extra_thread_info (struct thread_info *info)
870 struct thread_map map;
875 if (!ISTID (info->pid))
878 if (!info->private->stable)
881 if (!read_map (info->private->mapp, &map))
884 if (!map.thr_lwpp || !read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
889 switch (map.thr_state) {
890 case TS_ONPROC: name = "running"; break;
891 case TS_SLEEP: name = "sleeping"; break;
892 case TS_RUNNABLE: name = "runnable"; break;
893 case TS_ZOMBIE: name = "zombie"; break;
894 case TS_SUSPENDED: name = "suspended"; break;
896 case TS_FORK: name = "forking"; break;
898 default: name = "confused"; break;
904 sprintf (buf, "%s, LWP %d", name, lwpid);
908 /* Check whether libthread.so has just been loaded, and if so, try to
909 initialize user-space thread debugging support.
911 libthread.so loading happens while (a) an inferior process is being
912 started by procfs and (b) a core image is being loaded.
914 This function often gets called with uw_thread_active == 0. */
917 libthread_init (void)
919 struct minimal_symbol *ms;
920 struct thread_debug debug;
922 struct breakpoint *b;
925 /* Don't initialize twice. */
926 if (uw_thread_active)
929 /* Check whether libthread.so has been loaded. */
930 if (!(ms = lookup_minimal_symbol ("_thr_debug", NULL, NULL)))
933 /* Cache _thr_debug's address. */
934 if (!(thr_debug_addr = SYMBOL_VALUE_ADDRESS (ms)))
937 /* Initialize base_ops.to_xfer_memory(). */
938 base_ops = current_target;
940 /* Load _thr_debug's current contents. */
941 if (!read_thr_debug (&debug))
944 /* User code (e.g. my test programs) may dereference _thr_debug,
945 making it availble to GDB before shared libs are loaded. */
949 /* libthread.so has been loaded, and the current_target should now
950 reflect core_ops or procfs_ops. */
951 push_target (&uw_thread_ops); /* must precede notice_threads() */
952 uw_thread_active = 1;
954 if (!target_has_execution)
956 /* Locate threads in core file. */
961 /* Set a breakpoint on the stub function provided by libthread.so. */
962 thr_brk_addr = (CORE_ADDR)debug.thr_brk;
963 if (!(b = create_thread_event_breakpoint (thr_brk_addr)))
966 /* Activate the stub function. */
967 onp = (CORE_ADDR)&((struct thread_debug *)thr_debug_addr)->thr_debug_on;
968 if (!base_ops.to_xfer_memory ((CORE_ADDR)onp, (char *)&one,
969 sizeof (one), 1, NULL, &base_ops))
971 delete_breakpoint (b);
975 /* Prepare for finding the main thread, which doesn't yet exist. */
982 warning ("uw-thread: unable to initialize user-mode thread debugging\n");
983 deactivate_uw_thread ();
986 /* target_new_objfile_hook callback.
988 If OBJFILE is non-null, check whether libthread.so was just loaded,
989 and if so, prepare for user-mode thread debugging.
991 If OBJFILE is null, libthread.so has gone away, so stop debugging
994 This function often gets called with uw_thread_active == 0. */
997 uw_thread_new_objfile (struct objfile *objfile)
1002 else if (uw_thread_active)
1003 deactivate_uw_thread ();
1005 if (target_new_objfile_chain)
1006 target_new_objfile_chain (objfile);
1009 /* Initialize uw_thread_ops. */
1012 init_uw_thread_ops (void)
1014 uw_thread_ops.to_shortname = "unixware-threads";
1015 uw_thread_ops.to_longname = "UnixWare threads and pthread.";
1016 uw_thread_ops.to_doc = "UnixWare threads and pthread support.";
1017 uw_thread_ops.to_attach = uw_thread_attach;
1018 uw_thread_ops.to_detach = uw_thread_detach;
1019 uw_thread_ops.to_resume = uw_thread_resume;
1020 uw_thread_ops.to_wait = uw_thread_wait;
1021 uw_thread_ops.to_fetch_registers = uw_thread_fetch_registers;
1022 uw_thread_ops.to_store_registers = uw_thread_store_registers;
1023 uw_thread_ops.to_prepare_to_store = uw_thread_prepare_to_store;
1024 uw_thread_ops.to_create_inferior = uw_thread_create_inferior;
1025 uw_thread_ops.to_kill = uw_thread_kill;
1026 uw_thread_ops.to_mourn_inferior = uw_thread_mourn_inferior;
1027 uw_thread_ops.to_can_run = uw_thread_can_run;
1028 uw_thread_ops.to_thread_alive = uw_thread_alive;
1029 uw_thread_ops.to_find_new_threads = uw_thread_find_new_threads;
1030 uw_thread_ops.to_pid_to_str = uw_thread_pid_to_str;
1031 uw_thread_ops.to_extra_thread_info = uw_extra_thread_info;
1032 uw_thread_ops.to_stratum = thread_stratum;
1033 uw_thread_ops.to_magic = OPS_MAGIC;
1036 /* Module startup initialization function, automagically called by
1040 _initialize_uw_thread (void)
1042 init_uw_thread_ops ();
1043 add_target (&uw_thread_ops);
1045 procfs_suppress_run = 1;
1047 /* Notice when libthread.so gets loaded. */
1048 target_new_objfile_chain = target_new_objfile_hook;
1049 target_new_objfile_hook = uw_thread_new_objfile;