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

Unified Diff: gdb/inf-ttrace.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/inf-ttrace.h ('k') | gdb/infcall.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/inf-ttrace.c
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 2c620d58fe5ba75365ff00de48e2f9a5c70c5829..eb0adcb2298c3de25167375bb31561a8433ac7af 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -1,6 +1,6 @@
/* Low-level child interface to ttrace.
- Copyright (C) 2004-2012 Free Software Foundation, Inc.
+ Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,13 +31,14 @@
#include "target.h"
#include "gdb_assert.h"
-#include "gdb_string.h"
+#include <string.h>
#include <sys/mman.h>
#include <sys/ttrace.h>
#include <signal.h>
#include "inf-child.h"
#include "inf-ttrace.h"
+#include "common/filestuff.h"
@@ -408,7 +409,8 @@ inf_ttrace_stopped_by_watchpoint (void)
static pid_t inf_ttrace_vfork_ppid = -1;
static int
-inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
+inf_ttrace_follow_fork (struct target_ops *ops, int follow_child,
+ int detach_fork)
{
pid_t pid, fpid;
lwpid_t lwpid, flwpid;
@@ -457,7 +459,7 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
inf->pspace = parent_inf->pspace;
inf->aspace = parent_inf->aspace;
copy_terminal_info (inf, parent_inf);
- detach_breakpoints (pid);
+ detach_breakpoints (ptid_build (pid, lwpid, 0));
target_terminal_ours ();
fprintf_unfiltered (gdb_stdlog,
@@ -467,7 +469,11 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
else
{
inferior_ptid = ptid_build (pid, lwpid, 0);
- detach_breakpoints (fpid);
+ /* Detach any remaining breakpoints in the child. In the case
+ of fork events, we do not need to do this, because breakpoints
+ should have already been removed earlier. */
+ if (tts.tts_event == TTEVT_VFORK)
+ detach_breakpoints (ptid_build (fpid, flwpid, 0));
target_terminal_ours ();
fprintf_unfiltered (gdb_stdlog,
@@ -554,6 +560,11 @@ do_cleanup_pfds (void *dummy)
close (inf_ttrace_pfd1[1]);
close (inf_ttrace_pfd2[0]);
close (inf_ttrace_pfd2[1]);
+
+ unmark_fd_no_cloexec (inf_ttrace_pfd1[0]);
+ unmark_fd_no_cloexec (inf_ttrace_pfd1[1]);
+ unmark_fd_no_cloexec (inf_ttrace_pfd2[0]);
+ unmark_fd_no_cloexec (inf_ttrace_pfd2[1]);
}
static void
@@ -568,6 +579,11 @@ inf_ttrace_prepare (void)
close (inf_ttrace_pfd2[0]);
perror_with_name (("pipe"));
}
+
+ mark_fd_no_cloexec (inf_ttrace_pfd1[0]);
+ mark_fd_no_cloexec (inf_ttrace_pfd1[1]);
+ mark_fd_no_cloexec (inf_ttrace_pfd2[0]);
+ mark_fd_no_cloexec (inf_ttrace_pfd2[1]);
}
/* Prepare to be traced. */
@@ -626,9 +642,6 @@ inf_ttrace_him (struct target_ops *ops, int pid)
push_target (ops);
- /* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h, and will
- be 1 or 2 depending on whether we're starting without or with a
- shell. */
startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
/* On some targets, there must be some explicit actions taken after
@@ -785,7 +798,7 @@ inf_ttrace_attach (struct target_ops *ops, char *args, int from_tty)
}
static void
-inf_ttrace_detach (struct target_ops *ops, char *args, int from_tty)
+inf_ttrace_detach (struct target_ops *ops, const char *args, int from_tty)
{
pid_t pid = ptid_get_pid (inferior_ptid);
int sig = 0;
« no previous file with comments | « gdb/inf-ttrace.h ('k') | gdb/infcall.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698