[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/tty-child-frames dfb7f194265 2/2: More workarounds for GDB bug 3
From: |
Eli Zaretskii |
Subject: |
scratch/tty-child-frames dfb7f194265 2/2: More workarounds for GDB bug 32313 |
Date: |
Mon, 28 Oct 2024 09:47:43 -0400 (EDT) |
branch: scratch/tty-child-frames
commit dfb7f1942659cab4464e01f7e498efc4b269de3e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
More workarounds for GDB bug 32313
* src/eval.c (backtrace_args): Same treatment as
backtrace_function.
cherry-picked from commit b7b55df.
---
src/eval.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/eval.c b/src/eval.c
index 874cf6d868c..d0a2abf0089 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -50,8 +50,6 @@ Lisp_Object Vsignaling_function;
/* These would ordinarily be static, but they need to be visible to GDB. */
bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE;
-Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE;
-Lisp_Object backtrace_function (union specbinding *) EXTERNALLY_VISIBLE;
union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE;
union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE;
@@ -108,12 +106,22 @@ specpdl_arg (union specbinding *pdl)
return pdl->unwind.arg;
}
-Lisp_Object
-backtrace_function (union specbinding *pdl)
+/* To work around GDB bug 32313
+ <https://sourceware.org/bugzilla/show_bug.cgi?id=32313> make
+ backtrace_* functions visible-to-GDB pointers instead of merely
+ being an externally visible functions themselves. Declare the
+ pointer first to pacify gcc -Wmissing-variable-declarations. */
+#define GDB_FUNCPTR(func, resulttype, params) \
+ extern resulttype (*const func) params EXTERNALLY_VISIBLE; \
+ resulttype (*const func) params = func##_body
+
+static Lisp_Object
+backtrace_function_body (union specbinding *pdl)
{
eassert (pdl->kind == SPECPDL_BACKTRACE);
return pdl->bt.function;
}
+GDB_FUNCPTR (backtrace_function, Lisp_Object, (union specbinding *));
static ptrdiff_t
backtrace_nargs (union specbinding *pdl)
@@ -122,12 +130,13 @@ backtrace_nargs (union specbinding *pdl)
return pdl->bt.nargs;
}
-Lisp_Object *
-backtrace_args (union specbinding *pdl)
+static Lisp_Object *
+backtrace_args_body (union specbinding *pdl)
{
eassert (pdl->kind == SPECPDL_BACKTRACE);
return pdl->bt.args;
}
+GDB_FUNCPTR (backtrace_args, Lisp_Object *, (union specbinding *));
/* Functions to modify slots of backtrace records. */