cvsuser 04/03/09 07:21:09
Modified: src trace.c
Log:
trace output changed - fix keyed ops; cleanup
Revision Changes Path
1.48 +82 -82 parrot/src/trace.c
Index: trace.c
===================================================================
RCS file: /cvs/public/parrot/src/trace.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -w -r1.47 -r1.48
--- trace.c 9 Mar 2004 14:57:00 -0000 1.47
+++ trace.c 9 Mar 2004 15:21:09 -0000 1.48
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: trace.c,v 1.47 2004/03/09 14:57:00 leo Exp $
+$Id: trace.c,v 1.48 2004/03/09 15:21:09 leo Exp $
=head1 NAME
@@ -155,43 +155,47 @@
INTVAL i;
char *escaped;
int more = 0;
+ op_info_t *info = &interpreter->op_info_table[*pc];
- PIO_eprintf(interpreter, "%6vu %s",
- (UINTVAL)(pc - code_start),
- interpreter->op_info_table[*pc].name);
+ PIO_eprintf(interpreter, "%6vu %s", (UINTVAL)(pc - code_start), info->name);
- if (interpreter->op_info_table[*pc].arg_count > 1) {
+ if (info->arg_count > 1) {
PIO_eprintf(interpreter, " ");
/* pass 1 print arguments */
- for (i = 1; i < interpreter->op_info_table[*pc].arg_count; i++) {
+ for (i = 1; i < info->arg_count; i++) {
opcode_t o = *(pc + i);
- if (i > 1) {
+ if (i > 1 &&
+ info->types[i] != PARROT_ARG_KC &&
+ info->types[i] != PARROT_ARG_KIC &&
+ info->types[i] != PARROT_ARG_K
+ ) {
PIO_eprintf(interpreter, ", ");
}
- switch (interpreter->op_info_table[*pc].types[i]) {
+ switch (info->types[i]) {
case PARROT_ARG_IC:
PIO_eprintf(interpreter, "%vd", o);
break;
case PARROT_ARG_NC:
- PIO_eprintf(interpreter, "%vg", interpreter->code->const_table->
- constants[o]->u.number);
+ PIO_eprintf(interpreter, "%vg", PCONST(o)->u.number);
break;
case PARROT_ARG_SC:
- escaped = PDB_escape(interpreter->code->const_table->
- constants[o]->u.string->strstart,
- interpreter->code->const_table->
- constants[o]->u.string->bufused);
- PIO_eprintf(interpreter, "\"%s\"", escaped ? escaped : "(null)");
+ escaped = PDB_escape(PCONST(o)->u.string->strstart,
+ PCONST(o)->u.string->bufused);
+ PIO_eprintf(interpreter, "\"%s\"",
+ escaped ? escaped : "(null)");
if (escaped)
mem_sys_free(escaped);
break;
case PARROT_ARG_KC:
- trace_key_dump(interpreter, interpreter->code->const_table->
- constants[o]->u.key);
+ trace_key_dump(interpreter, PCONST(o)->u.key);
break;
case PARROT_ARG_KIC:
PIO_eprintf(interpreter, "[%vd]", o);
break;
+ case PARROT_ARG_K:
+ PIO_eprintf(interpreter, "[P%vd]",o);
+ more = 1;
+ break;
case PARROT_ARG_I:
PIO_eprintf(interpreter, "I%vd", o);
break;
@@ -206,10 +210,6 @@
PIO_eprintf(interpreter, "S%vd", o);
more = 1;
break;
- case PARROT_ARG_K:
- PIO_eprintf(interpreter, "P%vd=",o);
- more = 1;
- break;
case PARROT_ARG_KI:
PIO_eprintf(interpreter, "I%vd", o);
more = 1;
@@ -223,12 +223,12 @@
goto done;
PIO_eprintf(interpreter, " \t- ");
/* pass 2 print argument details if needed */
- for (i = 1; i < interpreter->op_info_table[*pc].arg_count; i++) {
+ for (i = 1; i < info->arg_count; i++) {
opcode_t o = *(pc + i);
if (i > 1) {
PIO_eprintf(interpreter, ", ");
}
- switch (interpreter->op_info_table[*pc].types[i]) {
+ switch (info->types[i]) {
case PARROT_ARG_P:
PIO_eprintf(interpreter, "P%vd=", o);
trace_pmc_dump(interpreter, REG_PMC(o));