]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: add check for empty array
authorPiotr Rudnicki <piotr.rudnicki@intel.com>
Wed, 9 Apr 2025 13:17:31 +0000 (15:17 +0200)
committerPiotr Rudnicki <piotr.rudnicki@intel.com>
Mon, 14 Apr 2025 09:42:54 +0000 (11:42 +0200)
commite25c84752c9df2bf3a999b53afb58e5bebaf3b7c
tree6182c394db62656f90e24b7c915b85163500ab85
parent29b68e449be8816505487ef7cd5abde72ed21ca4
gdb: add check for empty array

With the command before the change, gdb crashes with message:
(gdb) p 1 == { }
Fatal signal: Segmentation fault

After the fix in this commit, gdb shows following message:
(gdb) p 1 == { }
size of the array element must not be zero

Add new test cases to file gdb.base/printcmds.exp to test this change

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/printcmds.exp
gdb/valops.c