From: Guinevere Larsen Date: Thu, 15 May 2025 14:07:03 +0000 (-0300) Subject: gdb/solib: rename convenience variable to _linker_namespace X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96662aacaa0cf0a9766d874fc9577a5da417dbcc;p=thirdparty%2Fbinutils-gdb.git gdb/solib: rename convenience variable to _linker_namespace Based on feedback from IRC and PR solib/32959, this commit renames the recently introduced convenience variable $_current_linker_namespace to the shorter name $_linker_namespace. This makes it more in line with existing convenience variables such as $_thread and $_inferior, and faster to type. It should be ok to simply change the name because the variable was never released to the public, so there should be no existing scripts depending on the name. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32959 Reviewed-By: Eli Zaretskii Approved-By: Andrew Burgess Approved-By: Tom Tromey --- diff --git a/gdb/NEWS b/gdb/NEWS index 507e53359ce..4dcc344b072 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -41,7 +41,7 @@ is active. * New built-in convenience variables $_active_linker_namespaces and - $_current_linker_namespace. These show the number of active linker + $_linker_namespace. These show the number of active linker namespaces, and the namespace to which the current location belongs to. In systems that don't support linker namespaces, these always return the integers 1 and 0 respectively. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9aad9e7bc70..7d06e1f5fa4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -13109,8 +13109,8 @@ environment variable. Number of active linkage namespaces in the inferior. In systems with no support for linkage namespaces, this variable will always be set to @samp{1}. -@vindex $_current_linker_namespace@r{, convenience variable} -@item $_current_linker_namespace +@vindex $_linker_namespace@r{, convenience variable} +@item $_linker_namespace The namespace which contains the current location in the inferior. This returns @value{GDBN}'s internal numbering for the namespace. In systems with no support for linker namespaces, this variable will always be set to diff --git a/gdb/solib.c b/gdb/solib.c index afc1dcc02ba..3e821ba418a 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1818,13 +1818,13 @@ default_find_solib_addr (solib &so) return {}; } -/* Implementation of the current_linker_namespace convenience variable. +/* Implementation of the linker_namespace convenience variable. This returns the GDB internal identifier of the linker namespace, for the current frame, as an integer. If the inferior doesn't support linker namespaces, this always returns 0. */ static value * -current_linker_namespace_make_value (gdbarch *gdbarch, internalvar *var, +linker_namespace_make_value (gdbarch *gdbarch, internalvar *var, void *ignore) { const solib_ops *ops = gdbarch_so_ops (gdbarch); @@ -1846,11 +1846,11 @@ current_linker_namespace_make_value (gdbarch *gdbarch, internalvar *var, return value_from_longest (builtin_type (gdbarch)->builtin_int, nsid); } -/* Implementation of `$_current_linker_namespace' variable. */ +/* Implementation of `$_linker_namespace' variable. */ -static const struct internalvar_funcs current_linker_namespace_funcs = +static const struct internalvar_funcs linker_namespace_funcs = { - current_linker_namespace_make_value, + linker_namespace_make_value, nullptr, }; @@ -1869,8 +1869,8 @@ _initialize_solib () /* Convenience variables for debugging linker namespaces. These are set here, even if the solib_ops doesn't support them, for consistency. */ - create_internalvar_type_lazy ("_current_linker_namespace", - ¤t_linker_namespace_funcs, nullptr); + create_internalvar_type_lazy ("_linker_namespace", + &linker_namespace_funcs, nullptr); set_internalvar_integer (lookup_internalvar ("_active_linker_namespaces"), 1); add_com ( diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index b012ace7d13..01e3cc12bd3 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -772,7 +772,7 @@ set show_conv_list \ {$_shell_exitsignal = void} \ {$_shell_exitcode = 0} \ {$_active_linker_namespaces = 1} \ - {$_current_linker_namespace = }\ + {$_linker_namespace = }\ } if [allow_python_tests] { append show_conv_list \ diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp index cae1be75b77..801022b769e 100644 --- a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp +++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp @@ -112,7 +112,7 @@ proc_with_prefix test_conv_vars {} { gdb_test "print \$_active_linker_namespaces" "1" \ "1 namespace before starting inferior" - gdb_test "print \$_current_linker_namespace" "No registers." \ + gdb_test "print \$_linker_namespace" "No registers." \ "No current namespace before starting inferior" if { ![runto_main] } { @@ -121,7 +121,7 @@ proc_with_prefix test_conv_vars {} { gdb_test "print \$_active_linker_namespaces" "1" \ "Before activating namespaces" - gdb_test "print \$_current_linker_namespace" ".* = 0" \ + gdb_test "print \$_linker_namespace" ".* = 0" \ "Still in the default namespace" gdb_breakpoint "inc" allow-pending @@ -130,7 +130,7 @@ proc_with_prefix test_conv_vars {} { foreach_with_prefix dl {3 2 1} { gdb_continue_to_breakpoint "inc" - gdb_test "print \$_current_linker_namespace" ".* = $dl" \ + gdb_test "print \$_linker_namespace" ".* = $dl" \ "Verify we're in namespace $dl" } @@ -154,7 +154,7 @@ proc_with_prefix test_conv_vars {} { # breakpoints and pending breakpoints at the same time with # gdb_breakpoint. gdb_test "next" ".*assert.*" "load the first SO" - gdb_breakpoint "inc if \$_current_linker_namespace == 2" + gdb_breakpoint "inc if \$_linker_namespace == 2" gdb_continue_to_breakpoint "inc" gdb_continue_to_end "" continue 1 }