aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKilian Kilger <kkilger@gmail.com>2024-05-26 10:41:12 +0200
committerTom Tromey <tromey@adacore.com>2024-06-11 09:50:08 -0600
commit8130c1a430c952f65b621aee2c801316a61fab14 (patch)
treeb8b72230620014d2d8e63d9d27af434414942a3d
parentce6b89bfdfd530551a6c00761aaf1e4bb204c2be (diff)
downloadgdb-8130c1a430c952f65b621aee2c801316a61fab14.zip
gdb-8130c1a430c952f65b621aee2c801316a61fab14.tar.gz
gdb-8130c1a430c952f65b621aee2c801316a61fab14.tar.bz2
fix division by zero in target_read_string()
Under certain circumstances, a floating point exception in target_read_string() can happen when the type has been obtained by a call to stpy_lazy_string_elt_type(). In the latter function, a call to check_typedef() has been forgotten. This makes type->length = 0 in this case.
-rw-r--r--gdb/python/py-lazy-string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 0b7f5c9..8779716 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -266,7 +266,7 @@ stpy_lazy_string_elt_type (lazy_string_object *lazy)
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
- return realtype->target_type ();
+ return check_typedef (realtype->target_type ());
default:
/* This is done to preserve existing behaviour. PR 20769.
E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */