]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: fix gdb.base/dlmopen-ns-ids.exp racy test
authorGuinevere Larsen <guinevere@redhat.com>
Wed, 9 Apr 2025 18:08:13 +0000 (15:08 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Fri, 11 Apr 2025 12:17:58 +0000 (09:17 -0300)
commitda9ffdece9b30cec63bb890c4e36575648b3f222
treec91891b3b810b2dc7ce93ccf8bc7269755f4dd40
parentea0498f46e440199907213d920b7964d4fc38dc5
gdb/testsuite: fix gdb.base/dlmopen-ns-ids.exp racy test

The recently included gdb.base/dlmopen-ns-ids.exp test can sometimes
fail the call to get_integer_valueof when trying to check the namespace
ID of the fourth dlopened SO, for apparently no reason.

What's happening is that the call to get_first_so_ns doesn't necessarily
consume the GDB prompt, and so get_integer_valueof will see the prompt
immediately and not find the value the test is looking for.

To fix this, the test was changed so that we consume all of the output
of the command "info sharedlibrary", but only set the namespace ID for
the first occurrence of the SO we're looking for.  The command now also
gets the solib name as a parameter, to reduce the amount of output.

Co-Authored-By: Tom de Vries <tdevries@suse.de>
Approved-By: Tom de Vries <tdevries@suse.de>
gdb/testsuite/gdb.base/dlmopen-ns-ids.exp