本文整理汇总了C++中Log::Printf方法的典型用法代码示例。如果您正苦于以下问题:C++ Log::Printf方法的具体用法?C++ Log::Printf怎么用?C++ Log::Printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
POSIXThread::CrashNotify(const ProcessMessage &message)
{
// FIXME: Update stop reason as per bugzilla 14598
int signo = message.GetSignal();
assert(message.GetKind() == ProcessMessage::eCrashMessage);
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s () signo = %i, reason = '%s'",
__FUNCTION__, signo, message.PrintCrashReason());
SetStopInfo (lldb::StopInfoSP(new POSIXCrashStopInfo(*this, signo,
message.GetCrashReason(),
message.GetFaultAddress())));
SetResumeSignal(signo);
}
示例2:
void
ProcessKDP::DidAttach (ArchSpec &process_arch)
{
Process::DidAttach(process_arch);
Log *log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS));
if (log)
log->Printf ("ProcessKDP::DidAttach()");
if (GetID() != LLDB_INVALID_PROCESS_ID)
{
uint32_t cpu = m_comm.GetCPUType();
if (cpu)
{
uint32_t sub = m_comm.GetCPUSubtype();
process_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
}
}
}
示例3:
bool
ThreadPlanCallFunction::MischiefManaged ()
{
if (IsPlanComplete())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("Completed call function plan.");
ThreadPlan::MischiefManaged ();
return true;
}
else
{
return false;
}
}
示例4: strerror
void
ResumeOperation::Execute(ProcessMonitor *monitor)
{
int data = 0;
if (m_signo != LLDB_INVALID_SIGNAL_NUMBER)
data = m_signo;
if (PTRACE(PT_CONTINUE, m_tid, (caddr_t)1, data))
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
if (log)
log->Printf ("ResumeOperation (%" PRIu64 ") failed: %s", m_tid, strerror(errno));
m_result = false;
}
else
m_result = true;
}
示例5: thread
void
NativeThreadLinux::MaybeLogStateChange (lldb::StateType new_state)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
// If we're not logging, we're done.
if (!log)
return;
// If this is a state change to the same state, we're done.
lldb::StateType old_state = m_state;
if (new_state == old_state)
return;
NativeProcessProtocolSP m_process_sp = m_process_wp.lock ();
lldb::pid_t pid = m_process_sp ? m_process_sp->GetID () : LLDB_INVALID_PROCESS_ID;
// Log it.
log->Printf ("NativeThreadLinux: thread (pid=%" PRIu64 ", tid=%" PRIu64 ") changing from state %s to %s", pid, GetID (), StateAsCString (old_state), StateAsCString (new_state));
}
示例6: SBDebugger
void
SBDebugger::Destroy (SBDebugger &debugger)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s",
static_cast<void*>(debugger.m_opaque_sp.get()),
sstr.GetData());
}
Debugger::Destroy (debugger.m_opaque_sp);
if (debugger.m_opaque_sp.get() != NULL)
debugger.m_opaque_sp.reset();
}
示例7: DisableAllBreakpointSites
Error
ProcessKDP::DoDetach(bool keep_stopped)
{
Error error;
Log *log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
if (log)
log->Printf ("ProcessKDP::DoDetach(keep_stopped = %i)", keep_stopped);
if (m_comm.IsRunning())
{
// We are running and we can't interrupt a running kernel, so we need
// to just close the connection to the kernel and hope for the best
}
else
{
DisableAllBreakpointSites ();
m_thread_list.DiscardThreadPlans();
// If we are going to keep the target stopped, then don't send the disconnect message.
if (!keep_stopped && m_comm.IsConnected())
{
const bool success = m_comm.SendRequestDisconnect();
if (log)
{
if (success)
log->PutCString ("ProcessKDP::DoDetach() detach packet sent successfully");
else
log->PutCString ("ProcessKDP::DoDetach() connection channel shutdown failed");
}
m_comm.Disconnect ();
}
}
StopAsyncThread ();
m_comm.Clear();
SetPrivateState (eStateDetached);
ResumePrivateStateThread();
//KillDebugserverProcess ();
return error;
}
示例8: locker
bool
AllocatedMemoryCache::DeallocateMemory (lldb::addr_t addr)
{
Mutex::Locker locker (m_mutex);
PermissionsToBlockMap::iterator pos, end = m_memory_map.end();
bool success = false;
for (pos = m_memory_map.begin(); pos != end; ++pos)
{
if (pos->second->Contains (addr))
{
success = pos->second->FreeBlock (addr);
break;
}
}
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64 ") => %i", (uint64_t)addr, success);
return success;
}
示例9: err
int32_t
ThreadMacOSX::Resume()
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log && log->GetMask().IsSet(PD_LOG_VERBOSE))
log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__);
lldb::tid_t tid = GetID ();
if (ThreadIDIsValid(tid))
{
while (m_suspend_count > 0)
{
Error err(::thread_resume (tid), eErrorTypeMachKernel);
if (err.Success())
m_suspend_count--;
if (log || err.Fail())
err.PutToLog(log, "::thread_resume (%4.4x)", tid);
}
}
return GetSuspendCount();
}
示例10:
Error
NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
const char* reg_name,
uint32_t size,
RegisterValue &value)
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
long data;
Error error = NativeProcessLinux::PtraceWrapper(
PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), nullptr, 0, &data);
if (error.Success())
// First cast to an unsigned of the same size to avoid sign extension.
value.SetUInt64(static_cast<unsigned long>(data));
if (log)
log->Printf ("NativeRegisterContextLinux::%s() reg %s: 0x%lx", __FUNCTION__, reg_name, data);
return error;
}
示例11: switch
bool
NativeThreadLinux::GetStopReason (ThreadStopInfo &stop_info, std::string& description)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
description.clear();
switch (m_state)
{
case eStateStopped:
case eStateCrashed:
case eStateExited:
case eStateSuspended:
case eStateUnloaded:
if (log)
LogThreadStopInfo (*log, m_stop_info, "m_stop_info in thread:");
stop_info = m_stop_info;
description = m_stop_description;
if (log)
LogThreadStopInfo (*log, stop_info, "returned stop_info:");
return true;
case eStateInvalid:
case eStateConnected:
case eStateAttaching:
case eStateLaunching:
case eStateRunning:
case eStateStepping:
case eStateDetached:
if (log)
{
log->Printf ("NativeThreadLinux::%s tid %" PRIu64 " in state %s cannot answer stop reason",
__FUNCTION__, GetID (), StateAsCString (m_state));
}
return false;
}
llvm_unreachable("unhandled StateType!");
}
示例12: Thread
POSIXThread::POSIXThread(Process &process, lldb::tid_t tid)
: Thread(process, tid),
m_frame_ap()
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
log->Printf ("POSIXThread::%s (tid = %" PRIi64 ")", __FUNCTION__, tid);
// Set the current watchpoints for this thread.
Target &target = GetProcess()->GetTarget();
const WatchpointList &wp_list = target.GetWatchpointList();
size_t wp_size = wp_list.GetSize();
for (uint32_t wp_idx = 0; wp_idx < wp_size; wp_idx++)
{
lldb::WatchpointSP wp = wp_list.GetByIndex(wp_idx);
if (wp.get() && wp->IsEnabled())
{
assert(EnableHardwareWatchpoint(wp.get()));
}
}
}
示例13: bp_site
void
POSIXThread::BreakNotify(const ProcessMessage &message)
{
bool status;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
assert(GetRegisterContext());
status = GetPOSIXBreakpointProtocol()->UpdateAfterBreakpoint();
assert(status && "Breakpoint update failed!");
// With our register state restored, resolve the breakpoint object
// corresponding to our current PC.
assert(GetRegisterContext());
lldb::addr_t pc = GetRegisterContext()->GetPC();
if (log)
log->Printf ("POSIXThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
lldb::BreakpointSiteSP bp_site(GetProcess()->GetBreakpointSiteList().FindByAddress(pc));
// If the breakpoint is for this thread, then we'll report the hit, but if it is for another thread,
// we create a stop reason with should_stop=false. If there is no breakpoint location, then report
// an invalid stop reason. We don't need to worry about stepping over the breakpoint here, that will
// be taken care of when the thread resumes and notices that there's a breakpoint under the pc.
if (bp_site)
{
lldb::break_id_t bp_id = bp_site->GetID();
// If we have an operating system plug-in, we might have set a thread specific breakpoint using the
// operating system thread ID, so we can't make any assumptions about the thread ID so we must always
// report the breakpoint regardless of the thread.
if (bp_site->ValidForThisThread(this) || GetProcess()->GetOperatingSystem () != NULL)
SetStopInfo (StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id));
else
{
const bool should_stop = false;
SetStopInfo (StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id, should_stop));
}
}
else
SetStopInfo(StopInfoSP());
}
示例14: UpdateSDKDirectoryInfosIfNeeded
uint32_t
PlatformRemoteAppleWatch::FindFileInAllSDKs(const char *platform_file_path,
FileSpecList &file_list) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
LIBLLDB_LOG_VERBOSE);
if (platform_file_path && platform_file_path[0] &&
UpdateSDKDirectoryInfosIfNeeded()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
lldb_private::FileSpec local_file;
// First try for an exact match of major, minor and update
for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
if (log) {
log->Printf("Searching for %s in sdk path %s", platform_file_path,
m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
}
if (GetFileInSDK(platform_file_path, sdk_idx, local_file)) {
file_list.Append(local_file);
}
}
}
return file_list.GetSize();
}
示例15: GetRegisterContext
// Overridden by FreeBSDThread; this is used only on Linux.
void
POSIXThread::RefreshStateAfterStop()
{
// Invalidate all registers in our register context. We don't set "force" to
// true because the stop reply packet might have had some register values
// that were expedited and these will already be copied into the register
// context by the time this function gets called. The KDPRegisterContext
// class has been made smart enough to detect when it needs to invalidate
// which registers are valid by putting hooks in the register read and
// register supply functions where they check the process stop ID and do
// the right thing.
//if (StateIsStoppedState(GetState())
{
const bool force = false;
GetRegisterContext()->InvalidateIfNeeded (force);
}
// FIXME: This should probably happen somewhere else.
SetResumeState(eStateRunning, true);
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s (tid = %" PRIi64 ") setting thread resume state to running", __FUNCTION__, GetID());
}