本文整理汇总了C++中SBError::SetError方法的典型用法代码示例。如果您正苦于以下问题:C++ SBError::SetError方法的具体用法?C++ SBError::SetError怎么用?C++ SBError::SetError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SBError
的用法示例。
在下文中一共展示了SBError::SetError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: value_sp
lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
SBWatchpoint sb_watchpoint;
// If the SBValue is not valid, there's no point in even trying to watch it.
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
TargetSP target_sp (GetTarget().GetSP());
if (value_sp && target_sp)
{
// Read and Write cannot both be false.
if (!read && !write)
return sb_watchpoint;
// If the value is not in scope, don't try and watch and invalid value
if (!IsInScope())
return sb_watchpoint;
addr_t addr = GetLoadAddress();
if (addr == LLDB_INVALID_ADDRESS)
return sb_watchpoint;
size_t byte_size = GetByteSize();
if (byte_size == 0)
return sb_watchpoint;
uint32_t watch_type = 0;
if (read)
watch_type |= LLDB_WATCH_TYPE_READ;
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
Error rc;
ClangASTType type (value_sp->GetClangType());
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
error.SetError(rc);
if (watchpoint_sp)
{
sb_watchpoint.SetSP (watchpoint_sp);
Declaration decl;
if (value_sp->GetDeclaration (decl))
{
if (decl.GetFile())
{
StreamString ss;
// True to show fullpath for declaration file.
decl.DumpStopContext(&ss, true);
watchpoint_sp->SetDeclInfo(ss.GetString());
}
}
}
}
else if (target_sp)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", value_sp.get(), locker.GetError().AsCString());
error.SetErrorStringWithFormat("could not get SBValue: %s", locker.GetError().AsCString());
}
else
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", value_sp.get());
error.SetErrorString("could not set watchpoint, a target is required");
}
return sb_watchpoint;
}