X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Fnto-procfs.c;h=b9866c2259199a5b050a81050ffb5c50e641e22a;hb=refs%2Fheads%2Fupstream;hp=117edb161c3c760ad544164a0541ac8de8c94080;hpb=d7e15655a40e9133a1cbf53ea071f82cd6745ac8;p=external%2Fbinutils.git diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 117edb1..b9866c2 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1,7 +1,7 @@ /* Machine independent support for QNX Neutrino /proc (process file system) for GDB. Written by Colin Burgess at QNX Software Systems Limited. - Copyright (C) 2003-2018 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. Contributed by QNX Software Systems Ltd. @@ -42,8 +42,8 @@ #include "regcache.h" #include "solib.h" #include "inf-child.h" -#include "common/filestuff.h" -#include "common/scoped_fd.h" +#include "gdbsupport/filestuff.h" +#include "gdbsupport/scoped_fd.h" #define NULL_PID 0 #define _DEBUG_FLAG_TRACE (_DEBUG_FLAG_TRACE_EXEC|_DEBUG_FLAG_TRACE_RD|\ @@ -109,19 +109,16 @@ struct nto_procfs_target : public inf_child_target void mourn_inferior () override; - void pass_signals (int, unsigned char *) override; + void pass_signals (gdb::array_view) override; bool thread_alive (ptid_t ptid) override; void update_thread_list () override; - const char *pid_to_str (ptid_t) override; + std::string pid_to_str (ptid_t) override; void interrupt () override; - bool have_continuable_watchpoint () - { return true; } - const char *extra_thread_info (struct thread_info *) override; char *pid_to_exec_file (int pid) override; @@ -146,7 +143,7 @@ class nto_procfs_target_native final : public nto_procfs_target static const target_info nto_procfs_target_info = { "procfs", N_("QNX Neutrino local or remote process"), - N_("QNX Neutrino process. target procfs ") + N_("QNX Neutrino process. target procfs NODE") }; struct nto_procfs_target_procfs final : public nto_procfs_target @@ -217,8 +214,6 @@ nto_procfs_target::open (const char *arg, int from_tty) nto_procfs_node = ND_LOCAL_NODE; nodestr = (arg != NULL) ? xstrdup (arg) : NULL; - init_thread_list (); - if (nodestr) { nto_procfs_node = netmgr_strtond (nodestr, &endstr); @@ -663,7 +658,7 @@ nto_procfs_target::files_info () printf_unfiltered ("\tUsing the running image of %s %s via %s.\n", inf->attach_flag ? "attached" : "child", - target_pid_to_str (inferior_ptid), + target_pid_to_str (inferior_ptid).c_str (), (nodestr != NULL) ? nodestr : "local node"); } @@ -713,12 +708,10 @@ nto_procfs_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, - target_pid_to_str (ptid_t (pid))); + target_pid_to_str (ptid_t (pid)).c_str ()); else printf_unfiltered ("Attaching to %s\n", - target_pid_to_str (ptid_t (pid))); - - gdb_flush (gdb_stdout); + target_pid_to_str (ptid_t (pid)).c_str ()); } inferior_ptid = do_attach (ptid_t (pid)); inf = current_inferior (); @@ -1447,7 +1440,8 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno) /* Set list of signals to be handled in the target. */ void -nto_procfs_target::pass_signals (int numsigs, unsigned char *pass_signals) +nto_procfs_target::pass_signals + (gdb::array_view pass_signals) { int signo; @@ -1456,30 +1450,27 @@ nto_procfs_target::pass_signals (int numsigs, unsigned char *pass_signals) for (signo = 1; signo < NSIG; signo++) { int target_signo = gdb_signal_from_host (signo); - if (target_signo < numsigs && pass_signals[target_signo]) + if (target_signo < pass_signals.size () && pass_signals[target_signo]) sigdelset (&run.trace, signo); } } -char * +std::string nto_procfs_target::pid_to_str (ptid_t ptid) { - static char buf[1024]; - int pid, tid, n; + int pid, tid; struct tidinfo *tip; pid = ptid.pid (); tid = ptid.tid (); - n = snprintf (buf, 1023, "process %d", pid); - #if 0 /* NYI */ tip = procfs_thread_info (pid, tid); if (tip != NULL) snprintf (&buf[n], 1023, " (state = 0x%02x)", tip->state); #endif - return buf; + return string_printf ("process %d", pid); } /* to_can_run implementation for "target procfs". Note this really