]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add comment in dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 28 May 2020 19:47:53 +0000 (15:47 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 28 May 2020 19:47:53 +0000 (15:47 -0400)
Add a comment to clarify why we temporarily override some of the
context's fields, and especially the per_objfile field.  A longer
explanation can be found in this previous commit

    44486dcf19b ("gdb: use caller objfile in dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value")

gdb/ChangeLog:

* dwarf2/loc.c (class dwarf_evaluate_loc_desc)
<push_dwarf_reg_entry_value>: Add comment.

Change-Id: I60c6e1062799f729b30a9db78bcb6448783324b4

gdb/ChangeLog
gdb/dwarf2/loc.c

index cf46c4e92bdd64b4dd3fb62df8cb7a6b5250486a..44300d258ea922b15293da5e5198b047a408f6b9 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-28  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * dwarf2/loc.c (class dwarf_evaluate_loc_desc)
+       <push_dwarf_reg_entry_value>: Add comment.
+
 2020-05-28  Kevin Buettner  <kevinb@redhat.com>
            Keith Seitz  <keiths@redhat.com>
 
index 1aab1a4f51bcb837185ee95327e2c8846274070d..400bb4d16fc7ad7d37bcf03e054d87db96277894 100644 (file)
@@ -731,6 +731,12 @@ public:
       throw_error (NO_ENTRY_VALUE_ERROR,
                   _("Cannot resolve DW_AT_call_data_value"));
 
+    /* We are about to evaluate an expression in the context of the caller
+       of the current frame.  This evaluation context may be different from
+       the current (callee's) context), so temporarily set the caller's context.
+
+       It is possible for the caller to be from a different objfile from the
+       callee if the call is made through a function pointer.  */
     scoped_restore save_frame = make_scoped_restore (&this->frame,
                                                     caller_frame);
     scoped_restore save_per_cu = make_scoped_restore (&this->per_cu,