=== modified file 'src/print.c' --- trunk/src/print.c 2010-04-20 01:50:52 +0000 +++ patched/src/print.c 2010-06-14 02:41:47 +0000 @@ -996,6 +996,42 @@ ); } +DEFUN ("gdb-deb-print", Fgdb_deb_print, Sgdb_deb_print, 1, MANY, 0, + doc: /* Display a message in the debugger. +Does nothing unless Emacs is compiled with debugging support. + +The first argument is a format control string, and the rest are data +to be formatted under control of the string. See `format' for +details. + +If the message is longer than 1000 chars it will be split in several +lines. + +usage: (gdb-deb-print FORMAT-STRING &rest ARGS) */) + (nargs, args) + int nargs; + Lisp_Object *args; +{ +#ifdef EMACSDEBUG + Lisp_Object val; + struct gcpro gcpro1; + val = Fformat (nargs, args); + Lisp_Object max_len = make_number (1000); + Lisp_Object len; + Lisp_Object subval; + while (XINT( Flength(val)) > 0) + { + len = make_number (min (XINT (Flength (val)), XINT (max_len))); + subval = Fsubstring (val, make_number (0), len); + val = Fsubstring (val, len, Qnil); + GCPRO1 (subval); + DebPrint ((SDATA (subval))); + UNGCPRO; + } +#endif + return Qnil; +} + DEFUN ("error-message-string", Ferror_message_string, Serror_message_string, 1, 1, 0, @@ -2452,6 +2493,7 @@ defsubr (&Sprin1); defsubr (&Sprin1_to_string); + defsubr (&Sgdb_deb_print); defsubr (&Serror_message_string); defsubr (&Sprinc); defsubr (&Sprint);