Provide macros that can be overriden for the width of the PC & line number fields
authorMichael Meissner <gnu@the-meissners.org>
Thu, 19 Sep 1996 15:02:27 +0000 (15:02 +0000)
committerMichael Meissner <gnu@the-meissners.org>
Thu, 19 Sep 1996 15:02:27 +0000 (15:02 +0000)
sim/d10v/ChangeLog
sim/d10v/simops.c

index 9dd536e80959ad5f2ccbcdfd094f20d348377937..eb4c41a072654b1c6f429d910fa02c74ffab90d0 100644 (file)
@@ -1,5 +1,8 @@
 Thu Sep 19 10:30:22 1996  Michael Meissner  <meissner@tiktok.cygnus.com>
 
+       * 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.
 
index ae8477d953648a8503b96e2bed731fefe36e8923..9bfd52db832351e48b4a1af5b74225b971fac872 100644 (file)
@@ -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);
     }