当前位置: 首页>>代码示例>>C++>>正文


C++ SBStream::RedirectToFileHandle方法代码示例

本文整理汇总了C++中SBStream::RedirectToFileHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ SBStream::RedirectToFileHandle方法的具体用法?C++ SBStream::RedirectToFileHandle怎么用?C++ SBStream::RedirectToFileHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SBStream的用法示例。


在下文中一共展示了SBStream::RedirectToFileHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: thread

void
TestCase::Loop ()
{
	while (true)
	{
        bool call_test_step = false;
        if (m_process.IsValid())
        {
            SBEvent evt;
            m_listener.WaitForEvent (UINT32_MAX, evt);
            StateType state = SBProcess::GetStateFromEvent (evt);
            if (m_verbose)
                printf("event = %s\n",SBDebugger::StateAsCString(state));
            if (SBProcess::GetRestartedFromEvent(evt))
            {
                if (m_verbose)
                {
                    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));
                        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++)
                        {
                            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");
//.........这里部分代码省略.........
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:101,代码来源:TestCase.cpp


注:本文中的SBStream::RedirectToFileHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。