From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10232 invoked by alias); 1 Mar 2018 09:15:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8954 invoked by uid 89); 1 Mar 2018 09:14:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=personal X-HELO: mail-qt0-f180.google.com Received: from mail-qt0-f180.google.com (HELO mail-qt0-f180.google.com) (209.85.216.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Mar 2018 09:14:39 +0000 Received: by mail-qt0-f180.google.com with SMTP id t6so6633872qtn.9 for ; Thu, 01 Mar 2018 01:14:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=I1IK+gwVxsXkKnyaEcM96s6yhowoaabnjqCPggLvk+g=; b=Cj1FWvOOyGEgzazrkEB+DgFW2znZdLHUtH+TW7uRCWfwCz7LI8p/FY2t2XVdf369+B q03xI2XmHTIShrWhQY7H+BQOuQbdRwOTr7Pf3VGvi45XfBrzHQ715m9zb5OC8qrAoNRJ oKftE3j2T0iu14kGN668keDDL5P3053y7UyNDYBVqwL9pK9b4pxj6bYsD/guSJhy+UVd K6yTCHmBG25ORU/pJLqilqNCQULMmQAg//HeFrG5U5l8ChebzgSR7ZbC7nwZgQfgQE12 z20Ei4e0+UzVAXCXWY8x29JiSd5ABmJxXOCN0qF8jtTQxvaRLDYZqwXhz13utAtkWHgg SNJA== X-Gm-Message-State: AElRT7F/56YPueE/rO/JDwNPyZAX5mkHwecr1IueccoYuCNvX9LKD/jM x9ujS69KejZZGPBjwkPtk1iKi/wsZXFx8S/j8g0= X-Google-Smtp-Source: AG47ELukl2qFJzIy1qJvqGw4Q3hUpZvKl3cwkfzZkUc0PagWQayhCB+f49iF6Rcf5mTiRXn02tnWKpqFod7RYV9x3es= X-Received: by 10.237.41.35 with SMTP id s32mr1715289qtd.200.1519895677565; Thu, 01 Mar 2018 01:14:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.217.57 with HTTP; Thu, 1 Mar 2018 01:14:37 -0800 (PST) In-Reply-To: References: <1519727985-17914-1-git-send-email-markus.t.metzger@intel.com> <86sh9lgjxt.fsf@gmail.com> From: Yao Qi Date: Thu, 01 Mar 2018 09:15:00 -0000 Message-ID: Subject: Re: [PATCH] btrace, gdbserver: check btrace target pointers To: "Metzger, Markus T" Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00004.txt.bz2 On Wed, Feb 28, 2018 at 5:10 PM, Metzger, Markus T wrote: > > I moved two of those checks into the target_* method since I thought > it would be a good idea to be able to handle exceptions and since I had > to add the TRY/CATCH/CATCH_END, anyway, I thought it made sense > to handle the nullptr case also via exceptions. > > If we're not doing it that way, the caller would need to check the pointer > (either directly or via a *_p () function like we do with gdbarch) and st= ill > be prepared to handle exceptions from the actual call. > > My motivation was to simplify the caller but if you think the other way > is clearer I can move the check back into the callers. Is that your pref= erence? > I don't have a strong opinion on this. It is more about personal flavour of writing code. You are the major btrace contributor, so it is better to keep the code in a way you prefer. Patch is good to me, please push. --=20 Yao (=E9=BD=90=E5=B0=A7)