mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
Reject non-string types in gdb.Value.lazy_string
Currently, gdb.Value.lazy_string will allow the conversion of any object to a "lazy string". However, this was never the intent and is weird besides. This patch changes this code to correctly throw an exception in the non-matching cases. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20769
This commit is contained in:
@@ -24,6 +24,7 @@ main ()
|
||||
const char array[] = "array";
|
||||
pointer typedef_ptr = "typedef pointer";
|
||||
const char *null = 0;
|
||||
int not_a_string = 23;
|
||||
|
||||
return 0; /* break here */
|
||||
}
|
||||
|
||||
@@ -73,3 +73,8 @@ foreach var_spec { { "ptr" "pointer" "const char \\*" -1 } \
|
||||
#gdb_test "python print ($var.lazy_string(length=0).value())" "\"\"" "empty lazy string value"
|
||||
}
|
||||
}
|
||||
|
||||
gdb_py_test_silent_cmd "python nas = gdb.parse_and_eval('not_a_string')" \
|
||||
"get not_a_string" 1
|
||||
gdb_test "python print(nas.lazy_string())" \
|
||||
"Cannot make lazy string from this object"
|
||||
|
||||
Reference in New Issue
Block a user