Skip to content
Tcl Source Code View Ticket
Login

View Ticket

garbage strings in trace execution

Closed / Fixed971cb4f1db28882b1603700f0d8af60c6c1605a5Created 13 years agoUpdated 13 years ago
Descriptionplain2014-02-03 18:52:06
In order to repro: launch tclsh, [set tcl_traceExec 3], enter (empty command) => watch the output, some of the strings reported are obviously garbage
Referenced by1
  • 9533dbc4c7[971cb4f1db]: Make debugging traces less inclined to serious visual corruption check-in2014-02-04 08:15:52
miguelplain2014-02-03 18:53:07
assigning to dkf, hoping he sees immediately what's wrong
dkfhtml2014-02-03 22:57:11

It's the trim-set, which contains non-ASCII characters and which it seems that printf() doesn't do a good job of displaying. Not sure what to do about it, but it's really rather harmless.

dkfhtml2014-02-04 08:46:00

Such "garbage" as is there now is from TclPrintObject() rather than being injected by problems directly in printf(). I've only improved things in the tracing for the INST_STR_TRIM group of instructions because they're the only places where it is very likely to be a problem; elsewhere, problem characters are mostly rare.

I don't know if TclPrintObject() is doing the right thing, but it's what we use in other tricky cases (INST_PUSH for example).

dkfhtml2014-02-04 08:50:43

Any further fix belongs in PrintSourceToObj() in generic/tclCompile.c, which everything else is focussed through.

(Self note: this function moves to tclDisassemble.c on the dkf-improved-disassembler branch)

dkfhtml2014-02-04 09:05:06

Adjusted that function to be much less broken. (It assumed ASCII!) The result is that the reported case now produces code that can be much more easily understood.

Log in (anonymous is fine) to add a comment.