X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Fcorelow.c;h=5e9634e9d79195760cb816caf1de5903777ccfca;hb=d7a11d1383a2d0cdffc8c08e46b0cf5a66b3ce28;hp=52d6d95b3c07e2dbbfa39e880dddd1d948f301f0;hpb=0747795c085d3b2a35da6bb474f32c58ce1b70c8;p=external%2Fbinutils.git diff --git a/gdb/corelow.c b/gdb/corelow.c index 52d6d95..5e9634e9 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -42,7 +42,7 @@ #include "objfiles.h" #include "gdb_bfd.h" #include "completer.h" -#include "common/filestuff.h" +#include "gdbsupport/filestuff.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 @@ -56,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 @@ -83,7 +84,7 @@ public: bool thread_alive (ptid_t ptid) override; const struct target_desc *read_description () override; - const char *pid_to_str (ptid_t) override; + std::string pid_to_str (ptid_t) override; const char *thread_name (struct thread_info *) override; @@ -285,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/")) @@ -296,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; } @@ -417,8 +418,7 @@ core_target_open (const char *arg, int from_tty) if (!exec_bfd) set_gdbarch_from_file (core_bfd); - push_target (target); - target_holder.release (); + push_target (std::move (target_holder)); inferior_ptid = null_ptid; @@ -462,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) @@ -518,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 } } @@ -538,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); } @@ -986,10 +986,9 @@ core_target::read_description () return this->beneath ()->read_description (); } -const char * +std::string core_target::pid_to_str (ptid_t ptid) { - static char buf[64]; struct inferior *inf; int pid; @@ -1014,8 +1013,7 @@ core_target::pid_to_str (ptid_t ptid) return normal_pid_to_str (ptid); /* No luck. We simply don't have a valid PID to print. */ - xsnprintf (buf, sizeof buf, "
"); - return buf; + return "
"; } const char *