|
|
|
@ -1218,91 +1218,6 @@ trace_vprintf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, va_list ap) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* The function trace_one_insn has been replaced by the function pair
|
|
|
|
trace_prefix() + trace_generic(). It is still used. */ |
|
|
|
void |
|
|
|
trace_one_insn (SIM_DESC sd, sim_cpu *cpu, address_word pc, |
|
|
|
int line_p, const char *filename, int linenum, |
|
|
|
const char *phase_wo_colon, const char *fmt, |
|
|
|
...) |
|
|
|
{ |
|
|
|
va_list ap; |
|
|
|
char phase[SIZE_PHASE+2]; |
|
|
|
|
|
|
|
strncpy (phase, phase_wo_colon, SIZE_PHASE); |
|
|
|
strcat (phase, ":"); |
|
|
|
|
|
|
|
if (!line_p) |
|
|
|
{ |
|
|
|
trace_printf (sd, cpu, "%-*s %s:%-*d 0x%.*lx ", |
|
|
|
SIZE_PHASE+1, phase, |
|
|
|
filename, |
|
|
|
SIZE_LINE_NUMBER, linenum, |
|
|
|
SIZE_PC, (long)pc); |
|
|
|
va_start (ap, fmt); |
|
|
|
trace_vprintf (sd, cpu, fmt, ap); |
|
|
|
va_end (ap); |
|
|
|
trace_printf (sd, cpu, "\n"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
char buf[256]; |
|
|
|
|
|
|
|
buf[0] = 0; |
|
|
|
if (STATE_TEXT_SECTION (CPU_STATE (cpu)) |
|
|
|
&& pc >= STATE_TEXT_START (CPU_STATE (cpu)) |
|
|
|
&& pc < STATE_TEXT_END (CPU_STATE (cpu))) |
|
|
|
{ |
|
|
|
const char *pc_filename = (const char *)0; |
|
|
|
const char *pc_function = (const char *)0; |
|
|
|
unsigned int pc_linenum = 0; |
|
|
|
|
|
|
|
if (bfd_find_nearest_line (STATE_PROG_BFD (CPU_STATE (cpu)), |
|
|
|
STATE_TEXT_SECTION (CPU_STATE (cpu)), |
|
|
|
(struct bfd_symbol **) 0, |
|
|
|
pc - STATE_TEXT_START (CPU_STATE (cpu)), |
|
|
|
&pc_filename, &pc_function, &pc_linenum)) |
|
|
|
{ |
|
|
|
char *p = buf; |
|
|
|
if (pc_linenum) |
|
|
|
{ |
|
|
|
sprintf (p, "#%-*d ", SIZE_LINE_NUMBER, pc_linenum); |
|
|
|
p += strlen (p); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sprintf (p, "%-*s ", SIZE_LINE_NUMBER+1, "---"); |
|
|
|
p += SIZE_LINE_NUMBER+2; |
|
|
|
} |
|
|
|
|
|
|
|
if (pc_function) |
|
|
|
{ |
|
|
|
sprintf (p, "%s ", pc_function); |
|
|
|
p += strlen (p); |
|
|
|
} |
|
|
|
else if (pc_filename) |
|
|
|
{ |
|
|
|
char *q = (char *) strrchr (pc_filename, '/'); |
|
|
|
sprintf (p, "%s ", (q) ? q+1 : pc_filename); |
|
|
|
p += strlen (p); |
|
|
|
} |
|
|
|
|
|
|
|
if (*p == ' ') |
|
|
|
*p = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
trace_printf (sd, cpu, "%-*s 0x%.*x %-*.*s ", |
|
|
|
SIZE_PHASE+1, phase, |
|
|
|
SIZE_PC, (unsigned) pc, |
|
|
|
SIZE_LOCATION, SIZE_LOCATION, buf); |
|
|
|
va_start (ap, fmt); |
|
|
|
trace_vprintf (sd, cpu, fmt, ap); |
|
|
|
va_end (ap); |
|
|
|
trace_printf (sd, cpu, "\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
trace_printf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, ...) |
|
|
|
{ |
|
|
|
|