]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix gdb.Value.dynamic_type attribute
authorHannes Domani <ssbssa@yahoo.de>
Tue, 9 Sep 2025 17:28:36 +0000 (19:28 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Tue, 9 Sep 2025 19:11:27 +0000 (21:11 +0200)
commitb7e3459d2c08c16e85af69690eb7e42c824a447a
tree3e0b5c32d44cf0271ca1925c3f3bc525f14d3286
parent3719472095d25d799ed269f36034006c79460090
Fix gdb.Value.dynamic_type attribute

gdb currently crashes if you try to get the dynamic_type from a
gdb.Value of a POD struct:

(gdb) py print(gdb.parse_and_eval('pod').dynamic_type)
Fatal signal: Segmentation fault

It happens because value_rtti_type() returns NULL for them, and this is
not handled correctly.

Fixed by using val->type() as a fallback in this case.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/python/py-value.c
gdb/testsuite/gdb.python/py-value.c
gdb/testsuite/gdb.python/py-value.exp