solib_global_lookup: Fetch arch from objfile, not target_gdbarch.
[deliverable/binutils-gdb.git] / gdb / gcore.c
index 5427962be08dfa97d24f4de96abe9bb074d93d83..d2adfc880c5d8684edbf8d72039ee472ea42433d 100644 (file)
@@ -29,7 +29,6 @@
 #include "completer.h"
 #include "gcore.h"
 #include "cli/cli-decode.h"
-#include "gdb_assert.h"
 #include <fcntl.h>
 #include "regcache.h"
 #include "regset.h"
@@ -61,12 +60,10 @@ create_gcore_bfd (const char *filename)
   return obfd;
 }
 
-/* write_gcore_file -- helper for gcore_command (exported).
-   Compose and write the corefile data to the core file.  */
-
+/* write_gcore_file_1 -- do the actual work of write_gcore_file.  */
 
-void
-write_gcore_file (bfd *obfd)
+static void
+write_gcore_file_1 (bfd *obfd)
 {
   struct cleanup *cleanup;
   void *note_data = NULL;
@@ -111,6 +108,25 @@ write_gcore_file (bfd *obfd)
   do_cleanups (cleanup);
 }
 
+/* write_gcore_file -- helper for gcore_command (exported).
+   Compose and write the corefile data to the core file.  */
+
+void
+write_gcore_file (bfd *obfd)
+{
+  volatile struct gdb_exception except;
+
+  target_prepare_to_generate_core ();
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    write_gcore_file_1 (obfd);
+
+  target_done_generating_core ();
+
+  if (except.reason < 0)
+    throw_exception (except);
+}
+
 static void
 do_bfd_delete_cleanup (void *arg)
 {
This page took 0.024128 seconds and 4 git commands to generate.