Fix crash when setting breakpoint condition
authorTom Tromey <tromey@adacore.com>
Thu, 30 May 2019 20:13:10 +0000 (14:13 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 19 Jun 2019 12:06:02 +0000 (06:06 -0600)
commit680e1beed31da40080f61a35f6ccd626de818056
tree75454b722be92a1feb6afc3bda485b7e835d3bde
parentdcf3792354ddcd6e10e59e32060e34b27246e7da
Fix crash when setting breakpoint condition

gdb could crash when setting a breakpoint condition on a breakpoint
when using the Ada language.  The problem occurred because the
ada_evaluate_subexp would try to evaluate the array to compute its
attributes, but evaluating can't really be done at this time.

This patch fixes the problem by arranging not to try to evaluate in
EVAL_AVOID_SIDE_EFFECTS mode when computing an attribute.

Tested on x86-64 Fedora 29.  Because this is Ada-specific, and because
Joel approved it internally, I am checking it in.

gdb/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (ada_evaluate_subexp) <case OP_ATR_FIRST>: Handle
EVAL_AVOID_SIDE_EFFECTS specially.

gdb/testsuite/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

* gdb.ada/length_cond.exp: New file.
* gdb.ada/length_cond/length_cond.adb: New file.
* gdb.ada/length_cond/pck.adb: New file.
* gdb.ada/length_cond/pck.ads: New file.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/length_cond.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/length_cond/length_cond.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/length_cond/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/length_cond/pck.ads [new file with mode: 0644]