Optimized-out pointer: New test for error handling
authorDon Breazeal <donb@codesourcery.com>
Wed, 6 Apr 2016 21:01:50 +0000 (14:01 -0700)
committerDon Breazeal <donb@codesourcery.com>
Wed, 6 Apr 2016 21:30:20 +0000 (14:30 -0700)
commitb16f8a3b1ecce592fe331a5b1ce6632951350e9c
tree067184e9eac8c3bd29fca879cb8f0293d842b80f
parentc2f901dfb6cb5ae2845a48503df1fe0065085f83
Optimized-out pointer: New test for error handling

This patch implements a test that ensures that with "set print object
on", -var-create returns "<optimized out>" for an optimized out pointer
to structure, rather than throwing an error, while also ensuring that
any attempt to dereference the pointer *will* throw an error.

It uses the dwarf assembler to construct the appropriate debug info
to represent a pointer-to-struct in the program as optimized out,
and then accesses that pointer in various ways.  The test uses both
the console interpreter and the MI interpreter.

gdb/testsuite/ChangeLog:
2016-04-06  Don Breazeal  <donb@codesourcery.com>

* gdb.dwarf2/dw2-opt-structptr.c: New test program.
* gdb.dwarf2/dw2-opt-structptr.exp: New test script.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp [new file with mode: 0644]