This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/16188] Verify PTRACE_TRACEME succeeded?
- From: "palves at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 19 Nov 2013 10:39:23 +0000
- Subject: [Bug gdb/16188] Verify PTRACE_TRACEME succeeded?
- Auto-submitted: auto-generated
- References: <bug-16188-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16188
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com
--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
Yeah. In fork_inferior, we handle a similar case, when the fork child fails to
exec:
/* "Trace me, Dr. Memory!" */
(*traceme_fun) ();
...
environ = env;
if (exec_fun != NULL)
(*exec_fun) (argv[0], argv, env);
else
execvp (argv[0], argv);
/* If we get here, it's an error. */
save_errno = errno;
fprintf_unfiltered (gdb_stderr, "Cannot exec %s", exec_file);
for (i = 1; argv[i] != NULL; i++)
fprintf_unfiltered (gdb_stderr, " %s", argv[i]);
fprintf_unfiltered (gdb_stderr, ".\n");
fprintf_unfiltered (gdb_stderr, "Error: %s\n",
safe_strerror (save_errno));
gdb_flush (gdb_stderr);
_exit (0177);
}
So it seems like what's missing is making traceme_fun return an error
indication, and then change
(*traceme_fun) ();
to check for failure and _exit with error. This will make startup_inferior see
the child exit (before the number of expected traps), and error out with
"During startup program exited with code ...".
--
You are receiving this mail because:
You are on the CC list for the bug.