diff options
Diffstat (limited to 'source/Target/ThreadPlanCallUserExpression.cpp')
| -rw-r--r-- | source/Target/ThreadPlanCallUserExpression.cpp | 52 | 
1 files changed, 50 insertions, 2 deletions
diff --git a/source/Target/ThreadPlanCallUserExpression.cpp b/source/Target/ThreadPlanCallUserExpression.cpp index 827de3e6057a..90b8cf81171f 100644 --- a/source/Target/ThreadPlanCallUserExpression.cpp +++ b/source/Target/ThreadPlanCallUserExpression.cpp @@ -12,7 +12,7 @@  // C Includes  // C++ Includes  // Other libraries and framework includes -#include "llvm/Support/MachO.h" +  // Project includes  #include "lldb/lldb-private-log.h"  #include "lldb/Breakpoint/Breakpoint.h" @@ -21,6 +21,7 @@  #include "lldb/Core/Log.h"  #include "lldb/Core/Stream.h"  #include "lldb/Expression/ClangUserExpression.h" +#include "lldb/Host/HostInfo.h"  #include "lldb/Target/LanguageRuntime.h"  #include "lldb/Target/Process.h"  #include "lldb/Target/RegisterContext.h" @@ -56,7 +57,54 @@ ThreadPlanCallUserExpression::~ThreadPlanCallUserExpression ()  void  ThreadPlanCallUserExpression::GetDescription (Stream *s, lldb::DescriptionLevel level)  {         -    ThreadPlanCallFunction::GetDescription (s, level); +    if (level == eDescriptionLevelBrief) +        s->Printf("User Expression thread plan"); +    else +        ThreadPlanCallFunction::GetDescription (s, level); +} + +void +ThreadPlanCallUserExpression::WillPop () +{ +    ThreadPlanCallFunction::WillPop(); +    if (m_user_expression_sp) +        m_user_expression_sp.reset(); +} + +bool +ThreadPlanCallUserExpression::MischiefManaged () +{ +    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + +    if (IsPlanComplete()) +    { +        if (log) +            log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", +                        static_cast<void*>(this)); + +        if (m_manage_materialization && PlanSucceeded() && m_user_expression_sp) +        { +            lldb::addr_t function_stack_top; +            lldb::addr_t function_stack_bottom; +            lldb::addr_t function_stack_pointer = GetFunctionStackPointer(); + +            function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize(); +            function_stack_top = function_stack_pointer; +             +            StreamString  error_stream; +             +            ExecutionContext exe_ctx(GetThread()); + +            m_user_expression_sp->FinalizeJITExecution(error_stream, exe_ctx, m_result_var_sp, function_stack_bottom, function_stack_top); +        } +         +        ThreadPlan::MischiefManaged (); +        return true; +    } +    else +    { +        return false; +    }  }  StopInfoSP  | 
