public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 4/5] gdb: add inferior parameter to target_find_description
Date: Thu, 24 Nov 2022 11:25:16 -0500	[thread overview]
Message-ID: <4efcb8b6-8f0c-a83b-6688-665d0fd5e10e@polymtl.ca> (raw)
In-Reply-To: <20221124160428.83804-5-simon.marchi@efficios.com>

> @@ -546,16 +545,22 @@ target_find_description (void)
>    if (!tdesc_info->filename.empty ())
>      tdesc_info->tdesc = file_read_description_xml (tdesc_info->filename.data ());
>  
> +  /* The calls that get the target description from the target depend on INF
> +     being the current inferior, and some targets need a specific thread to
> +     be selected.  */
> +  scoped_restore_current_thread restore_thread;
> +  thread_info *thread = any_thread_of_inferior (inf);
> +  gdb_assert (thread != nullptr);
> +  switch_to_thread (thread);
Sorry, looks like I messed up my testing, this doesn't work when using
the "set tdesc filename" command while there are no threads:


 37 (gdb) set tdesc filename /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/arc-tdesc-cpu/trivial.xml^M
 38 /home/smarchi/src/binutils-gdb/gdb/thread.c:631: internal-error: any_thread_of_inferior: Assertion `inf->pid != 0' failed.^M
 39 A problem internal to GDB has been detected,^M
 40 further debugging may prove unreliable.^M
 41 ----- Backtrace -----^M
 42 FAIL: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/arc-tdesc-cpu/trivial.xml (GDB internal error)

I made it this way because the remote target uses inferior_ptid to set
the general thread in remote_target::xfer_partial, regardless of the
object.  For TARGET_OBJECT_AVAILABLE_FEATURES, since target descriptions
are a per-inferior thing (for now), it could look at the current
inferior instead, it doesn't really need a current thread.  This is part
of my larger work that I picked these patches from, so I will have to
re-check the order of the changes.

Simon


  reply	other threads:[~2022-11-24 16:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 16:04 [PATCH 0/5] Make some functions independent of current inferior Simon Marchi
2022-11-24 16:04 ` [PATCH 1/5] gdb: add inferior parameter to target_current_description Simon Marchi
2022-11-24 16:04 ` [PATCH 2/5] gdb: add inferior parameter to set_target_gdbarch, rename to set_inferior_gdbarch Simon Marchi
2022-11-24 16:42   ` Lancelot SIX
2022-11-24 16:47     ` Simon Marchi
2022-11-24 16:04 ` [PATCH 3/5] gdb: add inferior parameter to gdbarch_update_p Simon Marchi
2022-11-24 16:04 ` [PATCH 4/5] gdb: add inferior parameter to target_find_description Simon Marchi
2022-11-24 16:25   ` Simon Marchi [this message]
2022-11-24 16:04 ` [PATCH 5/5] gdb: add inferior parameter to target_clear_description 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=4efcb8b6-8f0c-a83b-6688-665d0fd5e10e@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).