summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-03-12 20:00:21 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-03-12 20:00:21 +0000
commit86d0db3d8bed209c3be8dd13caa52dae57229234 (patch)
treec764cfb6ad3b3ad8d23b8c54d28a871c96bfb404 /gdb
parent8da5a53dcaf1316a1d984f3daeaa74619c964798 (diff)
downloadgdb-86d0db3d8bed209c3be8dd13caa52dae57229234.tar.gz
* sol-thread.c: Replace use of TM_I386SOL2_H by an expression
that is true only on x86-solaris and x86_64-solaris. * procfs.c: Likewise. Move procfs_find_LDT_entry up together with proc_get_LDT_entry.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/procfs.c82
-rw-r--r--gdb/sol-thread.c9
3 files changed, 54 insertions, 46 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ed3a1bfeb60..cebe49d633e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,11 @@
-2008-03-12 Thiago Jung Bauermann <bauerman.ibm.com>
+2008-02-12 Joel Brobecker <brobecker@gnat.com>
+
+ * sol-thread.c: Replace use of TM_I386SOL2_H by an expression
+ that is true only on x86-solaris and x86_64-solaris.
+ * procfs.c: Likewise. Move procfs_find_LDT_entry up together
+ with proc_get_LDT_entry.
+
+2008-03-12 Thiago Jung Bauermann <bauerman@br.ibm.com>
* configure.ac (AC_CHECK_FUNCS): Add check for setsid.
* config.in, configure: Regenerate.
diff --git a/gdb/procfs.c b/gdb/procfs.c
index bde710a6806..72d72cc2180 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2919,7 +2919,7 @@ proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
#endif
}
-#ifdef TM_I386SOL2_H /* Is it hokey to use this? */
+#if (defined(__i386__) || defined(__x86_64__)) && defined (sun)
#include <sys/sysi86.h>
@@ -3011,7 +3011,45 @@ proc_get_LDT_entry (procinfo *pi, int key)
#endif
}
-#endif /* TM_I386SOL2_H */
+/*
+ * Function: procfs_find_LDT_entry
+ *
+ * Input:
+ * ptid_t ptid; // The GDB-style pid-plus-LWP.
+ *
+ * Return:
+ * pointer to the corresponding LDT entry.
+ */
+
+struct ssd *
+procfs_find_LDT_entry (ptid_t ptid)
+{
+ gdb_gregset_t *gregs;
+ int key;
+ procinfo *pi;
+
+ /* Find procinfo for the lwp. */
+ if ((pi = find_procinfo (PIDGET (ptid), TIDGET (ptid))) == NULL)
+ {
+ warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%d."),
+ PIDGET (ptid), TIDGET (ptid));
+ return NULL;
+ }
+ /* get its general registers. */
+ if ((gregs = proc_get_gregs (pi)) == NULL)
+ {
+ warning (_("procfs_find_LDT_entry: could not read gregs for %d:%d."),
+ PIDGET (ptid), TIDGET (ptid));
+ return NULL;
+ }
+ /* Now extract the GS register's lower 16 bits. */
+ key = (*gregs)[GS] & 0xffff;
+
+ /* Find the matching entry and return it. */
+ return proc_get_LDT_entry (pi, key);
+}
+
+#endif
/* =============== END, non-thread part of /proc "MODULE" =============== */
@@ -5331,46 +5369,6 @@ procfs_stopped_by_watchpoint (ptid_t ptid)
return 0;
}
-#ifdef TM_I386SOL2_H
-/*
- * Function: procfs_find_LDT_entry
- *
- * Input:
- * ptid_t ptid; // The GDB-style pid-plus-LWP.
- *
- * Return:
- * pointer to the corresponding LDT entry.
- */
-
-struct ssd *
-procfs_find_LDT_entry (ptid_t ptid)
-{
- gdb_gregset_t *gregs;
- int key;
- procinfo *pi;
-
- /* Find procinfo for the lwp. */
- if ((pi = find_procinfo (PIDGET (ptid), TIDGET (ptid))) == NULL)
- {
- warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%d."),
- PIDGET (ptid), TIDGET (ptid));
- return NULL;
- }
- /* get its general registers. */
- if ((gregs = proc_get_gregs (pi)) == NULL)
- {
- warning (_("procfs_find_LDT_entry: could not read gregs for %d:%d."),
- PIDGET (ptid), TIDGET (ptid));
- return NULL;
- }
- /* Now extract the GS register's lower 16 bits. */
- key = (*gregs)[GS] & 0xffff;
-
- /* Find the matching entry and return it. */
- return proc_get_LDT_entry (pi, key);
-}
-#endif /* TM_I386SOL2_H */
-
/*
* Memory Mappings Functions:
*/
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 796065d382a..bf31fa0194c 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1283,9 +1283,12 @@ ps_pdmodel (gdb_ps_prochandle_t ph, int *data_model)
}
#endif /* PR_MODEL_LP64 */
-#ifdef TM_I386SOL2_H
+#if (defined(__i386__) || defined(__x86_64__)) && defined (sun)
-/* Reads the local descriptor table of a LWP. */
+/* Reads the local descriptor table of a LWP.
+
+ This function is necessary on x86-solaris only. Without it, the loading
+ of libthread_db would fail because of ps_lgetLDT being undefined. */
ps_err_e
ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid,
@@ -1311,7 +1314,7 @@ ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid,
/* LDT not found. */
return PS_ERR;
}
-#endif /* TM_I386SOL2_H */
+#endif
/* Convert PTID to printable form. */