From 2134b0b4a5ff493878386183dfd8a735b5334ad7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 18 Nov 2024 13:47:22 -0700 Subject: 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 --- gdb/testsuite/gdb.python/py-lazy-string.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gdb/testsuite/gdb.python/py-lazy-string.c') diff --git a/gdb/testsuite/gdb.python/py-lazy-string.c b/gdb/testsuite/gdb.python/py-lazy-string.c index 326523d..805ba92 100644 --- a/gdb/testsuite/gdb.python/py-lazy-string.c +++ b/gdb/testsuite/gdb.python/py-lazy-string.c @@ -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 */ } -- cgit v1.1