[llvm-branch-commits] [lldb] r198517 - Undid most changes to ExecutionContext as they affected ExecutionContext objects that were being used when the process was privately stopped.

Greg Clayton gclayton at apple.com
Sat Jan 4 14:48:52 PST 2014


Author: gclayton
Date: Sat Jan  4 16:48:51 2014
New Revision: 198517

URL: http://llvm.org/viewvc/llvm-project?rev=198517&view=rev
Log:
Undid most changes to ExecutionContext as they affected ExecutionContext objects that were being used when the process was privately stopped.

Modified the ExecutionContextRef::Lock() to take a boolean value that can say if you want no thread/frame if the process is running and we now use this in the command interpreter.

Added Point, Size and Rect structs into the curses namespace for much easier API usage. Also added functions that know how to split bounding rectangles horizontally and vertically.

Changed the curses window creation over to use the new Rect functionality.


Modified:
    lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h
    lldb/branches/iohandler/include/lldb/Target/ExecutionContext.h
    lldb/branches/iohandler/source/Core/IOHandler.cpp
    lldb/branches/iohandler/source/Core/ValueObject.cpp
    lldb/branches/iohandler/source/Core/ValueObjectChild.cpp
    lldb/branches/iohandler/source/DataFormatters/LibCxxUnorderedMap.cpp
    lldb/branches/iohandler/source/Target/ExecutionContext.cpp

Modified: lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h Sat Jan  4 16:48:51 2014
@@ -307,7 +307,8 @@ public:
     ExecutionContext
     GetExecutionContext()
     {
-        return m_exe_ctx_ref.Lock();
+        const bool thread_and_frame_only_if_stopped = true;
+        return m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped);
     }
     
     void

Modified: lldb/branches/iohandler/include/lldb/Target/ExecutionContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Target/ExecutionContext.h?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Target/ExecutionContext.h (original)
+++ lldb/branches/iohandler/include/lldb/Target/ExecutionContext.h Sat Jan  4 16:48:51 2014
@@ -298,7 +298,7 @@ public:
     ///     any valid weak references in this object.
     //------------------------------------------------------------------
     ExecutionContext
-    Lock () const;
+    Lock (bool thread_and_frame_only_if_stopped) const;
 
     //------------------------------------------------------------------
     /// Returns true if this object has a weak reference to a thread.
@@ -402,7 +402,7 @@ public:
     ExecutionContext (const lldb::ThreadWP &thread_wp);
     ExecutionContext (const lldb::StackFrameWP &frame_wp);    
     ExecutionContext (const ExecutionContextRef &exe_ctx_ref);
-    ExecutionContext (const ExecutionContextRef *exe_ctx_ref);
+    ExecutionContext (const ExecutionContextRef *exe_ctx_ref, bool thread_and_frame_only_if_stopped = false);
     
     // These two variants take in a locker, and grab the target, lock the API mutex into locker, then
     // fill in the rest of the shared pointers.

Modified: lldb/branches/iohandler/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/IOHandler.cpp?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/IOHandler.cpp (original)
+++ lldb/branches/iohandler/source/Core/IOHandler.cpp Sat Jan  4 16:48:51 2014
@@ -505,6 +505,159 @@ namespace curses
     typedef std::vector<WindowSP> Windows;
     typedef std::vector<WindowDelegateSP> WindowDelegates;
 
+    // type summary add -s "x=${var.x}, y=${var.y}" curses::Rect
+    struct Point
+    {
+        int x;
+        int y;
+        
+        Point (int _x = 0, int _y = 0) :
+            x(_x),
+            y(_y)
+        {
+        }
+
+        void
+        Clear ()
+        {
+            x = 0;
+            y = 0;
+        }
+    };
+    
+    // type summary add -s "w=${var.width}, h=${var.height}" curses::Size
+    struct Size
+    {
+        int width;
+        int height;
+        Size (int w = 0, int h = 0) :
+            width (w),
+            height (h)
+        {
+        }
+        
+        void
+        Clear ()
+        {
+            width = 0;
+            height = 0;
+        }
+    };
+    
+    // type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
+    struct Rect
+    {
+        Point origin;
+        Size size;
+        
+        Rect () :
+            origin(),
+            size()
+        {
+        }
+    
+        Rect (const Point &p, const Size &s) :
+            origin (p),
+            size (s)
+        {
+        }
+        
+        void
+        Clear ()
+        {
+            origin.Clear();
+            size.Clear();
+        }
+        
+        // Return a status bar rectangle which is the last line of
+        // this rectangle. This rectangle will be modified to not
+        // include the status bar area.
+        Rect
+        MakeStatusBar ()
+        {
+            Rect status_bar;
+            if (size.height > 1)
+            {
+                status_bar.origin.x = origin.x;
+                status_bar.origin.y = size.height;
+                status_bar.size.width = size.width;
+                status_bar.size.height = 1;
+                --size.height;
+            }
+            return status_bar;
+        }
+
+        // Return a menubar rectangle which is the first line of
+        // this rectangle. This rectangle will be modified to not
+        // include the menubar area.
+        Rect
+        MakeMenuBar ()
+        {
+            Rect menubar;
+            if (size.height > 1)
+            {
+                menubar.origin.x = origin.x;
+                menubar.origin.y = origin.y;
+                menubar.size.width = size.width;
+                menubar.size.height = 1;
+                ++origin.y;
+                --size.height;
+            }
+            return menubar;
+        }
+
+        void
+        HorizontalSplitPercentage (float top_percentage, Rect &top, Rect &bottom) const
+        {
+            float top_height = top_percentage * size.height;
+            HorizontalSplit (top_height, top, bottom);
+        }
+
+        void
+        HorizontalSplit (int top_height, Rect &top, Rect &bottom) const
+        {
+            top = *this;
+            if (top_height < size.height)
+            {
+                top.size.height = top_height;
+                bottom.origin.x = origin.x;
+                bottom.origin.y = origin.y + top.size.height;
+                bottom.size.width = size.width;
+                bottom.size.height = size.height - top.size.height;
+            }
+            else
+            {
+                bottom.Clear();
+            }
+        }
+        
+        void
+        VerticalSplitPercentage (float left_percentage, Rect &left, Rect &right) const
+        {
+            float left_width = left_percentage * size.width;
+            VerticalSplit (left_width, left, right);
+        }
+
+
+        void
+        VerticalSplit (int left_width, Rect &left, Rect &right) const
+        {
+            left = *this;
+            if (left_width < size.width)
+            {
+                left.size.width = left_width;
+                right.origin.x = origin.x + left.size.width;
+                right.origin.y = origin.y;
+                right.size.width = size.width - left.size.width;
+                right.size.height = size.height;
+            }
+            else
+            {
+                right.Clear();
+            }
+        }
+    };
+
     enum HandleCharResult
     {
         eKeyNotHandled      = 0,
@@ -574,9 +727,9 @@ namespace curses
         {
         }
         
-        Window (const char *name, int nlines, int ncols, int begin_y, int begin_x) :
+        Window (const char *name, const Rect &bounds) :
             m_name (name),
-            m_window (::newwin (nlines, ncols, begin_y, begin_x)),
+            m_window (::newwin (bounds.size.height, bounds.size.width, bounds.origin.y, bounds.origin.y)),
             m_parent (NULL),
             m_subwindows (),
             m_delegate_sp (),
@@ -619,9 +772,13 @@ namespace curses
         void    Box (chtype v_char = ACS_VLINE, chtype h_char = ACS_HLINE) { ::box(m_window, v_char, h_char); }
         void    Clear ()    { ::wclear (m_window); }
         void    Erase ()    { ::werase (m_window); }
+        Rect    GetBounds () { return Rect (GetParentOrigin(), GetSize()); } // Get the rectangle in our parent window
         int     GetChar ()  { return ::wgetch (m_window); }
         int     GetCursorX ()     { return getcurx (m_window); }
         int     GetCursorY ()     { return getcury (m_window); }
+        Rect    GetFrame ()    { return Rect (Point(), GetSize()); } // Get our rectangle in our own coordinate system
+        Point   GetParentOrigin() { return Point (GetParentX(), GetParentY()); }
+        Size    GetSize()         { return Size (GetWidth(), GetHeight()); }
         int     GetParentX ()     { return getparx (m_window); }
         int     GetParentY ()     { return getpary (m_window); }
         int     GetMaxX()   { return getmaxx (m_window); }
@@ -630,12 +787,18 @@ namespace curses
         int     GetHeight() { return GetMaxY(); }
         void    MoveCursor (int x, int y) {  ::wmove (m_window, y, x); }
         void    MoveWindow (int x, int y) {  ::mvwin (m_window, y, x); }
+        void    MoveWindow (const Point &pt) {  ::mvwin (m_window, pt.y, pt.x); }
         void    Resize (int w, int h) { ::wresize(m_window, h, w); }
+        void    Resize (const Size &size) { ::wresize(m_window, size.height, size.width); }
         void    PutChar (int ch)    { ::waddch (m_window, ch); }
         void    PutCString (const char *s, int len = -1) { ::waddnstr (m_window, s, len); }
         void    Refresh ()  { ::wrefresh (m_window); }
         void    DeferredRefresh ()  { ::wnoutrefresh(m_window); }
         void    SetBackground (int color_pair_idx) { ::wbkgd (m_window,COLOR_PAIR(color_pair_idx)); }
+        void    SetBounds (const Rect &r) {
+            MoveWindow(r.origin);
+            Resize (r.size);
+        }
         void    UnderlineOn ()  { AttributeOn(A_UNDERLINE); }
         void    UnderlineOff () { AttributeOff(A_UNDERLINE); }
 
@@ -670,13 +833,20 @@ namespace curses
         }
 
         WindowSP
-        CreateSubWindow (const char *name, int h, int w, int y, int x, bool make_active)
+        CreateSubWindow (const char *name, const Rect &bounds, bool make_active)
         {
             WindowSP subwindow_sp;
             if (m_window)
-                subwindow_sp.reset(new Window(name, ::subwin (m_window, h, w, y, x), true));
+                subwindow_sp.reset(new Window(name, ::subwin (m_window,
+                                                              bounds.size.height,
+                                                              bounds.size.width,
+                                                              bounds.origin.y,
+                                                              bounds.origin.x), true));
             else
-                subwindow_sp.reset(new Window(name, ::newwin (h, w, y, x), true));
+                subwindow_sp.reset(new Window(name, ::newwin (bounds.size.height,
+                                                              bounds.size.width,
+                                                              bounds.origin.y,
+                                                              bounds.origin.x), true));
             subwindow_sp->m_parent = this;
             if (make_active)
             {
@@ -1488,16 +1658,16 @@ namespace curses
                 if (run_menu_sp->Action() == MenuActionResult::Quit)
                     return eQuitApplication;
 
-                const int win_width = run_menu_sp->GetDrawWidth();
-                const int win_height = run_menu_sp->GetSubmenus().size() + 2;
+                Rect menu_bounds;
+                menu_bounds.origin.x = run_menu_sp->GetStartingColumn();
+                menu_bounds.origin.y = 1;
+                menu_bounds.size.width = run_menu_sp->GetDrawWidth();
+                menu_bounds.size.height = run_menu_sp->GetSubmenus().size() + 2;
                 if (m_menu_window_sp)
                     window.GetParent()->RemoveSubWindow(m_menu_window_sp.get());
                 
                 m_menu_window_sp = window.GetParent()->CreateSubWindow (run_menu_sp->GetName().c_str(),
-                                                                        win_height,
-                                                                        win_width,
-                                                                        1,
-                                                                        run_menu_sp->GetStartingColumn(),
+                                                                        menu_bounds,
                                                                         true);
                 m_menu_window_sp->SetDelegate (run_menu_sp);
             }
@@ -2475,32 +2645,25 @@ public:
                     WindowSP main_window_sp = m_app.GetMainWindow();
                     WindowSP source_window_sp = main_window_sp->FindSubWindow("Source");
                     WindowSP variables_window_sp = main_window_sp->FindSubWindow("Variables");
-                    const int source_x = source_window_sp->GetParentX();
-                    const int source_y = source_window_sp->GetParentY();
-                    const int source_w = source_window_sp->GetWidth();
-                    const int source_h = source_window_sp->GetHeight();
+                    const Rect source_bounds = source_window_sp->GetBounds();
 
                     if (variables_window_sp)
                     {
-                        source_window_sp->Resize (source_w, source_h + variables_window_sp->GetHeight());
+                        source_window_sp->Resize (source_bounds.size.width,
+                                                  source_bounds.size.height + variables_window_sp->GetHeight());
                         main_window_sp->RemoveSubWindow(variables_window_sp.get());
                     }
                     else
                     {
-                        int new_source_h = (source_h / 3) * 2;
-                        int variables_h = source_h - new_source_h;
-                        if (variables_h > 0)
-                        {
-                            source_window_sp->Resize (source_w, new_source_h);
-                            WindowSP new_variables_window_sp = main_window_sp->CreateSubWindow ("Variables",
-                                                                                                variables_h,
-                                                                                                source_w,
-                                                                                                source_y + new_source_h,
-                                                                                                source_x,
-                                                                                                false);
-                            
-                            new_variables_window_sp->SetDelegate (WindowDelegateSP(new FrameVariablesWindowDelegate(m_debugger)));
-                        }
+                        Rect new_source_rect;
+                        Rect new_vars_rect;
+                        source_bounds.HorizontalSplitPercentage (0.70, new_source_rect, new_vars_rect);
+                        source_window_sp->SetBounds (new_source_rect);
+                        WindowSP new_variables_window_sp = main_window_sp->CreateSubWindow ("Variables",
+                                                                                            new_vars_rect,
+                                                                                            false);
+                        
+                        new_variables_window_sp->SetDelegate (WindowDelegateSP(new FrameVariablesWindowDelegate(m_debugger)));
                     }
                     touchwin(stdscr);
                 }
@@ -3122,44 +3285,40 @@ IOHandlerCursesGUI::Activate ()
         menubar_sp->AddSubmenu (help_menu_sp);
         menubar_sp->SetDelegate(app_menu_delegate_sp);
         
-        WindowSP menubar_window_sp = main_window_sp->CreateSubWindow("Menubar", 1, main_window_sp->GetWidth(), 0, 0, false);
+        Rect content_bounds = main_window_sp->GetFrame();
+        Rect menubar_bounds = content_bounds.MakeMenuBar();
+        Rect status_bounds = content_bounds.MakeStatusBar();
+        Rect source_bounds;
+        Rect variables_bounds;
+        content_bounds.HorizontalSplitPercentage(0.70, source_bounds, variables_bounds);
+        
+        WindowSP menubar_window_sp = main_window_sp->CreateSubWindow("Menubar", menubar_bounds, false);
         // Let the menubar get keys if the active window doesn't handle the
         // keys that are typed so it can respond to menubar key presses.
         menubar_window_sp->SetCanBeActive(false); // Don't let the menubar become the active window
         menubar_window_sp->SetDelegate(menubar_sp);
-        init_pair (1, COLOR_WHITE   , COLOR_BLUE  );
-        init_pair (2, COLOR_BLACK   , COLOR_WHITE );
-        init_pair (3, COLOR_MAGENTA , COLOR_WHITE );
-        init_pair (4, COLOR_MAGENTA , COLOR_BLACK );
-        init_pair (5, COLOR_RED     , COLOR_BLACK );
         
-        const int main_window_view_h = main_window_sp->GetHeight() - 1; // Subtract 1 for menubar
-        const int main_window_view_w = main_window_sp->GetWidth();
-        int source_window_height = (main_window_view_h / 3) * 2;
-        int locals_window_height = main_window_view_h - source_window_height;
         WindowSP source_window_sp (main_window_sp->CreateSubWindow("Source",
-                                                                   source_window_height,
-                                                                   main_window_view_w,
-                                                                   1,
-                                                                   0,
+                                                                   source_bounds,
                                                                    true));
-        WindowSP locals_window_sp (main_window_sp->CreateSubWindow("Variables",
-                                                                   locals_window_height - 1,
-                                                                   main_window_view_w,
-                                                                   1 + source_window_height,
-                                                                   0,
-                                                                   false));
+        WindowSP variables_window_sp (main_window_sp->CreateSubWindow("Variables",
+                                                                      variables_bounds,
+                                                                      false));
         WindowSP status_window_sp (main_window_sp->CreateSubWindow("Status",
-                                                                   1,
-                                                                   main_window_view_w,
-                                                                   source_window_height + locals_window_height,
-                                                                   0,
+                                                                   status_bounds,
                                                                    false));
         status_window_sp->SetCanBeActive(false); // Don't let the status bar become the active window
         main_window_sp->SetDelegate (std::static_pointer_cast<WindowDelegate>(app_delegate_sp));
         source_window_sp->SetDelegate (WindowDelegateSP(new SourceFileWindowDelegate(m_debugger)));
-        locals_window_sp->SetDelegate (WindowDelegateSP(new FrameVariablesWindowDelegate(m_debugger)));
+        variables_window_sp->SetDelegate (WindowDelegateSP(new FrameVariablesWindowDelegate(m_debugger)));
         status_window_sp->SetDelegate (WindowDelegateSP(new StatusBarWindowDelegate(m_debugger)));
+        
+        init_pair (1, COLOR_WHITE   , COLOR_BLUE  );
+        init_pair (2, COLOR_BLACK   , COLOR_WHITE );
+        init_pair (3, COLOR_MAGENTA , COLOR_WHITE );
+        init_pair (4, COLOR_MAGENTA , COLOR_BLACK );
+        init_pair (5, COLOR_RED     , COLOR_BLACK );
+
     }
 }
 

Modified: lldb/branches/iohandler/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ValueObject.cpp?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ValueObject.cpp (original)
+++ lldb/branches/iohandler/source/Core/ValueObject.cpp Sat Jan  4 16:48:51 2014
@@ -3707,7 +3707,8 @@ ValueObject::EvaluationPoint::SyncWithPr
 {
 
     // Start with the target, if it is NULL, then we're obviously not going to get any further:
-    ExecutionContext exe_ctx(m_exe_ctx_ref.Lock());
+    const bool thread_and_frame_only_if_stopped = true;
+    ExecutionContext exe_ctx(m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
     
     if (exe_ctx.GetTargetPtr() == NULL)
         return false;

Modified: lldb/branches/iohandler/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ValueObjectChild.cpp?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ValueObjectChild.cpp (original)
+++ lldb/branches/iohandler/source/Core/ValueObjectChild.cpp Sat Jan  4 16:48:51 2014
@@ -206,7 +206,8 @@ ValueObjectChild::UpdateValue ()
 
             if (m_error.Success())
             {
-                ExecutionContext exe_ctx (GetExecutionContextRef().Lock());
+                const bool thread_and_frame_only_if_stopped = true;
+                ExecutionContext exe_ctx (GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped));
                 m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
             }
         }

Modified: lldb/branches/iohandler/source/DataFormatters/LibCxxUnorderedMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/DataFormatters/LibCxxUnorderedMap.cpp?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/source/DataFormatters/LibCxxUnorderedMap.cpp (original)
+++ lldb/branches/iohandler/source/DataFormatters/LibCxxUnorderedMap.cpp Sat Jan  4 16:48:51 2014
@@ -84,7 +84,8 @@ lldb_private::formatters::LibcxxStdUnord
     stream.Printf("[%zu]",idx);
     DataExtractor data;
     val_hash.first->GetData(data);
-    ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock();
+    const bool thread_and_frame_only_if_stopped = true;
+    ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped);
     return val_hash.first->CreateValueObjectFromData(stream.GetData(),
                                                      data,
                                                      exe_ctx,

Modified: lldb/branches/iohandler/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/ExecutionContext.cpp?rev=198517&r1=198516&r2=198517&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/ExecutionContext.cpp (original)
+++ lldb/branches/iohandler/source/Target/ExecutionContext.cpp Sat Jan  4 16:48:51 2014
@@ -130,7 +130,7 @@ ExecutionContext::ExecutionContext (Targ
         if (m_process_sp)
         {
             m_thread_sp = m_process_sp->GetThreadList().GetSelectedThread();
-            if (StateIsStoppedState(m_process_sp->GetState(), true) && m_thread_sp)
+            if (m_thread_sp)
                 m_frame_sp = m_thread_sp->GetSelectedFrame();
         }
     }
@@ -149,18 +149,12 @@ ExecutionContext::ExecutionContext(Proce
 ExecutionContext::ExecutionContext (const ExecutionContextRef &exe_ctx_ref) :
     m_target_sp (exe_ctx_ref.GetTargetSP()),
     m_process_sp (exe_ctx_ref.GetProcessSP()),
-    m_thread_sp (),
-    m_frame_sp ()
+    m_thread_sp (exe_ctx_ref.GetThreadSP()),
+    m_frame_sp (exe_ctx_ref.GetFrameSP())
 {
-    if (m_process_sp)
-    {
-        m_thread_sp = exe_ctx_ref.GetThreadSP();
-        if (StateIsStoppedState(m_process_sp->GetState(), true))
-            m_frame_sp = exe_ctx_ref.GetFrameSP();
-    }
 }
 
-ExecutionContext::ExecutionContext (const ExecutionContextRef *exe_ctx_ref_ptr) :
+ExecutionContext::ExecutionContext (const ExecutionContextRef *exe_ctx_ref_ptr, bool thread_and_frame_only_if_stopped) :
     m_target_sp (),
     m_process_sp (),
     m_thread_sp (),
@@ -170,11 +164,10 @@ ExecutionContext::ExecutionContext (cons
     {
         m_target_sp  = exe_ctx_ref_ptr->GetTargetSP();
         m_process_sp = exe_ctx_ref_ptr->GetProcessSP();
-        if (m_process_sp)
+        if (!thread_and_frame_only_if_stopped || (m_process_sp && StateIsStoppedState(m_process_sp->GetState(), true)))
         {
             m_thread_sp = exe_ctx_ref_ptr->GetThreadSP();
-            if (StateIsStoppedState(m_process_sp->GetState(), true))
-                m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
+            m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
         }
     }
 }
@@ -192,12 +185,8 @@ ExecutionContext::ExecutionContext (cons
         {
             locker.Lock(m_target_sp->GetAPIMutex());
             m_process_sp = exe_ctx_ref_ptr->GetProcessSP();
-            if (m_process_sp)
-            {
-                m_thread_sp = exe_ctx_ref_ptr->GetThreadSP();
-                if (StateIsStoppedState(m_process_sp->GetState(), true))
-                    m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
-            }
+            m_thread_sp = exe_ctx_ref_ptr->GetThreadSP();
+            m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
         }
     }
 }
@@ -213,8 +202,7 @@ ExecutionContext::ExecutionContext (cons
         locker.Lock(m_target_sp->GetAPIMutex());
         m_process_sp = exe_ctx_ref.GetProcessSP();
         m_thread_sp  = exe_ctx_ref.GetThreadSP();
-        if (m_process_sp && StateIsStoppedState(m_process_sp->GetState(), true))
-            m_frame_sp   = exe_ctx_ref.GetFrameSP();
+        m_frame_sp   = exe_ctx_ref.GetFrameSP();
     }
 }
 
@@ -839,9 +827,9 @@ ExecutionContextRef::GetFrameSP () const
 }
 
 ExecutionContext
-ExecutionContextRef::Lock () const
+ExecutionContextRef::Lock (bool thread_and_frame_only_if_stopped) const
 {
-    return ExecutionContext(this);
+    return ExecutionContext(this, thread_and_frame_only_if_stopped);
 }
 
 





More information about the llvm-branch-commits mailing list