]> sourceware.org Git - binutils-gdb.git/commitdiff
Style more output of "disassemble" command
authorTom Tromey <tom@tromey.com>
Fri, 9 Oct 2020 01:41:45 +0000 (19:41 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 9 Oct 2020 01:41:45 +0000 (19:41 -0600)
I noticed a couple of spots where the "disassemble" could style its
output, but currently does not.  This patch adds styling to the
function name at the start of the disassembly, and any addresses
printed there.

gdb/ChangeLog
2020-10-08  Tom Tromey  <tom@tromey.com>

* cli/cli-cmds.c (print_disassembly): Style function name and
addresses.  Add _() wrappers.

gdb/testsuite/ChangeLog
2020-10-08  Tom Tromey  <tom@tromey.com>

* gdb.base/style.exp: Check that "main"'s name is styled.

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/style.exp

index 450561dff4c08d963dc47ed5ef985277276e9a7f..cba2c27c0e176475aa0e8ff54d033df48bee3dfd 100644 (file)
@@ -1,3 +1,8 @@
+2020-10-08  Tom Tromey  <tom@tromey.com>
+
+       * cli/cli-cmds.c (print_disassembly): Style function name and
+       addresses.  Add _() wrappers.
+
 2020-10-08  Shahab Vahedi  <shahab@synopsys.com>
 
        * NEWS: Mention ARC support in GDBserver.
index e3965fea0766fcd0ac9d4d714e2ff03a90488bd8..352abd0a634a577abe51b5987599395cb4179b72 100644 (file)
@@ -1395,14 +1395,18 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
   else
 #endif
     {
-      printf_filtered ("Dump of assembler code ");
+      printf_filtered (_("Dump of assembler code "));
       if (name != NULL)
-       printf_filtered ("for function %s:\n", name);
+       printf_filtered (_("for function %ps:\n"),
+                        styled_string (function_name_style.style (), name));
       if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
         {
          if (name == NULL)
-           printf_filtered ("from %s to %s:\n",
-                            paddress (gdbarch, low), paddress (gdbarch, high));
+           printf_filtered (_("from %ps to %ps:\n"),
+                            styled_string (address_style.style (),
+                                           paddress (gdbarch, low)),
+                            styled_string (address_style.style (),
+                                           paddress (gdbarch, high)));
 
          /* Dump the specified range.  */
          gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
@@ -1413,14 +1417,16 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
            {
              CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
              CORE_ADDR range_high = BLOCK_RANGE_END (block, i);
-             printf_filtered (_("Address range %s to %s:\n"),
-                              paddress (gdbarch, range_low),
-                              paddress (gdbarch, range_high));
+             printf_filtered (_("Address range %ps to %ps:\n"),
+                              styled_string (address_style.style (),
+                                             paddress (gdbarch, range_low)),
+                              styled_string (address_style.style (),
+                                             paddress (gdbarch, range_high)));
              gdb_disassembly (gdbarch, current_uiout, flags, -1,
                               range_low, range_high);
            }
        }
-      printf_filtered ("End of assembler dump.\n");
+      printf_filtered (_("End of assembler dump.\n"));
     }
 }
 
index 6a02cfbdd1bce16b8e19e3c10b64f3692c01bcca..075fe2ff5a3a5f2cc696b59d369b33869ea7d551 100644 (file)
@@ -1,3 +1,7 @@
+2020-10-08  Tom Tromey  <tom@tromey.com>
+
+       * gdb.base/style.exp: Check that "main"'s name is styled.
+
 2020-10-07  Tom Tromey  <tromey@adacore.com>
 
        * gdb.base/find.exp: Rename some tests.
index bfd26144fa4e66d53b3dde96efcdd5aa32e6525e..ef9f7c80a5ac0f8fcd624e5574422fdf321a094c 100644 (file)
@@ -91,9 +91,12 @@ save_vars { env(TERM) } {
            "Defined at $base_file_expr:$macro_line\r\n#define SOME_MACRO 23"
     }
 
+    set main [style main function]
     set func [style some_called_function function]
     # Somewhere should see the call to the function.
-    gdb_test "disassemble main" "[style $hex address].*$func.*"
+    gdb_test "disassemble main" \
+       [concat "Dump of assembler code for function $main:.*" \
+            "[style $hex address].*$func.*"]
 
     set ifield [style int_field variable]
     set sfield [style string_field variable]
This page took 0.081891 seconds and 5 git commands to generate.