# New Ticket Created by Leon Brocard
# Please include the string: [netlabs #744]
# in the subject line of all future correspondence about this issue.
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=744 >
I played with pdb and tracing today and liked the way that pdb escaped
strings, eg while diplaying the op 'print "hello\nthere" it put the
'\n' instead of a newline. Tracing is much more useful (and easier to
parse!) if it does this too, so I nabbed PDB_escape and exploited
it. Expect pretty graphs of parrot -t output...
Leon
--
Leon Brocard.............................http://www.astray.com/
Nanoware...............................http://www.nanoware.org/
........ It's not in the manual!
-- attachment 1 ------------------------------------------------------
url: http://bugs6.perl.org/rt2/attach/3475/3316/7e4aa8/trace.c.patch
Index: trace.c
===================================================================
RCS file: /cvs/public/parrot/trace.c,v
retrieving revision 1.14
diff -u -r1.14 trace.c
--- trace.c 12 May 2002 04:37:57 -0000 1.14
+++ trace.c 28 Jun 2002 15:14:36 -0000
@@ -23,6 +23,7 @@
opcode_t *pc)
{
INTVAL i;
+ char *escaped;
fprintf(stderr, "PC=%ld; OP=%ld (%s)", (long)(pc - code_start), *pc,
interpreter->op_info_table[*pc].full_name);
@@ -46,9 +47,9 @@
fprintf(stderr, "%ld", (long)*(pc + i));
break;
case PARROT_ARG_SC:
- fprintf(stderr, "\"%s\"",
- (char *)interpreter->code->const_table->
- constants[*(pc + i)]->string->bufstart);
+ escaped = PDB_escape(interpreter->code->const_table->
+ constants[*(pc + i)]->string->bufstart);
+ fprintf(stderr, "\"%s\"", escaped);
break;
case PARROT_ARG_KC:
/* what will a KEY constant look like? */
@@ -69,9 +70,10 @@
break;
case PARROT_ARG_S:
if (interpreter->string_reg.registers[*(pc + i)]) {
+ escaped = PDB_escape(interpreter->string_reg.
+ registers[*(pc + i)]->bufstart);
fprintf(stderr, "S%ld=\"%s\"", (long)*(pc + i),
- (char *)interpreter->string_reg.
- registers[*(pc + i)]->bufstart);
+ escaped);
}
else {
fprintf(stderr, "S%ld=(null)", (long)*(pc + i));