[5/5] gdb: make target_desc_info_from_user_p a method of target_desc_info
Commit Message
Move the implementation over to target_desc_info. Remove the
target_desc_info forward declaration in target-descriptions.h, it's no
longer needed.
Change-Id: Ic95060341685afe0b73af591ca6efe32f5e7e892
---
gdb/inferior.c | 2 +-
gdb/inferior.h | 5 +++++
gdb/target-descriptions.c | 8 --------
gdb/target-descriptions.h | 8 --------
4 files changed, 6 insertions(+), 17 deletions(-)
Comments
On 2023-02-03 2:21 p.m., Simon Marchi via Gdb-patches wrote:
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -345,6 +345,11 @@ extern void switch_to_inferior_no_thread (inferior *inf);
>
> struct target_desc_info
> {
> + /* Returns true if INFO indicates the target description had been supplied by
> + the user. */
There is no INFO anymore.
> + bool from_user_p ()
> + { return !this->filename.empty (); }
> +
On 2/6/23 13:41, Pedro Alves wrote:
> On 2023-02-03 2:21 p.m., Simon Marchi via Gdb-patches wrote:
>> --- a/gdb/inferior.h
>> +++ b/gdb/inferior.h
>> @@ -345,6 +345,11 @@ extern void switch_to_inferior_no_thread (inferior *inf);
>>
>> struct target_desc_info
>> {
>> + /* Returns true if INFO indicates the target description had been supplied by
>> + the user. */
>
> There is no INFO anymore.
Ah, thanks. I pushed this fix.
From f9b677528fdde6b1d5f402b75db2efcbe62c93d8 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Mon, 6 Feb 2023 14:12:27 -0500
Subject: [PATCH] gdb: adjust comment on target_desc_info::from_user_p
Remove the stale reference to INFO, which is now "this target
description info" now.
Change-Id: I35dbdb089048ed7cfffe730d3134ee391b176abf
---
gdb/inferior.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/inferior.h b/gdb/inferior.h
index bac483f0f78d..72034cc4ffbc 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -345,7 +345,7 @@ extern void switch_to_inferior_no_thread (inferior *inf);
struct target_desc_info
{
- /* Returns true if INFO indicates the target description had been supplied by
+ /* Returns true if this target description information has been supplied by
the user. */
bool from_user_p ()
{ return !this->filename.empty (); }
base-commit: 85df9457b72e4a198b4edfc908017612fca59509
@@ -961,7 +961,7 @@ clone_inferior_command (const char *args, int from_tty)
/* If the original inferior had a user specified target
description, make the clone use it too. */
- if (target_desc_info_from_user_p (&inf->tdesc_info))
+ if (inf->tdesc_info.from_user_p ())
inf->tdesc_info = orginf->tdesc_info;
clone_program_space (pspace, orginf->pspace);
@@ -345,6 +345,11 @@ extern void switch_to_inferior_no_thread (inferior *inf);
struct target_desc_info
{
+ /* Returns true if INFO indicates the target description had been supplied by
+ the user. */
+ bool from_user_p ()
+ { return !this->filename.empty (); }
+
/* A flag indicating that a description has already been fetched
from the target, so it should not be queried again. */
bool fetched = false;
@@ -451,14 +451,6 @@ get_arch_data (struct gdbarch *gdbarch)
return result;
}
-/* See target-descriptions.h. */
-
-int
-target_desc_info_from_user_p (struct target_desc_info *info)
-{
- return info != nullptr && !info->filename.empty ();
-}
-
/* The string manipulated by the "set tdesc filename ..." command. */
static std::string tdesc_filename_cmd_string;
@@ -26,9 +26,6 @@
struct tdesc_arch_data;
struct target_ops;
-/* An inferior's target description info is stored in this opaque
- object. There's one such object per inferior. */
-struct target_desc_info;
struct inferior;
/* Fetch the current inferior's description, and switch its current
@@ -48,11 +45,6 @@ void target_clear_description (void);
const struct target_desc *target_current_description (void);
-/* Returns true if INFO indicates the target description had been
- supplied by the user. */
-
-int target_desc_info_from_user_p (struct target_desc_info *info);
-
/* Record architecture-specific functions to call for pseudo-register
support. If tdesc_use_registers is called and gdbarch_num_pseudo_regs
is greater than zero, then these should be called as well.