X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgcore.c;h=d2adfc880c5d8684edbf8d72039ee472ea42433d;hb=9c1877ead06db18e19614a598d1e280acb97e971;hp=5427962be08dfa97d24f4de96abe9bb074d93d83;hpb=1d1f1ccb331f1fe9825c3bb6f6231a3aeb560d6f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gcore.c b/gdb/gcore.c index 5427962be0..d2adfc880c 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -29,7 +29,6 @@ #include "completer.h" #include "gcore.h" #include "cli/cli-decode.h" -#include "gdb_assert.h" #include #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) {