本文整理汇总了C++中SBStream::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ SBStream::GetData方法的具体用法?C++ SBStream::GetData怎么用?C++ SBStream::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SBStream
的用法示例。
在下文中一共展示了SBStream::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SBTarget
SBTarget
SBDebugger::GetSelectedTarget ()
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBTarget sb_target;
TargetSP target_sp;
if (m_opaque_sp)
{
// No need to lock, the target list is thread safe
target_sp = m_opaque_sp->GetTargetList().GetSelectedTarget ();
sb_target.SetSP (target_sp);
}
if (log)
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
static_cast<void*>(m_opaque_sp.get()),
static_cast<void*>(target_sp.get()), sstr.GetData());
}
return sb_target;
}
示例2: process_sp
bool
SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
{
ProcessSP process_sp(GetSP());
if (process_sp)
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() == eStateConnected)
{
ProcessAttachInfo attach_info;
attach_info.SetProcessID (pid);
error.SetError (process_sp->Attach (attach_info));
}
else
{
error.SetErrorString ("must be in eStateConnected to call RemoteAttachToProcessWithID");
}
}
else
{
error.SetErrorString ("unable to attach pid");
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log) {
SBStream sstr;
error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s",
static_cast<void*>(process_sp.get()), pid,
static_cast<void*>(error.get()), sstr.GetData());
}
return error.Success();
}
示例3: SBLineEntry
SBLineEntry
SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
if (m_opaque_ptr)
{
LineTable *line_table = m_opaque_ptr->GetLineTable ();
if (line_table)
{
LineEntry line_entry;
if (line_table->GetLineEntryAtIndex(idx, line_entry))
sb_line_entry.SetLineEntry(line_entry);
}
}
if (log)
{
SBStream sstr;
sb_line_entry.GetDescription (sstr);
log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'",
static_cast<void*>(m_opaque_ptr), idx,
static_cast<void*>(sb_line_entry.get()), sstr.GetData());
}
return sb_line_entry;
}
示例4: api_locker
SBError
SBProcess::Kill ()
{
SBError sb_error;
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
sb_error.SetError (m_opaque_sp->Destroy());
}
else
sb_error.SetErrorString ("SBProcess is invalid");
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s",
m_opaque_sp.get(),
sb_error.get(),
sstr.GetData());
}
return sb_error;
}
示例5: process_sp
SBError
SBProcess::Signal (int signo)
{
SBError sb_error;
ProcessSP process_sp(GetSP());
if (process_sp)
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->Signal (signo));
}
else
sb_error.SetErrorString ("SBProcess is invalid");
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s",
process_sp.get(),
signo,
sb_error.get(),
sstr.GetData());
}
return sb_error;
}
示例6: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
// send process description
SBProcess process = SBProcess::GetProcessFromEvent(event);
SBStream description;
for (int i = 0; i < process.GetNumThreads(); ++i) {
// send each thread description
description.Clear();
SBThread thread = process.GetThreadAtIndex(i);
thread.GetDescription(description);
g_thread_descriptions.push(description.GetData());
// send each frame function name
uint32_t num_frames = thread.GetNumFrames();
for(int j = 0; j < num_frames; ++j) {
const char* function_name = thread.GetFrameAtIndex(j).GetSymbol().GetName();
if (function_name)
g_frame_functions.push(function_name);
}
}
}
}
}
示例7: SBFileSpec
SBFileSpec
SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFileSpec sb_file_spec;
if (m_opaque_ptr)
{
FileSpecList &support_files = m_opaque_ptr->GetSupportFiles ();
FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
sb_file_spec.SetFileSpec(file_spec);
}
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
static_cast<void*>(m_opaque_ptr), idx,
static_cast<const void*>(sb_file_spec.get()),
sstr.GetData());
}
return sb_file_spec;
}
示例8: SBCommandReturnObject
void
SBCommandInterpreter::HandleCommandsFromFile (lldb::SBFileSpec &file,
lldb::SBExecutionContext &override_context,
lldb::SBCommandInterpreterRunOptions &options,
lldb::SBCommandReturnObject result)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream s;
file.GetDescription (s);
log->Printf ("SBCommandInterpreter(%p)::HandleCommandsFromFile (file=\"%s\", SBCommandReturnObject(%p))",
static_cast<void*>(m_opaque_ptr), s.GetData(),
static_cast<void*>(result.get()));
}
if (!IsValid())
{
result->AppendError ("SBCommandInterpreter is not valid.");
result->SetStatus (eReturnStatusFailed);
return;
}
if (!file.IsValid())
{
SBStream s;
file.GetDescription (s);
result->AppendErrorWithFormat ("File is not valid: %s.", s.GetData());
result->SetStatus (eReturnStatusFailed);
}
FileSpec tmp_spec = file.ref();
ExecutionContext ctx, *ctx_ptr;
if (override_context.get())
{
ctx = override_context.get()->Lock(true);
ctx_ptr = &ctx;
}
else
ctx_ptr = nullptr;
m_opaque_ptr->HandleCommandsFromFile (tmp_spec, ctx_ptr, options.ref(), result.ref());
}
示例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;
ProcessSP process_sp(GetSP());
if (log)
{
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p))...",
process_sp.get(),
addr,
dst,
dst_len,
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_read = process_sp->ReadMemory (addr, dst, dst_len, sb_error.ref());
}
else
{
if (log)
log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
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) => %zu",
process_sp.get(),
addr,
dst,
dst_len,
sb_error.get(),
sstr.GetData(),
bytes_read);
}
return bytes_read;
}
示例10: GetInfoItemByPathAsString
bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
bool success = false;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope()) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
Thread *thread = exe_ctx.GetThreadPtr();
StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
if (info_root_sp) {
StructuredData::ObjectSP node =
info_root_sp->GetObjectForDotSeparatedPath(path);
if (node) {
if (node->GetType() == eStructuredDataTypeString) {
strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
success = true;
}
if (node->GetType() == eStructuredDataTypeInteger) {
strm.Printf("0x%" PRIx64, node->GetAsInteger()->GetValue());
success = true;
}
if (node->GetType() == eStructuredDataTypeFloat) {
strm.Printf("0x%f", node->GetAsFloat()->GetValue());
success = true;
}
if (node->GetType() == eStructuredDataTypeBoolean) {
if (node->GetAsBoolean()->GetValue() == true)
strm.Printf("true");
else
strm.Printf("false");
success = true;
}
if (node->GetType() == eStructuredDataTypeNull) {
strm.Printf("null");
success = true;
}
}
}
} else {
if (log)
log->Printf("SBThread(%p)::GetInfoItemByPathAsString() => error: "
"process is running",
static_cast<void *>(exe_ctx.GetThreadPtr()));
}
}
if (log)
log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());
return success;
}
示例11: GetDescription
SBWatchpoint::SBWatchpoint(const lldb::WatchpointSP &wp_sp)
: m_opaque_sp(wp_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (log) {
SBStream sstr;
GetDescription(sstr, lldb::eDescriptionLevelBrief);
log->Printf("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp"
"=%p) => this.sp = %p (%s)",
static_cast<void *>(wp_sp.get()),
static_cast<void *>(m_opaque_sp.get()), sstr.GetData());
}
}
示例12: log
SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) :
m_opaque_sp (lldb_object_sp)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData());
}
}
示例13: listener_func
void listener_func() {
while (!g_done) {
SBEvent event;
bool got_event = g_listener.WaitForEvent(1, event);
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
SBStream description;
event.GetDescription(description);
string str(description.GetData());
g_event_descriptions.push(str);
}
}
}
示例14: log
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
m_opaque_ap()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (rhs.m_opaque_ap.get())
m_opaque_ap.reset (new FileSpec (rhs.get()));
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => SBFileSpec(%p): %s",
rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData());
}
}
示例15: 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());
}
}