public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/options: fix copy&paste error in string_option_def
@ 2023-12-14 13:17 Andrew Burgess
  2023-12-14 15:36 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2023-12-14 13:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Spotted what appears to be a copy&paste error in string_option_def,
the code for string handling writes the address fetching callback
function into the option_def::var_address::enumeration location,
rather than option_def::var_address::string.

Of course, this works just fine as option_def::var_address is a union,
and all of its members are function pointers, so they're going to be
the same size on every target GDB cares about.

But it doesn't hurt to be correct, so fixed in this commit.

There should be no user visible changes after this commit.
---
 gdb/cli/cli-option.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
index 4c62227f31c..2645c58188c 100644
--- a/gdb/cli/cli-option.h
+++ b/gdb/cli/cli-option.h
@@ -304,7 +304,7 @@ struct string_option_def : option_def
 		  show_cmd_cb_,
 		  set_doc_, show_doc_, help_doc_)
   {
-    var_address.enumeration = detail::get_var_address<const char *, Context>;
+    var_address.string = detail::get_var_address<std::string, Context>;
   }
 };
 

base-commit: 5c5e642dc0f6b223c2339d8dee64fbc63eee8e1a
-- 
2.25.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/options: fix copy&paste error in string_option_def
  2023-12-14 13:17 [PATCH] gdb/options: fix copy&paste error in string_option_def Andrew Burgess
@ 2023-12-14 15:36 ` Tom Tromey
  2023-12-14 16:29   ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2023-12-14 15:36 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> Spotted what appears to be a copy&paste error in string_option_def,
Andrew> the code for string handling writes the address fetching callback
Andrew> function into the option_def::var_address::enumeration location,
Andrew> rather than option_def::var_address::string.

Andrew> Of course, this works just fine as option_def::var_address is a union,
Andrew> and all of its members are function pointers, so they're going to be
Andrew> the same size on every target GDB cares about.

Andrew> But it doesn't hurt to be correct, so fixed in this commit.

Looks good.  Thank you.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/options: fix copy&paste error in string_option_def
  2023-12-14 15:36 ` Tom Tromey
@ 2023-12-14 16:29   ` Andrew Burgess
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2023-12-14 16:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> Spotted what appears to be a copy&paste error in string_option_def,
> Andrew> the code for string handling writes the address fetching callback
> Andrew> function into the option_def::var_address::enumeration location,
> Andrew> rather than option_def::var_address::string.
>
> Andrew> Of course, this works just fine as option_def::var_address is a union,
> Andrew> and all of its members are function pointers, so they're going to be
> Andrew> the same size on every target GDB cares about.
>
> Andrew> But it doesn't hurt to be correct, so fixed in this commit.
>
> Looks good.  Thank you.
> Approved-By: Tom Tromey <tom@tromey.com>

Pushed.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-14 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 13:17 [PATCH] gdb/options: fix copy&paste error in string_option_def Andrew Burgess
2023-12-14 15:36 ` Tom Tromey
2023-12-14 16:29   ` Andrew Burgess

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).