changeset 32316:8d3b15dd7505

VM: Collect script frames properly for who / whos (Bug #64674) Previously, who() / whos() printed variables for all frames, causing duplication for scripts. This patch fixes it. * libinterp/corefcn/stack-frame.cc: Limit stack collection to non-script frames.
author Petter T. <petter.vilhelm@gmail.com>
date Wed, 20 Sep 2023 19:56:02 -0400
parents 228e7b6332d5
children 906ea9c9c5d9
files libinterp/corefcn/stack-frame.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/stack-frame.cc	Tue Sep 19 15:16:14 2023 -0400
+++ b/libinterp/corefcn/stack-frame.cc	Wed Sep 20 19:56:02 2023 -0400
@@ -1422,6 +1422,8 @@
     return *m_lazy_data;
   }
 
+  bool is_script_frame () { return m_unwind_data->m_is_script; }
+
   lazy_data_struct *m_lazy_data = nullptr;
 
 private:
@@ -2343,7 +2345,9 @@
 
   void visit_bytecode_fcn_stack_frame (bytecode_fcn_stack_frame& frame)
   {
-    append_list (frame);
+    // For scripts, only collect symbol info in the outer most frame
+    if (!frame.is_script_frame ())
+      append_list (frame);
 
     std::shared_ptr<stack_frame> alink = frame.access_link ();