[gdb/exp] Fix exception when printing optimized out vla
authorTom de Vries <tdevries@suse.de>
Fri, 20 Jul 2018 14:41:00 +0000 (16:41 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 25 Jul 2018 19:25:16 +0000 (21:25 +0200)
commit16f808ec99b141bf03091d3b309a335c68d4e9e0
tree3f9d6f3dcaaf4415c5c731a25b24fcb7e0708a02
parentd7154a8d08b142d1258dc2e4189ff0d00cd26493
[gdb/exp] Fix exception when printing optimized out vla

When compiling vla-optimized-out.c with -O3 and a recent gcc, and trying to
print the vla a in f1, we run into this gdb exception:
...
Cannot find matching parameter at DW_TAG_call_site 0x4003be at main
...

This is a regression introduced by 42dc7699a2 "[gdb/exp] Fix printing of type
of optimized out vla".

This patch fixes the regression by wrapping the ctx.eval call in
dwarf2_locexpr_baton_eval in try/catch, similar to what is done in
dwarf2_evaluate_loc_desc_full.

Build and reg-tested on x86_64-linux.

2018-07-25  Tom de Vries  <tdevries@suse.de>

* dwarf2loc.c (dwarf2_locexpr_baton_eval): Wrap ctx.eval call in
try/catch.

* gdb.base/vla-optimized-out-o3.exp: New file.  Reuse
vla-optimized-out.c.
gdb/ChangeLog
gdb/dwarf2loc.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/vla-optimized-out-o3.exp [new file with mode: 0644]
This page took 0.027188 seconds and 4 git commands to generate.