aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2024-10-27 17:21:23 -0700
committerPaul Eggert2024-10-27 17:23:32 -0700
commitebf3fb9a2295520ef8ce1756086fd9bbd3d04e9e (patch)
tree55a6fd81bd303cd24dabd19d912cac9ffc392637 /src
parent9e40d3f2a1c2b5388a4eab72dbe506a21816f69b (diff)
downloademacs-ebf3fb9a2295520ef8ce1756086fd9bbd3d04e9e.tar.gz
emacs-ebf3fb9a2295520ef8ce1756086fd9bbd3d04e9e.zip
Work around GDB bug 32313 when debugging Emacs internals
Problem reported by Eli Zaretskii in: https://lists.gnu.org/r/emacs-devel/2024-10/msg00653.html * src/eval.c (backtrace_function_body): Rename from backtrace_function, and make it static. (GDB_FUNCPTR): New macro. (backtrace_function): New function pointer, for GDB only.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index 874cf6d868c..3c4999d818c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -51,7 +51,6 @@ Lisp_Object Vsignaling_function;
51/* These would ordinarily be static, but they need to be visible to GDB. */ 51/* These would ordinarily be static, but they need to be visible to GDB. */
52bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE; 52bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE;
53Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE; 53Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE;
54Lisp_Object backtrace_function (union specbinding *) EXTERNALLY_VISIBLE;
55union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; 54union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE;
56union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; 55union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE;
57 56
@@ -108,12 +107,21 @@ specpdl_arg (union specbinding *pdl)
108 return pdl->unwind.arg; 107 return pdl->unwind.arg;
109} 108}
110 109
111Lisp_Object 110static Lisp_Object
112backtrace_function (union specbinding *pdl) 111backtrace_function_body (union specbinding *pdl)
113{ 112{
114 eassert (pdl->kind == SPECPDL_BACKTRACE); 113 eassert (pdl->kind == SPECPDL_BACKTRACE);
115 return pdl->bt.function; 114 return pdl->bt.function;
116} 115}
116/* To work around GDB bug 32313
117 <https://sourceware.org/bugzilla/show_bug.cgi?id=32313>
118 make backtrace_function a visible-to-GDB pointer instead of merely
119 being an externally visible function itself. Declare the pointer
120 first to pacify gcc -Wmissing-variable-declarations. */
121#define GDB_FUNCPTR(func, resulttype, params) \
122 extern resulttype (*const func) params EXTERNALLY_VISIBLE; \
123 resulttype (*const func) params = func##_body
124GDB_FUNCPTR (backtrace_function, Lisp_Object, (union specbinding *));
117 125
118static ptrdiff_t 126static ptrdiff_t
119backtrace_nargs (union specbinding *pdl) 127backtrace_nargs (union specbinding *pdl)