aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-06 00:10:15 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-06 00:10:15 +0000
commit542493f93c68755e0c005309e061d5a5a42142ac (patch)
tree7abc952b75cef5d4c9d31973e9f3826ea5a173b0
parentf3ac48d0deccc3cab889ac91e4ba9c46b09ae9b3 (diff)
downloadglibc-542493f93c68755e0c005309e061d5a5a42142ac.zip
glibc-542493f93c68755e0c005309e061d5a5a42142ac.tar.gz
glibc-542493f93c68755e0c005309e061d5a5a42142ac.tar.bz2
Update.
2000-01-05 Philip Blundell <philb@gnu.org> * sysdeps/arm/frame.h: New file. * sysdeps/generic/frame.h: Likewise. * sysdeps/generic/segfault.c (struct layout): Delete definition; include the above file instead. * sysdeps/generic/backtrace.c (struct layout): Likewise. (__backtrace): Use ADVANCE_STACK_FRAME. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (ADVANCE_STACK_FRAME): New macro. (GET_FRAME): Apply above to returned value. * sysdeps/unix/sysv/linux/arm/bits/armsigctx.h: Add `fault_address'.
-rw-r--r--ChangeLog14
-rw-r--r--sysdeps/arm/frame.h26
-rw-r--r--sysdeps/generic/backtrace.c15
-rw-r--r--sysdeps/generic/frame.h24
-rw-r--r--sysdeps/generic/segfault.c11
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/armsigctx.h9
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigcontextinfo.h5
7 files changed, 87 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index f59386e..3d2ac73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2000-01-05 Philip Blundell <philb@gnu.org>
+
+ * sysdeps/arm/frame.h: New file.
+ * sysdeps/generic/frame.h: Likewise.
+ * sysdeps/generic/segfault.c (struct layout): Delete definition;
+ include the above file instead.
+ * sysdeps/generic/backtrace.c (struct layout): Likewise.
+ (__backtrace): Use ADVANCE_STACK_FRAME.
+ * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+ (ADVANCE_STACK_FRAME): New macro.
+ (GET_FRAME): Apply above to returned value.
+
+ * sysdeps/unix/sysv/linux/arm/bits/armsigctx.h: Add `fault_address'.
+
2000-01-05 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/posix/getaddrinfo.c: Add support for SOCK_RAW.
diff --git a/sysdeps/arm/frame.h b/sysdeps/arm/frame.h
new file mode 100644
index 0000000..16f329c
--- /dev/null
+++ b/sysdeps/arm/frame.h
@@ -0,0 +1,26 @@
+/* Definition of stack frame structure. ARM/APCS version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* This is the APCS stack backtrace structure. */
+struct layout
+{
+ struct layout *next;
+ void *sp;
+ void *return_address;
+};
diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c
index 2d329e1..3eae3f4 100644
--- a/sysdeps/generic/backtrace.c
+++ b/sysdeps/generic/backtrace.c
@@ -19,7 +19,8 @@
Boston, MA 02111-1307, USA. */
#include <execinfo.h>
-
+#include <frame.h>
+#include <sigcontextinfo.h>
/* This is a global variable set at program start time. It marks the
highest used stack address. */
@@ -49,11 +50,11 @@ extern void *__libc_stack_end;
# define INNER_THAN <
#endif
-struct layout
-{
- struct layout *next;
- void *return_address;
-};
+/* By default assume the `next' pointer in struct layout points to the
+ next struct layout. */
+#ifndef ADVANCE_STACK_FRAME
+# define ADVANCE_STACK_FRAME(next) ((struct layout *) (next))
+#endif
int
__backtrace (array, size)
@@ -81,7 +82,7 @@ __backtrace (array, size)
array[cnt++] = current->return_address;
- current = current->next;
+ current = ADVANCE_STACK_FRAME (current->next);
}
return cnt;
diff --git a/sysdeps/generic/frame.h b/sysdeps/generic/frame.h
new file mode 100644
index 0000000..7ad7a64
--- /dev/null
+++ b/sysdeps/generic/frame.h
@@ -0,0 +1,24 @@
+/* Definition of stack frame structure. Generic version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+struct layout
+{
+ void *next;
+ void *return_address;
+};
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
index b1bb178..41e3aa5 100644
--- a/sysdeps/generic/segfault.c
+++ b/sysdeps/generic/segfault.c
@@ -28,6 +28,9 @@
#include <unistd.h>
#include <stdio-common/_itoa.h>
+/* Get the definition of "struct layout". */
+#include <frame.h>
+
/* This file defines macros to access the content of the sigcontext element
passed up by the signal handler. */
#include <sigcontextinfo.h>
@@ -72,14 +75,6 @@ extern void *__libc_stack_end;
/* We'll use tis a lot. */
#define WRITE_STRING(s) write (fd, s, strlen (s))
-
-struct layout
-{
- void *next;
- void *return_address;
-};
-
-
/* Name of the output file. */
static const char *fname;
diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
index 3435a96..636a93b 100644
--- a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
+++ b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
@@ -1,5 +1,5 @@
/* Definition of `struct sigcontext' for Linux/ARM
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,12 @@
Fortunately 2.0 puts a magic number in the first word and this is not
a legal value for `trap_no', so we can tell them apart. */
+/* Early 2.2 and 2.3 kernels do not have the `fault_address' member in
+ the sigcontext structure. Unfortunately there is no reliable way
+ to test for its presence and this word will contain garbage for too-old
+ kernels. Versions 2.2.14 and 2.3.35 (plus later versions) are known to
+ include this element. */
+
#ifndef __ARMSIGCTX_H
#define __ARMSIGCTX_H 1
@@ -50,6 +56,7 @@ union k_sigcontext
unsigned long int arm_lr;
unsigned long int arm_pc;
unsigned long int arm_cpsr;
+ unsigned long fault_address;
} v21;
struct
{
diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
index 7f6ecbd..1aaca1e 100644
--- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
@@ -24,7 +24,10 @@
#define GET_PC(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
-#define GET_FRAME(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
+#define GET_FRAME(ctx) \
+ ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
#define GET_STACK(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
+#define ADVANCE_STACK_FRAME(frm) \
+ ((struct layout *)frm - 1)