summaryrefslogtreecommitdiff
path: root/gdb/sol-thread.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2000-08-30 00:58:58 +0000
committerMichael Snyder <msnyder@specifix.com>2000-08-30 00:58:58 +0000
commitd97a3c65ac68a8dc117f43ef2caeb4b101e7655a (patch)
tree243c2fa6ce5522e67c0eb3d3f7ccf8a51e4bed90 /gdb/sol-thread.c
parent7a83007edcd9d53a80bc6135f4cb3d00fc5ace43 (diff)
downloadgdb-d97a3c65ac68a8dc117f43ef2caeb4b101e7655a.tar.gz
2000-08-29 Michael Snyder <msnyder@seadog.cygnus.com>
* valops.c (value_cast): Indentation fix-up. * acconfig.h (HAVE_PRGREGSET32_T, HAVE_PRFPREGSET32_T, HAVE_STRUCT_LINK_MAP32): New configure macros. * config.in: Ditto. * configure.in: Test for the above new macros. * breakpoint.c: Update copyright date. * core-sol2.c: Include v9/sys/privregs.h directly to work around a bug in Sun's Solaris 8 header files. (fetch_core_registers): Use the above new configure macros to handle cross-debugging of 32-bit core files on a 64-bit host. * sol-thread.c (ps_pdmodel) New function. (rw_common): For debugging of 32-bit apps on a 64-bit host, truncate addresses to 32 bits. * solib.c (solib_extract_address): Functionize. Make 32/64 aware. (LM_ADDR, LM_NEXT, LM_NAME): Ditto. (IGNORE_FIRST_LINK_MAP): Ditto. (first_link_map_member): Make 32/64 aware. (open_symbol_file_object): Ditto. (current_sos): Ditto.
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r--gdb/sol-thread.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 0ddeb2666b6..3e5014e4acd 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, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of GDB.
@@ -57,6 +57,7 @@
#include <sys/stat.h>
#include <dlfcn.h>
#include "gdbcmd.h"
+#include "gdbcore.h"
extern struct target_ops sol_thread_ops; /* Forward declaration */
extern struct target_ops sol_core_ops; /* Forward declaration */
@@ -1044,6 +1045,13 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
inferior_pid = procfs_first_available (); /* Find any live lwp. */
/* Note: don't need to call switch_to_thread; we're just reading memory. */
+#if defined (__sparcv9)
+ /* For Sparc64 cross Sparc32, make sure the address has not been
+ accidentally sign-extended (or whatever) to beyond 32 bits. */
+ if (bfd_elf_get_arch_size (exec_bfd) == 32)
+ addr &= 0xffffffff;
+#endif
+
while (size > 0)
{
int cc;
@@ -1301,6 +1309,25 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
return PS_OK;
}
+/* Identify process as 32-bit or 64-bit.
+ At the moment I'm using bfd to do this.
+ There might be a more solaris-specific (eg. procfs) method,
+ but this ought to work. */
+
+ps_err_e
+ps_pdmodel (gdb_ps_prochandle_t ph, int *data_model)
+{
+ if (exec_bfd == 0)
+ return PS_ERR;
+
+ if (bfd_elf_get_arch_size (exec_bfd) == 32)
+ *data_model = PR_MODEL_ILP32;
+ else
+ *data_model = PR_MODEL_LP64;
+
+ return PS_OK;
+}
+
#ifdef TM_I386SOL2_H
/* Reads the local descriptor table of a LWP. */