[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] Hurd, C++: Avoid GNU C nested functions
From: |
Thomas Schwinge |
Subject: |
[PATCH 2/5] Hurd, C++: Avoid GNU C nested functions |
Date: |
Thu, 8 Dec 2016 08:50:33 +0100 |
..., which C++ doesn't allow, so...
gdb/
* gnu-nat.c (gnu_create_inferior): Move nested "trace_me"
function...
(gnu_ptrace_me): ... here.
---
gdb/ChangeLog | 4 ++++
gdb/gnu-nat.c | 20 +++++++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f68a787..8b43cd8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2016-12-08 Thomas Schwinge <thomas@codesourcery.com>
+ * gnu-nat.c (gnu_create_inferior): Move nested "trace_me"
+ function...
+ (gnu_ptrace_me): ... here.
+
* i386-gnu-nat.c (i386_gnu_dr_set_control_one)
(i386_gnu_dr_set_addr_one): Explicitly cast "void *".
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 92b9292..34fd6f1 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2110,6 +2110,16 @@ cur_inf (void)
}
static void
+gnu_ptrace_me (void)
+{
+ /* We're in the child; make this process stop as soon as it execs. */
+ struct inf *inf = cur_inf ();
+ inf_debug (inf, "tracing self");
+ if (ptrace (PTRACE_TRACEME) != 0)
+ error (_("ptrace (PTRACE_TRACEME) failed!"));
+}
+
+static void
gnu_create_inferior (struct target_ops *ops,
char *exec_file, char *allargs, char **env,
int from_tty)
@@ -2117,17 +2127,9 @@ gnu_create_inferior (struct target_ops *ops,
struct inf *inf = cur_inf ();
int pid;
- void trace_me (void)
- {
- /* We're in the child; make this process stop as soon as it execs. */
- inf_debug (inf, "tracing self");
- if (ptrace (PTRACE_TRACEME) != 0)
- error (_("ptrace (PTRACE_TRACEME) failed!"));
- }
-
inf_debug (inf, "creating inferior");
- pid = fork_inferior (exec_file, allargs, env, trace_me,
+ pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
NULL, NULL, NULL, NULL);
/* Attach to the now stopped child, which is actually a shell... */
--
2.10.2
- Fix C++ compilation of the Hurd port, Thomas Schwinge, 2016/12/08
- [PATCH 1/5] Hurd, C++: Explicitly cast "void *", Thomas Schwinge, 2016/12/08
- [PATCH 2/5] Hurd, C++: Avoid GNU C nested functions,
Thomas Schwinge <=
- [PATCH 5/5] Hurd, C++: Mach/Hurd headers and MIG stubs are not yet fit for C++, Thomas Schwinge, 2016/12/08
- [PATCH 3/5] Hurd, C++: Avoid "const char *" to "char *" casts, Thomas Schwinge, 2016/12/08
- [PATCH 4/5] Hurd, C++: kern_return_t vs. error_t, Thomas Schwinge, 2016/12/08
- Re: Fix C++ compilation of the Hurd port, Luis Machado, 2016/12/23