This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/4][REPOST] Remote Linux ptrace exec events
- From: Tom Tromey <tromey at redhat dot com>
- To: Don Breazeal <donb at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>, Don Breazeal <don_breazeal at relay1 dot mentorg dot com>
- Date: Wed, 21 May 2014 09:28:44 -0600
- Subject: Re: [PATCH 2/4][REPOST] Remote Linux ptrace exec events
- Authentication-results: sourceware.org; auth=none
- References: <1398885482-8449-1-git-send-email-donb at codesourcery dot com> <1398885482-8449-3-git-send-email-donb at codesourcery dot com>
>>>>> "Don" == Don Breazeal <donb@codesourcery.com> writes:
Don> One caveat: when an exec is detected, gdbserver emits a couple of warnings:
Don> gdbserver: unexpected r_debug version 0
Don> gdbserver: unexpected r_debug version 0
Don> However, debugging of shared libraries that are loaded by the exec'd
Don> program works just fine. These messages may be caused by gdbserver making
Don> an attempt to initialize the solib hook before the r_debug structure has
Don> been initialized. I intend to follow up in a subsequent patch.
I think it would be better to have that fix in the initial patch.
I am curious what others think though.
Don> diff --git a/gdb/common/linux-ptrace.c b/gdb/common/linux-ptrace.c
Don> index e3fc705..b137df9 100644
Don> --- a/gdb/common/linux-ptrace.c
Don> +++ b/gdb/common/linux-ptrace.c
Don> @@ -491,8 +491,11 @@ linux_test_for_tracefork (int child_pid)
Don> if (ret == child_pid && WIFSTOPPED (status)
Don> && status >> 16 == PTRACE_EVENT_EXIT)
Don> {
Don> - /* PTRACE_O_TRACEEXIT is supported. */
Don> - current_ptrace_options |= PTRACE_O_TRACEEXIT;
Don> + /* PTRACE_O_TRACEEXIT is supported. We use exit events to
Don> + implement support for exec events. Since fork events are
Don> + supported we know exec events are supported, so we enable
Don> + exec events here. */
Don> + current_ptrace_options |= PTRACE_O_TRACEEXIT | PTRACE_O_TRACEEXEC;
Don> }
There's code earlier in the function that is #ifdef GDBSERVER
and that checks PTRACE_O_TRACEEXEC for gdb. It seems like more
unification there would be a better approach.
Don> +static int
Don> +extended_event_reported (const struct target_waitstatus *waitstatus)
Don> +{
Don> +
Don> + if (waitstatus == NULL)
Don> + return 0;
Don> +
Don> + return waitstatus->kind == TARGET_WAITKIND_EXECD;
Extra newline after the "{".
I can't really comment on the rest, I'm afraid.
Tom