aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremy Bryant2025-07-23 23:35:01 +0100
committerEli Zaretskii2025-08-07 16:26:17 +0300
commitcaa6bc95c1b5904bd50c6aee5c70c6994594756c (patch)
tree955f1e2401e063fd041125c3e130b6e277993500 /src
parentb6f177b68a6bf82a21e18e63dd4843fdc31af0e0 (diff)
downloademacs-caa6bc95c1b5904bd50c6aee5c70c6994594756c.tar.gz
emacs-caa6bc95c1b5904bd50c6aee5c70c6994594756c.zip
New debugger-trap function to break to GDB
* src/eval.c: new primitive debugger-trap * src/.gdbinit: set breakpoint to Fdebugger_trap * etc/DEBUG: document it. Remove suggestion to use Fredraw_display. This do-nothing primitive gives control to GDB, and for debugging convenience a breakpoint is set by default in .gdbinit.
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit5
-rw-r--r--src/eval.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index d3bfad59486..0eab7ac9afa 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1314,6 +1314,11 @@ if defined_WINDOWSNT
1314 end 1314 end
1315end 1315end
1316 1316
1317# Break at default trap function to give control to GDB.
1318# Call from Emacs with M-x debugger-trap
1319break Fdebugger_trap
1320
1321
1317# Put the Python code at the end of .gdbinit so that if GDB does not 1322# Put the Python code at the end of .gdbinit so that if GDB does not
1318# support Python, GDB will do all the above initializations before 1323# support Python, GDB will do all the above initializations before
1319# reporting an error. 1324# reporting an error.
diff --git a/src/eval.c b/src/eval.c
index 204adb62472..829d6104618 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3091,6 +3091,21 @@ FUNCTIONP (Lisp_Object object)
3091 return false; 3091 return false;
3092} 3092}
3093 3093
3094DEFUN ("debugger-trap", Fdebugger_trap, Sdebugger_trap, 0, 0, "",
3095 doc: /* Trap execution flow and hand over control to GDB.
3096The Emacs source file src/.gdbinit uses this via the GDB command
3097"break Fdebugger_trap".
3098
3099This function has no effect. It is reserved for debugging, and is not
3100called by Emacs otherwise.
3101
3102For Lisp debugging see debug, as well as edebug, in the manual:
3103"(elisp) Debugging". */)
3104 (void)
3105{
3106 return Qnil;
3107}
3108
3094Lisp_Object 3109Lisp_Object
3095funcall_general (Lisp_Object fun, ptrdiff_t numargs, Lisp_Object *args) 3110funcall_general (Lisp_Object fun, ptrdiff_t numargs, Lisp_Object *args)
3096{ 3111{
@@ -4617,4 +4632,5 @@ alist of active lexical bindings. */);
4617 defsubr (&Sspecial_variable_p); 4632 defsubr (&Sspecial_variable_p);
4618 DEFSYM (Qfunctionp, "functionp"); 4633 DEFSYM (Qfunctionp, "functionp");
4619 defsubr (&Sfunctionp); 4634 defsubr (&Sfunctionp);
4635 defsubr (&Sdebugger_trap);
4620} 4636}