mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
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
This commit is contained in:
@@ -810,6 +810,15 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
if (! PyArg_ParseTuple (args, "|s", &arg))
|
||||
return NULL;
|
||||
|
||||
/* Treat a string consisting of just whitespace the same as
|
||||
NULL. */
|
||||
if (arg != NULL)
|
||||
{
|
||||
arg = skip_spaces (arg);
|
||||
if (*arg == '\0')
|
||||
arg = NULL;
|
||||
}
|
||||
|
||||
if (arg != NULL)
|
||||
location = string_to_event_location_basic (&arg, python_language,
|
||||
symbol_name_match_type::WILD);
|
||||
|
||||
Reference in New Issue
Block a user