Remove some defines from tui-data.h
[external/binutils.git] / gdb / corelow.c
index e7f164f..5e9634e 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-
-/* Standard C includes.  */
-#include <fcntl.h>
-#include <signal.h>
-
-/* Local non-gdb includes.  */
 #include "arch-utils.h"
-#include "bfd.h"
-#include "command.h"
-#include "common/filestuff.h"
-#include "completer.h"
-#include "exec.h"
-#include "filenames.h"
-#include "frame.h"
-#include "gdb_bfd.h"
-#include "gdbcore.h"
-#include "gdbthread.h"
+#include <signal.h>
+#include <fcntl.h>
+#include "frame.h"             /* required by inferior.h */
 #include "inferior.h"
 #include "infrun.h"
-#include "objfiles.h"
+#include "symtab.h"
+#include "command.h"
+#include "bfd.h"
+#include "target.h"
 #include "process-stratum-target.h"
-#include "progspace.h"
-#include "readline/readline.h"
+#include "gdbcore.h"
+#include "gdbthread.h"
 #include "regcache.h"
 #include "regset.h"
-#include "solib.h"
 #include "symfile.h"
-#include "symtab.h"
-#include "target.h"
+#include "exec.h"
+#include "readline/readline.h"
+#include "solib.h"
+#include "filenames.h"
+#include "progspace.h"
+#include "objfiles.h"
+#include "gdb_bfd.h"
+#include "completer.h"
+#include "gdbsupport/filestuff.h"
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
@@ -60,7 +56,8 @@ static core_fns *sniff_core_bfd (gdbarch *core_gdbarch,
 static const target_info core_target_info = {
   "core",
   N_("Local core dump file"),
-  N_("Use a core file as a target.  Specify the filename of the core file.")
+  N_("Use a core file as a target.\n\
+Specify the filename of the core file.")
 };
 
 class core_target final : public process_stratum_target
@@ -289,7 +286,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
   int core_tid;
   int pid, lwpid;
   asection *reg_sect = (asection *) reg_sect_arg;
-  int fake_pid_p = 0;
+  bool fake_pid_p = false;
   struct inferior *inf;
 
   if (!startswith (bfd_section_name (abfd, asect), ".reg/"))
@@ -300,7 +297,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
   pid = bfd_core_file_pid (core_bfd);
   if (pid == 0)
     {
-      fake_pid_p = 1;
+      fake_pid_p = true;
       pid = CORELOW_PID;
     }
 
@@ -465,16 +462,15 @@ core_target_open (const char *arg, int from_tty)
      may be a thread_stratum target loaded on top of target core by
      now.  The layer above should claim threads found in the BFD
      sections.  */
-  TRY
+  try
     {
       target_update_thread_list ();
     }
 
-  CATCH (except, RETURN_MASK_ERROR)
+  catch (const gdb_exception_error &except)
     {
       exception_print (gdb_stderr, except);
     }
-  END_CATCH
 
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
@@ -521,15 +517,14 @@ core_target_open (const char *arg, int from_tty)
      anything about threads.  That is why the test is >= 2.  */
   if (thread_count () >= 2)
     {
-      TRY
+      try
        {
          thread_command (NULL, from_tty);
        }
-      CATCH (except, RETURN_MASK_ERROR)
+      catch (const gdb_exception_error &except)
        {
          exception_print (gdb_stderr, except);
        }
-      END_CATCH
     }
 }
 
@@ -541,6 +536,8 @@ core_target::detach (inferior *inf, int from_tty)
      'this'.  */
   unpush_target (this);
 
+  /* Clear the register cache and the frame cache.  */
+  registers_changed ();
   reinit_frame_cache ();
   maybe_say_no_core_file_now (from_tty);
 }