Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / cli / cli-cmds.c
index 409240c118ca3d6bd8646b386855862e27c9e31e..e1204f74ef1aea3840f4c94007cdcaa158551fb8 100644 (file)
@@ -1,6 +1,7 @@
 /* GDB CLI commands.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
 
    This file is part of GDB.
 
@@ -800,6 +801,18 @@ exit_status_set_internal_vars (int exit_status)
   clear_internalvar (var_signal);
   if (WIFEXITED (exit_status))
     set_internalvar_integer (var_code, WEXITSTATUS (exit_status));
+#ifdef __MINGW32__
+  else if (WIFSIGNALED (exit_status) && WTERMSIG (exit_status) == -1)
+    {
+      /* The -1 condition can happen on MinGW, if we don't recognize
+        the fatal exception code encoded in the exit status; see
+        gdbsupport/gdb_wait.c.  We don't want to lose information in
+        the exit status in that case.  Record it as a normal exit
+        with the full exit status, including the higher 0xC0000000
+        bits.  */
+      set_internalvar_integer (var_code, exit_status);
+    }
+#endif
   else if (WIFSIGNALED (exit_status))
     set_internalvar_integer (var_signal, WTERMSIG (exit_status));
   else
@@ -938,7 +951,7 @@ edit_command (const char *arg, int from_tty)
           if (sym)
            printf_filtered ("%s is in %s (%s:%d).\n",
                             paddress (gdbarch, sal.pc),
-                            SYMBOL_PRINT_NAME (sym),
+                            sym->print_name (),
                             symtab_to_filename_for_display (sal.symtab),
                             sal.line);
           else
@@ -1270,7 +1283,7 @@ list_command (const char *arg, int from_tty)
       if (sym)
        printf_filtered ("%s is in %s (%s:%d).\n",
                         paddress (gdbarch, sal.pc),
-                        SYMBOL_PRINT_NAME (sym),
+                        sym->print_name (),
                         symtab_to_filename_for_display (sal.symtab), sal.line);
       else
        printf_filtered ("%s is at %s:%d.\n",
@@ -1338,7 +1351,9 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
                   gdb_disassembly_flags flags)
 {
 #if defined(TUI)
-  if (!tui_is_window_visible (DISASSEM_WIN))
+  if (tui_is_window_visible (DISASSEM_WIN))
+    tui_show_assembly (gdbarch, low);
+  else
 #endif
     {
       printf_filtered ("Dump of assembler code ");
@@ -1368,12 +1383,6 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
        }
       printf_filtered ("End of assembler dump.\n");
     }
-#if defined(TUI)
-  else
-    {
-      tui_show_assembly (gdbarch, low);
-    }
-#endif
 }
 
 /* Subroutine of disassemble_command to simplify it.
@@ -1433,6 +1442,7 @@ static void
 disassemble_command (const char *arg, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
+  struct obj_section *section;
   CORE_ADDR low, high;
   const char *name;
   CORE_ADDR pc;
@@ -1484,6 +1494,14 @@ disassemble_command (const char *arg, int from_tty)
     }
 
   pc = value_as_address (parse_to_comma_and_eval (&p));
+
+  /* ROCM: get the gdbarch from the objfile, if found */
+  section = find_pc_overlay (pc);
+  if (section == NULL)
+    section = find_pc_section (pc);
+  if (section != NULL)
+    gdbarch = get_objfile_arch (section->objfile);
+
   if (p[0] == ',')
     ++p;
   if (p[0] == '\0')
@@ -1758,7 +1776,7 @@ print_sal_location (const symtab_and_line &sal)
 
   const char *sym_name = NULL;
   if (sal.symbol != NULL)
-    sym_name = SYMBOL_PRINT_NAME (sal.symbol);
+    sym_name = sal.symbol->print_name ();
   printf_filtered (_("file: \"%s\", line number: %d, symbol: \"%s\"\n"),
                   symtab_to_filename_for_display (sal.symtab),
                   sal.line, sym_name != NULL ? sym_name : "???");
This page took 0.027276 seconds and 4 git commands to generate.