Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Kamil Rytarowski <n54@gmx.com>, gdb-patches@sourceware.org
Cc: tom@tromey.com
Subject: Re: [PATCH v3] Disable get_ptrace_pid for NetBSD
Date: Wed, 18 Mar 2020 21:13:06 -0400	[thread overview]
Message-ID: <f042adb6-f87d-5a39-31ae-7560c7cae907@simark.ca> (raw)
In-Reply-To: <20200318231651.18045-1-n54@gmx.com>

On 2020-03-18 7:16 p.m., Kamil Rytarowski wrote:
> @@ -336,15 +350,14 @@ get_ptrace_pid (ptid_t ptid)
>  void
>  inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
>  {
> -  pid_t pid;
>    int request;
> 
>    if (minus_one_ptid == ptid)
>      /* Resume all threads.  Traditionally ptrace() only supports
>         single-threaded processes, so simply resume the inferior.  */
> -    pid = inferior_ptid.pid ();
> +    ptid = inferior_ptid;
>    else
> -    pid = get_ptrace_pid (ptid);
> +    ptid = ptid_t (inferior_ptid.pid ());

That's not what I meant.  To keep the existing behavior, I believe it should be:

  if (minus_one_ptid == ptid)
    /* Resume all threads.  Traditionally ptrace() only supports
       single-threaded processes, so simply resume the inferior.  */
    ptid = ptid_t (inferior_ptid.pid ());

> 
>    if (catch_syscall_enabled () > 0)
>      request = PT_SYSCALL;
> @@ -365,7 +378,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
>       where it was.  If GDB wanted it to start some other way, we have
>       already written a new program counter value to the child.  */
>    errno = 0;
> -  ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
> +  gdb_ptrace (request, ptid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
>    if (errno != 0)
>      perror_with_name (("ptrace"));
>  }

I'm getting this:

/home/simark/src/binutils-gdb/gdb/inf-ptrace.c: In member function ‘virtual void inf_ptrace_target::resume(ptid_t, int, gdb_signal)’:
/home/simark/src/binutils-gdb/gdb/inf-ptrace.c:379:15: error: invalid conversion from ‘int’ to ‘__ptrace_request’ [-fpermissive]
  379 |   gdb_ptrace (request, ptid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
      |               ^~~~~~~
      |               |
      |               int
/home/simark/src/binutils-gdb/gdb/inf-ptrace.c:41:30: note:   initializing argument 1 of ‘int gdb_ptrace(__ptrace_request, ptid_t, long int, long int)’
   41 | gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,


We would need to change the type of the variable `ret` to PTRACE_TYPE_ARG1.

I'll make a test run on Linux with those changes to check if there's any regression.

Simon


  reply	other threads:[~2020-03-19  1:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 21:49 [PATCH] " Kamil Rytarowski
2020-03-18 21:51 ` Kamil Rytarowski
2020-03-18 21:55 ` [PATCH v2] " Kamil Rytarowski
2020-03-18 22:21   ` Simon Marchi
2020-03-18 23:30     ` Kamil Rytarowski
2020-03-18 23:16   ` [PATCH v3] " Kamil Rytarowski
2020-03-19  1:13     ` Simon Marchi [this message]
2020-03-19 12:01       ` Kamil Rytarowski
2020-03-19 12:28     ` [PATCH v4] " Kamil Rytarowski
2020-03-19 12:55       ` Simon Marchi
2020-03-19 15:30         ` Simon Marchi
2020-03-19 15:51           ` Kamil Rytarowski
2020-03-20 15:50           ` Tom Tromey
2020-03-19 15:45       ` [PATCH v5] " Kamil Rytarowski
2020-03-19 19:27         ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f042adb6-f87d-5a39-31ae-7560c7cae907@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=n54@gmx.com \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox