diff options
author | Andrew Cagney <cagney@redhat.com> | 2000-02-29 13:53:59 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2000-02-29 13:53:59 +0000 |
commit | 05e28a7bbf77a063303591ea3ba713c7a990264f (patch) | |
tree | 5ad8ea5e26960deb6831070ca2161a4dd08dc7a8 /gdb/sol-thread.c | |
parent | b241ba8eab18119f11a6c95f7e577045e535ad39 (diff) | |
download | gdb-05e28a7bbf77a063303591ea3ba713c7a990264f.zip gdb-05e28a7bbf77a063303591ea3ba713c7a990264f.tar.gz gdb-05e28a7bbf77a063303591ea3ba713c7a990264f.tar.bz2 |
From Peter Schauer: Fix Solaris/x86 threads by copying linux code.
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r-- | gdb/sol-thread.c | 53 |
1 files changed, 8 insertions, 45 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 71e9216..0ec10a4 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1318,61 +1318,24 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, #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; - /* Reads the local descriptor table of a LWP. */ ps_err_e ps_lgetLDT (gdb_ps_prochandle_t 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; + /* NOTE: only used on Solaris, therefore OK to refer to procfs.c */ + extern struct ssd *procfs_find_LDT_entry (int); + struct ssd *ret; - if (ioctl (lwp_fd, PIOCNLDT, &nldt) == -1) - return PS_ERR; - - if (nldt_allocated < nldt) + ret = procfs_find_LDT_entry (BUILD_LWP (lwpid, PIDGET (inferior_pid))); + if (ret) { - ldt_bufp - = (struct ssd *) xrealloc (ldt_bufp, (nldt + 1) * sizeof (struct ssd)); - nldt_allocated = nldt; + memcpy (pldt, ret, sizeof (struct ssd)); + return PS_OK; } - - if (ioctl (lwp_fd, PIOCLDT, ldt_bufp) == -1) + else /* LDT not found. */ return PS_ERR; - - /* Search LDT for the LWP via register GS. */ - for (i = 0; i < nldt; i++) - { - if (ldt_bufp[i].sel == (gregset[GS] & 0xffff)) - { - *pldt = ldt_bufp[i]; - return PS_OK; - } - } - - /* LDT not found. */ - return PS_ERR; } #endif /* TM_I386SOL2_H */ |