summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorDaniel Colascione <dancol@dancol.org>2018-06-09 15:41:29 -0700
committerDaniel Colascione <dancol@dancol.org>2018-06-09 17:46:05 -0700
commitaaffae8458dcd774540e7e6b4219c8b5a9902075 (patch)
treee2689ed60bdd3c76084ac59552d223d6b1f294e8 /src/print.c
parent16015dea97b3b4da7ff66a7e822c3c26b2ab6d2b (diff)
downloademacs-aaffae8458dcd774540e7e6b4219c8b5a9902075.tar.gz
emacs-aaffae8458dcd774540e7e6b4219c8b5a9902075.tar.bz2
emacs-aaffae8458dcd774540e7e6b4219c8b5a9902075.zip
Add debug facility for formatting in rr sessions
The existing debug print commands don't work in rr, since they touch stderr. The new xfmt command just calls Fformat and doesn't touch the stdio streams. * src/.gdbinit: (xfmt): New GDB command. * src/print.c: (debug_format): New function.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c11
1 files changed, 11 insertions, 0 deletions
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)
}
}
+/* This function formats the given object and returns the result as a
+ string. Use this in contexts where you can inspect strings, but
+ where stderr output won't work --- e.g., while replaying rr
+ recordings. */
+const char * debug_format (const char *, Lisp_Object) EXTERNALLY_VISIBLE;
+const char *
+debug_format (const char *fmt, Lisp_Object arg)
+{
+ return SSDATA (CALLN (Fformat, build_string (fmt), arg));
+}
+
DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
1, 1, 0,