public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: check for groups with duplicate names in reggroups:add
Date: Tue, 18 Oct 2022 14:54:22 -0400	[thread overview]
Message-ID: <e43f993a-7813-0757-5af8-0fe588d50ef4@efficios.com> (raw)
In-Reply-To: <87v8ohgeh9.fsf@tromey.com>

On 10/18/22 14:42, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> In the downstream ROCm GDB port, we would create multiple register
> Simon> groups with duplicate names.  While it did not really hurt, it certainly
> Simon> wasn't the intent.  And I don't think it ever makes sense to do so.
> 
> Simon> To catch these, change the assert in reggroups::add to check for
> Simon> duplicate names.  It's no longer necessary to check for duplicate
> Simon> reggroup pointers, because adding the same group twice would be caught
> Simon> by the duplicate name check.
> 
> I haven't looked but would it be possible for malformed XML from the
> target to trigger this assert?
> 
> Tom

I don't think so, because the target description support code creates
the groups as it finds them while iterating registers.  It only creates
a group if it doesn't exist already:

  https://gitlab.com/gnutools/binutils-gdb/-/blob/152cc35ebff44eb06a00364ca1dbcf5fca6772b4/gdb/target-descriptions.c#L1124-1125

In other words, the XML tdesc doesn't have a list of groups, where if a
group was duplicated, it could trigger this assert.

Simon

  reply	other threads:[~2022-10-18 18:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 14:17 Simon Marchi
2022-10-18 18:42 ` Tom Tromey
2022-10-18 18:54   ` Simon Marchi [this message]
2022-10-18 19:01     ` Tom Tromey
2022-10-18 20:47       ` Simon Marchi
2022-10-19  1:54         ` Tom Tromey
2022-10-19  2:12           ` Simon Marchi

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=e43f993a-7813-0757-5af8-0fe588d50ef4@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).