diff options
author | Jason Molenda <jmolenda@apple.com> | 1998-04-11 05:43:33 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1998-04-11 05:43:33 +0000 |
commit | f0fce3b80b0f045dc926074f3378c7418e64757e (patch) | |
tree | 7991b9a36a8f9945f2c41d5f2a53e28a1b6a7051 /gdb/sol-thread.c | |
parent | baee3bc6e9db248118a7bb1bf571d8bd002ae6a5 (diff) | |
download | gdb-f0fce3b80b0f045dc926074f3378c7418e64757e.zip gdb-f0fce3b80b0f045dc926074f3378c7418e64757e.tar.gz gdb-f0fce3b80b0f045dc926074f3378c7418e64757e.tar.bz2 |
Fri Apr 10 22:36:28 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
Update support for x86 Solaris 2.
* config/i386/tm-i386sol2.h, nm-i386sol2.h: New configuration
files for x86 Solaris 2.
* config/i386/i386sol2.mt, i386sol2.mh: Use them.
* config/sparc/tm-sun4sol2.h (PROCFS_GET_CARRY): New macro, extract
carry flag from a given regset.
(IS_STATIC_TRANSFORM_NAME): New macro, check if a symbol name
is a SunPro transformed name.
* i386-tdep.c (sunpro_static_transform_name): New function to
extract the source name from a SunPro transformed name.
* inferior.h (procfs_first_available, procfs_get_pid_fd):
Add prototypes.
* infrun.c (wait_for_inferior): Handle breakpoint hit in
signal handler without intervening stop in sigtramp.
* procfs.c (procfs_lwp_creation_handler): Use PROCFS_GET_CARRY
instead of direct access to the status register.
(procfs_get_pid_fd): New function, returns procfs fd for a given pid.
* sol-thread.c (ps_lgetLDT): New function, returns LDT for a given
lwpid.
(sol_find_new_threads): Handle failed libthread_db initialization
gracefully.
* stabsread.c (define_symbol): Use IS_STATIC_TRANSFORM_NAME
to check for a SunPro transformed symbol name.
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r-- | gdb/sol-thread.c | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index fbbbbcb..d606264 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1,5 +1,5 @@ /* Low level interface for debugging Solaris threads for GDB, the GNU debugger. - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -717,7 +717,7 @@ sol_thread_store_registers (regno) error ("sol_thread_store_registers: td_thr_getfpregs %s", td_err_string (val)); - /* restore register value */ + /* restore new register value */ memcpy(& registers[REGISTER_BYTE(regno)], old_value, REGISTER_SIZE); #if 0 @@ -1244,6 +1244,64 @@ ps_lsetfpregs (const struct ps_prochandle *ph, lwpid_t lwpid, return PS_OK; } + +#ifdef TM_I386SOL2_H + +/* Get local descriptor table. */ + +#include <sys/procfs.h> +#include <sys/reg.h> +#include <sys/sysi86.h> + +static int nldt_allocated = 0; +static struct ssd *ldt_bufp = NULL; + +ps_err_e +ps_lgetLDT (const struct ps_prochandle *ph, lwpid_t lwpid, + struct ssd *pldt) +{ + gregset_t gregset; + int lwp_fd; + ps_err_e val; + int nldt; + int i; + + /* Get procfs file descriptor for the LWP. */ + lwp_fd = procfs_get_pid_fd (BUILD_LWP (lwpid, PIDGET (inferior_pid))); + if (lwp_fd < 0) + return PS_BADLID; + + /* Fetch registers und LDT descriptors. */ + if (ioctl (lwp_fd, PIOCGREG, &gregset) == -1) + return PS_ERR; + + if (ioctl (lwp_fd, PIOCNLDT, &nldt) == -1) + return PS_ERR; + + if (nldt_allocated < nldt) + { + ldt_bufp + = (struct ssd *) xrealloc (ldt_bufp, (nldt + 1) * sizeof (struct ssd)); + nldt_allocated = nldt; + } + + if (ioctl (lwp_fd, PIOCLDT, ldt_bufp) == -1) + return PS_ERR; + + /* Search LDT for the LWP via register GS. */ + for (i = 0; i < nldt; i++) + { + if (ldt_bufp[i].sel == gregset[GS]) + { + *pldt = ldt_bufp[i]; + return PS_OK; + } + } + + /* LDT not found. */ + return PS_ERR; +} +#endif /* TM_I386SOL2_H */ /* Convert a pid to printable form. */ @@ -1306,6 +1364,10 @@ sol_find_new_threads_callback(th, ignored) void sol_find_new_threads() { + /* don't do anything if init failed to resolve the libthread_db library */ + if (!procfs_suppress_run) + return; + if (inferior_pid == -1) { printf_filtered("No process.\n"); |