Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Luis Machado <luis.machado@linaro.org>, gdb-patches@sourceware.org
Subject: [review v3] [AArch64, SVE] Improve target description check for SVE in gdbserver
Date: Tue, 19 Nov 2019 15:03:00 -0000	[thread overview]
Message-ID: <20191119150249.71E572816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1574172175000.I28b782cb1677560ca9a06a1be442974b25aabae4@gnutoolchain-gerrit.osci.io>

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 <luis.machado@linaro.org>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Tue, 19 Nov 2019 15:02:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Luis Machado <luis.machado@linaro.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment


  parent reply	other threads:[~2019-11-19 15:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 14:03 [review] " Luis Machado (Code Review)
2019-11-19 14:05 ` [review v2] " Luis Machado (Code Review)
2019-11-19 14:23 ` Simon Marchi (Code Review)
2019-11-19 14:30 ` Luis Machado (Code Review)
2019-11-19 14:43 ` [review v3] " Luis Machado (Code Review)
2019-11-19 15:03 ` Simon Marchi (Code Review) [this message]
2019-11-19 15:14 ` [review v4] " Luis Machado (Code Review)
2019-11-20 16:34   ` Alan Hayward
2019-11-20 16:51     ` Luis Machado
     [not found]     ` <c30acac0-f73f-c368-d980-94ece81e92e5@polymtl.ca>
2019-11-21  8:23       ` Alan Hayward
2019-11-20 16:59 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-20 16:59 ` Sourceware to Gerrit sync (Code Review)

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=20191119150249.71E572816F@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=luis.machado@linaro.org \
    /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