From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 8F37B381DCF6 for ; Thu, 19 Mar 2020 01:13:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F37B381DCF6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 173861E5F9; Wed, 18 Mar 2020 21:13:07 -0400 (EDT) Subject: Re: [PATCH v3] Disable get_ptrace_pid for NetBSD To: Kamil Rytarowski , gdb-patches@sourceware.org Cc: tom@tromey.com References: <20200318215531.25248-1-n54@gmx.com> <20200318231651.18045-1-n54@gmx.com> From: Simon Marchi Message-ID: Date: Wed, 18 Mar 2020 21:13:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200318231651.18045-1-n54@gmx.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2020 01:13:10 -0000 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