diff options
author | Greg Clayton <gclayton@apple.com> | 2014-02-27 21:35:49 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-02-27 21:35:49 +0000 |
commit | 46822c7c720d76cfd85c8a18a50d0b9a1e334722 (patch) | |
tree | efeb9d4fa4ae9d597a6a4e75b6bcd95e9daf66e2 /lldb/tools/lldb-perf/lib | |
parent | 4e764b4cb1de49d6b01c4a161f4058481edc8c8c (diff) | |
download | bcm5719-llvm-46822c7c720d76cfd85c8a18a50d0b9a1e334722.tar.gz bcm5719-llvm-46822c7c720d76cfd85c8a18a50d0b9a1e334722.zip |
Fixed the lldb_perf_clang.cpp test case to be able to run correctly.
1 - There were some outdated options being passed to clang
2 - There were some bad paths being passed as options
3 - The path to the main.cpp file ("/tmp/main.cpp") was wrong when the tests were being run, now we create a temp file
4 - Added a new ActionType::eNone to do nothing (no continue, step, or kill)
llvm-svn: 202431
Diffstat (limited to 'lldb/tools/lldb-perf/lib')
-rw-r--r-- | lldb/tools/lldb-perf/lib/TestCase.cpp | 195 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/TestCase.h | 8 |
2 files changed, 119 insertions, 84 deletions
diff --git a/lldb/tools/lldb-perf/lib/TestCase.cpp b/lldb/tools/lldb-perf/lib/TestCase.cpp index 9d58fa2061d..f0c4528351a 100644 --- a/lldb/tools/lldb-perf/lib/TestCase.cpp +++ b/lldb/tools/lldb-perf/lib/TestCase.cpp @@ -152,101 +152,125 @@ TestCase::Loop () if (m_verbose) printf("event = %s\n",SBDebugger::StateAsCString(state)); if (SBProcess::GetRestartedFromEvent(evt)) - continue; - switch (state) { - case eStateInvalid: - case eStateDetached: - case eStateCrashed: - case eStateUnloaded: - break; - case eStateExited: - return; - case eStateConnected: - case eStateAttaching: - case eStateLaunching: - case eStateRunning: - case eStateStepping: - continue; - case eStateStopped: - case eStateSuspended: + if (m_verbose) { - call_test_step = true; - bool fatal = false; - bool selected_thread = false; - for (auto thread_index = 0; thread_index < m_process.GetNumThreads(); thread_index++) + const uint32_t num_threads = m_process.GetNumThreads(); + for (auto thread_index = 0; thread_index < num_threads; thread_index++) { SBThread thread(m_process.GetThreadAtIndex(thread_index)); SBFrame frame(thread.GetFrameAtIndex(0)); - bool select_thread = false; - StopReason stop_reason = thread.GetStopReason(); - if (m_verbose) printf("tid = 0x%llx pc = 0x%llx ",thread.GetThreadID(),frame.GetPC()); - switch (stop_reason) + SBStream strm; + strm.RedirectToFileHandle(stdout, false); + frame.GetDescription(strm); + } + puts("restarted"); + } + call_test_step = false; + } + else + { + switch (state) + { + case eStateInvalid: + case eStateDetached: + case eStateCrashed: + case eStateUnloaded: + break; + case eStateExited: + return; + case eStateConnected: + case eStateAttaching: + case eStateLaunching: + case eStateRunning: + case eStateStepping: + call_test_step = false; + break; + + case eStateStopped: + case eStateSuspended: + { + call_test_step = true; + bool fatal = false; + bool selected_thread = false; + const uint32_t num_threads = m_process.GetNumThreads(); + for (auto thread_index = 0; thread_index < num_threads; thread_index++) { - case eStopReasonNone: - if (m_verbose) - printf("none\n"); - break; - - case eStopReasonTrace: - select_thread = true; - if (m_verbose) - printf("trace\n"); - break; - - case eStopReasonPlanComplete: - select_thread = true; - if (m_verbose) - printf("plan complete\n"); - break; - case eStopReasonThreadExiting: - if (m_verbose) - printf("thread exiting\n"); - break; - case eStopReasonExec: - if (m_verbose) - printf("exec\n"); - break; - case eStopReasonInvalid: - if (m_verbose) - printf("invalid\n"); - break; - case eStopReasonException: - select_thread = true; - if (m_verbose) - printf("exception\n"); - fatal = true; - break; - case eStopReasonBreakpoint: - select_thread = true; - if (m_verbose) - printf("breakpoint id = %lld.%lld\n",thread.GetStopReasonDataAtIndex(0),thread.GetStopReasonDataAtIndex(1)); - break; - case eStopReasonWatchpoint: - select_thread = true; - if (m_verbose) - printf("watchpoint id = %lld\n",thread.GetStopReasonDataAtIndex(0)); - break; - case eStopReasonSignal: - select_thread = true; - if (m_verbose) - printf("signal %d\n",(int)thread.GetStopReasonDataAtIndex(0)); - break; + SBThread thread(m_process.GetThreadAtIndex(thread_index)); + SBFrame frame(thread.GetFrameAtIndex(0)); + SBStream strm; + strm.RedirectToFileHandle(stdout, false); + frame.GetDescription(strm); + bool select_thread = false; + StopReason stop_reason = thread.GetStopReason(); + if (m_verbose) printf("tid = 0x%llx pc = 0x%llx ",thread.GetThreadID(),frame.GetPC()); + switch (stop_reason) + { + case eStopReasonNone: + if (m_verbose) + printf("none\n"); + break; + + case eStopReasonTrace: + select_thread = true; + if (m_verbose) + printf("trace\n"); + break; + + case eStopReasonPlanComplete: + select_thread = true; + if (m_verbose) + printf("plan complete\n"); + break; + case eStopReasonThreadExiting: + if (m_verbose) + printf("thread exiting\n"); + break; + case eStopReasonExec: + if (m_verbose) + printf("exec\n"); + break; + case eStopReasonInvalid: + if (m_verbose) + printf("invalid\n"); + break; + case eStopReasonException: + select_thread = true; + if (m_verbose) + printf("exception\n"); + fatal = true; + break; + case eStopReasonBreakpoint: + select_thread = true; + if (m_verbose) + printf("breakpoint id = %lld.%lld\n",thread.GetStopReasonDataAtIndex(0),thread.GetStopReasonDataAtIndex(1)); + break; + case eStopReasonWatchpoint: + select_thread = true; + if (m_verbose) + printf("watchpoint id = %lld\n",thread.GetStopReasonDataAtIndex(0)); + break; + case eStopReasonSignal: + select_thread = true; + if (m_verbose) + printf("signal %d\n",(int)thread.GetStopReasonDataAtIndex(0)); + break; + } + if (select_thread && !selected_thread) + { + m_thread = thread; + selected_thread = m_process.SetSelectedThread(thread); + } } - if (select_thread && !selected_thread) + if (fatal) { - m_thread = thread; - selected_thread = m_process.SetSelectedThread(thread); + if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true); + exit(1); } } - if (fatal) - { - if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true); - exit(1); - } + break; } - break; - } + } } else { @@ -264,6 +288,9 @@ TestCase::Loop () SBError err; switch (action.type) { + case ActionWanted::Type::eNone: + // Just exit and wait for the next event + break; case ActionWanted::Type::eContinue: err = m_process.Continue(); break; diff --git a/lldb/tools/lldb-perf/lib/TestCase.h b/lldb/tools/lldb-perf/lib/TestCase.h index e882ff3c9b3..811d0432b58 100644 --- a/lldb/tools/lldb-perf/lib/TestCase.h +++ b/lldb/tools/lldb-perf/lib/TestCase.h @@ -32,6 +32,7 @@ public: eStepOut, eRelaunch, eCallNext, + eNone, eKill } type; lldb::SBThread thread; @@ -45,6 +46,13 @@ public: } void + None () + { + type = Type::eNone; + thread = lldb::SBThread(); + } + + void Continue() { type = Type::eContinue; |