Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, jimw@sifive.com, palmer@sifive.com,
	jhb@FreeBSD.org
Subject: Re: [PATCH 3/4] gdb/riscv: Create each unique target description only once
Date: Thu, 29 Nov 2018 19:17:00 -0000	[thread overview]
Message-ID: <20181129191729.GH18841@embecosm.com> (raw)
In-Reply-To: <6277aa2c-c64e-e7d2-07d9-444ce80ef170@redhat.com>

* Pedro Alves <palves@redhat.com> [2018-11-29 18:12:29 +0000]:

> On 11/29/2018 04:48 PM, Andrew Burgess wrote:
> 
> > +
> > +  /* Add TDESC into the cache, a target description created to match
> > +     FEATURES.  */
> > +  void add (const struct riscv_gdbarch_features features,
> > +            const target_desc *tdesc)
> > +  {
> > +    feature_tdesc_pair p (features, tdesc);
> > +    m_tdesc_list.push_back (p);
> > +  }
> > +
> > +private:
> > +
> > +  /* Map from a feature set to the corresponding target description.  */
> > +  typedef std::pair<const struct riscv_gdbarch_features,
> > +                    const target_desc *> feature_tdesc_pair;
> > +
> > +  /* List of all target descriptions we've previously seen.  */
> > +  std::vector<feature_tdesc_pair> m_tdesc_list;
> > +};
> 
> Did you consider an unordered_map instead of this whole class here?
> See xml-tdesc.c's xml_cache.  If there's a reason the custom data
> structure is preferred, I think that warrants a comment.

No, the class only exists to group the lookup/update methods.  As I
only expect the list to contain 1 or 2 items in a "normal" session I
didn't invest much thought into it really.  I'll take a look at the
example you suggest and update the patch accordingly.

Thanks for the feedback,

Andrew


  reply	other threads:[~2018-11-29 19:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 22:50 [RFC] gdb/riscv: Add read_description method for riscv_linux_nat_target Andrew Burgess
2018-11-28 23:37 ` Jim Wilson
2018-11-29  2:23 ` Jim Wilson
2018-11-29 16:50   ` [PATCH 3/4] gdb/riscv: Create each unique target description only once Andrew Burgess
2018-11-29 18:12     ` Pedro Alves
2018-11-29 19:17       ` Andrew Burgess [this message]
2018-11-29 22:32       ` Andrew Burgess
2018-11-30 17:07         ` Pedro Alves
2018-11-29 16:50   ` [PATCH 2/4] gdb/riscv: Add equality operators to riscv_gdb_features Andrew Burgess
2018-11-29 16:50   ` [PATCH 4/4] gdb/riscv: Add read_description method for riscv_linux_nat_target Andrew Burgess
2018-11-29 22:22     ` Jim Wilson
2018-11-29 16:50   ` [PATCH 0/4] " Andrew Burgess
2018-11-29 16:50   ` [PATCH 1/4] gdb/riscv: Make some target description functions constant Andrew Burgess

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=20181129191729.GH18841@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=jimw@sifive.com \
    --cc=palmer@sifive.com \
    --cc=palves@redhat.com \
    /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