aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/config/sparc/tm-sun4sol2.h5
-rw-r--r--gdb/procfs.c18
-rw-r--r--gdb/sol-thread.c35
4 files changed, 48 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e3a3d3f..37a14a6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+Tue May 14 18:05:16 1996 Stu Grossman (grossman@critters.cygnus.com)
+
+ * procfs.c (procfs_thread_alive procfs_stop): Make static.
+ * (procfs_pid_to_str): New routine to print out thread id's in an
+ intelligible manner.
+ * sol-thread.c (sol_thread_fetch_registers): Re-order manner in
+ which supply_register is called to fix bug with writing writing
+ individual regs.
+ * config/sparc/tm-sun4sol2.h: Define default for
+ target_pid_to_str in case host lacks libthread_db.
+
Mon May 13 23:53:30 1996 Stu Grossman (grossman@critters.cygnus.com)
* Makefile.in config.in configure configure.in
diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h
index 8a2a0e6..dcfe792 100644
--- a/gdb/config/sparc/tm-sun4sol2.h
+++ b/gdb/config/sparc/tm-sun4sol2.h
@@ -81,4 +81,9 @@ extern char *sunpro_static_transform_name PARAMS ((char *));
extern char *solaris_pid_to_str PARAMS ((int pid));
#define target_pid_to_str(PID) solaris_pid_to_str (PID)
+#else
+
+extern char *procfs_pid_to_str PARAMS ((int pid));
+#define target_pid_to_str(PID) procfs_pid_to_str (PID)
+
#endif
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 08cbb45..eceb8ba 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -4386,7 +4386,7 @@ procfs_stopped_by_watchpoint(pid)
/* Why is this necessary? Shouldn't dead threads just be removed from the
thread database? */
-int
+static int
procfs_thread_alive (pid)
int pid;
{
@@ -4399,14 +4399,28 @@ procfs_thread_alive (pid)
XXX - This may not be correct for all systems. Some may want to use
killpg() instead of kill (-pgrp). */
-void
+static void
procfs_stop ()
{
extern pid_t inferior_process_group;
kill (-inferior_process_group, SIGINT);
}
+
+/* Convert a pid to printable form. */
+#ifdef TIDGET
+char *
+procfs_pid_to_str (pid)
+ int pid;
+{
+ static char buf[100];
+
+ sprintf (buf, "Kernel thread %d", TIDGET (pid));
+
+ return buf;
+}
+#endif /* TIDGET */
struct target_ops procfs_ops = {
"procfs", /* to_shortname */
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 96a5d78..d107e22 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -504,7 +504,7 @@ sol_thread_fetch_registers (regno)
thread_t thread;
td_thrhandle_t thandle;
td_err_e val;
- prgregset_t regset;
+ prgregset_t gregset;
prfpregset_t fpregset;
#if 0
int xregsize;
@@ -525,33 +525,30 @@ sol_thread_fetch_registers (regno)
/* Get the integer regs */
- val = td_thr_getgregs (&thandle, regset);
- if (val == TD_OK)
- supply_gregset (regset);
- else if (val == TD_PARTIALREG)
- {
- /* For the sparc, only i0->i7, l0->l7, pc and sp are saved by a thread
- context switch. */
-
- supply_gregset (regset); /* This is not entirely correct, as it sets
- the valid bits for the o, g, ps, y, npc,
- wim and tbr. That should be harmless
- though, as the context switch routine
- doesn't need to save them. */
- }
- else
+ val = td_thr_getgregs (&thandle, gregset);
+ if (val != TD_OK
+ && val != TD_PARTIALREG)
error ("sol_thread_fetch_registers: td_thr_getgregs %s",
td_err_string (val));
+ /* For the sparc, TD_PARTIALREG means that only i0->i7, l0->l7, pc and sp
+ are saved (by a thread context switch). */
+
/* And, now the fp regs */
val = td_thr_getfpregs (&thandle, &fpregset);
- if (val == TD_OK)
- supply_fpregset (fpregset);
- else if (val != TD_NOFPREGS)
+ if (val != TD_OK
+ && val != TD_NOFPREGS)
error ("sol_thread_fetch_registers: td_thr_getfpregs %s",
td_err_string (val));
+/* Note that we must call supply_{g fp}regset *after* calling the td routines
+ because the td routines call ps_lget* which affect the values stored in the
+ registers array. */
+
+ supply_gregset (gregset);
+ supply_fpregset (fpregset);
+
#if 0
/* thread_db doesn't seem to handle this right */
val = td_thr_getxregsize (&thandle, &xregsize);