[5/9] Don't let property evaluation affect the current language

Message ID 20221007180120.1866772-6-tromey@adacore.com
State Committed
Commit 12bb802fab16b5bf8edc027c247741bd75db1257
Series Fix "finish" with variably-sized types |

Commit Message

Tom Tromey Oct. 7, 2022, 6:01 p.m. UTC
  On PPC, we saw that calling an inferior function could sometimes
change the current language, because gdb would select the call dummy
frame -- associated with _start.

This patch changes gdb so that the current language is never affected
by DWARF property evaluation.
 gdb/dwarf2/loc.c | 5 +++++
 1 file changed, 5 insertions(+)


diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index ad45d57a654..3333bf438ff 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1647,6 +1647,11 @@  dwarf2_evaluate_property (const struct dynamic_prop *prop,
   if (prop == NULL)
     return false;
+  /* Evaluating a property should not change the current language.
+     Without this here this could happen if the code below selects a
+     frame.  */
+  scoped_restore_current_language save_language;
   if (frame == NULL && has_stack_frames ())
     frame = get_selected_frame (NULL);