GNU bug report logs - #6420
Some enhancements to debugging

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Mon, 14 Jun 2010 06:13:02 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6420 in the body.
You can then email your comments to 6420 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6420; Package emacs. (Mon, 14 Jun 2010 06:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 14 Jun 2010 06:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: Some enhancements to debugging
Date: Mon, 14 Jun 2010 08:11:59 +0200
[Message part 1 (text/plain, inline)]
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)
[w32proc-debprint-thread-0.diff (text/x-patch, attachment)]
[gdb-deb-print-0.diff (text/x-patch, attachment)]
[trace-to-debugger-0.diff (text/x-patch, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6420; Package emacs. (Mon, 14 Jun 2010 18:00:03 GMT) Full text and rfc822 format available.

Message #8 received at 6420 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6420 <at> debbugs.gnu.org
Subject: Re: bug#6420: Some enhancements to debugging
Date: Mon, 14 Jun 2010 20:58:33 +0300
> From: Lennart Borgman <lennart.borgman <at> gmail.com>
> Date: Mon, 14 Jun 2010 08:11:59 +0200
> Cc: 
> 
> === modified file 'src/w32proc.c'
> --- trunk/src/w32proc.c	2010-06-04 14:13:35 +0000
> +++ patched/src/w32proc.c	2010-06-14 05:53:50 +0000
> @@ -121,9 +121,17 @@
>  {
>    char buf[1024];
>    va_list args;
> +  char *buf_pos = buf;
> +
> +  /* On NT add thread id */
> +#ifdef WINDOWSNT
> +  DWORD thread_id = GetCurrentThreadId ();
> +  sprintf (buf_pos, "[Th%04x]  ", thread_id);
> +  buf_pos = buf_pos + 10;
> +#endif

The above #ifdef is unnecessary: all the platforms that compile this
file have WINDOWSNT defined by definition.

Also, why do you use magic constants such as 10, instead of the value
returned by `sprintf'?

> -	  DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld\n",
> -		     GetLastError (), cp->fd));
> +	  DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld, pid %ld\n",
> +		     GetLastError (), cp->fd, cp->pid));

cp->fd and cp->pid are both `int', so no need for `l' in `%ld'.  Just
use `%d'.

> +If the message is longer than 1000 chars it will be split in several
> +lines.

Not really 1000, since you are prepending a thread ID, no?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6420; Package emacs. (Mon, 14 Jun 2010 18:04:01 GMT) Full text and rfc822 format available.

Message #11 received at 6420 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 6420 <at> debbugs.gnu.org
Subject: Re: bug#6420: Some enhancements to debugging
Date: Mon, 14 Jun 2010 20:02:57 +0200
On Mon, Jun 14, 2010 at 7:58 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Lennart Borgman <lennart.borgman <at> gmail.com>
>> Date: Mon, 14 Jun 2010 08:11:59 +0200
>> Cc:
>>
>> === modified file 'src/w32proc.c'
>> --- trunk/src/w32proc.c       2010-06-04 14:13:35 +0000
>> +++ patched/src/w32proc.c     2010-06-14 05:53:50 +0000
>> @@ -121,9 +121,17 @@
>>  {
>>    char buf[1024];
>>    va_list args;
>> +  char *buf_pos = buf;
>> +
>> +  /* On NT add thread id */
>> +#ifdef WINDOWSNT
>> +  DWORD thread_id = GetCurrentThreadId ();
>> +  sprintf (buf_pos, "[Th%04x]  ", thread_id);
>> +  buf_pos = buf_pos + 10;
>> +#endif
>
> The above #ifdef is unnecessary: all the platforms that compile this
> file have WINDOWSNT defined by definition.

OK, I thought it maybe was used by the ms-dos port too.

> Also, why do you use magic constants such as 10, instead of the value
> returned by `sprintf'?

Eh, because my C fu is low. Of course the return value should be used instead.

>> -       DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld\n",
>> -                  GetLastError (), cp->fd));
>> +       DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld, pid %ld\n",
>> +                  GetLastError (), cp->fd, cp->pid));
>
> cp->fd and cp->pid are both `int', so no need for `l' in `%ld'.  Just
> use `%d'.
>
>> +If the message is longer than 1000 chars it will be split in several
>> +lines.
>
> Not really 1000, since you are prepending a thread ID, no?

Yes, I was not very specific there. I did not think it was that important.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6420; Package emacs. (Sat, 19 Sep 2020 21:18:02 GMT) Full text and rfc822 format available.

Message #14 received at 6420 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6420 <at> debbugs.gnu.org
Subject: Re: bug#6420: Some enhancements to debugging
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 <lennart.borgman <at> gmail.com> 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




Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Sep 2020 21:19:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6420; Package emacs. (Mon, 10 May 2021 11:12:02 GMT) Full text and rfc822 format available.

Message #19 received at 6420 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6420 <at> debbugs.gnu.org
Subject: Re: bug#6420: Some enhancements to debugging
Date: Mon, 10 May 2021 13:11:13 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

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

And I guess there wasn't any enthusiasm for applying this patch this
year, either, so I'm closing this bug report.  If this is something that
should be worked upon further, please respond to the debbugs address,
and we'll reopen.

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




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 10 May 2021 11:12:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 6420 <at> debbugs.gnu.org and Lennart Borgman <lennart.borgman <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 10 May 2021 11:12:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Jun 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 316 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.