Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: gdb/gdb_obstack.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/gdb_obstack.h ('k') | gdb/gdb_proc_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/gdb_obstack.c
diff --git a/gdb/nbsd-nat.c b/gdb/gdb_obstack.c
similarity index 53%
copy from gdb/nbsd-nat.c
copy to gdb/gdb_obstack.c
index 14b562f140f84166ac06030427b1f9f08208feae..df34968f3fc5e6006149716a1d630fb96cb0dd5f 100644
--- a/gdb/nbsd-nat.c
+++ b/gdb/gdb_obstack.c
@@ -1,6 +1,6 @@
-/* Native-dependent code for NetBSD.
+/* Obstack wrapper for GDB.
- Copyright (C) 2006-2012 Free Software Foundation, Inc.
+ Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,28 +18,30 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdb_obstack.h"
-#include <sys/param.h>
-
-#include "nbsd-nat.h"
-
-/* Return the name of a file that can be opened to get the symbols for
- the child process identified by PID. */
+/* Concatenate NULL terminated variable argument list of `const char *'
+ strings; return the new string. Space is found in the OBSTACKP.
+ Argument list must be terminated by a sentinel expression `(char *)
+ NULL'. */
char *
-nbsd_pid_to_exec_file (int pid)
+obconcat (struct obstack *obstackp, ...)
{
- size_t len = MAXPATHLEN;
- char *buf = xcalloc (len, sizeof (char));
- char *path;
+ va_list ap;
- path = xstrprintf ("/proc/%d/exe", pid);
- if (readlink (path, buf, MAXPATHLEN) == -1)
+ va_start (ap, obstackp);
+ for (;;)
{
- xfree (buf);
- buf = NULL;
+ const char *s = va_arg (ap, const char *);
+
+ if (s == NULL)
+ break;
+
+ obstack_grow_str (obstackp, s);
}
+ va_end (ap);
+ obstack_1grow (obstackp, 0);
- xfree (path);
- return buf;
+ return obstack_finish (obstackp);
}
« no previous file with comments | « gdb/gdb_obstack.h ('k') | gdb/gdb_proc_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698