gdb/options: fix copy&paste error in string_option_def

Message ID 7d5ab0d95447c98d8581a94c1e1568dd44ffdf34.1702559691.git.aburgess@redhat.com
State New
Headers
Series gdb/options: fix copy&paste error in string_option_def |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged

Commit Message

Andrew Burgess Dec. 14, 2023, 1:17 p.m. UTC
  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(-)


base-commit: 5c5e642dc0f6b223c2339d8dee64fbc63eee8e1a
  

Comments

Tom Tromey Dec. 14, 2023, 3:36 p.m. UTC | #1
>>>>> "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
  
Andrew Burgess Dec. 14, 2023, 4:29 p.m. UTC | #2
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
  

Patch

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>;
   }
 };