]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: check that "info shared" and "info linker-namespaces" before running...
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Jun 2025 19:32:59 +0000 (15:32 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 26 Jun 2025 18:08:31 +0000 (14:08 -0400)
While writing my solib_ops C++ification series, I broke this, and it
didn't seem to be caught by the testsuite.  Add a test for those.

The exact message for "info linker-namespaces" varies depending on the
solib_ops of the target architecture (whether ops->num_active_namespaces
is nullptr or not).  For now, just accept any message (a crash will
still be caught).  A later patch in this series will make the message
consistent and update this test.

Change-Id: I6bce2ff317447bbf321fc9cbd2d42c3dcea0c683
Approved-By: Pedro Alves <pedro@palves.net>
gdb/testsuite/gdb.base/dlmopen-ns-ids.exp
gdb/testsuite/gdb.base/info-shared.exp

index 94b4a6e50bcf8bb5289a4540844b643157afff76..e95732a5bbbef2eebb4b3799b1b64f619328f5b4 100644 (file)
@@ -169,6 +169,11 @@ proc_with_prefix test_conv_vars {} {
 proc test_info_linker_namespaces {} {
     clean_restart $::binfile
 
+    # Check that "info linker-namespaces" while the inferior is not running
+    # doesn't crash.
+    gdb_test "info linker-namespaces" "" \
+       "info linker-namespaces before running"
+
     if { ![runto_main] } {
        return
     }
index 6f1b2d6af7e0f4ecc9e9addbb8e79e467f0de082..e81b28e27a5bb533123a332f6992e2b13cc5c411 100644 (file)
@@ -79,6 +79,9 @@ proc check_info_shared { test expect1 expect2 } {
     }
 }
 
+# Check that "info shared" before running doesn't crash.
+check_info_shared "info sharedlibrary before running" 0 0
+
 # Start the inferior, and check neither of the libraries are loaded at
 # the start.
 if ![runto_main] {