unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: John Wiegley <johnw@gnu.org>
Cc: Juanma Barranquero <lekktu@gmail.com>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	6991-done@debbugs.gnu.org,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	6991@debbugs.gnu.org
Subject: bug#6991: Please keep bytecode out of *Backtrace* buffers
Date: Fri, 26 Feb 2016 17:49:59 -0800 (PST)	[thread overview]
Message-ID: <2223f654-1e67-4a9a-a471-828fd4078410@default> (raw)
In-Reply-To: <m2d1rj7z4r.fsf@newartisans.com>

> Drew, can you show me what it will look like to have the elision
> performed? Sometimes the byte-code contains strings that give me
> a clue as to the problem, so I'm wondering what will disappear if
> this is fixed.

Nothing prevents letting a user control the degree of elision.
If someone thinks that part of a #[...] occurrence might be
helpful then a yankable and readable part of it could be included.
In general, my guess is that most #[...] occurrences can just
be removed (replaced by an elision indicator).

I can show what I do, at least:

1. I start by trying to yank a whole backtrace into a bug-report
   buffer.

2. That typically doesn't work completely: some of the yanked
   text is truncated (not yanked) because it is binary stuff
   from byte-code.

3. So I often have to yank separate pieces of a backtrace - parts
   that are yankable (which might still contain some byte-code,
   but byte-code that is yankable).

4. I remove anything that is problematic/meaningless, leaving
   ordinary text that humans can read.  In my experience there
   is nothing in the byte code that is of interest and that
   doesn't also appear anyway in the non-byte-code part of the
   backtrace.

5. I can include some from an Emacs 24.5 backtrace (Emacs 25 is
   unusable for me - crashes within a minute or two, and has
   done so for a couple years now).

6. Caveat: I byte-compile my code with the oldest Emacs version
   that that particular code supports.  That could be Emacs 20,
   22, 23 (or maybe 24 or 25, for some libraries).

Here's a backtrace with some byte-code in it:

Debugger entered--entering a function:
* icicle-ucs-names()
* #[(prompt &optional names) "\b\204


See, only the top two lines got pasted (even into an Outlook
window, and the second line was truncated at the first null
byte (it appears as ^@ in the backtrace, where that is a null
char and not two chars).

The " \204 that you (might) see here looks like this in Emacs:
"^H\204^G^@\306" etc., but each of those ^LETTER occurrences
is a control char, not a doublet with first char ^.

Then I would yank a bit more, not bothering to copy the
same byte-code that appears in the third line:

* apply(#[(prompt &optional names) "\b\204


Then I would copy and paste some more - in this case all of
the rest of the backtrace has no byte-code:

* read-char-by-name("Unicode (name or hex): ")
  (list (read-char-by-name "Unicode (name or hex): ") (prefix-numeric-value current-prefix-arg) t t)
  call-interactively(ucsc-insert nil nil)
  command-execute(ucsc-insert)

Then I would clean up the byte-code that was successfully
yanked, probably replacing it with "...".  I don't have a
special way of doing these things.  I just edit manually,
to give something like this:

Debugger entered--entering a function:
* icicle-ucs-names()
* #[(prompt &optional names) "..." [names cands prompt new-prompt enable-recursive-minibuffers completion-ignore-case icicle-ucs-names delq nil mapcar icicle-make-char-candidate copy-sequence t (1) "	" ((3 (face icicle-candidate-part))) icicle-mctize-all lambda (string pred action) if (eq action (quote metadata)) (quote (metadata (category . unicode-name))) complete-with-action action quote (string pred) completing-read string-match-p "\\`[0-9a-fA-F]+\\'" string-to-number 16 "^#" read assoc-string try-completion icicle-transform-multi-completion (2) get-text-property 0 icicle-whole-candidate characterp error "Invalid character: `%s'" add-to-list icicle-read-char-history icicle-read-char-by-name-multi-completion-flag icicle-show-multi-completion-flag icicle-multi-completing-p icicle-list-use-nth-parts icicle-transform-before-sort-p ...] 10 "Read a character... I'VE ELIDED MOST OF A LONG DOC STRING HERE")
* apply(#[(prompt &optional names) - same as line above.)
* read-char-by-name("Unicode (name or hex): ")
  (list (read-char-by-name "Unicode (name or hex): ") (prefix-numeric-value current-prefix-arg) t t)
  call-interactively(ucsc-insert nil nil)
  command-execute(ucsc-insert) 

In this case I also manually elided a long doc string, not
just byte-code.

Is it worthwhile to keep some of what is inside #[...]?
Here, I did - I removed only the binary code stuff.  But it
might be good in most cases to just elide each occurrence of
#[STUFF].

HTH - Drew





  reply	other threads:[~2016-02-27  1:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07  1:35 bug#6991: Please keep bytecode out of *Backtrace* buffers jidanni
2012-02-22  1:02 ` Glenn Morris
2012-02-22 16:43   ` Drew Adams
2012-02-22 17:01     ` Juanma Barranquero
2012-07-02 17:40       ` Drew Adams
2012-07-02 18:38         ` Stefan Monnier
2012-07-02 19:06           ` Drew Adams
2013-01-24 22:43             ` Drew Adams
     [not found]             ` <<FEE817DF5DCC41CD9156B414FF2088D1@us.oracle.com>
2013-08-07 22:25               ` Drew Adams
2016-02-26  6:41           ` Lars Ingebrigtsen
2016-02-26 14:11             ` Drew Adams
2016-02-27  0:52               ` John Wiegley
2016-02-27  1:49                 ` Drew Adams [this message]
2016-11-19  1:55                   ` npostavs
2016-11-19  2:37                     ` Drew Adams
2016-11-19  7:41                     ` Eli Zaretskii
2016-11-19 14:39                       ` npostavs
2016-11-19 15:07                         ` Eli Zaretskii
2016-11-19 15:20                           ` npostavs
2016-11-19 18:34                             ` Eli Zaretskii
2016-11-19 22:33                               ` npostavs
2016-11-20 15:46                                 ` Eli Zaretskii
2016-11-22 18:07                                   ` Noam Postavsky
2016-11-22 18:52                                     ` Eli Zaretskii
2016-11-22 21:07                                       ` Noam Postavsky
2016-11-23 16:05                                         ` Eli Zaretskii
2016-11-26 17:18                                           ` npostavs
2016-11-26 18:54                                             ` Stefan Monnier
2017-02-12  2:26                                               ` npostavs
2017-05-28 14:58                                                 ` npostavs
2017-06-24 22:27                                                   ` npostavs
2017-06-25 19:11                                                     ` Stefan Monnier
2017-06-26  3:34                                                       ` npostavs
2017-06-26  4:02                                                         ` Stefan Monnier
2017-06-26 12:50                                                           ` npostavs
2017-06-26 14:54                                                             ` Stefan Monnier
2017-06-27  3:56                                                               ` npostavs
2017-06-27 16:18                                                                 ` Stefan Monnier
2017-06-29 23:52                                                                   ` npostavs
2016-11-26 23:45                                             ` Richard Stallman
2016-11-27  0:33                                               ` Noam Postavsky
2016-11-27  3:34                                                 ` Clément Pit--Claudel
2016-11-27  3:36                                                 ` Eli Zaretskii
2016-11-27 14:10                                                   ` Noam Postavsky
2016-11-27 23:21                                                 ` Richard Stallman
2016-11-19 17:08                       ` Richard Stallman
2016-02-27  4:13                 ` Lars Ingebrigtsen
2017-09-11 10:57 ` bug#6991: Rocky Bernstein
2017-09-11 14:28   ` bug#6991: Eli Zaretskii
2017-09-13  1:13     ` bug#6991: Rocky Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2223f654-1e67-4a9a-a471-828fd4078410@default \
    --to=drew.adams@oracle.com \
    --cc=6991-done@debbugs.gnu.org \
    --cc=6991@debbugs.gnu.org \
    --cc=johnw@gnu.org \
    --cc=larsi@gnus.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).