# New Ticket Created by Kevin Tew
# Please include the string: [perl #39934]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39934 >
embed.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
Feedback wanted.
Kevin
Index: src/embed.c
===================================================================
--- src/embed.c (revision 13526)
+++ src/embed.c (working copy)
@@ -864,6 +864,10 @@
PDB_t *pdb;
PDB_line_t *line;
char *c;
+ int op_code_seq_num = 0;
+ int debugs;
+ int num_mappings;
+ int curr_mapping = 0;
pdb = (PDB_t *)mem_sys_allocate_zeroed(sizeof(PDB_t));
@@ -873,7 +877,36 @@
PDB_disassemble(interpreter, NULL);
line = pdb->file->line;
+ debugs = (interpreter->code->debugs != NULL);
+
+ PIO_printf(interpreter, "%12s-%12s", "Seq_Op_Num", "Relative-PC");
+ if ( debugs ) {
+ PIO_printf(interpreter, " %6s:\n","SrcLn#");
+ num_mappings = interpreter->code->debugs->num_mappings;
+ }
+ else {
+ PIO_printf(interpreter, "\n");
+ }
while (line->next) {
+ /* PIO_printf(interpreter, "%i < %i %i == %i \n", curr_mapping,
num_mappings, op_code_seq_num,
interpreter->code->debugs->mappings[curr_mapping]->offset); */
+ if (debugs && curr_mapping < num_mappings)
+ {
+ if ( op_code_seq_num ==
interpreter->code->debugs->mappings[curr_mapping]->offset)
+ {
+ int filename_const_offset =
interpreter->code->debugs->mappings[curr_mapping]->u.filename;
+ PIO_printf(interpreter, "Current Source Filename %Ss\n",
interpreter->code->const_table->constants[filename_const_offset]->u.string);
+ curr_mapping++;
+ }
+ }
+
+ PIO_printf(interpreter, "%012i-%012i", op_code_seq_num, line->opcode -
interpreter->code->base.data);
+ if ( debugs ) {
+ PIO_printf(interpreter, " %06i:
\t",interpreter->code->debugs->base.data[op_code_seq_num]);
+ }
+ else {
+ PIO_printf(interpreter, "\t");
+ }
+
/* If it has a label print it */
if (line->label)
PIO_printf(interpreter, "L%li:\t", line->label->number);
@@ -882,6 +915,7 @@
PIO_printf(interpreter, "%c", *(c++));
PIO_printf(interpreter, "\n");
line = line->next;
+ op_code_seq_num++;
}
return;
}