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>
2 files changed