void ProcessPOSIXLog::DisableLog (Args &args, Stream *feedback_strm) { LogSP log (GetLog ()); if (log) { uint32_t flag_bits = 0; const size_t argc = args.GetArgumentCount (); if (argc > 0) { flag_bits = log->GetMask().Get(); for (size_t i = 0; i < argc; ++i) { const char *arg = args.GetArgumentAtIndex (i); if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~POSIX_LOG_ALL; else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~POSIX_LOG_ASYNC; else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~POSIX_LOG_BREAKPOINTS; else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~POSIX_LOG_COMM; else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~POSIX_LOG_DEFAULT; else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~POSIX_LOG_PACKETS; else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY; else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_SHORT; else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_LONG; else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~POSIX_LOG_PROCESS; else if (::strcasecmp (arg, "ptrace") == 0 ) flag_bits &= ~POSIX_LOG_PTRACE; else if (::strcasecmp (arg, "registers") == 0 ) flag_bits &= ~POSIX_LOG_REGISTERS; else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~POSIX_LOG_STEP; else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~POSIX_LOG_THREAD; else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~POSIX_LOG_VERBOSE; else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~POSIX_LOG_WATCHPOINTS; else { feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); ListLogCategories (feedback_strm); } } } if (flag_bits == 0) GetLog ().reset(); else log->GetMask().Reset (flag_bits); } return; }
bool POSIXThread::Resume() { lldb::StateType resume_state = GetResumeState(); ProcessMonitor &monitor = GetMonitor(); bool status; LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) log->Printf ("POSIXThread::%s ()", __FUNCTION__); switch (resume_state) { default: assert(false && "Unexpected state for resume!"); status = false; break; case lldb::eStateRunning: SetState(resume_state); status = monitor.Resume(GetID(), GetResumeSignal()); break; case lldb::eStateStepping: SetState(resume_state); status = monitor.SingleStep(GetID(), GetResumeSignal()); break; } return status; }
void ProcessGDBRemoteLog::DisableLog (const char **categories, Stream *feedback_strm) { LogSP log (GetLog ()); if (log) { uint32_t flag_bits = 0; if (categories[0] != NULL) { flag_bits = log->GetMask().Get(); for (size_t i = 0; categories[i] != NULL; ++i) { const char *arg = categories[i]; if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~GDBR_LOG_ALL; else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~GDBR_LOG_ASYNC; else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~GDBR_LOG_BREAKPOINTS; else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~GDBR_LOG_COMM; else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~GDBR_LOG_DEFAULT; else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~GDBR_LOG_PACKETS; else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY; else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT; else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG; else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~GDBR_LOG_PROCESS; else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~GDBR_LOG_STEP; else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~GDBR_LOG_THREAD; else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~GDBR_LOG_VERBOSE; else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~GDBR_LOG_WATCHPOINTS; else { feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); ListLogCategories (feedback_strm); } } } if (flag_bits == 0) GetLog ().reset(); else log->GetMask().Reset (flag_bits); } return; }
POSIXThread::POSIXThread(Process &process, lldb::tid_t tid) : Thread(process, tid), m_frame_ap(0) { LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) log->Printf ("POSIXThread::%s (tid = %i)", __FUNCTION__, tid); }
void POSIXThread::RefreshStateAfterStop() { LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) log->Printf ("POSIXThread::%s ()", __FUNCTION__); // Let all threads recover from stopping and do any clean up based // on the previous thread state (if any). ProcessSP base = GetProcess(); ProcessPOSIX &process = static_cast<ProcessPOSIX&>(*base); process.GetThreadList().RefreshStateAfterStop(); }
lldb::RegisterContextSP POSIXThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) { lldb::RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) log->Printf ("POSIXThread::%s ()", __FUNCTION__); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); if (concrete_frame_idx == 0) reg_ctx_sp = GetRegisterContext(); else { assert(GetUnwinder()); reg_ctx_sp = GetUnwinder()->CreateRegisterContextForFrame(frame); } return reg_ctx_sp; }