From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D61213857027 for ; Wed, 24 Nov 2021 15:02:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D61213857027 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-537-pRJS0KqdPGWpWwX0exIP4Q-1; Wed, 24 Nov 2021 10:02:31 -0500 X-MC-Unique: pRJS0KqdPGWpWwX0exIP4Q-1 Received: by mail-wr1-f69.google.com with SMTP id d7-20020a5d6447000000b00186a113463dso562979wrw.10 for ; Wed, 24 Nov 2021 07:02:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IYHt0OjaM74uX6BN9x3brrIsNcMgf/RVD37+TACvrzA=; b=HG3/5a6eGlkPMGBuELw5K5ve8o5LQCXGpsDPN1pjgb0CUvC64kmJ5VmSWs76inthCf 55PLSAwDtcKRmFgNDDK6Qe2NDQTUFDe12OesKIiFtdtknN2Pyrb5+/CO+QAO47K34Gr0 7foCBUn374+wBsRYjL0ysdcIleN+35+MQula11RL60s9o6BFA44++mFIOSNoM/juf2js yxjhuGvwQx/iSCmVIQRWz/DX7YiK5HJM1vZmp2DrEyYuycaZcqpUGaXG45Y3JFMPL9F3 nBrb651/KVKmPPfuf1ViDWMgwWZRgXPa/EbHA3AOXLYRhSAuUnDmE7XHbeNmNiqkxId6 B4dA== X-Gm-Message-State: AOAM533xzytXJCdGqhBM8U6ZTMYm0Gkaq5RN847vqMNGC4/dOflWh2DP DHG9Q+5HnB4CH/vtKTdZgW5WMYdqFTiLukXVKMJAFVoH6ATxd2Os6fXH40qkaZT5GG5EiWzp03y B1o25VyTHRJPPz227Ek8u1A== X-Received: by 2002:a1c:7e04:: with SMTP id z4mr15682017wmc.134.1637766148992; Wed, 24 Nov 2021 07:02:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUGF66rqoj49LEzInRvlxqmbgrYFC7voZ9T8XEPDGb+lxGZm5/VqYqaF8x45N0Vv1rc1fMHg== X-Received: by 2002:a1c:7e04:: with SMTP id z4mr15681645wmc.134.1637766145823; Wed, 24 Nov 2021 07:02:25 -0800 (PST) Received: from localhost (host86-166-129-255.range86-166.btcentralplus.com. [86.166.129.255]) by smtp.gmail.com with ESMTPSA id b10sm72320wrt.36.2021.11.24.07.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 07:02:25 -0800 (PST) Date: Wed, 24 Nov 2021 15:02:24 +0000 From: Andrew Burgess To: John Baldwin Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 09/13] fbsd-nat: Include ptrace operation in error messages. Message-ID: <20211124150224.GI2662946@redhat.com> References: <20210803185000.22171-1-jhb@FreeBSD.org> <20210803185000.22171-10-jhb@FreeBSD.org> MIME-Version: 1.0 In-Reply-To: <20210803185000.22171-10-jhb@FreeBSD.org> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 15:02:12 up 5 days, 4:00, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 24 Nov 2021 15:02:37 -0000 * John Baldwin [2021-08-03 11:49:56 -0700]: > --- > gdb/fbsd-nat.c | 34 ++++++++++++++++++---------------- > 1 file changed, 18 insertions(+), 16 deletions(-) LGTM. Thanks, Andrew > > diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c > index 36ce00164dd..49dadb0a1e7 100644 > --- a/gdb/fbsd-nat.c > +++ b/gdb/fbsd-nat.c > @@ -820,7 +820,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr) > if (!fbsd_fetch_kinfo_proc (pid, &kp)) > perror_with_name (_("Failed to fetch process information")); > if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_LWPINFO)")); > if (strcmp (kp.ki_comm, pl.pl_tdname) == 0) > return NULL; > xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname); > @@ -849,22 +849,22 @@ fbsd_enable_proc_events (pid_t pid) > > if (ptrace (PT_GET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events, > sizeof (events)) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_GET_EVENT_MASK)")); > events |= PTRACE_FORK | PTRACE_LWP; > #ifdef PTRACE_VFORK > events |= PTRACE_VFORK; > #endif > if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events, > sizeof (events)) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_SET_EVENT_MASK)")); > #else > #ifdef TDP_RFPPWAIT > if (ptrace (PT_FOLLOW_FORK, pid, (PTRACE_TYPE_ARG3)0, 1) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_FOLLOW_FORK)")); > #endif > #ifdef PT_LWP_EVENTS > if (ptrace (PT_LWP_EVENTS, pid, (PTRACE_TYPE_ARG3)0, 1) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_LWP_EVENTS)")); > #endif > #endif > } > @@ -883,13 +883,13 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid) > gdb_assert (!in_thread_list (target, ptid_t (pid))); > nlwps = ptrace (PT_GETNUMLWPS, pid, NULL, 0); > if (nlwps == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_GETNUMLWPS)")); > > gdb::unique_xmalloc_ptr lwps (XCNEWVEC (lwpid_t, nlwps)); > > nlwps = ptrace (PT_GETLWPLIST, pid, (caddr_t) lwps.get (), nlwps); > if (nlwps == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_GETLWPLIST)")); > > for (i = 0; i < nlwps; i++) > { > @@ -903,7 +903,7 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid) > /* Don't add exited threads. Note that this is only called > when attaching to a multi-threaded process. */ > if (ptrace (PT_LWPINFO, lwps[i], (caddr_t) &pl, sizeof pl) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_LWPINFO)")); > if (pl.pl_flags & PL_FLAG_EXITED) > continue; > #endif > @@ -1177,7 +1177,9 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) > request = PT_SUSPEND; > > if (ptrace (request, tp->ptid.lwp (), NULL, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (request == PT_RESUME ? > + ("ptrace (PT_RESUME)") : > + ("ptrace (PT_SUSPEND)")); > } > } > else > @@ -1186,7 +1188,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) > until the process is continued however). */ > for (thread_info *tp : all_non_exited_threads (this, ptid)) > if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_RESUME)")); > ptid = inferior_ptid; > } > > @@ -1216,7 +1218,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) > if (step) > { > if (ptrace (PT_SETSTEP, get_ptrace_pid (ptid), NULL, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_SETSTEP)")); > step = 0; > } > ptid = ptid_t (ptid.pid ()); > @@ -1304,7 +1306,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, > > pid = wptid.pid (); > if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_LWPINFO)")); > > wptid = ptid_t (pid, pl.pl_lwpid, 0); > > @@ -1336,7 +1338,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, > delete_thread (thr); > } > if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_CONTINUE)")); > continue; > } > #endif > @@ -1399,7 +1401,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, > gdb_assert (pid == child); > > if (ptrace (PT_LWPINFO, child, (caddr_t)&pl, sizeof pl) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_LWPINFO)")); > > gdb_assert (pl.pl_flags & PL_FLAG_CHILD); > child_ptid = ptid_t (child, pl.pl_lwpid, 0); > @@ -1485,7 +1487,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, > and once system call stops are enabled on a process > it stops for all system call entries and exits. */ > if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_CONTINUE)")); > continue; > } > } > @@ -1625,7 +1627,7 @@ fbsd_nat_target::follow_fork (ptid_t child_ptid, target_waitkind fork_kind, > infrun.c. */ > > if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1) > - perror_with_name (("ptrace")); > + perror_with_name (("ptrace (PT_DETACH)")); > > #ifndef PTRACE_VFORK > if (fork_kind == TARGET_WAITKIND_VFORKED) > -- > 2.31.1 >