This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4][REPOST] Remote Linux ptrace exec events


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]