Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gdb Add a hack to automatically switch to...



details:   https://anonhg.NetBSD.org/src/rev/ced5a16970d4
branches:  trunk
changeset: 516302:ced5a16970d4
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sat Oct 20 17:44:58 2001 +0000

description:
Add a hack to automatically switch to 26-bit mode when starting up on an
arm26 system.  This could be done better.

diffstat:

 gnu/dist/toolchain/gdb/armnbsd-nat.c |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 52ac105d5c00 -r ced5a16970d4 gnu/dist/toolchain/gdb/armnbsd-nat.c
--- a/gnu/dist/toolchain/gdb/armnbsd-nat.c      Sat Oct 20 17:14:36 2001 +0000
+++ b/gnu/dist/toolchain/gdb/armnbsd-nat.c      Sat Oct 20 17:44:58 2001 +0000
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/ptrace.h>
+#include <sys/sysctl.h>
 #include <sys/user.h>
 #include <machine/reg.h>
 #include "inferior.h"
@@ -170,6 +171,20 @@
 void
 _initialize_armnbsd_nat ()
 {
+  int mib[2];
+  char machine[16];
+  size_t len;
 
-/*  arm_apcs_32 = 0; */
+  /* XXX Grotty hack to guess whether this is a 26-bit system.  This
+     should really be determined on the fly, to allow debugging a
+     32-bit core on a 26-bit machine, or a 26-bit process on a 32-bit
+     machine.  For now, users will just have to use "set apcs32" as
+     appropriate. */
+  mib[0] = CTL_HW;
+  mib[1] = HW_MACHINE;
+  len = sizeof(machine);
+  if (sysctl(mib, 2, machine, &len, NULL, 0) == 0 &&
+      strcmp(machine, "arm26") == 0)
+    arm_apcs_32 = 0;
 }
+



Home | Main Index | Thread Index | Old Index