Subject: bug#6420: Some enhancements to debugging

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 19 Sep 2020 23:17:43 +0200

(This was ten years ago, but didn't get a lot of attention at the time.)

Lennart Borgman <[email-masked]> writes:

> Here are some patches to make debugging easier.
>
> The first patch adds thread id to the output when running on w32. That
> is very important information when you try to debug system calls and
> thread usage. (w32proc-debprint-thread-0.diff)
>
> The second patch adds a way to print output to the debugger from lisp.
> (gdb-deb-print-0.diff)
>
> The third patch lets you output tracing of functions to the debugger
> too. This patch also have some convenience things like making the
> function at point default for function name.
> (trace-to-debugger-0.diff)

[...]

> +  /* On NT add thread id */
> +#ifdef WINDOWSNT
> +  DWORD thread_id = GetCurrentThreadId ();
> +  sprintf (buf_pos, "[Th%04x]  ", thread_id);
> +  buf_pos = buf_pos + 10;
> +#endif
>  
>    va_start (args, fmt);
> -  vsprintf (buf, fmt, args);
> +  vsprintf (buf_pos, fmt, args);
>    va_end (args);
>    OutputDebugString (buf);
>  }

This patch has nothing to do with the rest, I guess?  Eli had comments
on the style, but not the utility of the change.  Eli, would adding this
be useful (after fixing the coding issues)?

The rest of the patch set is about adding support for DebPrint from
Lisp, which I have no opinion about, because I've never used DebPrint:

> +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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no