aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit6
-rw-r--r--src/print.c11
2 files changed, 17 insertions, 0 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 67dcf718e3c..3cebdff5e7b 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -119,6 +119,12 @@ Print the value of the lisp variable given as argument.
119Works only when an inferior emacs is executing. 119Works only when an inferior emacs is executing.
120end 120end
121 121
122# Format the value and print it as a string. Works in
123# an rr session and during live debugging. Calls into lisp.
124define xfmt
125 printf "%s\n", debug_format("%S", $arg0)
126end
127
122# Print out current buffer point and boundaries 128# Print out current buffer point and boundaries
123define ppt 129define ppt
124 set $b = current_buffer 130 set $b = current_buffer
diff --git a/src/print.c b/src/print.c
index 83943752204..234f44a4a5d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -855,6 +855,17 @@ safe_debug_print (Lisp_Object arg)
855 } 855 }
856} 856}
857 857
858/* This function formats the given object and returns the result as a
859 string. Use this in contexts where you can inspect strings, but
860 where stderr output won't work --- e.g., while replaying rr
861 recordings. */
862const char * debug_format (const char *, Lisp_Object) EXTERNALLY_VISIBLE;
863const char *
864debug_format (const char *fmt, Lisp_Object arg)
865{
866 return SSDATA (CALLN (Fformat, build_string (fmt), arg));
867}
868
858 869
859DEFUN ("error-message-string", Ferror_message_string, Serror_message_string, 870DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
860 1, 1, 0, 871 1, 1, 0,