diff options
author | Tom Tromey <tom@tromey.com> | 2025-02-12 20:43:38 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2025-02-13 14:43:56 -0700 |
commit | 27c6f1271bacc44552f612ce8a801d725dabb6cf (patch) | |
tree | 43cf2423fc69277dd355f74220d2d203fd9bf44f | |
parent | aeb6452a5dc93d928d7cb7bcc61a3f3c334e9550 (diff) | |
download | binutils-27c6f1271bacc44552f612ce8a801d725dabb6cf.zip binutils-27c6f1271bacc44552f612ce8a801d725dabb6cf.tar.gz binutils-27c6f1271bacc44552f612ce8a801d725dabb6cf.tar.bz2 |
Remove assumption from py-symbol.exp
The current py-symbol.exp test makes an assumption about which symbol
will be returned first. I don't think gdb should really make promises
about the order in which the symbols are listed, though, and a series
I am working on changes this behavior. This patch changes the test to
merely ensure that both symbols are returned.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
-rw-r--r-- | gdb/testsuite/gdb.python/py-symbol.exp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp index 40f9038..55cdebe 100644 --- a/gdb/testsuite/gdb.python/py-symbol.exp +++ b/gdb/testsuite/gdb.python/py-symbol.exp @@ -149,10 +149,12 @@ gdb_breakpoint "function_in_other_file" gdb_continue_to_breakpoint "function_in_other_file" gdb_test "python print (gdb.lookup_static_symbol ('rr').value ())" "99" \ "print value of rr from other file" -gdb_test "python print (gdb.lookup_static_symbols ('rr')\[0\].value ())" "99" \ - "print value of gdb.lookup_static_symbols ('rr')\[0\], from the other file" -gdb_test "python print (gdb.lookup_static_symbols ('rr')\[1\].value ())" "42" \ - "print value of gdb.lookup_static_symbols ('rr')\[1\], from the other file" +# GDB doesn't really guarantee the order of these, so sort the values. +gdb_test_no_output "python rrs = gdb.lookup_static_symbols ('rr')" \ + "fetch all rr symbols, from the other file" +gdb_test "python print (sorted(\[int(x.value()) for x in rrs\]))" \ + "\\\[42, 99\\\]" \ + "print values of all 'rr' symbols, from the other file" # Now continue back to the first source file. set linenum [gdb_get_line_number "Break at end."] @@ -164,10 +166,12 @@ gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0 # static symbol from the second source file. gdb_test "python print (gdb.lookup_static_symbol ('rr').value ())" "42" \ "print value of rr from main file" -gdb_test "python print (gdb.lookup_static_symbols ('rr')\[0\].value ())" "99" \ - "print value of gdb.lookup_static_symbols ('rr')\[0\], from the main file" -gdb_test "python print (gdb.lookup_static_symbols ('rr')\[1\].value ())" "42" \ - "print value of gdb.lookup_static_symbols ('rr')\[1\], from the main file" +# This should be consistent with the first file. +gdb_test_no_output "python rrs = gdb.lookup_static_symbols ('rr')" \ + "fetch all rr symbols, from the main file" +gdb_test "python print (sorted(\[int(x.value()) for x in rrs\]))" \ + "\\\[42, 99\\\]" \ + "print values of all 'rr' symbols, from the main file" # Test is_variable attribute. gdb_py_test_silent_cmd "python a = gdb.lookup_symbol(\'a\')" "Get variable a" 0 |