From 891513ee79ba7470f3eae78955b5b9c7c4631dda Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 19 Sep 1996 15:02:27 +0000 Subject: [PATCH] Provide macros that can be overriden for the width of the PC & line number fields --- sim/d10v/ChangeLog | 3 +++ sim/d10v/simops.c | 27 +++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 9dd536e8095..eb4c41a0726 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,5 +1,8 @@ Thu Sep 19 10:30:22 1996 Michael Meissner + * simops.c (SIZE_{PC,LINE_NUMBER}): New default sizes for output. + (trace_input_func): Use them. + * Makefile.in (run): Add dependencies on libbfd.a and libiberity.a. diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c index ae8477d9536..9bfd52db832 100644 --- a/sim/d10v/simops.c +++ b/sim/d10v/simops.c @@ -67,6 +67,14 @@ extern bfd *exec_bfd; #define SIZE_LOCATION 20 #endif +#ifndef SIZE_PC +#define SIZE_PC 6 +#endif + +#ifndef SIZE_LINE_NUMBER +#define SIZE_LINE_NUMBER 4 +#endif + static void trace_input_func (name, in1, in2, in3) char *name; @@ -103,13 +111,13 @@ trace_input_func (name, in1, in2, in3) if ((d10v_debug & DEBUG_LINE_NUMBER) == 0) (*d10v_callback->printf_filtered) (d10v_callback, - "0x%.6x %s: %-*s", - (unsigned)PC, type, + "0x%.*x %s: %-*s", + SIZE_PC, (unsigned)PC, + type, SIZE_INSTRUCTION, name); else { - buf[0] = '\0'; if (!init_text_p) { init_text_p = 1; @@ -123,6 +131,7 @@ trace_input_func (name, in1, in2, in3) } } + buf[0] = '\0'; byte_pc = (bfd_vma)PC << 2; if (text && byte_pc >= text_start && byte_pc < text_end) { @@ -135,9 +144,14 @@ trace_input_func (name, in1, in2, in3) p = buf; if (linenumber) { - sprintf (p, "#%-4d ", linenumber); + sprintf (p, "#%-*d ", SIZE_LINE_NUMBER, linenumber); p += strlen (p); } + else + { + sprintf (p, "%-*s ", SIZE_LINE_NUMBER+1, "---"); + p += SIZE_LINE_NUMBER+2; + } if (functionname) { @@ -157,8 +171,9 @@ trace_input_func (name, in1, in2, in3) } (*d10v_callback->printf_filtered) (d10v_callback, - "0x%.6x %s: %-*.*s %-*s", - (unsigned)PC, type, + "0x%.*x %s: %-*.*s %-*s", + SIZE_PC, (unsigned)PC, + type, SIZE_LOCATION, SIZE_LOCATION, buf, SIZE_INSTRUCTION, name); } -- 2.30.2