X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Ffbsd-nat.c;h=5f121fc6f2aca006cd65b62f1ae4dd28d1eaa5ca;hb=ead0e69a4ab34d0c689f0c4c310b8d788867da32;hp=e6b68949199d744620696d0ad0baba7dde725967;hpb=6d78332e7748754d4a77a31e692fb8760c8c12ff;p=external%2Fbinutils.git diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index e6b6894..5f121fc 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for FreeBSD. - Copyright (C) 2002-2018 Free Software Foundation, Inc. + Copyright (C) 2002-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -18,14 +18,15 @@ along with this program. If not, see . */ #include "defs.h" -#include "byte-vector.h" +#include "gdbsupport/byte-vector.h" #include "gdbcore.h" #include "inferior.h" #include "regcache.h" #include "regset.h" +#include "gdbarch.h" #include "gdbcmd.h" #include "gdbthread.h" -#include "gdb_wait.h" +#include "gdbsupport/gdb_wait.h" #include "inf-ptrace.h" #include #include @@ -37,7 +38,7 @@ #include #endif #if !defined(HAVE_KINFO_GETVMMAP) -#include "filestuff.h" +#include "gdbsupport/filestuff.h" #endif #include "elf-bfd.h" @@ -231,6 +232,13 @@ fbsd_fetch_cmdline (pid_t pid) if (sysctl (mib, 4, cmdline.get (), &len, NULL, 0) == -1) return nullptr; + /* Join the arguments with spaces to form a single string. */ + char *cp = cmdline.get (); + for (size_t i = 0; i < len - 1; i++) + if (cp[i] == '\0') + cp[i] = ' '; + cp[len - 1] = '\0'; + return cmdline; } @@ -890,10 +898,9 @@ fbsd_nat_target::thread_alive (ptid_t ptid) return true; } -/* Convert PTID to a string. Returns the string in a static - buffer. */ +/* Convert PTID to a string. */ -const char * +std::string fbsd_nat_target::pid_to_str (ptid_t ptid) { lwpid_t lwp; @@ -901,11 +908,9 @@ fbsd_nat_target::pid_to_str (ptid_t ptid) lwp = ptid.lwp (); if (lwp != 0) { - static char buf[64]; int pid = ptid.pid (); - xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid); - return buf; + return string_printf ("LWP %d of process %d", lwp, pid); } return normal_pid_to_str (ptid); @@ -1343,8 +1348,8 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, "FLWP: deleting thread for LWP %u\n", pl.pl_lwpid); if (print_thread_events) - printf_unfiltered (_("[%s exited]\n"), target_pid_to_str - (wptid)); + printf_unfiltered (_("[%s exited]\n"), + target_pid_to_str (wptid).c_str ()); delete_thread (thr); } if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)