本文整理汇总了C++中LogSP类的典型用法代码示例。如果您正苦于以下问题:C++ LogSP类的具体用法?C++ LogSP怎么用?C++ LogSP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogSP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log
AllocatedMemoryCache::AllocatedBlockSP
AllocatedMemoryCache::AllocatePage (uint32_t byte_size,
uint32_t permissions,
uint32_t chunk_size,
Error &error)
{
AllocatedBlockSP block_sp;
const size_t page_size = 4096;
const size_t num_pages = (byte_size + page_size - 1) / page_size;
const size_t page_byte_size = num_pages * page_size;
addr_t addr = m_process.DoAllocateMemory(page_byte_size, permissions, error);
LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
{
log->Printf ("Process::DoAllocateMemory (byte_size = 0x%8.8zx, permissions = %s) => 0x%16.16llx",
page_byte_size,
GetPermissionsAsCString(permissions),
(uint64_t)addr);
}
if (addr != LLDB_INVALID_ADDRESS)
{
block_sp.reset (new AllocatedBlock (addr, page_byte_size, permissions, chunk_size));
m_memory_map.insert (std::make_pair (permissions, block_sp));
}
return block_sp;
}
示例2: log
void
POSIXThread::BreakNotify(const ProcessMessage &message)
{
bool status;
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
assert(GetRegisterContext());
status = GetRegisterContextPOSIX()->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.8llx", __FUNCTION__, pc);
lldb::BreakpointSiteSP bp_site(GetProcess()->GetBreakpointSiteList().FindByAddress(pc));
assert(bp_site);
lldb::break_id_t bp_id = bp_site->GetID();
assert(bp_site && bp_site->ValidForThisThread(this));
m_breakpoint = bp_site;
m_stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id);
}
示例3: scoped_timer
void
DWARFDebugAranges::Sort (bool minimize)
{
Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p",
__PRETTY_FUNCTION__, this);
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
size_t orig_arange_size = 0;
if (log)
{
orig_arange_size = m_aranges.GetSize();
log->Printf ("DWARFDebugAranges::Sort(minimize = %u) with %zu entries", minimize, orig_arange_size);
}
m_aranges.Sort();
m_aranges.CombineConsecutiveEntriesWithEqualData();
if (log)
{
if (minimize)
{
const size_t new_arange_size = m_aranges.GetSize();
const size_t delta = orig_arange_size - new_arange_size;
log->Printf ("DWARFDebugAranges::Sort() %zu entries after minimizing (%zu entries combined for %zu bytes saved)",
new_arange_size, delta, delta * sizeof(Range));
}
Dump (log.get());
}
}
示例4: locker
lldb::addr_t
AllocatedMemoryCache::AllocateMemory (size_t byte_size,
uint32_t permissions,
Error &error)
{
Mutex::Locker locker (m_mutex);
addr_t addr = LLDB_INVALID_ADDRESS;
std::pair<PermissionsToBlockMap::iterator, PermissionsToBlockMap::iterator> range = m_memory_map.equal_range (permissions);
for (PermissionsToBlockMap::iterator pos = range.first; pos != range.second; ++pos)
{
addr = (*pos).second->ReserveBlock (byte_size);
}
if (addr == LLDB_INVALID_ADDRESS)
{
AllocatedBlockSP block_sp (AllocatePage (byte_size, permissions, 16, error));
if (block_sp)
addr = block_sp->ReserveBlock (byte_size);
}
LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8zx, permissions = %s) => 0x%16.16llx", byte_size, GetPermissionsAsCString(permissions), (uint64_t)addr);
return addr;
}
示例5: InvokeCallback
bool
BreakpointLocation::ShouldStop (StoppointCallbackContext *context)
{
bool should_stop = true;
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
m_hit_count++;
if (!IsEnabled())
return false;
if (m_hit_count <= GetIgnoreCount())
return false;
// We only run synchronous callbacks in ShouldStop:
context->is_synchronous = true;
should_stop = InvokeCallback (context);
if (log)
{
StreamString s;
GetDescription (&s, lldb::eDescriptionLevelVerbose);
log->Printf ("Hit breakpoint location: %s, %s.\n", s.GetData(), should_stop ? "stopping" : "continuing");
}
return should_stop;
}
示例6: this_sp
bool
BreakpointLocation::ResolveBreakpointSite ()
{
if (m_bp_site_sp)
return true;
Process *process = m_owner.GetTarget().GetProcessSP().get();
if (process == NULL)
return false;
if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
return false;
BreakpointLocationSP this_sp(this);
lldb::break_id_t new_id = process->CreateBreakpointSite (this_sp, false);
if (new_id == LLDB_INVALID_BREAK_ID)
{
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
if (log)
log->Warning ("Tried to add breakpoint site at 0x%llx but it was already present.\n",
m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()));
return false;
}
return true;
}
示例7: GetResumeState
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;
}
示例8: scoped_timer
bool
DWARFDebugPubnames::Extract(const DataExtractor& data)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"DWARFDebugPubnames::Extract (byte_size = %zu)",
data.GetByteSize());
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
if (log)
log->Printf("DWARFDebugPubnames::Extract (byte_size = %zu)", data.GetByteSize());
if (data.ValidOffset(0))
{
uint32_t offset = 0;
DWARFDebugPubnamesSet set;
while (data.ValidOffset(offset))
{
if (set.Extract(data, &offset))
{
m_sets.push_back(set);
offset = set.GetOffsetOfNextEntry();
}
else
break;
}
if (log)
Dump (log.get());
return true;
}
return false;
}
示例9: Thread
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);
}
示例10: log
void
ProcessKDPLog::LogIf (uint32_t mask, const char *format, ...)
{
LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (mask));
if (log)
{
va_list args;
va_start (args, format);
log->VAPrintf (format, args);
va_end (args);
}
}
示例11: log
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;
}
示例12: SetError
kern_return_t
RegisterContextMach_x86_64::ReadGPR (bool force)
{
int set = GPRRegSet;
if (force || !RegisterSetIsCached(set))
{
mach_msg_type_number_t count = GPRWordCount;
SetError(GPRRegSet, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count));
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
if (log)
LogGPR (log.get(), "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID());
}
return GetError(GPRRegSet, Read);
}
示例13: assert
void
POSIXThread::CrashNotify(const ProcessMessage &message)
{
int signo = message.GetSignal();
assert(message.GetKind() == ProcessMessage::eCrashMessage);
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf ("POSIXThread::%s () signo = %i, reason = '%s'", __FUNCTION__, signo, message.PrintCrashReason());
m_stop_info = lldb::StopInfoSP(new POSIXCrashStopInfo(
*this, signo, message.GetCrashReason()));
SetResumeSignal(signo);
}
示例14: log
void
RegisterContext_i386::LogGPR(const char *title)
{
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
if (log)
{
if (title)
log->Printf ("%s", title);
for (uint32_t i=0; i<k_num_gpr_registers; i++)
{
uint32_t reg = gpr_eax + i;
log->Printf("%12s = 0x%8.8x", g_register_infos[reg].name, (&user.regs)[reg]);
}
}
}
示例15: log
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;
}