/* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GDB.
#include <dlfcn.h>
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "regcache.h"
extern struct target_ops sol_thread_ops; /* Forward declaration */
extern struct target_ops sol_core_ops; /* Forward declaration */
static struct cleanup *
save_inferior_pid (void)
{
- return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
+ int *saved_pid = xmalloc (sizeof (int));
+ *saved_pid = inferior_pid;
+ return make_cleanup (restore_inferior_pid, saved_pid);
}
static void
-restore_inferior_pid (void *pid)
+restore_inferior_pid (void *data)
{
- inferior_pid = (int) pid;
+ int *saved_pid = data;
+ inferior_pid = *saved_pid;
+ xfree (saved_pid);
}
\f
if (regno != -1)
{ /* Not writing all the regs */
/* save new register value */
- char old_value[REGISTER_SIZE];
+ char* old_value = (char*) alloca (REGISTER_SIZE);
memcpy (old_value, ®isters[REGISTER_BYTE (regno)], REGISTER_SIZE);
val = p_td_thr_getgregs (&thandle, gregset);
static int
sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+ struct mem_attrib *attrib,
struct target_ops *target)
{
int retval;
/* Note: don't need to call switch_to_thread; we're just reading memory. */
if (target_has_execution)
- retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, target);
+ retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len,
+ dowrite, attrib, target);
else
retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
- dowrite, target);
+ dowrite, attrib, target);
do_cleanups (old_chain);
{
int cc;
+ /* FIXME: passing 0 as attrib argument. */
if (target_has_execution)
- cc = procfs_ops.to_xfer_memory (addr, buf, size, dowrite, &procfs_ops);
+ cc = procfs_ops.to_xfer_memory (addr, buf, size,
+ dowrite, 0, &procfs_ops);
else
- cc = orig_core_ops.to_xfer_memory (addr, buf, size, dowrite, &core_ops);
+ cc = orig_core_ops.to_xfer_memory (addr, buf, size,
+ dowrite, 0, &core_ops);
if (cc < 0)
{