From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52122 invoked by alias); 19 Nov 2019 15:03:05 -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 52110 invoked by uid 89); 19 Nov 2019 15:03:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 15:02:54 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id D656B202D0; Tue, 19 Nov 2019 10:02:52 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 9142C202D0; Tue, 19 Nov 2019 10:02:49 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 71E572816F; Tue, 19 Nov 2019 10:02:49 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Tue, 19 Nov 2019 15:03:00 -0000 From: "Simon Marchi (Code Review)" To: Luis Machado , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review v3] [AArch64, SVE] Improve target description check for SVE in gdbserver X-Gerrit-Change-Id: I28b782cb1677560ca9a06a1be442974b25aabae4 X-Gerrit-Change-Number: 690 X-Gerrit-ChangeURL: X-Gerrit-Commit: a3549c71ca46dfab0d08e9d6d5b68977d20df7b1 In-Reply-To: References: X-Gerrit-Comment-Date: Tue, 19 Nov 2019 10:02:49 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191119150249.71E572816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00595.txt.bz2 Simon Marchi has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/690 ...................................................................... Patch Set 3: (1 comment) | --- gdb/gdbserver/tdesc.c | +++ gdb/gdbserver/tdesc.c | @@ -186,3 +186,19 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name) | tdesc->features.emplace_back (new_feature); | return new_feature; | } | + | +/* See gdbsupport/tdesc.h. */ | + | +bool | +tdesc_contains_feature (const target_desc *tdesc, const std::string feature) | +{ | + if (tdesc && !tdesc->features.empty ()) PS2, Line 195: > No use case in particular for a NULL tdesc, though i tend to think having the check here prevents having to add such a check elsewhere. We don't want gdbserver to die when we see a NULL tdesc for example. > > Unless a NULL tdesc is a major error we don't want to allow. Then i agree an assert would be good. Thoughts? I don't know if it's possible to execute with no target description in gdbserver, or if we always have one. regcache->tdesc is initialized in init_register_cache. I checked the various paths that could be called, and it appears to me like it's always non-NULL. For example: - the new_register_cache call at server.c:4110, passes current_target_desc. current_target_desc returns a default target description at worst - get_thread_regcache passes a tdesc, which it asserts to be not null - in tracepoint.c, we call get_ipa_tdesc, which is target-specific. I did a quick scan of the architectures, and it looks like they always return something non-NULL. I believe that it's not possible to get a NULL tdesc here, so I would vote for making it an assert. | + { | + for (const tdesc_feature_up &f : tdesc->features) | + { | + if (f->name.compare (feature) == 0) | + return true; | + } | + } | + | + return false; -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I28b782cb1677560ca9a06a1be442974b25aabae4 Gerrit-Change-Number: 690 Gerrit-PatchSet: 3 Gerrit-Owner: Luis Machado Gerrit-Reviewer: Luis Machado Gerrit-CC: Simon Marchi Gerrit-Comment-Date: Tue, 19 Nov 2019 15:02:49 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Luis Machado Comment-In-Reply-To: Simon Marchi Gerrit-MessageType: comment