Hurd, C++: Avoid GNU C nested functions
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 25 Nov 2016 13:56:01 +0000 (14:56 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 8 Dec 2016 07:24:22 +0000 (08:24 +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
gdb/gnu-nat.c

index f68a787e7e97805a06d8581a9525a8e30b0d1e4b..8b43cd8e635df9fd061cb0c1f173c615a9eea19d 100644 (file)
@@ -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 *".
 
index 92b92924283939bc132f83beb92a5885f5d993c6..34fd6f1cedb8b06f4a6750c0b514d62a0a90d872 100644 (file)
@@ -2109,6 +2109,16 @@ cur_inf (void)
   return gnu_current_inf;
 }
 
+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,
@@ -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...  */
This page took 0.030086 seconds and 4 git commands to generate.