old-cross-binutils/gdb/testsuite/gdb.mi
Andrew Burgess 37a8db1a33 gdb: Guard against undefined behaviour in mi-vla-fortran.exp
The test gdb.mi/mi-vla-fortran.exp reveals an issue with the DWARF
generated by gfortran.

In the test a pointer variable 'pvla2' is created:
    real, pointer :: pvla2 (:, :)

Initially this variable will be unassociated, so something like this:
    l = associated(pvla2)

should return false.

In the test gdb stops at a point _before_ pvla2 is associated with
anything, and we then try to print pvla2, the expectation is that gdb
should reply <not associated>.

The problem is that the data the DWARF directs gdb to read (to identify
if the variable is associated or not) is not initialised until the first
time pvla2 is accessed.

As a result gdb ends up reading uninitialised memory, sometimes this
uninitialised memory indicates the variable is associated (when it's
not).  This first mistake can lead to a cascade of errors, reading
uninitialised memory, with the result that gdb builds an invalid type to
associate with the variable pvla2.

In some cases, this invalid type can be very large, which when we try to
print pvla2 causes gdb to allocate a large amount of memory.

A recent commit added a new gdb variable 'max-value-size', which
prevents gdb from allocating values of extreme size.  As a result
directly trying to print pvla2 will now now error rather than allocate a
large amount of memory.

However, some of the later tests create a varobj for pvla2, and then
ask for the children of that varobj to be displayed.  In the case where
an invalid type has been computed for pvla2 then the number of children
can be wrong, and very big, in which case trying to display all of these
children can cause gdb to consume an excessive amount of memory.

This commit first detects if printing pvla2 triggers the max-value-size
error, if it does then we avoid all the follow on tests relating to the
unassociated pvla2, which avoids the second error printing the varobj
children.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-vla-fortran.exp: Add XFAIL for accessing unassociated
	pointer.  Don't perform further tests on the unassociated pointer
	if the first test fails.
2016-02-01 18:05:35 +00:00
..
array.f GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
basics.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ChangeLog-1999-2003
dw2-ref-missing-frame-func.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
dw2-ref-missing-frame-main.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
dw2-ref-missing-frame.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
dw2-ref-missing-frame.S GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
gdb669.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
gdb680.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
gdb701.c
gdb701.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
gdb792.cc
gdb792.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
gdb2549.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
Makefile.in
mi-async.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-basics.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-break.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-breakpoint-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-catch-load-so.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-catch-load.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-catch-load.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cli.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-param-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-condbreak-call-thr-state-mt.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-condbreak-call-thr-state-st.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-condbreak-call-thr-state.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-condbreak-call-thr-state.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-console.c
mi-console.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-detach.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-disassemble.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-dprintf-pending.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-dprintf-pending.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-dprintf-pendshr.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-dprintf.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-dprintf.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-eval.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-exit-code.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-exit-code.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-file-transfer.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-file.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-fill-memory.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-fullname-deleted.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-hack-cli.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-i-cmd.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-info-os.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-inheritance-syntax-error.cc
mi-inheritance-syntax-error.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-language.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-logging.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-memory-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-nonstop-exit.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-nonstop.exp Reapply: List inferiors/threads/pspaces in ascending order 2016-01-12 01:12:38 +00:00
mi-ns-stale-regcache.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-nsintrall.exp Reapply: List inferiors/threads/pspaces in ascending order 2016-01-12 01:12:38 +00:00
mi-nsmoribund.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-nsthrexec.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-pending.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-pending.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-pendshr.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-pendshr2.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-pthreads.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-read-memory.c
mi-read-memory.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-record-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-reg-undefined.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-reg-undefined.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-reg-undefined.S GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-regs.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-return.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-reverse.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-simplerun.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-solib.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-stack.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-stack.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-start.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-start.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-stepi.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-stepn.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-stepn.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-syn-frame.c
mi-syn-frame.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-undefined-cmd.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-until.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-block.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-child-f.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-child.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-child.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-cmd.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-cp.cc GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-cp.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-create-rtti.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-create-rtti.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-display.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-invalidate.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-list-children-invalid-grandchild.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-list-children-invalid-grandchild.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-rtti.cc GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-var-rtti.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-vla-c99.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-vla-fortran.exp gdb: Guard against undefined behaviour in mi-vla-fortran.exp 2016-02-01 18:05:35 +00:00
mi-watch-nonstop.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-watch.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi2-amd64-entry-value.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi2-amd64-entry-value.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi2-amd64-entry-value.s GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi2-prompt.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi2-var-child.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
non-stop-exit.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
non-stop.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ns-stale-regcache.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
nsintrall.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
nsmoribund.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
nsthrexec.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pending.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pendshr1.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pendshr2.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pr11022.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pr11022.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pthreads.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
solib-lib.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
solib-main.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
testcmds
until.c
var-cmd.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
vla.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
vla.f90 GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
watch-nonstop.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00