本文整理汇总了C++中SBStream类的典型用法代码示例。如果您正苦于以下问题:C++ SBStream类的具体用法?C++ SBStream怎么用?C++ SBStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SBStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: api_locker
bool
SBBreakpoint::GetDescription (SBStream &s)
{
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
m_opaque_sp->GetResolverDescription (s.get());
m_opaque_sp->GetFilterDescription (s.get());
const size_t num_locations = m_opaque_sp->GetNumLocations ();
s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
return true;
}
s.Printf ("No value");
return false;
}
示例2: process_sp
bool
SBProcess::GetDescription (SBStream &description)
{
Stream &strm = description.ref();
ProcessSP process_sp(GetSP());
if (process_sp)
{
char path[PATH_MAX];
GetTarget().GetExecutable().GetPath (path, sizeof(path));
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
const char *exe_name = NULL;
if (exe_module)
exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
strm.Printf ("SBProcess: pid = %" PRIu64 ", state = %s, threads = %d%s%s",
process_sp->GetID(),
lldb_private::StateAsCString (GetState()),
GetNumThreads(),
exe_name ? ", executable = " : "",
exe_name ? exe_name : "");
}
else
strm.PutCString ("No value");
return true;
}
示例3:
bool
SBFunction::GetDescription (SBStream &s)
{
if (m_opaque_ptr)
{
s.Printf ("SBFunction: id = 0x%8.8x, name = %s",
m_opaque_ptr->GetID(),
m_opaque_ptr->GetName().AsCString());
Type *func_type = m_opaque_ptr->GetType();
if (func_type)
s.Printf(", type = %s", func_type->GetName().AsCString());
return true;
}
s.Printf ("No value");
return false;
}
示例4: GetDescription
bool SBBreakpointName::GetDescription(SBStream &s) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
BreakpointName *bp_name = GetBreakpointName();
if (!bp_name)
{
s.Printf("No value");
return false;
}
LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
std::lock_guard<std::recursive_mutex> guard(
m_impl_up->GetTarget()->GetAPIMutex());
bp_name->GetDescription(s.get(), eDescriptionLevelFull);
return true;
}
示例5: process_sp
size_t
SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &sb_error)
{
size_t bytes_written = 0;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ProcessSP process_sp(GetSP());
if (log)
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p))...",
static_cast<void*>(process_sp.get()), addr,
static_cast<const void*>(src),
static_cast<uint64_t>(src_len),
static_cast<void*>(sb_error.get()));
if (process_sp)
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
bytes_written = process_sp->WriteMemory (addr, src, src_len, sb_error.ref());
}
else
{
if (log)
log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running",
static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
static_cast<void*>(process_sp.get()), addr,
static_cast<const void*>(src),
static_cast<uint64_t>(src_len),
static_cast<void*>(sb_error.get()), sstr.GetData(),
static_cast<uint64_t>(bytes_written));
}
return bytes_written;
}
示例6: log
void
SBDebugger::SetSelectedTarget (SBTarget &sb_target)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_sp)
{
m_opaque_sp->GetTargetList().SetSelectedTarget (sb_target.get());
}
if (log)
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(),
sb_target.get(), sstr.GetData());
}
}
示例7: SBCommandReturnObject
lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBExecutionContext &override_context, SBCommandReturnObject &result, bool add_to_history)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
static_cast<void*>(m_opaque_ptr), command_line,
static_cast<void*>(result.get()), add_to_history);
ExecutionContext ctx, *ctx_ptr;
if (override_context.get())
{
ctx = override_context.get()->Lock(true);
ctx_ptr = &ctx;
}
else
ctx_ptr = nullptr;
result.Clear();
if (command_line && IsValid())
{
result.ref().SetInteractive(false);
m_opaque_ptr->HandleCommand (command_line, add_to_history ? eLazyBoolYes : eLazyBoolNo, result.ref(), ctx_ptr);
}
else
{
result->AppendError ("SBCommandInterpreter or the command line is not valid");
result->SetStatus (eReturnStatusFailed);
}
// We need to get the value again, in case the command disabled the log!
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
result.GetDescription (sstr);
log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p): %s, add_to_history=%i) => %i",
static_cast<void*>(m_opaque_ptr), command_line,
static_cast<void*>(result.get()), sstr.GetData(),
add_to_history, result.GetStatus());
}
return result.GetStatus();
}
示例8: GetFileSpec
SBFileSpec SBLineEntry::GetFileSpec() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->file)
sb_file_spec.SetFileSpec(m_opaque_ap->file);
if (log) {
SBStream sstr;
sb_file_spec.GetDescription(sstr);
log->Printf("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s",
static_cast<void *>(m_opaque_ap.get()),
static_cast<const void *>(sb_file_spec.get()), sstr.GetData());
}
return sb_file_spec;
}
示例9: log
size_t
SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t bytes_read = 0;
if (log)
{
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p))...",
m_opaque_sp.get(),
addr,
dst,
(uint32_t) dst_len,
sb_error.get());
}
if (m_opaque_sp)
{
Error error;
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
bytes_read = m_opaque_sp->ReadMemory (addr, dst, dst_len, error);
sb_error.SetError (error);
}
else
{
sb_error.SetErrorString ("SBProcess is invalid");
}
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p): %s) => %d",
m_opaque_sp.get(),
addr,
dst,
(uint32_t) dst_len,
sb_error.get(),
sstr.GetData(),
(uint32_t) bytes_read);
}
return bytes_read;
}
示例10: GetMemoryRegionAtIndex
bool SBMemoryRegionInfoList::GetMemoryRegionAtIndex(
uint32_t idx, SBMemoryRegionInfo ®ion_info) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info);
if (log) {
SBStream sstr;
region_info.GetDescription(sstr);
log->Printf("SBMemoryRegionInfoList::GetMemoryRegionAtIndex (this.ap=%p, "
"idx=%d) => SBMemoryRegionInfo (this.ap=%p, '%s')",
static_cast<void *>(m_opaque_ap.get()), idx,
static_cast<void *>(region_info.m_opaque_ap.get()),
sstr.GetData());
}
return result;
}
示例11:
bool
SBFileSpec::GetDescription (SBStream &description) const
{
Stream &strm = description.ref();
char path[PATH_MAX];
if (m_opaque_ap->GetPath(path, sizeof(path)))
strm.PutCString (path);
return true;
}
示例12: GetCString
bool
SBError::GetDescription (SBStream &description)
{
if (m_opaque_ap.get())
{
if (m_opaque_ap->Success())
description.Printf ("success");
else
{
const char * err_string = GetCString();
description.Printf ("error: %s", (err_string != NULL ? err_string : ""));
}
}
else
description.Printf ("error: <NULL>");
return true;
}
示例13: 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();
}
示例14: GetDescription
bool SBCompileUnit::GetDescription(SBStream &description) {
Stream &strm = description.ref();
if (m_opaque_ptr) {
m_opaque_ptr->Dump(&strm, false);
} else
strm.PutCString("No value");
return true;
}
示例15: log
SBModule
SBSymbolContext::GetModule ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBModule sb_module;
if (m_opaque_ap.get())
sb_module.SetModule(m_opaque_ap->module_sp);
if (log)
{
SBStream sstr;
sb_module.GetDescription (sstr);
log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s",
m_opaque_ap.get(), sb_module.get(), sstr.GetData());
}
return sb_module;
}