diff options
author | Tom Tromey <tom@tromey.com> | 2019-12-21 09:51:05 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-14 17:57:52 -0700 |
commit | ff47f4f06d296b672337e2c7363a745cd2725f58 (patch) | |
tree | 9a60eb2433cffbcbfab90243b5fe2744a8e8cd76 /gdb/testsuite/gdb.python/python.exp | |
parent | b300843444cf833f7b3943ebae060c3d88b4ce91 (diff) | |
download | binutils-ff47f4f06d296b672337e2c7363a745cd2725f58.zip binutils-ff47f4f06d296b672337e2c7363a745cd2725f58.tar.gz binutils-ff47f4f06d296b672337e2c7363a745cd2725f58.tar.bz2 |
Fix valgrind error from gdb.decode_line
PR symtab/12535 points out that gdb.decode_line("") will cause a
valgrind report.
I think the empty linespec does not really make sense. So, this patch
changes gdb.decode_line to treat a whitespace-only linespec the same
as a non-existing argument.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
PR symtab/12535:
* python/python.c (gdbpy_decode_line): Treat empty string the same
as no argument.
gdb/testsuite/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
PR symtab/12535:
* gdb.python/python.exp: Test decode_line with empty string
argument.
Change-Id: I1d95812b4b7a21d69a3e9afd05b9e3141a931897
Diffstat (limited to 'gdb/testsuite/gdb.python/python.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index f002497..a50a7b4 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -234,6 +234,10 @@ gdb_test "python print (len(symtab))" "2" "test decode_line current location" gdb_test "python print (symtab\[0\])" "None" "test decode_line expression parse" gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line current location" +# Test that decode_line with an empty string argument does not crash. +gdb_py_test_silent_cmd "python symtab2 = gdb.decode_line('')" \ + "test decode_line with empty string" 1 + if { [is_remote host] } { set python_c [string_to_regexp "python.c"] } else { |