This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 02/15 v2] Remove some GDBSERVER checks from linux-ptrace
- From: Doug Evans <dje at google dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>, Tom Tromey <tromey at redhat dot com>
- Date: Thu, 17 Jul 2014 09:35:38 +0100
- Subject: Re: [PATCH 02/15 v2] Remove some GDBSERVER checks from linux-ptrace
- Authentication-results: sourceware.org; auth=none
- References: <1405520243-17282-1-git-send-email-gbenson at redhat dot com> <1405520243-17282-3-git-send-email-gbenson at redhat dot com>
On Wed, Jul 16, 2014 at 7:17 AM, Gary Benson <gbenson@redhat.com> wrote:
> This patch removes some GDBSERVER checks from nat/linux-ptrace.c.
> Currently the code uses a compile-time check to decide whether some
> flags should be used. This changes the code to instead let users of
> the module specify an additional set of flags; and then changes gdb's
> linux-nat.c to call this function. At some later date, when the back
> ends are fully merged, we will be able to remove this function again.
>
> gdb/
> 2014-07-16 Tom Tromey <tromey@redhat.com>
> Gary Benson <gbenson@redhat.com>
>
> * nat/linux-ptrace.c (additional_flags): New global.
> (linux_test_for_tracesysgood, linux_test_for_tracefork): Use
> additional_flags; don't check GDBSERVER.
> (linux_ptrace_set_additional_flags): New function.
> * nat/linux-ptrace.h (linux_ptrace_set_additional_flags):
> Declare.
> * linux-nat.c (_initialize_linux_nat): Call
> linux_ptrace_set_additional_flags.
LGTM.
I had a thought, and please don't feel compelled to have to submit yet
another revision.
I'm just writing this down for completeness' sake.
Since linux_ptrace_set_additional_flags is supposed to be called
before any other related function, one could add an assert to the
other functions to verify this.
> [...]
> +/* Set additional ptrace flags to use. Some such flags may be checked
> + by the implementation above. This function must be called before
> + any other function in this file; otherwise the flags may not take
> + effect appropriately. */
> +
> +void
> +linux_ptrace_set_additional_flags (int flags)
> +{
> + additional_flags = flags;
> +}