diff options
| author | Paul Eggert | 2024-10-27 17:21:23 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-10-27 17:23:32 -0700 |
| commit | ebf3fb9a2295520ef8ce1756086fd9bbd3d04e9e (patch) | |
| tree | 55a6fd81bd303cd24dabd19d912cac9ffc392637 /src/eval.c | |
| parent | 9e40d3f2a1c2b5388a4eab72dbe506a21816f69b (diff) | |
| download | emacs-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/eval.c')
| -rw-r--r-- | src/eval.c | 14 |
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. */ |
| 52 | bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE; | 52 | bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE; |
| 53 | Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE; | 53 | Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE; |
| 54 | Lisp_Object backtrace_function (union specbinding *) EXTERNALLY_VISIBLE; | ||
| 55 | union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; | 54 | union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; |
| 56 | union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; | 55 | union 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 | ||
| 111 | Lisp_Object | 110 | static Lisp_Object |
| 112 | backtrace_function (union specbinding *pdl) | 111 | backtrace_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 | ||
| 124 | GDB_FUNCPTR (backtrace_function, Lisp_Object, (union specbinding *)); | ||
| 117 | 125 | ||
| 118 | static ptrdiff_t | 126 | static ptrdiff_t |
| 119 | backtrace_nargs (union specbinding *pdl) | 127 | backtrace_nargs (union specbinding *pdl) |