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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « gdb/gdb_obstack.h ('k') | gdb/gdb_proc_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Native-dependent code for NetBSD. 1 /* Obstack wrapper for GDB.
2 2
3 Copyright (C) 2006-2012 Free Software Foundation, Inc. 3 Copyright (C) 2013 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 #include "defs.h" 20 #include "defs.h"
21 #include "gdb_obstack.h"
21 22
22 #include <sys/param.h> 23 /* Concatenate NULL terminated variable argument list of `const char *'
23 24 strings; return the new string. Space is found in the OBSTACKP.
24 #include "nbsd-nat.h" 25 Argument list must be terminated by a sentinel expression `(char *)
25 26 NULL'. */
26 /* Return the name of a file that can be opened to get the symbols for
27 the child process identified by PID. */
28 27
29 char * 28 char *
30 nbsd_pid_to_exec_file (int pid) 29 obconcat (struct obstack *obstackp, ...)
31 { 30 {
32 size_t len = MAXPATHLEN; 31 va_list ap;
33 char *buf = xcalloc (len, sizeof (char));
34 char *path;
35 32
36 path = xstrprintf ("/proc/%d/exe", pid); 33 va_start (ap, obstackp);
37 if (readlink (path, buf, MAXPATHLEN) == -1) 34 for (;;)
38 { 35 {
39 xfree (buf); 36 const char *s = va_arg (ap, const char *);
40 buf = NULL; 37
38 if (s == NULL)
39 » break;
40
41 obstack_grow_str (obstackp, s);
41 } 42 }
43 va_end (ap);
44 obstack_1grow (obstackp, 0);
42 45
43 xfree (path); 46 return obstack_finish (obstackp);
44 return buf;
45 } 47 }
OLDNEW
« 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