Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.
To avoid this we now create instances of the lldb_private::Debugger that each
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack
So now clients should call:
SBDebugger::Initialize(); // (static function)
SBDebugger debugger (SBDebugger::Create());
// Use which ever file handles you wish
debugger.SetErrorFileHandle (stderr, false);
debugger.SetOutputFileHandle (stdout, false);
debugger.SetInputFileHandle (stdin, true);
// main loop
SBDebugger::Terminate(); // (static function)
SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.
Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106615 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 482ecec..c93b46b 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -15,22 +15,22 @@
SBAddress::SBAddress () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::Address(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
}
SBAddress::SBAddress (const SBAddress &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::Address(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
}
SBAddress::~SBAddress ()
@@ -43,7 +43,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::Address(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -51,7 +51,7 @@
bool
SBAddress::IsValid () const
{
- return m_lldb_object_ap.get() != NULL && m_lldb_object_ap->IsValid();
+ return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
}
void
@@ -59,21 +59,21 @@
{
if (lldb_object_ptr)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *lldb_object_ptr;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *lldb_object_ptr;
else
- m_lldb_object_ap.reset (new lldb_private::Address(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
return;
}
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
lldb::addr_t
SBAddress::GetFileAddress () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetFileAddress();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetFileAddress();
else
return LLDB_INVALID_ADDRESS;
}
@@ -81,8 +81,8 @@
lldb::addr_t
SBAddress::GetLoadAddress (const SBProcess &process) const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetLoadAddress(process.get());
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetLoadAddress(process.get());
else
return LLDB_INVALID_ADDRESS;
}
@@ -90,12 +90,12 @@
bool
SBAddress::OffsetAddress (addr_t offset)
{
- if (m_lldb_object_ap.get())
+ if (m_opaque_ap.get())
{
- addr_t addr_offset = m_lldb_object_ap->GetOffset();
+ addr_t addr_offset = m_opaque_ap->GetOffset();
if (addr_offset != LLDB_INVALID_ADDRESS)
{
- m_lldb_object_ap->SetOffset(addr_offset + offset);
+ m_opaque_ap->SetOffset(addr_offset + offset);
return true;
}
}
@@ -106,13 +106,13 @@
const lldb_private::Address *
SBAddress::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::Address &
SBAddress::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
diff --git a/source/API/SBBlock.cpp b/source/API/SBBlock.cpp
index 536febd..2ca8e76 100644
--- a/source/API/SBBlock.cpp
+++ b/source/API/SBBlock.cpp
@@ -14,24 +14,24 @@
SBBlock::SBBlock () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBBlock::SBBlock (lldb_private::Block *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBBlock::~SBBlock ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBBlock::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
void
@@ -39,7 +39,7 @@
{
if (IsValid())
{
- m_lldb_object_ptr->AppendVariables (can_create, get_parent_variables, var_list);
+ m_opaque_ptr->AppendVariables (can_create, get_parent_variables, var_list);
}
}
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index ad636f3..f90d7ad 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -62,18 +62,18 @@
SBBreakpoint::SBBreakpoint () :
- m_break_sp ()
+ m_opaque_sp ()
{
}
SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) :
- m_break_sp (rhs.m_break_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) :
- m_break_sp (bp_sp)
+ m_opaque_sp (bp_sp)
{
}
@@ -86,7 +86,7 @@
{
if (this != &rhs)
{
- m_break_sp = rhs.m_break_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@@ -94,8 +94,8 @@
break_id_t
SBBreakpoint::GetID () const
{
- if (m_break_sp)
- return m_break_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
return LLDB_INVALID_BREAK_ID;
}
@@ -103,28 +103,24 @@
bool
SBBreakpoint::IsValid() const
{
- return m_break_sp;
+ return m_opaque_sp;
}
void
SBBreakpoint::Dump (FILE *f)
{
- if (m_break_sp)
+ if (m_opaque_sp && f)
{
- if (f == NULL)
- f = SBDebugger::GetOutputFileHandle();
- if (f == NULL)
- return;
lldb_private::StreamFile str (f);
- m_break_sp->Dump (&str);
+ m_opaque_sp->Dump (&str);
}
}
void
SBBreakpoint::ClearAllBreakpointSites ()
{
- if (m_break_sp)
- m_break_sp->ClearAllBreakpointSites ();
+ if (m_opaque_sp)
+ m_opaque_sp->ClearAllBreakpointSites ();
}
SBBreakpointLocation
@@ -132,18 +128,18 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
+ if (m_opaque_sp)
{
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_break_sp->GetTarget().GetProcessSP().get();
+ Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
}
- sb_bp_location.SetLocation (m_break_sp->FindLocationByAddress (address));
+ sb_bp_location.SetLocation (m_opaque_sp->FindLocationByAddress (address));
}
}
return sb_bp_location;
@@ -154,18 +150,18 @@
{
break_id_t lldb_id = (break_id_t) 0;
- if (m_break_sp)
+ if (m_opaque_sp)
{
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_break_sp->GetTarget().GetProcessSP().get();
+ Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
}
- lldb_id = m_break_sp->FindLocationIDByAddress (address);
+ lldb_id = m_opaque_sp->FindLocationIDByAddress (address);
}
}
@@ -177,8 +173,8 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
- sb_bp_location.SetLocation (m_break_sp->FindLocationByID (bp_loc_id));
+ if (m_opaque_sp)
+ sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
return sb_bp_location;
}
@@ -188,8 +184,8 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
- sb_bp_location.SetLocation (m_break_sp->GetLocationAtIndex (index));
+ if (m_opaque_sp)
+ sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index));
return sb_bp_location;
}
@@ -197,13 +193,7 @@
void
SBBreakpoint::ListLocations (FILE* f, const char *description_level)
{
- if (f == NULL)
- f = SBDebugger::GetOutputFileHandle();
-
- if (f == NULL)
- return;
-
- if (m_break_sp)
+ if (m_opaque_sp && f)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -218,10 +208,10 @@
StreamFile str (f);
str.IndentMore();
- int num_locs = m_break_sp->GetNumLocations();
+ int num_locs = m_opaque_sp->GetNumLocations();
for (int i = 0; i < num_locs; ++i)
{
- BreakpointLocation *loc = m_break_sp->GetLocationAtIndex (i).get();
+ BreakpointLocation *loc = m_opaque_sp->GetLocationAtIndex (i).get();
loc->GetDescription (&str, level);
str.EOL();
}
@@ -231,15 +221,15 @@
void
SBBreakpoint::SetEnabled (bool enable)
{
- if (m_break_sp)
- m_break_sp->SetEnabled (enable);
+ if (m_opaque_sp)
+ m_opaque_sp->SetEnabled (enable);
}
bool
SBBreakpoint::IsEnabled ()
{
- if (m_break_sp)
- return m_break_sp->IsEnabled();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsEnabled();
else
return false;
}
@@ -247,15 +237,15 @@
void
SBBreakpoint::SetIgnoreCount (int32_t count)
{
- if (m_break_sp)
- m_break_sp->SetIgnoreCount (count);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIgnoreCount (count);
}
int32_t
SBBreakpoint::GetIgnoreCount () const
{
- if (m_break_sp)
- return m_break_sp->GetIgnoreCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIgnoreCount();
else
return 0;
}
@@ -263,16 +253,16 @@
void
SBBreakpoint::SetThreadID (tid_t sb_thread_id)
{
- if (m_break_sp)
- m_break_sp->SetThreadID (sb_thread_id);
+ if (m_opaque_sp)
+ m_opaque_sp->SetThreadID (sb_thread_id);
}
tid_t
SBBreakpoint::GetThreadID ()
{
tid_t lldb_thread_id = LLDB_INVALID_THREAD_ID;
- if (m_break_sp)
- lldb_thread_id = m_break_sp->GetThreadID();
+ if (m_opaque_sp)
+ lldb_thread_id = m_opaque_sp->GetThreadID();
return lldb_thread_id;
}
@@ -280,16 +270,16 @@
void
SBBreakpoint::SetThreadIndex (uint32_t index)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
}
uint32_t
SBBreakpoint::GetThreadIndex() const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return 0;
else
@@ -302,16 +292,16 @@
void
SBBreakpoint::SetThreadName (const char *thread_name)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
}
const char *
SBBreakpoint::GetThreadName () const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return NULL;
else
@@ -323,16 +313,16 @@
void
SBBreakpoint::SetQueueName (const char *queue_name)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
const char *
SBBreakpoint::GetQueueName () const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return NULL;
else
@@ -344,8 +334,8 @@
size_t
SBBreakpoint::GetNumResolvedLocations() const
{
- if (m_break_sp)
- return m_break_sp->GetNumResolvedLocations();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetNumResolvedLocations();
else
return 0;
}
@@ -353,8 +343,8 @@
size_t
SBBreakpoint::GetNumLocations() const
{
- if (m_break_sp)
- return m_break_sp->GetNumLocations();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetNumLocations();
else
return 0;
}
@@ -365,7 +355,7 @@
if (f == NULL)
return;
- if (m_break_sp)
+ if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -379,15 +369,15 @@
StreamFile str (f);
- m_break_sp->GetDescription (&str, level);
+ m_opaque_sp->GetDescription (&str, level);
str.EOL();
if (describe_locations)
{
//str.IndentMore();
- // int num_locs = m_break_sp->GetNumLocations();
+ // int num_locs = m_opaque_sp->GetNumLocations();
// for (int i = 0; i < num_locs; ++i)
// {
- // BreakpointLocation *loc = m_break_sp->FindLocationByIndex (i);
+ // BreakpointLocation *loc = m_opaque_sp->FindLocationByIndex (i);
// loc->GetDescription (&str, level);
// str.EOL();
// }
@@ -405,22 +395,22 @@
lldb::user_id_t break_loc_id
)
{
- BreakpointSP bp_sp(ctx->context.target->GetBreakpointList().FindBreakpointByID(break_id));
+ BreakpointSP bp_sp(ctx->exe_ctx.target->GetBreakpointList().FindBreakpointByID(break_id));
if (baton && bp_sp)
{
CallbackData *data = (CallbackData *)baton;
lldb_private::Breakpoint *bp = bp_sp.get();
if (bp && data->callback)
{
- if (ctx->context.process)
+ if (ctx->exe_ctx.process)
{
- SBProcess sb_process (ctx->context.process->GetSP());
+ SBProcess sb_process (ctx->exe_ctx.process->GetSP());
SBThread sb_thread;
SBBreakpointLocation sb_location;
assert (bp_sp);
sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
- if (ctx->context.thread)
- sb_thread.SetThread(ctx->context.thread->GetSP());
+ if (ctx->exe_ctx.thread)
+ sb_thread.SetThread(ctx->exe_ctx.thread->GetSP());
return data->callback (data->callback_baton,
sb_process,
@@ -435,10 +425,10 @@
void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{
- if (m_break_sp.get())
+ if (m_opaque_sp.get())
{
BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
- m_break_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
+ m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
}
}
@@ -446,24 +436,24 @@
lldb_private::Breakpoint *
SBBreakpoint::operator->() const
{
- return m_break_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Breakpoint *
SBBreakpoint::get() const
{
- return m_break_sp.get();
+ return m_opaque_sp.get();
}
lldb::BreakpointSP &
SBBreakpoint::operator *()
{
- return m_break_sp;
+ return m_opaque_sp;
}
const lldb::BreakpointSP &
SBBreakpoint::operator *() const
{
- return m_break_sp;
+ return m_opaque_sp;
}
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index b5e7859..f376f53 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -31,7 +31,7 @@
}
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
- m_break_loc_sp (break_loc_sp)
+ m_opaque_sp (break_loc_sp)
{
}
@@ -42,7 +42,7 @@
bool
SBBreakpointLocation::IsValid() const
{
- return m_break_loc_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
addr_t
@@ -50,9 +50,9 @@
{
addr_t ret_addr = LLDB_INVALID_ADDRESS;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- ret_addr = m_break_loc_sp->GetLoadAddress();
+ ret_addr = m_opaque_sp->GetLoadAddress();
}
return ret_addr;
@@ -61,17 +61,17 @@
void
SBBreakpointLocation::SetEnabled (bool enabled)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- m_break_loc_sp->SetEnabled (enabled);
+ m_opaque_sp->SetEnabled (enabled);
}
}
bool
SBBreakpointLocation::IsEnabled ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsEnabled();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsEnabled();
else
return false;
}
@@ -79,8 +79,8 @@
int32_t
SBBreakpointLocation::GetIgnoreCount ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->GetIgnoreCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIgnoreCount();
else
return 0;
}
@@ -88,40 +88,39 @@
void
SBBreakpointLocation::SetIgnoreCount (int32_t n)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetIgnoreCount (n);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIgnoreCount (n);
}
void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetThreadID (thread_id);
+ if (m_opaque_sp)
+ m_opaque_sp->SetThreadID (thread_id);
}
tid_t
SBBreakpointLocation::GetThreadID ()
{
tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
- if (m_break_loc_sp)
- sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
-
+ if (m_opaque_sp)
+ sb_thread_id = m_opaque_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
return sb_thread_id;
}
void
SBBreakpointLocation::SetThreadIndex (uint32_t index)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
}
uint32_t
SBBreakpointLocation::GetThreadIndex() const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return 0;
else
@@ -134,16 +133,16 @@
void
SBBreakpointLocation::SetThreadName (const char *thread_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
}
const char *
SBBreakpointLocation::GetThreadName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -155,16 +154,16 @@
void
SBBreakpointLocation::SetQueueName (const char *queue_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
const char *
SBBreakpointLocation::GetQueueName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -176,8 +175,8 @@
bool
SBBreakpointLocation::IsResolved ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsResolved();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsResolved();
else
return false;
}
@@ -185,11 +184,11 @@
void
SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_sp)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
// Uninstall the callbacks?
}
- m_break_loc_sp = break_loc_sp;
+ m_opaque_sp = break_loc_sp;
}
void
@@ -198,7 +197,7 @@
if (f == NULL)
return;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -212,7 +211,7 @@
StreamFile str (f);
- m_break_loc_sp->GetDescription (&str, level);
+ m_opaque_sp->GetDescription (&str, level);
str.EOL();
}
}
@@ -221,8 +220,8 @@
SBBreakpointLocation::GetBreakpoint ()
{
SBBreakpoint sb_bp;
- if (m_break_loc_sp)
- *sb_bp = m_break_loc_sp->GetBreakpoint ().GetSP();
+ if (m_opaque_sp)
+ *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
return sb_bp;
}
diff --git a/source/API/SBBroadcaster.cpp b/source/API/SBBroadcaster.cpp
index 14c5357..bbad8e2 100644
--- a/source/API/SBBroadcaster.cpp
+++ b/source/API/SBBroadcaster.cpp
@@ -19,124 +19,124 @@
SBBroadcaster::SBBroadcaster () :
- m_lldb_object (NULL),
- m_lldb_object_owned (false)
+ m_opaque (NULL),
+ m_opaque_owned (false)
{
}
SBBroadcaster::SBBroadcaster (const char *name) :
- m_lldb_object (new Broadcaster (name)),
- m_lldb_object_owned (true)
+ m_opaque (new Broadcaster (name)),
+ m_opaque_owned (true)
{
}
SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) :
- m_lldb_object (broadcaster),
- m_lldb_object_owned (owns)
+ m_opaque (broadcaster),
+ m_opaque_owned (owns)
{
}
SBBroadcaster::~SBBroadcaster()
{
- SetLLDBObjectPtr (NULL, false);
+ reset (NULL, false);
}
void
SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
{
- if (m_lldb_object == NULL)
+ if (m_opaque == NULL)
return;
if (unique)
- m_lldb_object->BroadcastEventIfUnique (event_type);
+ m_opaque->BroadcastEventIfUnique (event_type);
else
- m_lldb_object->BroadcastEvent (event_type);
+ m_opaque->BroadcastEvent (event_type);
}
void
SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
{
- if (m_lldb_object == NULL)
+ if (m_opaque == NULL)
return;
- EventSP event_sp = event.GetSharedPtr ();
+ EventSP event_sp = event.GetSP ();
if (unique)
- m_lldb_object->BroadcastEventIfUnique (event_sp);
+ m_opaque->BroadcastEventIfUnique (event_sp);
else
- m_lldb_object->BroadcastEvent (event_sp);
+ m_opaque->BroadcastEvent (event_sp);
}
void
SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events)
{
- if (m_lldb_object)
- m_lldb_object->AddInitialEventsToListener (listener.get(), requested_events);
+ if (m_opaque)
+ m_opaque->AddInitialEventsToListener (listener.get(), requested_events);
}
uint32_t
SBBroadcaster::AddListener (const SBListener &listener, uint32_t event_mask)
{
- if (m_lldb_object)
- return m_lldb_object->AddListener (listener.get(), event_mask);
+ if (m_opaque)
+ return m_opaque->AddListener (listener.get(), event_mask);
return 0;
}
const char *
SBBroadcaster::GetName ()
{
- if (m_lldb_object)
- return m_lldb_object->GetBroadcasterName().AsCString();
+ if (m_opaque)
+ return m_opaque->GetBroadcasterName().AsCString();
return NULL;
}
bool
SBBroadcaster::EventTypeHasListeners (uint32_t event_type)
{
- if (m_lldb_object)
- return m_lldb_object->EventTypeHasListeners (event_type);
+ if (m_opaque)
+ return m_opaque->EventTypeHasListeners (event_type);
return false;
}
bool
SBBroadcaster::RemoveListener (const SBListener &listener, uint32_t event_mask)
{
- if (m_lldb_object)
- return m_lldb_object->RemoveListener (listener.get(), event_mask);
+ if (m_opaque)
+ return m_opaque->RemoveListener (listener.get(), event_mask);
return false;
}
Broadcaster *
-SBBroadcaster::GetLLDBObjectPtr () const
+SBBroadcaster::get () const
{
- return m_lldb_object;
+ return m_opaque;
}
void
-SBBroadcaster::SetLLDBObjectPtr (Broadcaster *broadcaster, bool owns)
+SBBroadcaster::reset (Broadcaster *broadcaster, bool owns)
{
- if (m_lldb_object && m_lldb_object_owned)
- delete m_lldb_object;
- m_lldb_object = broadcaster;
- m_lldb_object_owned = owns;
+ if (m_opaque && m_opaque_owned)
+ delete m_opaque;
+ m_opaque = broadcaster;
+ m_opaque_owned = owns;
}
bool
SBBroadcaster::IsValid () const
{
- return m_lldb_object != NULL;
+ return m_opaque != NULL;
}
bool
SBBroadcaster::operator == (const SBBroadcaster &rhs) const
{
- return m_lldb_object == rhs.m_lldb_object;
+ return m_opaque == rhs.m_opaque;
}
bool
SBBroadcaster::operator != (const SBBroadcaster &rhs) const
{
- return m_lldb_object != rhs.m_lldb_object;
+ return m_opaque != rhs.m_opaque;
}
diff --git a/source/API/SBCommandContext.cpp b/source/API/SBCommandContext.cpp
index c022a71..35bd6bb 100644
--- a/source/API/SBCommandContext.cpp
+++ b/source/API/SBCommandContext.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/API/SBCommandContext.h"
@@ -17,8 +17,8 @@
using namespace lldb_private;
-SBCommandContext::SBCommandContext (CommandContext *lldb_object) :
- m_lldb_object (lldb_object)
+SBCommandContext::SBCommandContext (Debugger *lldb_object) :
+ m_opaque (lldb_object)
{
}
@@ -29,6 +29,6 @@
bool
SBCommandContext::IsValid () const
{
- return m_lldb_object != NULL;
+ return m_opaque != NULL;
}
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index f7c0d52..27e542c 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -30,8 +30,8 @@
using namespace lldb_private;
-SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter &interpreter) :
- m_interpreter (interpreter)
+SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
+ m_opaque_ptr (interpreter)
{
}
@@ -40,28 +40,49 @@
}
bool
+SBCommandInterpreter::IsValid() const
+{
+ return m_opaque_ptr != NULL;
+}
+
+
+bool
SBCommandInterpreter::CommandExists (const char *cmd)
{
- return m_interpreter.CommandExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->CommandExists (cmd);
+ return false;
}
bool
SBCommandInterpreter::AliasExists (const char *cmd)
{
- return m_interpreter.AliasExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->AliasExists (cmd);
+ return false;
}
bool
SBCommandInterpreter::UserCommandExists (const char *cmd)
{
- return m_interpreter.UserCommandExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->UserCommandExists (cmd);
+ return false;
}
lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
{
result.Clear();
- m_interpreter.HandleCommand (command_line, add_to_history, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->HandleCommand (command_line, add_to_history, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
return result.GetStatus();
}
@@ -73,64 +94,79 @@
int max_return_elements,
SBStringList &matches)
{
- int num_completions;
- lldb_private::StringList lldb_matches;
- num_completions = m_interpreter.HandleCompletion (current_line, cursor, last_char, match_start_point,
- max_return_elements, lldb_matches);
+ int num_completions = 0;
+ if (m_opaque_ptr)
+ {
+ lldb_private::StringList lldb_matches;
+ num_completions = m_opaque_ptr->HandleCompletion (current_line, cursor, last_char, match_start_point,
+ max_return_elements, lldb_matches);
- SBStringList temp_list (&lldb_matches);
- matches.AppendList (temp_list);
-
+ SBStringList temp_list (&lldb_matches);
+ matches.AppendList (temp_list);
+ }
return num_completions;
}
const char **
SBCommandInterpreter::GetEnvironmentVariables ()
{
- const Args *env_vars = m_interpreter.GetEnvironmentVariables();
- if (env_vars)
- return env_vars->GetConstArgumentVector ();
+ if (m_opaque_ptr)
+ {
+ const Args *env_vars = m_opaque_ptr->GetEnvironmentVariables();
+ if (env_vars)
+ return env_vars->GetConstArgumentVector ();
+ }
return NULL;
}
bool
SBCommandInterpreter::HasCommands ()
{
- return m_interpreter.HasCommands();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasCommands();
+ return false;
}
bool
SBCommandInterpreter::HasAliases ()
{
- return m_interpreter.HasAliases();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasAliases();
+ return false;
}
bool
SBCommandInterpreter::HasUserCommands ()
{
- return m_interpreter.HasUserCommands ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasUserCommands ();
+ return false;
}
bool
SBCommandInterpreter::HasAliasOptions ()
{
- return m_interpreter.HasAliasOptions ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasAliasOptions ();
+ return false;
}
bool
SBCommandInterpreter::HasInterpreterVariables ()
{
- return m_interpreter.HasInterpreterVariables ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasInterpreterVariables ();
+ return false;
}
SBProcess
SBCommandInterpreter::GetProcess ()
{
SBProcess process;
- CommandContext *context = m_interpreter.Context();
- if (context)
+ if (m_opaque_ptr)
{
- Target *target = context->GetTarget();
+ Debugger &debugger = m_opaque_ptr->GetDebugger();
+ Target *target = debugger.GetCurrentTarget().get();
if (target)
process.SetProcess(target->GetProcessSP());
}
@@ -140,7 +176,7 @@
ssize_t
SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
{
- if (src)
+ if (m_opaque_ptr && src && src[0])
return WriteToScriptInterpreter (src, strlen(src));
return 0;
}
@@ -148,9 +184,9 @@
ssize_t
SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
{
- if (src && src[0])
+ if (m_opaque_ptr && src && src[0])
{
- ScriptInterpreter *script_interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter();
if (script_interpreter)
return ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len);
}
@@ -159,35 +195,58 @@
CommandInterpreter *
-SBCommandInterpreter::GetLLDBObjectPtr ()
+SBCommandInterpreter::get ()
{
- return &m_interpreter;
+ return m_opaque_ptr;
}
CommandInterpreter &
-SBCommandInterpreter::GetLLDBObjectRef ()
+SBCommandInterpreter::ref ()
{
- return m_interpreter;
+ assert (m_opaque_ptr);
+ return *m_opaque_ptr;
+}
+
+void
+SBCommandInterpreter::reset (lldb_private::CommandInterpreter *interpreter)
+{
+ m_opaque_ptr = interpreter;
}
void
SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &result)
{
result.Clear();
- m_interpreter.SourceInitFile (false, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->SourceInitFile (false, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
}
void
SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnObject &result)
{
result.Clear();
- m_interpreter.SourceInitFile (true, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->SourceInitFile (true, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
}
SBBroadcaster
SBCommandInterpreter::GetBroadcaster ()
{
- SBBroadcaster broadcaster (&m_interpreter, false);
+ SBBroadcaster broadcaster (m_opaque_ptr, false);
return broadcaster;
}
diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp
index b345a04..5742c5c 100644
--- a/source/API/SBCommandReturnObject.cpp
+++ b/source/API/SBCommandReturnObject.cpp
@@ -12,53 +12,54 @@
#include "lldb/API/SBCommandReturnObject.h"
using namespace lldb;
+using namespace lldb_private;
SBCommandReturnObject::SBCommandReturnObject () :
- m_return_object_ap (new lldb_private::CommandReturnObject ())
+ m_opaque_ap (new CommandReturnObject ())
{
}
SBCommandReturnObject::~SBCommandReturnObject ()
{
- // m_return_object_ap will automatically delete any pointer it owns
+ // m_opaque_ap will automatically delete any pointer it owns
}
bool
SBCommandReturnObject::IsValid() const
{
- return m_return_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
const char *
SBCommandReturnObject::GetOutput ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetOutputStream().GetData();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetOutputStream().GetData();
return NULL;
}
const char *
SBCommandReturnObject::GetError ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetErrorStream().GetData();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetErrorStream().GetData();
return NULL;
}
size_t
SBCommandReturnObject::GetOutputSize ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetOutputStream().GetSize();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetOutputStream().GetSize();
return 0;
}
size_t
SBCommandReturnObject::GetErrorSize ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetErrorStream().GetSize();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetErrorStream().GetSize();
return 0;
}
@@ -89,60 +90,73 @@
void
SBCommandReturnObject::Clear()
{
- if (m_return_object_ap.get())
- m_return_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
lldb::ReturnStatus
SBCommandReturnObject::GetStatus()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetStatus();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetStatus();
return lldb::eReturnStatusInvalid;
}
bool
SBCommandReturnObject::Succeeded ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->Succeeded();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Succeeded();
return false;
}
bool
SBCommandReturnObject::HasResult ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->HasResult();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->HasResult();
return false;
}
void
SBCommandReturnObject::AppendMessage (const char *message)
{
- if (m_return_object_ap.get())
- m_return_object_ap->AppendMessage (message);
+ if (m_opaque_ap.get())
+ m_opaque_ap->AppendMessage (message);
}
-lldb_private::CommandReturnObject *
-SBCommandReturnObject::GetLLDBObjectPtr()
+CommandReturnObject *
+SBCommandReturnObject::operator ->() const
{
- return m_return_object_ap.get();
+ return m_opaque_ap.get();
+}
+
+CommandReturnObject *
+SBCommandReturnObject::get() const
+{
+ return m_opaque_ap.get();
+}
+
+CommandReturnObject &
+SBCommandReturnObject::operator *() const
+{
+ assert(m_opaque_ap.get());
+ return *(m_opaque_ap.get());
}
-lldb_private::CommandReturnObject &
-SBCommandReturnObject::GetLLDBObjectRef()
+CommandReturnObject &
+SBCommandReturnObject::ref() const
{
- assert(m_return_object_ap.get());
- return *(m_return_object_ap.get());
+ assert(m_opaque_ap.get());
+ return *(m_opaque_ap.get());
}
void
-SBCommandReturnObject::SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr)
+SBCommandReturnObject::SetLLDBObjectPtr (CommandReturnObject *ptr)
{
- if (m_return_object_ap.get())
- m_return_object_ap.reset (ptr);
+ if (m_opaque_ap.get())
+ m_opaque_ap.reset (ptr);
}
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index e2a7917..b1ae37b 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -18,57 +18,57 @@
SBCommunication::SBCommunication() :
- m_lldb_object (NULL),
- m_lldb_object_owned (false)
+ m_opaque (NULL),
+ m_opaque_owned (false)
{
}
SBCommunication::SBCommunication(const char * broadcaster_name) :
- m_lldb_object (new Communication (broadcaster_name)),
- m_lldb_object_owned (true)
+ m_opaque (new Communication (broadcaster_name)),
+ m_opaque_owned (true)
{
}
SBCommunication::~SBCommunication()
{
- if (m_lldb_object && m_lldb_object_owned)
- delete m_lldb_object;
- m_lldb_object = NULL;
- m_lldb_object_owned = false;
+ if (m_opaque && m_opaque_owned)
+ delete m_opaque;
+ m_opaque = NULL;
+ m_opaque_owned = false;
}
ConnectionStatus
SBCommunication::CheckIfBytesAvailable ()
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (0, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (0, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::WaitForBytesAvailableInfinite ()
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (UINT32_MAX, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (UINT32_MAX, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::WaitForBytesAvailableWithTimeout (uint32_t timeout_usec)
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (timeout_usec, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (timeout_usec, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::Connect (const char *url)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- if (!m_lldb_object->HasConnection ())
- m_lldb_object->SetConnection (new ConnectionFileDescriptor());
- return m_lldb_object->Connect (url, NULL);
+ if (!m_opaque->HasConnection ())
+ m_opaque->SetConnection (new ConnectionFileDescriptor());
+ return m_opaque->Connect (url, NULL);
}
return eConnectionStatusNoConnection;
}
@@ -76,15 +76,15 @@
ConnectionStatus
SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- if (m_lldb_object->HasConnection ())
+ if (m_opaque->HasConnection ())
{
- if (m_lldb_object->IsConnected())
- m_lldb_object->Disconnect ();
+ if (m_opaque->IsConnected())
+ m_opaque->Disconnect ();
}
- m_lldb_object->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
- if (m_lldb_object->IsConnected())
+ m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
+ if (m_opaque->IsConnected())
return eConnectionStatusSuccess;
else
return eConnectionStatusLostConnection;
@@ -96,24 +96,24 @@
ConnectionStatus
SBCommunication::Disconnect ()
{
- if (m_lldb_object)
- return m_lldb_object->Disconnect ();
+ if (m_opaque)
+ return m_opaque->Disconnect ();
return eConnectionStatusNoConnection;
}
bool
SBCommunication::IsConnected () const
{
- if (m_lldb_object)
- return m_lldb_object->IsConnected ();
+ if (m_opaque)
+ return m_opaque->IsConnected ();
return false;
}
size_t
SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status)
{
- if (m_lldb_object)
- return m_lldb_object->Read (dst, dst_len, timeout_usec, status, NULL);
+ if (m_opaque)
+ return m_opaque->Read (dst, dst_len, timeout_usec, status, NULL);
status = eConnectionStatusNoConnection;
return 0;
}
@@ -122,8 +122,8 @@
size_t
SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &status)
{
- if (m_lldb_object)
- return m_lldb_object->Write (src, src_len, status, NULL);
+ if (m_opaque)
+ return m_opaque->Write (src, src_len, status, NULL);
status = eConnectionStatusNoConnection;
return 0;
}
@@ -131,8 +131,8 @@
bool
SBCommunication::ReadThreadStart ()
{
- if (m_lldb_object)
- return m_lldb_object->StartReadThread ();
+ if (m_opaque)
+ return m_opaque->StartReadThread ();
return false;
}
@@ -140,16 +140,16 @@
bool
SBCommunication::ReadThreadStop ()
{
- if (m_lldb_object)
- return m_lldb_object->StopReadThread ();
+ if (m_opaque)
+ return m_opaque->StopReadThread ();
return false;
}
bool
SBCommunication::ReadThreadIsRunning ()
{
- if (m_lldb_object)
- return m_lldb_object->ReadThreadIsRunning ();
+ if (m_opaque)
+ return m_opaque->ReadThreadIsRunning ();
return false;
}
@@ -160,9 +160,9 @@
void *callback_baton
)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- m_lldb_object->SetReadThreadBytesReceivedCallback (callback, callback_baton);
+ m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton);
return true;
}
return false;
@@ -171,7 +171,7 @@
SBBroadcaster
SBCommunication::GetBroadcaster ()
{
- SBBroadcaster broadcaster (m_lldb_object, false);
+ SBBroadcaster broadcaster (m_opaque, false);
return broadcaster;
}
@@ -180,15 +180,15 @@
//void
//SBCommunication::CreateIfNeeded ()
//{
-// if (m_lldb_object == NULL)
+// if (m_opaque == NULL)
// {
// static uint32_t g_broadcaster_num;
// char broadcaster_name[256];
// ::snprintf (name, broadcaster_name, "%p SBCommunication", this);
-// m_lldb_object = new Communication (broadcaster_name);
-// m_lldb_object_owned = true;
+// m_opaque = new Communication (broadcaster_name);
+// m_opaque_owned = true;
// }
-// assert (m_lldb_object);
+// assert (m_opaque);
//}
//
//
diff --git a/source/API/SBCompileUnit.cpp b/source/API/SBCompileUnit.cpp
index a12934a..dc873e3 100644
--- a/source/API/SBCompileUnit.cpp
+++ b/source/API/SBCompileUnit.cpp
@@ -18,35 +18,35 @@
SBCompileUnit::SBCompileUnit () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBCompileUnit::~SBCompileUnit ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
SBFileSpec
SBCompileUnit::GetFileSpec () const
{
SBFileSpec file_spec;
- if (m_lldb_object_ptr)
- file_spec.SetFileSpec(*m_lldb_object_ptr);
+ if (m_opaque_ptr)
+ file_spec.SetFileSpec(*m_opaque_ptr);
return file_spec;
}
uint32_t
SBCompileUnit::GetNumLineEntries () const
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- LineTable *line_table = m_lldb_object_ptr->GetLineTable ();
+ LineTable *line_table = m_opaque_ptr->GetLineTable ();
if (line_table)
return line_table->GetSize();
}
@@ -57,9 +57,9 @@
SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
{
SBLineEntry sb_line_entry;
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- LineTable *line_table = m_lldb_object_ptr->GetLineTable ();
+ LineTable *line_table = m_opaque_ptr->GetLineTable ();
if (line_table)
{
LineEntry line_entry;
@@ -73,15 +73,15 @@
uint32_t
SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
FileSpec file_spec;
if (inline_file_spec && inline_file_spec->IsValid())
file_spec = inline_file_spec->ref();
else
- file_spec = *m_lldb_object_ptr;
+ file_spec = *m_opaque_ptr;
- return m_lldb_object_ptr->FindLineEntry (start_idx,
+ return m_opaque_ptr->FindLineEntry (start_idx,
line,
inline_file_spec ? inline_file_spec->get() : NULL,
NULL);
@@ -92,29 +92,29 @@
bool
SBCompileUnit::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
bool
SBCompileUnit::operator == (const SBCompileUnit &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBCompileUnit::operator != (const SBCompileUnit &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
const lldb_private::CompileUnit *
SBCompileUnit::operator->() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
const lldb_private::CompileUnit &
SBCompileUnit::operator*() const
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 72e7907..d8d0dbb 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -43,112 +43,121 @@
Debugger::Terminate();
}
+SBDebugger
+SBDebugger::Create()
+{
+ SBDebugger debugger;
+ debugger.reset(Debugger::CreateInstance());
+ return debugger;
+}
+
+
+SBDebugger::SBDebugger () :
+ m_opaque_sp ()
+{
+}
+
+SBDebugger::~SBDebugger ()
+{
+}
+
+bool
+SBDebugger::IsValid() const
+{
+ return m_opaque_sp.get() != NULL;
+}
+
+
void
SBDebugger::SetAsync (bool b)
{
- static bool value_set_once = false;
-
- if (!value_set_once)
- {
- value_set_once = true;
- Debugger::GetSharedInstance().SetAsyncExecution(b);
- }
+ if (m_opaque_sp)
+ m_opaque_sp->SetAsyncExecution(b);
}
-void
-SBDebugger::SetInputFile (const char *tty_name)
-{
- // DEPRECATED: will be removed in next submission
- FILE *fh = ::fopen (tty_name, "r");
- SetInputFileHandle (fh, true);
-}
-
-void
-SBDebugger::SetOutputFile (const char *tty_name)
-{
- // DEPRECATED: will be removed in next submission
- FILE *fh = ::fopen (tty_name, "w");
- SetOutputFileHandle (fh, true);
- SetErrorFileHandle (fh, false);
-}
-
-void
-SBDebugger::SetErrorFile (const char *tty_name)
-{
- // DEPRECATED: will be removed in next submission
-}
-
-
// Shouldn't really be settable after initialization as this could cause lots of problems; don't want users
// trying to switch modes in the middle of a debugging session.
void
SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetInputFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
}
void
SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetOutputFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
}
void
SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetErrorFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
}
FILE *
SBDebugger::GetInputFileHandle ()
{
- return Debugger::GetSharedInstance().GetInputFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetInputFileHandle();
+ return NULL;
}
FILE *
SBDebugger::GetOutputFileHandle ()
{
- return Debugger::GetSharedInstance().GetOutputFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetOutputFileHandle();
+ return NULL;
}
FILE *
SBDebugger::GetErrorFileHandle ()
{
- return Debugger::GetSharedInstance().GetErrorFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetErrorFileHandle();
+ return NULL;
}
SBCommandInterpreter
SBDebugger::GetCommandInterpreter ()
{
- SBCommandInterpreter sb_interpreter(Debugger::GetSharedInstance().GetCommandInterpreter());
+ SBCommandInterpreter sb_interpreter;
+ if (m_opaque_sp)
+ sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
return sb_interpreter;
}
void
SBDebugger::HandleCommand (const char *command)
{
- SBProcess process;
- SBCommandInterpreter sb_interpreter(Debugger::GetSharedInstance().GetCommandInterpreter());
- SBCommandReturnObject result;
-
- sb_interpreter.HandleCommand (command, result, false);
-
- if (GetErrorFileHandle() != NULL)
- result.PutError (GetErrorFileHandle());
- if (GetOutputFileHandle() != NULL)
- result.PutOutput (GetOutputFileHandle());
-
- if (Debugger::GetSharedInstance().GetAsyncExecution() == false)
+ if (m_opaque_sp)
{
- process = GetCommandInterpreter().GetProcess ();
- if (process.IsValid())
+ SBCommandInterpreter sb_interpreter(GetCommandInterpreter ());
+ SBCommandReturnObject result;
+
+ sb_interpreter.HandleCommand (command, result, false);
+
+ if (GetErrorFileHandle() != NULL)
+ result.PutError (GetErrorFileHandle());
+ if (GetOutputFileHandle() != NULL)
+ result.PutOutput (GetOutputFileHandle());
+
+ if (m_opaque_sp->GetAsyncExecution() == false)
{
- EventSP event_sp;
- Listener &lldb_listener = Debugger::GetSharedInstance().GetListener();
- while (lldb_listener.GetNextEventForBroadcaster (process.get(), event_sp))
+ SBProcess process(GetCommandInterpreter().GetProcess ());
+ if (process.IsValid())
{
- SBEvent event(event_sp);
- HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
+ EventSP event_sp;
+ Listener &lldb_listener = m_opaque_sp->GetListener();
+ while (lldb_listener.GetNextEventForBroadcaster (process.get(), event_sp))
+ {
+ SBEvent event(event_sp);
+ HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
+ }
}
}
}
@@ -157,7 +166,9 @@
SBListener
SBDebugger::GetListener ()
{
- SBListener sb_listener(Debugger::GetSharedInstance().GetListener());
+ SBListener sb_listener;
+ if (m_opaque_sp)
+ sb_listener.reset(&m_opaque_sp->GetListener(), false);
return sb_listener;
}
@@ -271,53 +282,6 @@
}
}
-void
-SBDebugger::ReportCurrentLocation (FILE *out, FILE *err)
-{
- if ((out == NULL) || (err == NULL))
- return;
-
- SBTarget sb_target (GetCurrentTarget());
- if (!sb_target.IsValid())
- {
- fprintf (out, "no target\n");
- return;
- }
-
- SBProcess process = sb_target.GetProcess ();
- if (process.IsValid())
- {
- StateType state = process.GetState();
-
- if (StateIsStoppedState (state))
- {
- if (state == eStateExited)
- {
- int exit_status = process.GetExitStatus();
- const char *exit_description = process.GetExitDescription();
- ::fprintf (out, "Process %d exited with status = %i (0x%8.8x) %s\n",
- process.GetProcessID(),
- exit_status,
- exit_status,
- exit_description ? exit_description : "");
- }
- else
- {
- fprintf (out, "Process %d %s\n", process.GetProcessID(), StateAsCString (state));
- SBThread current_thread = process.GetThreadAtIndex (0);
- if (current_thread.IsValid())
- {
- process.DisplayThreadsInfo (out, err, true);
- }
- else
- fprintf (out, "No valid thread found in current process\n");
- }
- }
- else
- fprintf (out, "No current location or status available\n");
- }
-}
-
SBSourceManager &
SBDebugger::GetSourceManager ()
{
@@ -367,38 +331,6 @@
eScriptLanguageDefault,
NULL);
}
-//pid_t
-/*
-SBDebugger::AttachByName (const char *process_name, const char *filename)
-{
- SBTarget *temp_target = GetCurrentTarget();
- SBTarget sb_target;
- pid_t return_pid = (pid_t) LLDB_INVALID_PROCESS_ID;
-
- if (temp_target == NULL)
- {
- if (filename != NULL)
- {
- sb_target = CreateWithFile (filename);
- sb_target.SetArch (LLDB_ARCH_DEFAULT);
- }
- }
- else
- {
- sb_target = *temp_target;
- }
-
- if (sb_target.IsValid())
- {
- SBProcess process = sb_target.GetProcess ();
- if (process.IsValid())
- {
- return_pid = process.AttachByName (process_name);
- }
- }
- return return_pid;
-}
-*/
const char *
SBDebugger::GetVersionString ()
@@ -429,34 +361,77 @@
SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple)
{
- ArchSpec arch;
- FileSpec file_spec (filename);
- arch.SetArchFromTargetTriple(target_triple);
- TargetSP target_sp;
- Error error (Debugger::GetSharedInstance().GetTargetList().CreateTarget (file_spec, arch, NULL, true, target_sp));
- SBTarget target(target_sp);
+ SBTarget target;
+ if (m_opaque_sp)
+ {
+ ArchSpec arch;
+ FileSpec file_spec (filename);
+ arch.SetArchFromTargetTriple(target_triple);
+ TargetSP target_sp;
+ Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
+ target.reset (target_sp);
+ }
return target;
}
SBTarget
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
{
- FileSpec file (filename);
- ArchSpec arch = lldb_private::GetDefaultArchitecture();
- TargetSP target_sp;
- Error error;
+ SBTarget target;
+ if (m_opaque_sp)
+ {
+ FileSpec file (filename);
+ ArchSpec arch = lldb_private::GetDefaultArchitecture();
+ TargetSP target_sp;
+ Error error;
- if (archname != NULL)
- {
- ArchSpec arch2 (archname);
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch2, NULL, true, target_sp);
+ if (archname != NULL)
+ {
+ ArchSpec arch2 (archname);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch2, NULL, true, target_sp);
+ }
+ else
+ {
+ if (!arch.IsValid())
+ arch = LLDB_ARCH_DEFAULT;
+
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
+
+ if (error.Fail())
+ {
+ if (arch == LLDB_ARCH_DEFAULT_32BIT)
+ arch = LLDB_ARCH_DEFAULT_64BIT;
+ else
+ arch = LLDB_ARCH_DEFAULT_32BIT;
+
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
+ }
+ }
+
+ if (error.Success())
+ {
+ m_opaque_sp->GetTargetList().SetCurrentTarget (target_sp.get());
+ target.reset(target_sp);
+ }
}
- else
+ return target;
+}
+
+SBTarget
+SBDebugger::CreateTarget (const char *filename)
+{
+ SBTarget target;
+ if (m_opaque_sp)
{
+ FileSpec file (filename);
+ ArchSpec arch = lldb_private::GetDefaultArchitecture();
+ TargetSP target_sp;
+ Error error;
+
if (!arch.IsValid())
arch = LLDB_ARCH_DEFAULT;
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
if (error.Fail())
{
@@ -465,77 +440,57 @@
else
arch = LLDB_ARCH_DEFAULT_32BIT;
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
+ }
+
+ if (error.Success())
+ {
+ m_opaque_sp->GetTargetList().SetCurrentTarget (target_sp.get());
+ target.reset (target_sp);
}
}
-
- if (error.Success())
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (target_sp.get());
- else
- target_sp.reset();
-
- SBTarget sb_target (target_sp);
- return sb_target;
-}
-
-SBTarget
-SBDebugger::CreateTarget (const char *filename)
-{
- FileSpec file (filename);
- ArchSpec arch = lldb_private::GetDefaultArchitecture();
- TargetSP target_sp;
- Error error;
-
- if (!arch.IsValid())
- arch = LLDB_ARCH_DEFAULT;
-
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
-
- if (error.Fail())
- {
- if (arch == LLDB_ARCH_DEFAULT_32BIT)
- arch = LLDB_ARCH_DEFAULT_64BIT;
- else
- arch = LLDB_ARCH_DEFAULT_32BIT;
-
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
- }
-
- if (!error.Fail())
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (target_sp.get());
-
- SBTarget sb_target (target_sp);
- return sb_target;
+ return target;
}
SBTarget
SBDebugger::GetTargetAtIndex (uint32_t idx)
{
- SBTarget sb_target (Debugger::GetSharedInstance().GetTargetList().GetTargetAtIndex (idx));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().GetTargetAtIndex (idx));
return sb_target;
}
SBTarget
SBDebugger::FindTargetWithProcessID (pid_t pid)
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcessID (pid));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().FindTargetWithProcessID (pid));
return sb_target;
}
SBTarget
SBDebugger::FindTargetWithFileAndArch (const char *filename, const char *arch_name)
{
- ArchSpec arch;
- if (arch_name)
- arch.SetArch(arch_name);
- return SBTarget (Debugger::GetSharedInstance().GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename),
- arch_name ? &arch : NULL));
+ SBTarget sb_target;
+ if (m_opaque_sp && filename && filename[0])
+ {
+ ArchSpec arch;
+ if (arch_name)
+ arch.SetArch(arch_name);
+ TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename), arch_name ? &arch : NULL));
+ sb_target.reset(target_sp);
+ }
+ return sb_target;
}
SBTarget
SBDebugger::FindTargetWithLLDBProcess (const lldb::ProcessSP &process_sp)
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcess (process_sp.get()));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().FindTargetWithProcess (process_sp.get()));
return sb_target;
}
@@ -543,27 +498,54 @@
uint32_t
SBDebugger::GetNumTargets ()
{
- return Debugger::GetSharedInstance().GetTargetList().GetNumTargets ();}
+ if (m_opaque_sp)
+ return m_opaque_sp->GetTargetList().GetNumTargets ();
+ return 0;
+}
SBTarget
SBDebugger::GetCurrentTarget ()
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().GetCurrentTarget ());
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().GetCurrentTarget ());
return sb_target;
}
void
SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
{
- Debugger::GetSharedInstance().DispatchInput ((const char *) data, data_len);
+ if (m_opaque_sp)
+ m_opaque_sp->DispatchInput ((const char *) data, data_len);
}
void
SBDebugger::PushInputReader (SBInputReader &reader)
{
- if (reader.IsValid())
+ if (m_opaque_sp && reader.IsValid())
{
InputReaderSP reader_sp(*reader);
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
+ m_opaque_sp->PushInputReader (reader_sp);
}
}
+
+void
+SBDebugger::reset (const lldb::DebuggerSP &debugger_sp)
+{
+ m_opaque_sp = debugger_sp;
+}
+
+Debugger *
+SBDebugger::get () const
+{
+ return m_opaque_sp.get();
+}
+
+Debugger &
+SBDebugger::ref () const
+{
+ assert (m_opaque_sp.get());
+ return *m_opaque_sp;
+}
+
+
diff --git a/source/API/SBError.cpp b/source/API/SBError.cpp
index 0e00d58..e91c94d 100644
--- a/source/API/SBError.cpp
+++ b/source/API/SBError.cpp
@@ -16,15 +16,15 @@
SBError::SBError () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBError::SBError (const SBError &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new Error(*rhs));
+ m_opaque_ap.reset (new Error(*rhs));
}
@@ -37,14 +37,14 @@
{
if (rhs.IsValid())
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *rhs;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *rhs;
else
- m_lldb_object_ap.reset (new Error(*rhs));
+ m_opaque_ap.reset (new Error(*rhs));
}
else
{
- m_lldb_object_ap.reset();
+ m_opaque_ap.reset();
}
return *this;
}
@@ -53,47 +53,47 @@
const char *
SBError::GetCString () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->AsCString();
return NULL;
}
void
SBError::Clear ()
{
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
bool
SBError::Fail () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Fail();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Fail();
return false;
}
bool
SBError::Success () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Success();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Success();
return false;
}
uint32_t
SBError::GetError () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetError();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetError();
return true;
}
ErrorType
SBError::GetType () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetType();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetType();
return eErrorTypeInvalid;
}
@@ -101,14 +101,14 @@
SBError::SetError (uint32_t err, ErrorType type)
{
CreateIfNeeded ();
- m_lldb_object_ap->SetError (err, type);
+ m_opaque_ap->SetError (err, type);
}
void
SBError::SetError (const Error &lldb_error)
{
CreateIfNeeded ();
- *m_lldb_object_ap = lldb_error;
+ *m_opaque_ap = lldb_error;
}
@@ -116,21 +116,21 @@
SBError::SetErrorToErrno ()
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorToErrno ();
+ m_opaque_ap->SetErrorToErrno ();
}
void
SBError::SetErrorToGenericError ()
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorToErrno ();
+ m_opaque_ap->SetErrorToErrno ();
}
void
SBError::SetErrorString (const char *err_str)
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorString (err_str);
+ m_opaque_ap->SetErrorString (err_str);
}
int
@@ -139,7 +139,7 @@
CreateIfNeeded ();
va_list args;
va_start (args, format);
- int num_chars = m_lldb_object_ap->SetErrorStringWithVarArg (format, args);
+ int num_chars = m_opaque_ap->SetErrorStringWithVarArg (format, args);
va_end (args);
return num_chars;
}
@@ -147,27 +147,27 @@
bool
SBError::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
void
SBError::CreateIfNeeded ()
{
- if (m_lldb_object_ap.get() == NULL)
- m_lldb_object_ap.reset(new Error ());
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset(new Error ());
}
lldb_private::Error *
SBError::operator->()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::Error *
SBError::get()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
@@ -175,6 +175,6 @@
SBError::operator*() const
{
// Be sure to call "IsValid()" before calling this function or it will crash
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
diff --git a/source/API/SBEvent.cpp b/source/API/SBEvent.cpp
index c082863..c04ee72 100644
--- a/source/API/SBEvent.cpp
+++ b/source/API/SBEvent.cpp
@@ -24,19 +24,19 @@
SBEvent::SBEvent () :
m_event_sp (),
- m_lldb_object (NULL)
+ m_opaque (NULL)
{
}
SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) :
m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))),
- m_lldb_object (m_event_sp.get())
+ m_opaque (m_event_sp.get())
{
}
SBEvent::SBEvent (EventSP &event_sp) :
m_event_sp (event_sp),
- m_lldb_object (event_sp.get())
+ m_opaque (event_sp.get())
{
}
@@ -47,7 +47,7 @@
void
SBEvent::Dump (FILE *f) const
{
- const Event *lldb_event = GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
{
StreamFile str(f);
@@ -58,7 +58,7 @@
const char *
SBEvent::GetDataFlavor ()
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
return lldb_event->GetData()->GetFlavor().AsCString();
return NULL;
@@ -67,7 +67,7 @@
uint32_t
SBEvent::GetType () const
{
- const Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
return lldb_event->GetType();
return 0;
@@ -77,9 +77,9 @@
SBEvent::GetBroadcaster () const
{
SBBroadcaster broadcaster;
- const Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
- broadcaster.SetLLDBObjectPtr (lldb_event->GetBroadcaster(), false);
+ broadcaster.reset (lldb_event->GetBroadcaster(), false);
return broadcaster;
}
@@ -88,9 +88,9 @@
{
if (broadcaster)
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
- return lldb_event->BroadcasterIs (broadcaster->GetLLDBObjectPtr ());
+ return lldb_event->BroadcasterIs (broadcaster->get());
}
return false;
}
@@ -98,79 +98,66 @@
bool
SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
- return lldb_event->BroadcasterIs (broadcaster.GetLLDBObjectPtr ());
+ return lldb_event->BroadcasterIs (broadcaster.get());
return false;
}
void
SBEvent::Clear()
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
lldb_event->Clear();
}
EventSP &
-SBEvent::GetSharedPtr () const
+SBEvent::GetSP () const
{
return m_event_sp;
}
Event *
-SBEvent::GetLLDBObjectPtr ()
+SBEvent::get() const
{
// There is a dangerous accessor call GetSharedPtr which can be used, so if
// we have anything valid in m_event_sp, we must use that since if it gets
// used by a function that puts something in there, then it won't update
- // m_lldb_object...
+ // m_opaque...
if (m_event_sp)
- m_lldb_object = m_event_sp.get();
+ m_opaque = m_event_sp.get();
- return m_lldb_object;
-}
-
-const Event *
-SBEvent::GetLLDBObjectPtr () const
-{
- // There is a dangerous accessor call GetSharedPtr which can be used, so if
- // we have anything valid in m_event_sp, we must use that since if it gets
- // used by a function that puts something in there, then it won't update
- // m_lldb_object...
- if (m_event_sp)
- m_lldb_object = m_event_sp.get();
-
- return m_lldb_object;
+ return m_opaque;
}
void
-SBEvent::SetEventSP (EventSP &event_sp)
+SBEvent::reset (EventSP &event_sp)
{
m_event_sp = event_sp;
- m_lldb_object = m_event_sp.get();
+ m_opaque = m_event_sp.get();
}
void
-SBEvent::SetLLDBObjectPtr (Event* event_ptr)
+SBEvent::reset (Event* event_ptr)
{
- m_lldb_object = event_ptr;
+ m_opaque = event_ptr;
m_event_sp.reset();
}
bool
SBEvent::IsValid() const
{
- // Do NOT use m_lldb_object directly!!! Must use the SBEvent::GetLLDBObjectPtr()
- // accessor. See comments in SBEvent::GetLLDBObjectPtr()....
- return SBEvent::GetLLDBObjectPtr() != NULL;
+ // Do NOT use m_opaque directly!!! Must use the SBEvent::get()
+ // accessor. See comments in SBEvent::get()....
+ return SBEvent::get() != NULL;
}
const char *
SBEvent::GetCStringFromEvent (const SBEvent &event)
{
- return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.GetLLDBObjectPtr()));
+ return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()));
}
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 48c7511..308e609 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -16,19 +16,19 @@
SBFileSpec::SBFileSpec () :
- m_lldb_object_ap()
+ m_opaque_ap()
{
}
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
- m_lldb_object_ap()
+ m_opaque_ap()
{
- if (rhs.m_lldb_object_ap.get())
- m_lldb_object_ap.reset (new FileSpec (*m_lldb_object_ap));
+ if (rhs.m_opaque_ap.get())
+ m_opaque_ap.reset (new FileSpec (*m_opaque_ap));
}
SBFileSpec::SBFileSpec (const char *path) :
- m_lldb_object_ap(new FileSpec (path))
+ m_opaque_ap(new FileSpec (path))
{
}
@@ -42,7 +42,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::FileSpec(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::FileSpec(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -50,14 +50,14 @@
bool
SBFileSpec::IsValid() const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
bool
SBFileSpec::Exists () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Exists();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Exists();
return false;
}
@@ -71,24 +71,24 @@
const char *
SBFileSpec::GetFileName() const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetFilename().AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetFilename().AsCString();
return NULL;
}
const char *
SBFileSpec::GetDirectory() const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetDirectory().AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetDirectory().AsCString();
return NULL;
}
uint32_t
SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetPath (dst_path, dst_len);
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetPath (dst_path, dst_len);
if (dst_path && dst_len)
*dst_path = '\0';
@@ -99,35 +99,35 @@
const lldb_private::FileSpec *
SBFileSpec::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::FileSpec *
SBFileSpec::get() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::FileSpec &
SBFileSpec::operator*() const
{
- return *m_lldb_object_ap.get();
+ return *m_opaque_ap.get();
}
const lldb_private::FileSpec &
SBFileSpec::ref() const
{
- return *m_lldb_object_ap.get();
+ return *m_opaque_ap.get();
}
void
SBFileSpec::SetFileSpec (const lldb_private::FileSpec& fs)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = fs;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = fs;
else
- m_lldb_object_ap.reset (new FileSpec (fs));
+ m_opaque_ap.reset (new FileSpec (fs));
}
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index c379532..cd9b4cd 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -41,12 +41,12 @@
using namespace lldb_private;
SBFrame::SBFrame () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) :
- m_lldb_object_sp (lldb_object_sp)
+ m_opaque_sp (lldb_object_sp)
{
}
@@ -58,65 +58,65 @@
void
SBFrame::SetFrame (const lldb::StackFrameSP &lldb_object_sp)
{
- m_lldb_object_sp = lldb_object_sp;
+ m_opaque_sp = lldb_object_sp;
}
bool
SBFrame::IsValid() const
{
- return (m_lldb_object_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
SBSymbolContext
SBFrame::GetSymbolContext (uint32_t resolve_scope) const
{
SBSymbolContext sb_sym_ctx;
- if (m_lldb_object_sp)
- sb_sym_ctx.SetSymbolContext(&m_lldb_object_sp->GetSymbolContext (resolve_scope));
+ if (m_opaque_sp)
+ sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
return sb_sym_ctx;
}
SBModule
SBFrame::GetModule () const
{
- SBModule sb_module (m_lldb_object_sp->GetSymbolContext (eSymbolContextModule).module_sp);
+ SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp);
return sb_module;
}
SBCompileUnit
SBFrame::GetCompileUnit () const
{
- SBCompileUnit sb_comp_unit(m_lldb_object_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
+ SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
return sb_comp_unit;
}
SBFunction
SBFrame::GetFunction () const
{
- SBFunction sb_function(m_lldb_object_sp->GetSymbolContext (eSymbolContextFunction).function);
+ SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function);
return sb_function;
}
SBBlock
SBFrame::GetBlock () const
{
- SBBlock sb_block(m_lldb_object_sp->GetSymbolContext (eSymbolContextBlock).block);
+ SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block);
return sb_block;
}
SBLineEntry
SBFrame::GetLineEntry () const
{
- SBLineEntry sb_line_entry(&m_lldb_object_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
+ SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
return sb_line_entry;
}
uint32_t
SBFrame::GetFrameID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return UINT32_MAX;
}
@@ -125,24 +125,24 @@
lldb::addr_t
SBFrame::GetPC () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetPC().GetLoadAddress (&m_lldb_object_sp->GetThread().GetProcess());
+ if (m_opaque_sp)
+ return m_opaque_sp->GetPC().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess());
return LLDB_INVALID_ADDRESS;
}
bool
SBFrame::SetPC (lldb::addr_t new_pc)
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->SetPC (new_pc);
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
return false;
}
lldb::addr_t
SBFrame::GetSP () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->GetSP();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->GetSP();
return LLDB_INVALID_ADDRESS;
}
@@ -150,8 +150,8 @@
lldb::addr_t
SBFrame::GetFP () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->GetFP();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->GetFP();
return LLDB_INVALID_ADDRESS;
}
@@ -160,15 +160,15 @@
SBFrame::GetPCAddress () const
{
SBAddress sb_addr;
- if (m_lldb_object_sp)
- sb_addr.SetAddress (&m_lldb_object_sp->GetPC());
+ if (m_opaque_sp)
+ sb_addr.SetAddress (&m_opaque_sp->GetPC());
return sb_addr;
}
void
SBFrame::Clear()
{
- m_lldb_object_sp.reset();
+ m_opaque_sp.reset();
}
SBValue
@@ -250,40 +250,40 @@
bool
SBFrame::operator == (const SBFrame &rhs) const
{
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBFrame::operator != (const SBFrame &rhs) const
{
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::StackFrame *
SBFrame::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::StackFrame *
SBFrame::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
SBThread
SBFrame::GetThread () const
{
- SBThread sb_thread (m_lldb_object_sp->GetThread().GetSP());
+ SBThread sb_thread (m_opaque_sp->GetThread().GetSP());
return sb_thread;
}
const char *
SBFrame::Disassemble () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->Disassemble();
+ if (m_opaque_sp)
+ return m_opaque_sp->Disassemble();
return NULL;
}
@@ -292,7 +292,7 @@
lldb_private::StackFrame *
SBFrame::GetLLDBObjectPtr ()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
SBValueList
@@ -302,10 +302,10 @@
bool in_scope_only)
{
SBValueList value_list;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
size_t i;
- VariableList *variable_list = m_lldb_object_sp->GetVariableList();
+ VariableList *variable_list = m_opaque_sp->GetVariableList();
if (variable_list)
{
const size_t num_variables = variable_list->GetSize();
@@ -334,7 +334,7 @@
}
if (add_variable)
{
- if (in_scope_only && !variable_sp->IsInScope(m_lldb_object_sp.get()))
+ if (in_scope_only && !variable_sp->IsInScope(m_opaque_sp.get()))
continue;
value_list.Append(ValueObjectSP (new ValueObjectVariable (variable_sp)));
@@ -346,7 +346,7 @@
if (statics)
{
- CompileUnit *frame_comp_unit = m_lldb_object_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit;
+ CompileUnit *frame_comp_unit = m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit;
if (frame_comp_unit)
{
@@ -377,9 +377,9 @@
SBFrame::GetRegisters ()
{
SBValueList value_list;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- RegisterContext *reg_ctx = m_lldb_object_sp->GetRegisterContext();
+ RegisterContext *reg_ctx = m_opaque_sp->GetRegisterContext();
if (reg_ctx)
{
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index 010a5ec..c4beff1 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -15,50 +15,50 @@
SBFunction::SBFunction () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBFunction::~SBFunction ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBFunction::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
const char *
SBFunction::GetName() const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetName().AsCString();
return NULL;
}
const char *
SBFunction::GetMangledName () const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetMangledName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetMangledName().AsCString();
return NULL;
}
bool
SBFunction::operator == (const SBFunction &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBFunction::operator != (const SBFunction &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
diff --git a/source/API/SBInputReader.cpp b/source/API/SBInputReader.cpp
index 022d732..4d1c7b9 100644
--- a/source/API/SBInputReader.cpp
+++ b/source/API/SBInputReader.cpp
@@ -10,8 +10,9 @@
#include "lldb/lldb-enumerations.h"
-#include "lldb/API/SBInputReader.h"
+#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
+#include "lldb/API/SBInputReader.h"
#include "lldb/API/SBStringList.h"
#include "lldb/Core/InputReader.h"
@@ -20,7 +21,7 @@
using namespace lldb_private;
SBInputReader::SBInputReader () :
- m_reader_sp (),
+ m_opaque_sp (),
m_callback_function (NULL),
m_callback_baton (NULL)
@@ -28,12 +29,12 @@
}
SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
- m_reader_sp (reader_sp)
+ m_opaque_sp (reader_sp)
{
}
SBInputReader::SBInputReader (const SBInputReader &rhs) :
- m_reader_sp (rhs.m_reader_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
@@ -45,7 +46,7 @@
SBInputReader::PrivateCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
@@ -62,6 +63,7 @@
SBError
SBInputReader::Initialize
(
+ SBDebugger &debugger,
Callback callback_function,
void *callback_baton,
lldb::InputReaderGranularity granularity,
@@ -71,14 +73,14 @@
)
{
SBError sb_error;
- m_reader_sp.reset (new InputReader ());
+ m_opaque_sp.reset (new InputReader (debugger.ref()));
m_callback_function = callback_function;
m_callback_baton = callback_baton;
- if (m_reader_sp)
+ if (m_opaque_sp)
{
- sb_error.SetError (m_reader_sp->Initialize (SBInputReader::PrivateCallback,
+ sb_error.SetError (m_opaque_sp->Initialize (SBInputReader::PrivateCallback,
this,
granularity,
end_token,
@@ -88,7 +90,7 @@
if (sb_error.Fail())
{
- m_reader_sp.reset ();
+ m_opaque_sp.reset ();
m_callback_function = NULL;
m_callback_baton = NULL;
}
@@ -99,46 +101,53 @@
bool
SBInputReader::IsValid () const
{
- return (m_reader_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
const SBInputReader &
SBInputReader::operator = (const SBInputReader &rhs)
{
if (this != &rhs)
- m_reader_sp = rhs.m_reader_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
return *this;
}
-lldb_private::InputReader *
+InputReader *
SBInputReader::operator->() const
{
- return m_reader_sp.get();
+ return m_opaque_sp.get();
}
lldb::InputReaderSP &
SBInputReader::operator *()
{
- return m_reader_sp;
+ return m_opaque_sp;
}
const lldb::InputReaderSP &
SBInputReader::operator *() const
{
- return m_reader_sp;
+ return m_opaque_sp;
}
-lldb_private::InputReader *
+InputReader *
SBInputReader::get() const
{
- return m_reader_sp.get();
+ return m_opaque_sp.get();
+}
+
+InputReader &
+SBInputReader::ref() const
+{
+ assert (m_opaque_sp.get());
+ return *m_opaque_sp;
}
bool
SBInputReader::IsDone () const
{
- if (m_reader_sp)
- return m_reader_sp->IsDone();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsDone();
else
return true;
}
@@ -146,15 +155,15 @@
void
SBInputReader::SetIsDone (bool value)
{
- if (m_reader_sp)
- m_reader_sp->SetIsDone (value);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIsDone (value);
}
bool
SBInputReader::IsActive () const
{
- if (m_reader_sp)
- return m_reader_sp->IsActive();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsActive();
else
return false;
}
@@ -162,8 +171,8 @@
InputReaderGranularity
SBInputReader::GetGranularity ()
{
- if (m_reader_sp)
- return m_reader_sp->GetGranularity();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetGranularity();
else
return eInputReaderGranularityInvalid;
}
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 564fda0..181b6b0 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -15,7 +15,7 @@
using namespace lldb_private;
//SBInstruction::SBInstruction (lldb_private::Disassembler::Instruction *lldb_insn) :
-// m_lldb_object_sp (lldb_insn);
+// m_opaque_sp (lldb_insn);
//{
//}
@@ -30,7 +30,7 @@
//bool
//SBInstruction::IsValid()
//{
-// return (m_lldb_object_sp.get() != NULL);
+// return (m_opaque_sp.get() != NULL);
//}
//size_t
@@ -38,7 +38,7 @@
//{
// if (IsValid())
// {
-// return m_lldb_object_sp->GetByteSize();
+// return m_opaque_sp->GetByteSize();
// }
// return 0;
//}
@@ -48,7 +48,7 @@
//{
// if (IsValid ())
// {
-// m_lldb_object_sp->SetByteSize (byte_size);
+// m_opaque_sp->SetByteSize (byte_size);
// }
//}
@@ -57,7 +57,7 @@
//{
// if (IsValid ())
// {
-// return m_lldb_object_sp->DoesBranch ();
+// return m_opaque_sp->DoesBranch ();
// }
// return false;
//}
@@ -70,5 +70,5 @@
//StreamFile out_strem (out);
- //m_lldb_object_sp->Dump (out, LLDB_INVALID_ADDRESS, NULL, 0);
+ //m_opaque_sp->Dump (out, LLDB_INVALID_ADDRESS, NULL, 0);
}
diff --git a/source/API/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index 4835400..a35f94a 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -14,26 +14,26 @@
SBLineEntry::SBLineEntry () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
{
- m_lldb_object_ap.reset (new lldb_private::LineEntry (*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
}
}
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
}
const SBLineEntry &
@@ -42,7 +42,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*rhs));
}
return *this;
}
@@ -50,10 +50,10 @@
void
SBLineEntry::SetLineEntry (const lldb_private::LineEntry &lldb_object_ref)
{
- if (m_lldb_object_ap.get())
- (*m_lldb_object_ap.get()) = lldb_object_ref;
+ if (m_opaque_ap.get())
+ (*m_opaque_ap.get()) = lldb_object_ref;
else
- m_lldb_object_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
+ m_opaque_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
}
@@ -66,8 +66,8 @@
SBLineEntry::GetStartAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
+ if (m_opaque_ap.get())
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
return sb_address;
}
@@ -75,10 +75,10 @@
SBLineEntry::GetEndAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
+ if (m_opaque_ap.get())
{
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
- sb_address.OffsetAddress(m_lldb_object_ap->range.GetByteSize());
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
+ sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
}
return sb_address;
}
@@ -86,7 +86,7 @@
bool
SBLineEntry::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
@@ -94,16 +94,16 @@
SBLineEntry::GetFileSpec () const
{
SBFileSpec sb_file_spec;
- if (m_lldb_object_ap.get() && m_lldb_object_ap->file)
- sb_file_spec.SetFileSpec(m_lldb_object_ap->file);
+ if (m_opaque_ap.get() && m_opaque_ap->file)
+ sb_file_spec.SetFileSpec(m_opaque_ap->file);
return sb_file_spec;
}
uint32_t
SBLineEntry::GetLine () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->line;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->line;
return 0;
}
@@ -111,16 +111,16 @@
uint32_t
SBLineEntry::GetColumn () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->column;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->column;
return 0;
}
bool
SBLineEntry::operator == (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) == 0;
@@ -131,8 +131,8 @@
bool
SBLineEntry::operator != (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) != 0;
@@ -143,13 +143,13 @@
const lldb_private::LineEntry *
SBLineEntry::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::LineEntry &
SBLineEntry::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp
index 0652610..3e2f212 100644
--- a/source/API/SBListener.cpp
+++ b/source/API/SBListener.cpp
@@ -19,30 +19,32 @@
using namespace lldb_private;
-SBListener::SBListener ()
+SBListener::SBListener () :
+ m_opaque_ptr (NULL),
+ m_opaque_ptr_owned (false)
{
}
SBListener::SBListener (const char *name) :
- m_lldb_object_ptr (new Listener (name)),
- m_lldb_object_ptr_owned (true)
+ m_opaque_ptr (new Listener (name)),
+ m_opaque_ptr_owned (true)
{
}
SBListener::SBListener (Listener &listener) :
- m_lldb_object_ptr (&listener),
- m_lldb_object_ptr_owned (false)
+ m_opaque_ptr (&listener),
+ m_opaque_ptr_owned (false)
{
}
SBListener::~SBListener ()
{
- if (m_lldb_object_ptr_owned)
+ if (m_opaque_ptr_owned)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- delete m_lldb_object_ptr;
- m_lldb_object_ptr = NULL;
+ delete m_opaque_ptr;
+ m_opaque_ptr = NULL;
}
}
}
@@ -50,30 +52,30 @@
bool
SBListener::IsValid() const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
void
SBListener::AddEvent (const SBEvent &event)
{
- EventSP &event_sp = event.GetSharedPtr ();
+ EventSP &event_sp = event.GetSP ();
if (event_sp)
- m_lldb_object_ptr->AddEvent (event_sp);
+ m_opaque_ptr->AddEvent (event_sp);
}
void
SBListener::Clear ()
{
- if (IsValid())
- m_lldb_object_ptr->Clear ();
+ if (m_opaque_ptr)
+ m_opaque_ptr->Clear ();
}
uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- return m_lldb_object_ptr->StartListeningForEvents (broadcaster.GetLLDBObjectPtr (), event_mask);
+ return m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
}
return false;
}
@@ -81,9 +83,9 @@
bool
SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- return m_lldb_object_ptr->StopListeningForEvents (broadcaster.GetLLDBObjectPtr (), event_mask);
+ return m_opaque_ptr->StopListeningForEvents (broadcaster.get(), event_mask);
}
return false;
}
@@ -91,7 +93,7 @@
bool
SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
{
- if (IsValid())
+ if (m_opaque_ptr)
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -101,13 +103,13 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
+ if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -119,7 +121,7 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -128,16 +130,16 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
- broadcaster.GetLLDBObjectPtr (),
+ if (m_opaque_ptr->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
+ broadcaster.get(),
event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -150,7 +152,7 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -159,40 +161,40 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
- broadcaster.GetLLDBObjectPtr (),
- event_type_mask,
- event_sp))
+ if (m_opaque_ptr->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
+ broadcaster.get(),
+ event_type_mask,
+ event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::PeekAtNextEvent (SBEvent &event)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- event.SetLLDBObjectPtr (m_lldb_object_ptr->PeekAtNextEvent ());
+ event.reset (m_opaque_ptr->PeekAtNextEvent ());
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::PeekAtNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- event.SetLLDBObjectPtr (m_lldb_object_ptr->PeekAtNextEventForBroadcaster (broadcaster.GetLLDBObjectPtr ()));
+ event.reset (m_opaque_ptr->PeekAtNextEventForBroadcaster (broadcaster.get()));
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -200,44 +202,44 @@
SBListener::PeekAtNextEventForBroadcasterWithType (const SBBroadcaster &broadcaster, uint32_t event_type_mask,
SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- event.SetLLDBObjectPtr(m_lldb_object_ptr->PeekAtNextEventForBroadcasterWithType (broadcaster.GetLLDBObjectPtr (), event_type_mask));
+ event.reset(m_opaque_ptr->PeekAtNextEventForBroadcasterWithType (broadcaster.get(), event_type_mask));
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::GetNextEvent (SBEvent &event)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEvent (event_sp))
+ if (m_opaque_ptr->GetNextEvent (event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::GetNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEventForBroadcaster (broadcaster.GetLLDBObjectPtr (), event_sp))
+ if (m_opaque_ptr->GetNextEventForBroadcaster (broadcaster.get(), event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -249,51 +251,61 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEventForBroadcasterWithType (broadcaster.GetLLDBObjectPtr (),
- event_type_mask,
- event_sp))
+ if (m_opaque_ptr->GetNextEventForBroadcasterWithType (broadcaster.get(),
+ event_type_mask,
+ event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::HandleBroadcastEvent (const SBEvent &event)
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->HandleBroadcastEvent (event.GetSharedPtr());
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HandleBroadcastEvent (event.GetSP());
return false;
}
-lldb_private::Listener *
+Listener *
SBListener::operator->() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
-lldb_private::Listener *
+Listener *
SBListener::get() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
-lldb_private::Listener &
+void
+SBListener::reset(Listener *listener, bool transfer_ownership)
+{
+ if (m_opaque_ptr_owned && m_opaque_ptr)
+ delete m_opaque_ptr;
+ m_opaque_ptr_owned = transfer_ownership;
+ m_opaque_ptr = listener;
+}
+
+
+Listener &
SBListener::operator *()
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
-const lldb_private::Listener &
+const Listener &
SBListener::operator *() const
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index 6a54c21..011197a 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -15,12 +15,12 @@
SBModule::SBModule () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBModule::SBModule (const lldb::ModuleSP& module_sp) :
- m_lldb_object_sp (module_sp)
+ m_opaque_sp (module_sp)
{
}
@@ -31,23 +31,23 @@
bool
SBModule::IsValid () const
{
- return m_lldb_object_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
SBFileSpec
SBModule::GetFileSpec () const
{
SBFileSpec file_spec;
- if (m_lldb_object_sp)
- file_spec.SetFileSpec(m_lldb_object_sp->GetFileSpec());
+ if (m_opaque_sp)
+ file_spec.SetFileSpec(m_opaque_sp->GetFileSpec());
return file_spec;
}
const uint8_t *
SBModule::GetUUIDBytes () const
{
- if (m_lldb_object_sp)
- return (const uint8_t *)m_lldb_object_sp->GetUUID().GetBytes();
+ if (m_opaque_sp)
+ return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes();
return NULL;
}
@@ -55,53 +55,53 @@
bool
SBModule::operator == (const SBModule &rhs) const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ if (m_opaque_sp)
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
return false;
}
bool
SBModule::operator != (const SBModule &rhs) const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ if (m_opaque_sp)
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
return false;
}
lldb::ModuleSP &
SBModule::operator *()
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
lldb_private::Module *
SBModule::operator ->()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Module *
SBModule::operator ->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Module *
SBModule::get()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Module *
SBModule::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
void
SBModule::SetModule (const lldb::ModuleSP& module_sp)
{
- m_lldb_object_sp = module_sp;
+ m_opaque_sp = module_sp;
}
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index a646e4b..7db5591 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -19,8 +19,9 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h"
-#include "lldb/Target/Thread.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
// Project includes
@@ -37,7 +38,7 @@
SBProcess::SBProcess () :
- m_lldb_object_sp()
+ m_opaque_sp()
{
}
@@ -47,13 +48,13 @@
//----------------------------------------------------------------------
SBProcess::SBProcess (const SBProcess& rhs) :
- m_lldb_object_sp (rhs.m_lldb_object_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBProcess::SBProcess (const lldb::ProcessSP &process_sp) :
- m_lldb_object_sp (process_sp)
+ m_opaque_sp (process_sp)
{
}
@@ -67,30 +68,30 @@
void
SBProcess::SetProcess (const ProcessSP &process_sp)
{
- m_lldb_object_sp = process_sp;
+ m_opaque_sp = process_sp;
}
void
SBProcess::Clear ()
{
- m_lldb_object_sp.reset();
+ m_opaque_sp.reset();
}
bool
SBProcess::IsValid() const
{
- return m_lldb_object_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
uint32_t
SBProcess::GetNumThreads ()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
const bool can_update = true;
- return m_lldb_object_sp->GetThreadList().GetSize(can_update);
+ return m_opaque_sp->GetThreadList().GetSize(can_update);
}
return 0;
}
@@ -99,8 +100,8 @@
SBProcess::GetCurrentThread () const
{
SBThread sb_thread;
- if (m_lldb_object_sp)
- sb_thread.SetThread (m_lldb_object_sp->GetThreadList().GetCurrentThread());
+ if (m_opaque_sp)
+ sb_thread.SetThread (m_opaque_sp->GetThreadList().GetCurrentThread());
return sb_thread;
}
@@ -108,8 +109,8 @@
SBProcess::GetTarget() const
{
SBTarget sb_target;
- if (m_lldb_object_sp)
- sb_target = SBDebugger::FindTargetWithLLDBProcess (m_lldb_object_sp);
+ if (m_opaque_sp)
+ sb_target = m_opaque_sp->GetTarget().GetSP();
return sb_target;
}
@@ -117,10 +118,10 @@
size_t
SBProcess::PutSTDIN (const char *src, size_t src_len)
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->PutSTDIN (src, src_len, error);
+ return m_opaque_sp->PutSTDIN (src, src_len, error);
}
else
return 0;
@@ -129,10 +130,10 @@
size_t
SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->GetSTDOUT (dst, dst_len, error);
+ return m_opaque_sp->GetSTDOUT (dst, dst_len, error);
}
else
return 0;
@@ -141,10 +142,10 @@
size_t
SBProcess::GetSTDERR (char *dst, size_t dst_len) const
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->GetSTDERR (dst, dst_len, error);
+ return m_opaque_sp->GetSTDERR (dst, dst_len, error);
}
else
return 0;
@@ -156,14 +157,14 @@
if (out == NULL)
return;
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
const StateType event_state = SBProcess::GetStateFromEvent (event);
char message[1024];
int message_len = ::snprintf (message,
sizeof (message),
"Process %d %s\n",
- m_lldb_object_sp->GetID(),
+ m_opaque_sp->GetID(),
SBDebugger::StateAsCString (event_state));
if (message_len > 0)
@@ -174,14 +175,14 @@
void
SBProcess::AppendCurrentStateReport (const SBEvent &event, SBCommandReturnObject &result)
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
const StateType event_state = SBProcess::GetStateFromEvent (event);
char message[1024];
::snprintf (message,
sizeof (message),
"Process %d %s\n",
- m_lldb_object_sp->GetID(),
+ m_opaque_sp->GetID(),
SBDebugger::StateAsCString (event_state));
result.AppendMessage (message);
@@ -191,16 +192,16 @@
bool
SBProcess::SetCurrentThread (const SBThread &thread)
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetThreadList().SetCurrentThreadByID (thread.GetThreadID());
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetThreadList().SetCurrentThreadByID (thread.GetThreadID());
return false;
}
bool
SBProcess::SetCurrentThreadByID (uint32_t tid)
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetThreadList().SetCurrentThreadByID (tid);
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetThreadList().SetCurrentThreadByID (tid);
return false;
}
@@ -208,16 +209,16 @@
SBProcess::GetThreadAtIndex (size_t index)
{
SBThread thread;
- if (m_lldb_object_sp)
- thread.SetThread (m_lldb_object_sp->GetThreadList().GetThreadAtIndex(index));
+ if (m_opaque_sp)
+ thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index));
return thread;
}
StateType
SBProcess::GetState ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetState();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetState();
else
return eStateInvalid;
}
@@ -226,8 +227,8 @@
int
SBProcess::GetExitStatus ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetExitStatus ();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetExitStatus ();
else
return 0;
}
@@ -235,8 +236,8 @@
const char *
SBProcess::GetExitDescription ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetExitDescription ();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetExitDescription ();
else
return NULL;
}
@@ -244,8 +245,8 @@
lldb::pid_t
SBProcess::GetProcessID ()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return LLDB_INVALID_PROCESS_ID;
}
@@ -253,85 +254,12 @@
uint32_t
SBProcess::GetAddressByteSize () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetAddressByteSize();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetAddressByteSize();
else
return 0;
}
-
-void
-SBProcess::DisplayThreadsInfo (FILE *out, FILE *err, bool only_threads_with_stop_reason)
-{
- if (m_lldb_object_sp != NULL)
- {
- size_t num_thread_infos_dumped = 0;
- size_t num_threads = GetNumThreads();
-
- if (out == NULL)
- out = SBDebugger::GetOutputFileHandle();
-
- if (err == NULL)
- err = SBDebugger::GetErrorFileHandle();
-
- if ((out == NULL) ||(err == NULL))
- return;
-
- if (num_threads > 0)
- {
- Thread::StopInfo thread_stop_info;
- SBThread curr_thread (m_lldb_object_sp->GetThreadList().GetCurrentThread());
- for (int i = 0; i < num_threads; ++i)
- {
- SBThread thread (m_lldb_object_sp->GetThreadList().GetThreadAtIndex(i));
- if (thread.IsValid())
- {
- bool is_current_thread = false;
- StreamFile str (out);
- if (thread == curr_thread)
- is_current_thread = true;
- StopReason thread_stop_reason = eStopReasonNone;
- if (thread->GetStopInfo (&thread_stop_info))
- {
- thread_stop_reason = thread_stop_info.GetStopReason();
- if (thread_stop_reason == eStopReasonNone)
- {
- if (only_threads_with_stop_reason && !is_current_thread)
- continue;
- }
- }
- ++num_thread_infos_dumped;
- fprintf (out, " %c thread #%u: tid = 0x%4.4x, pc = 0x%16.16llx",
- (is_current_thread ? '*' : ' '),
- thread->GetIndexID(), thread->GetID(), thread->GetRegisterContext()->GetPC());
-
- StackFrameSP frame_sp(thread->GetStackFrameAtIndex (0));
- if (frame_sp)
- {
- SymbolContext sc (frame_sp->GetSymbolContext (eSymbolContextEverything));
- fprintf (out, ", where = ");
- sc.DumpStopContext (&str, m_lldb_object_sp.get(), frame_sp->GetPC ());
- }
-
- if (thread_stop_reason != eStopReasonNone)
- {
- fprintf (out, ", stop reason = ");
- thread_stop_info.Dump (&str);
- }
-
- const char *thread_name = thread->GetName();
- if (thread_name && thread_name[0])
- fprintf (out, ", thread_name = '%s'", thread_name);
-
- fprintf (out, "\n");
-
- SBThread sb_thread (thread);
- sb_thread.DisplayFramesForCurrentContext (out, err, 0, 1, false, 1);
- }
- }
- }
- }
-}
bool
SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
{
@@ -340,11 +268,11 @@
if (IsValid())
{
EventSP event_sp;
- StateType state = m_lldb_object_sp->WaitForStateChangedEvents (NULL, event_sp);
+ StateType state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp);
while (StateIsStoppedState (state))
{
- state = m_lldb_object_sp->WaitForStateChangedEvents (NULL, event_sp);
+ state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp);
SBEvent event (event_sp);
AppendCurrentStateReport (event, result);
state_changed = true;
@@ -358,7 +286,7 @@
{
SBError sb_error;
if (IsValid())
- sb_error.SetError(m_lldb_object_sp->Resume());
+ sb_error.SetError(m_opaque_sp->Resume());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -370,8 +298,8 @@
SBProcess::Destroy ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError(m_lldb_object_sp->Destroy());
+ if (m_opaque_sp)
+ sb_error.SetError(m_opaque_sp->Destroy());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -384,7 +312,7 @@
{
SBError sb_error;
if (IsValid())
- sb_error.SetError (m_lldb_object_sp->Halt());
+ sb_error.SetError (m_opaque_sp->Halt());
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -394,8 +322,8 @@
SBProcess::Kill ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Destroy());
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Destroy());
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -406,8 +334,8 @@
SBProcess::AttachByName (const char *name, bool wait_for_launch)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Attach (name, wait_for_launch));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Attach (name, wait_for_launch));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -425,8 +353,8 @@
SBProcess::Attach (lldb::pid_t attach_pid)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Attach (attach_pid));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Attach (attach_pid));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -436,8 +364,8 @@
SBProcess::Detach ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Detach());
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Detach());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -448,102 +376,38 @@
SBProcess::Signal (int signal)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Signal (signal));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Signal (signal));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
}
-void
-SBProcess::ListThreads ()
-{
- FILE *out = SBDebugger::GetOutputFileHandle();
- if (out == NULL)
- return;
-
- if (m_lldb_object_sp)
- {
- size_t num_threads = GetNumThreads ();
- if (num_threads > 0)
- {
- Thread *cur_thread = m_lldb_object_sp->GetThreadList().GetCurrentThread().get();
- for (int i = 0; i < num_threads; ++i)
- {
- Thread *thread = m_lldb_object_sp->GetThreadList().GetThreadAtIndex(i).get();
- if (thread)
- {
- bool is_current_thread = false;
- if (thread == cur_thread)
- is_current_thread = true;
- fprintf (out, " [%u] %c tid = 0x%4.4x, pc = 0x%16.16llx",
- i,
- (is_current_thread ? '*' : ' '),
- thread->GetID(),
- thread->GetRegisterContext()->GetPC());
- const char *thread_name = thread->GetName();
- if (thread_name && thread_name[0])
- fprintf (out, ", name = %s", thread_name);
- const char *queue_name = thread->GetQueueName();
- if (queue_name && queue_name[0])
- fprintf (out, ", queue = %s", queue_name);
- fprintf (out, "\n");
- }
- }
- }
- }
-}
-
SBThread
SBProcess::GetThreadByID (tid_t sb_thread_id)
{
SBThread thread;
- if (m_lldb_object_sp)
- thread.SetThread (m_lldb_object_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id));
+ if (m_opaque_sp)
+ thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id));
return thread;
}
-void
-SBProcess::Backtrace (bool all_threads, uint32_t num_frames)
-{
- if (m_lldb_object_sp)
- {
- if (!all_threads)
- {
- SBDebugger::UpdateCurrentThread (*this);
- SBThread cur_thread = GetCurrentThread();
- if (cur_thread.IsValid())
- cur_thread.Backtrace (num_frames);
- }
- else
- {
- int num_threads = GetNumThreads ();
- for (int i = 0; i < num_threads; ++i)
- {
- SBThread sb_thread = GetThreadAtIndex (i);
- sb_thread.Backtrace (num_frames);
- }
- }
- }
-}
-
StateType
SBProcess::GetStateFromEvent (const SBEvent &event)
{
- return Process::ProcessEventData::GetStateFromEvent (event.GetLLDBObjectPtr());
+ return Process::ProcessEventData::GetStateFromEvent (event.get());
}
-
bool
SBProcess::GetRestartedFromEvent (const SBEvent &event)
{
- return Process::ProcessEventData::GetRestartedFromEvent (event.GetLLDBObjectPtr());
+ return Process::ProcessEventData::GetRestartedFromEvent (event.get());
}
SBProcess
SBProcess::GetProcessFromEvent (const SBEvent &event)
{
- SBProcess process(Process::ProcessEventData::GetProcessFromEvent (event.GetLLDBObjectPtr()));
+ SBProcess process(Process::ProcessEventData::GetProcessFromEvent (event.get()));
return process;
}
@@ -551,14 +415,14 @@
SBBroadcaster
SBProcess::GetBroadcaster () const
{
- SBBroadcaster broadcaster(m_lldb_object_sp.get(), false);
+ SBBroadcaster broadcaster(m_opaque_sp.get(), false);
return broadcaster;
}
lldb_private::Process *
SBProcess::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
size_t
@@ -569,7 +433,7 @@
if (IsValid())
{
Error error;
- bytes_read = m_lldb_object_sp->ReadMemory (addr, dst, dst_len, error);
+ bytes_read = m_opaque_sp->ReadMemory (addr, dst, dst_len, error);
sb_error.SetError (error);
}
else
@@ -588,7 +452,7 @@
if (IsValid())
{
Error error;
- bytes_written = m_lldb_object_sp->WriteMemory (addr, src, src_len, error);
+ bytes_written = m_opaque_sp->WriteMemory (addr, src, src_len, error);
sb_error.SetError (error);
}
@@ -599,6 +463,6 @@
lldb_private::Process *
SBProcess::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
diff --git a/source/API/SBSourceManager.cpp b/source/API/SBSourceManager.cpp
index c8a0874..701665e 100644
--- a/source/API/SBSourceManager.cpp
+++ b/source/API/SBSourceManager.cpp
@@ -21,7 +21,7 @@
SBSourceManager::SBSourceManager (SourceManager& source_manager) :
- m_source_manager (source_manager)
+ m_opaque_ref (source_manager)
{
}
@@ -48,12 +48,12 @@
StreamFile str (f);
- return m_source_manager.DisplaySourceLinesWithLineNumbers (*file,
- line,
- context_before,
- context_after,
- current_line_cstr,
- &str);
+ return m_opaque_ref.DisplaySourceLinesWithLineNumbers (*file,
+ line,
+ context_before,
+ context_after,
+ current_line_cstr,
+ &str);
}
return 0;
}
@@ -61,5 +61,5 @@
SourceManager &
SBSourceManager::GetLLDBManager ()
{
- return m_source_manager;
+ return m_opaque_ref;
}
diff --git a/source/API/SBStringList.cpp b/source/API/SBStringList.cpp
index b4cfb9b..f152000 100644
--- a/source/API/SBStringList.cpp
+++ b/source/API/SBStringList.cpp
@@ -15,22 +15,22 @@
using namespace lldb_private;
SBStringList::SBStringList () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBStringList::SBStringList (const lldb_private::StringList *lldb_strings_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_strings_ptr)
- m_lldb_object_ap.reset (new lldb_private::StringList (*lldb_strings_ptr));
+ m_opaque_ap.reset (new lldb_private::StringList (*lldb_strings_ptr));
}
SBStringList::SBStringList (const SBStringList &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList(*rhs));
+ m_opaque_ap.reset (new lldb_private::StringList(*rhs));
}
@@ -44,7 +44,7 @@
SBStringList::operator = (const SBStringList &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList(*rhs));
+ m_opaque_ap.reset (new lldb_private::StringList(*rhs));
return *this;
}
@@ -52,19 +52,19 @@
const lldb_private::StringList *
SBStringList::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::StringList &
SBStringList::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
bool
SBStringList::IsValid() const
{
- return (m_lldb_object_ap.get() != NULL);
+ return (m_opaque_ap.get() != NULL);
}
void
@@ -73,9 +73,9 @@
if (str != NULL)
{
if (IsValid())
- m_lldb_object_ap->AppendString (str);
+ m_opaque_ap->AppendString (str);
else
- m_lldb_object_ap.reset (new lldb_private::StringList (str));
+ m_opaque_ap.reset (new lldb_private::StringList (str));
}
}
@@ -87,9 +87,9 @@
&& (strc > 0))
{
if (IsValid())
- m_lldb_object_ap->AppendList (strv, strc);
+ m_opaque_ap->AppendList (strv, strc);
else
- m_lldb_object_ap.reset (new lldb_private::StringList (strv, strc));
+ m_opaque_ap.reset (new lldb_private::StringList (strv, strc));
}
}
@@ -99,8 +99,8 @@
if (strings.IsValid())
{
if (! IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList());
- m_lldb_object_ap->AppendList (*(strings.m_lldb_object_ap));
+ m_opaque_ap.reset (new lldb_private::StringList());
+ m_opaque_ap->AppendList (*(strings.m_opaque_ap));
}
}
@@ -109,7 +109,7 @@
{
if (IsValid())
{
- return m_lldb_object_ap->GetSize();
+ return m_opaque_ap->GetSize();
}
return 0;
}
@@ -119,7 +119,7 @@
{
if (IsValid())
{
- return m_lldb_object_ap->GetStringAtIndex (idx);
+ return m_opaque_ap->GetStringAtIndex (idx);
}
return NULL;
}
@@ -129,6 +129,6 @@
{
if (IsValid())
{
- m_lldb_object_ap->Clear();
+ m_opaque_ap->Clear();
}
}
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index 8500c8b..502efaa 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -14,39 +14,39 @@
SBSymbol::SBSymbol () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBSymbol::~SBSymbol ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBSymbol::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
const char *
SBSymbol::GetName() const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetName().AsCString();
return NULL;
}
const char *
SBSymbol::GetMangledName () const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetMangledName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetMangledName().AsCString();
return NULL;
}
@@ -54,11 +54,11 @@
bool
SBSymbol::operator == (const SBSymbol &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBSymbol::operator != (const SBSymbol &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
diff --git a/source/API/SBSymbolContext.cpp b/source/API/SBSymbolContext.cpp
index dec8529..d192569 100644
--- a/source/API/SBSymbolContext.cpp
+++ b/source/API/SBSymbolContext.cpp
@@ -16,22 +16,22 @@
SBSymbolContext::SBSymbolContext () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (sc_ptr)
- m_lldb_object_ap.reset (new SymbolContext (*sc_ptr));
+ m_opaque_ap.reset (new SymbolContext (*sc_ptr));
}
SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- *m_lldb_object_ap = *rhs.m_lldb_object_ap;
+ *m_opaque_ap = *rhs.m_opaque_ap;
}
SBSymbolContext::~SBSymbolContext ()
@@ -44,7 +44,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::SymbolContext(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::SymbolContext(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -54,22 +54,22 @@
{
if (sc_ptr)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *sc_ptr;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *sc_ptr;
else
- m_lldb_object_ap.reset (new SymbolContext (*sc_ptr));
+ m_opaque_ap.reset (new SymbolContext (*sc_ptr));
}
else
{
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
}
bool
SBSymbolContext::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
@@ -78,35 +78,35 @@
SBSymbolContext::GetModule ()
{
SBModule sb_module;
- if (m_lldb_object_ap.get())
- sb_module.SetModule(m_lldb_object_ap->module_sp);
+ if (m_opaque_ap.get())
+ sb_module.SetModule(m_opaque_ap->module_sp);
return sb_module;
}
SBCompileUnit
SBSymbolContext::GetCompileUnit ()
{
- return SBCompileUnit (m_lldb_object_ap.get() ? m_lldb_object_ap->comp_unit : NULL);
+ return SBCompileUnit (m_opaque_ap.get() ? m_opaque_ap->comp_unit : NULL);
}
SBFunction
SBSymbolContext::GetFunction ()
{
- return SBFunction (m_lldb_object_ap.get() ? m_lldb_object_ap->function : NULL);
+ return SBFunction (m_opaque_ap.get() ? m_opaque_ap->function : NULL);
}
SBBlock
SBSymbolContext::GetBlock ()
{
- return SBBlock (m_lldb_object_ap.get() ? m_lldb_object_ap->block : NULL);
+ return SBBlock (m_opaque_ap.get() ? m_opaque_ap->block : NULL);
}
SBLineEntry
SBSymbolContext::GetLineEntry ()
{
SBLineEntry sb_line_entry;
- if (m_lldb_object_ap.get())
- sb_line_entry.SetLineEntry (m_lldb_object_ap->line_entry);
+ if (m_opaque_ap.get())
+ sb_line_entry.SetLineEntry (m_opaque_ap->line_entry);
return sb_line_entry;
}
@@ -114,19 +114,19 @@
SBSymbol
SBSymbolContext::GetSymbol ()
{
- return SBSymbol (m_lldb_object_ap.get() ? m_lldb_object_ap->symbol : NULL);
+ return SBSymbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL);
}
lldb_private::SymbolContext*
SBSymbolContext::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::SymbolContext *
SBSymbolContext::GetLLDBObjectPtr() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 3fba69e..ff08689 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -53,12 +53,12 @@
}
SBTarget::SBTarget (const SBTarget& rhs) :
- m_target_sp (rhs.m_target_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBTarget::SBTarget(const TargetSP& target_sp) :
- m_target_sp (target_sp)
+ m_opaque_sp (target_sp)
{
}
@@ -67,7 +67,7 @@
{
if (this != &rhs)
{
- m_target_sp = rhs.m_target_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@@ -83,28 +83,37 @@
bool
SBTarget::IsValid () const
{
- return m_target_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
SBProcess
SBTarget::GetProcess ()
{
SBProcess sb_process;
- if (IsValid())
- sb_process.SetProcess (m_target_sp->GetProcessSP());
+ if (m_opaque_sp)
+ sb_process.SetProcess (m_opaque_sp->GetProcessSP());
return sb_process;
}
+SBDebugger
+SBTarget::GetDebugger () const
+{
+ SBDebugger debugger;
+ if (m_opaque_sp)
+ debugger.reset (m_opaque_sp->GetDebugger().GetSP());
+ return debugger;
+}
+
SBProcess
SBTarget::CreateProcess ()
{
SBProcess sb_process;
- if (IsValid())
+ if (m_opaque_sp)
{
- SBListener sb_listener = SBDebugger::GetListener();
+ SBListener sb_listener (m_opaque_sp->GetDebugger().GetListener());
if (sb_listener.IsValid())
- sb_process.SetProcess (m_target_sp->CreateProcess (*sb_listener));
+ sb_process.SetProcess (m_opaque_sp->CreateProcess (*sb_listener));
}
return sb_process;
}
@@ -141,9 +150,9 @@
SBTarget::GetExecutable ()
{
SBFileSpec exe_file_spec;
- if (IsValid())
+ if (m_opaque_sp)
{
- ModuleSP exe_module_sp (m_target_sp->GetExecutableModule ());
+ ModuleSP exe_module_sp (m_opaque_sp->GetExecutableModule ());
if (exe_module_sp)
exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
}
@@ -154,8 +163,8 @@
bool
SBTarget::DeleteTargetFromList (TargetList *list)
{
- if (IsValid())
- return list->DeleteTarget (m_target_sp);
+ if (m_opaque_sp)
+ return list->DeleteTarget (m_opaque_sp);
else
return false;
}
@@ -163,9 +172,9 @@
bool
SBTarget::MakeCurrentTarget ()
{
- if (IsValid())
+ if (m_opaque_sp)
{
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (m_target_sp.get());
+ m_opaque_sp->GetDebugger().GetTargetList().SetCurrentTarget (m_opaque_sp.get());
return true;
}
return false;
@@ -174,24 +183,31 @@
bool
SBTarget::operator == (const SBTarget &rhs) const
{
- return m_target_sp.get() == rhs.m_target_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBTarget::operator != (const SBTarget &rhs) const
{
- return m_target_sp.get() != rhs.m_target_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::Target *
-SBTarget::GetLLDBObjectPtr()
+SBTarget::operator ->() const
{
- return m_target_sp.get();
+ return m_opaque_sp.get();
}
-const lldb_private::Target *
-SBTarget::GetLLDBObjectPtr() const
+
+lldb_private::Target *
+SBTarget::get() const
{
- return m_target_sp.get();
+ return m_opaque_sp.get();
+}
+
+void
+SBTarget::reset (const lldb::TargetSP& target_sp)
+{
+ m_opaque_sp = target_sp;
}
SBBreakpoint
@@ -207,8 +223,8 @@
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && line != 0)
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
+ if (m_opaque_sp.get() && line != 0)
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
return sb_bp;
}
@@ -216,16 +232,16 @@
SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && symbol_name && symbol_name[0])
+ if (m_opaque_sp.get() && symbol_name && symbol_name[0])
{
if (module_name && module_name[0])
{
FileSpec module_file_spec(module_name);
- *sb_bp = m_target_sp->CreateBreakpoint (&module_file_spec, symbol_name, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, symbol_name, false);
}
else
{
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, symbol_name, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, symbol_name, false);
}
}
return sb_bp;
@@ -235,7 +251,7 @@
SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && symbol_name_regex && symbol_name_regex[0])
+ if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0])
{
RegularExpression regexp(symbol_name_regex);
@@ -243,11 +259,11 @@
{
FileSpec module_file_spec(module_name);
- *sb_bp = m_target_sp->CreateBreakpoint (&module_file_spec, regexp, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, regexp, false);
}
else
{
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, regexp, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, regexp, false);
}
}
return sb_bp;
@@ -259,22 +275,22 @@
SBTarget::BreakpointCreateByAddress (addr_t address)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get())
- *sb_bp = m_target_sp->CreateBreakpoint (address, false);
+ if (m_opaque_sp.get())
+ *sb_bp = m_opaque_sp->CreateBreakpoint (address, false);
return sb_bp;
}
void
SBTarget::ListAllBreakpoints ()
{
- FILE *out_file = SBDebugger::GetOutputFileHandle();
+ FILE *out_file = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out_file == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
- const BreakpointList &bp_list = m_target_sp->GetBreakpointList();
+ const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList();
size_t num_bps = bp_list.GetSize();
for (int i = 0; i < num_bps; ++i)
{
@@ -288,8 +304,8 @@
SBTarget::FindBreakpointByID (break_id_t bp_id)
{
SBBreakpoint sb_breakpoint;
- if (m_target_sp && bp_id != LLDB_INVALID_BREAK_ID)
- *sb_breakpoint = m_target_sp->GetBreakpointByID (bp_id);
+ if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID)
+ *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id);
return sb_breakpoint;
}
@@ -297,17 +313,17 @@
bool
SBTarget::BreakpointDelete (break_id_t bp_id)
{
- if (m_target_sp)
- return m_target_sp->RemoveBreakpointByID (bp_id);
+ if (m_opaque_sp)
+ return m_opaque_sp->RemoveBreakpointByID (bp_id);
return false;
}
bool
SBTarget::EnableAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->EnableAllBreakpoints ();
+ m_opaque_sp->EnableAllBreakpoints ();
return true;
}
return false;
@@ -316,9 +332,9 @@
bool
SBTarget::DisableAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->DisableAllBreakpoints ();
+ m_opaque_sp->DisableAllBreakpoints ();
return true;
}
return false;
@@ -327,9 +343,9 @@
bool
SBTarget::DeleteAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->RemoveAllBreakpoints ();
+ m_opaque_sp->RemoveAllBreakpoints ();
return true;
}
return false;
@@ -339,8 +355,8 @@
uint32_t
SBTarget::GetNumModules () const
{
- if (m_target_sp)
- return m_target_sp->GetImages().GetSize();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetImages().GetSize();
return 0;
}
@@ -348,8 +364,8 @@
SBTarget::FindModule (const SBFileSpec &sb_file_spec)
{
SBModule sb_module;
- if (m_target_sp && sb_file_spec.IsValid())
- sb_module.SetModule (m_target_sp->GetImages().FindFirstModuleForFileSpec (*sb_file_spec, NULL));
+ if (m_opaque_sp && sb_file_spec.IsValid())
+ sb_module.SetModule (m_opaque_sp->GetImages().FindFirstModuleForFileSpec (*sb_file_spec, NULL));
return sb_module;
}
@@ -357,8 +373,8 @@
SBTarget::GetModuleAtIndex (uint32_t idx)
{
SBModule sb_module;
- if (m_target_sp)
- sb_module.SetModule(m_target_sp->GetImages().GetModuleAtIndex(idx));
+ if (m_opaque_sp)
+ sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx));
return sb_module;
}
@@ -366,7 +382,7 @@
SBBroadcaster
SBTarget::GetBroadcaster () const
{
- SBBroadcaster broadcaster(m_target_sp.get(), false);
+ SBBroadcaster broadcaster(m_opaque_sp.get(), false);
return broadcaster;
}
@@ -376,11 +392,11 @@
if (file_address_start == LLDB_INVALID_ADDRESS)
return;
- FILE *out = SBDebugger::GetOutputFileHandle();
+ FILE *out = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
SBModule module;
if (module_name != NULL)
@@ -388,7 +404,7 @@
SBFileSpec file_spec (module_name);
module = FindModule (file_spec);
}
- ArchSpec arch (m_target_sp->GetArchitecture());
+ ArchSpec arch (m_opaque_sp->GetArchitecture());
if (!arch.IsValid())
return;
Disassembler *disassembler = Disassembler::FindPlugin (arch);
@@ -446,11 +462,11 @@
if (function_name == NULL)
return;
- FILE *out = SBDebugger::GetOutputFileHandle();
+ FILE *out = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
SBModule module;
@@ -460,7 +476,7 @@
module = FindModule (file_spec);
}
- ArchSpec arch (m_target_sp->GetArchitecture());
+ ArchSpec arch (m_opaque_sp->GetArchitecture());
if (!arch.IsValid())
return;
@@ -486,7 +502,7 @@
if (module_name != NULL)
containing_module = new FileSpec (module_name);
- SearchFilterSP filter_sp (m_target_sp->GetSearchFilterForModule (containing_module));
+ SearchFilterSP filter_sp (m_opaque_sp->GetSearchFilterForModule (containing_module));
AddressResolverSP resolver_sp (new AddressResolverName (function_name));
resolver_sp->ResolveAddress (*filter_sp);
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 7a86999..24e5484 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -11,8 +11,10 @@
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -35,7 +37,7 @@
using namespace lldb_private;
SBThread::SBThread () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
@@ -43,13 +45,13 @@
// Thread constructor
//----------------------------------------------------------------------
SBThread::SBThread (const ThreadSP& lldb_object_sp) :
- m_lldb_object_sp (lldb_object_sp)
+ m_opaque_sp (lldb_object_sp)
{
}
SBThread::SBThread (const SBThread &rhs)
{
- m_lldb_object_sp = rhs.m_lldb_object_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
//----------------------------------------------------------------------
@@ -62,16 +64,16 @@
bool
SBThread::IsValid() const
{
- return m_lldb_object_sp != NULL;
+ return m_opaque_sp != NULL;
}
StopReason
SBThread::GetStopReason()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
lldb_private::Thread::StopInfo thread_stop_info;
- if (m_lldb_object_sp->GetStopInfo(&thread_stop_info))
+ if (m_opaque_sp->GetStopInfo(&thread_stop_info))
return thread_stop_info.GetStopReason();
}
return eStopReasonInvalid;
@@ -80,10 +82,10 @@
size_t
SBThread::GetStopDescription (char *dst, size_t dst_len)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
lldb_private::Thread::StopInfo thread_stop_info;
- if (m_lldb_object_sp->GetStopInfo(&thread_stop_info))
+ if (m_opaque_sp->GetStopInfo(&thread_stop_info))
{
const char *stop_desc = thread_stop_info.GetStopDescription();
if (stop_desc)
@@ -129,7 +131,7 @@
case eStopReasonSignal:
{
- stop_desc = m_lldb_object_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (thread_stop_info.GetSignal());
+ stop_desc = m_opaque_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (thread_stop_info.GetSignal());
if (stop_desc == NULL || stop_desc[0] == '\0')
{
static char signal_desc[] = "signal";
@@ -169,15 +171,15 @@
void
SBThread::SetThread (const ThreadSP& lldb_object_sp)
{
- m_lldb_object_sp = lldb_object_sp;
+ m_opaque_sp = lldb_object_sp;
}
lldb::tid_t
SBThread::GetThreadID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return LLDB_INVALID_THREAD_ID;
}
@@ -185,23 +187,23 @@
uint32_t
SBThread::GetIndexID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetIndexID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIndexID();
return LLDB_INVALID_INDEX32;
}
const char *
SBThread::GetName () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetName();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetName();
return NULL;
}
const char *
SBThread::GetQueueName () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetQueueName();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetQueueName();
return NULL;
}
@@ -219,9 +221,9 @@
if ((out == NULL) || (err == NULL))
return;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- uint32_t num_stack_frames = m_lldb_object_sp->GetStackFrameCount ();
+ uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount ();
StackFrameSP frame_sp;
int frame_idx = 0;
@@ -230,7 +232,7 @@
if (frame_idx >= num_stack_frames)
break;
- frame_sp = m_lldb_object_sp->GetStackFrameAtIndex (frame_idx);
+ frame_sp = m_opaque_sp->GetStackFrameAtIndex (frame_idx);
if (!frame_sp)
break;
@@ -257,17 +259,16 @@
uint32_t source_lines_before)
{
bool success = false;
-
- if ((out == NULL) || (err == NULL))
+
+ if ((out == NULL) || (err == NULL))
return false;
-
- if (m_lldb_object_sp && frame.IsValid())
+
+ if (m_opaque_sp && frame.IsValid())
{
-
StreamFile str (out);
-
+
SBSymbolContext sc(frame.GetSymbolContext(eSymbolContextEverything));
-
+
if (show_frame_info && sc.IsValid())
{
user_id_t frame_idx = (user_id_t) frame.GetFrameID();
@@ -277,28 +278,28 @@
frame_idx,
GetThreadID(),
pc);
- sc->DumpStopContext (&str, &m_lldb_object_sp->GetProcess(), *frame.GetPCAddress());
+ sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress());
fprintf (out, "\n");
success = true;
}
-
+
SBCompileUnit comp_unit(sc.GetCompileUnit());
if (show_source && comp_unit.IsValid())
{
- success = false;
+ success = false;
SBLineEntry line_entry;
if (line_entry.IsValid())
{
- SBSourceManager& source_manager = SBDebugger::GetSourceManager();
- SBFileSpec line_entry_file_spec = line_entry.GetFileSpec();
-
+ SourceManager& source_manager = m_opaque_sp->GetProcess().GetTarget().GetDebugger().GetSourceManager();
+ SBFileSpec line_entry_file_spec (line_entry.GetFileSpec());
+
if (line_entry_file_spec.IsValid())
{
- source_manager.DisplaySourceLinesWithLineNumbers (line_entry_file_spec,
+ source_manager.DisplaySourceLinesWithLineNumbers (line_entry_file_spec.ref(),
line_entry.GetLine(),
source_lines_after,
source_lines_before, "->",
- out);
+ &str);
success = true;
}
}
@@ -310,17 +311,17 @@
void
SBThread::StepOver (lldb::RunMode stop_other_threads)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
- StackFrameSP frame_sp(m_lldb_object_sp->GetStackFrameAtIndex (0));
+ StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
if (frame_sp)
{
if (frame_sp->HasDebugInformation ())
{
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
- m_lldb_object_sp->QueueThreadPlanForStepRange (abort_other_plans,
+ m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans,
eStepTypeOver,
sc.line_entry.range,
sc,
@@ -330,15 +331,15 @@
}
else
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (true,
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (true,
abort_other_plans,
stop_other_threads);
}
}
- Process &process = m_lldb_object_sp->GetProcess();
+ Process &process = m_opaque_sp->GetProcess();
// Why do we need to set the current thread by ID here???
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -346,17 +347,17 @@
void
SBThread::StepInto (lldb::RunMode stop_other_threads)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
- StackFrameSP frame_sp(m_lldb_object_sp->GetStackFrameAtIndex (0));
+ StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
if (frame_sp && frame_sp->HasDebugInformation ())
{
bool avoid_code_without_debug_info = true;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
- m_lldb_object_sp->QueueThreadPlanForStepRange (abort_other_plans,
+ m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans,
eStepTypeInto,
sc.line_entry.range,
sc,
@@ -365,14 +366,14 @@
}
else
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (false,
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (false,
abort_other_plans,
stop_other_threads);
}
- Process &process = m_lldb_object_sp->GetProcess();
+ Process &process = m_opaque_sp->GetProcess();
// Why do we need to set the current thread by ID here???
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
@@ -381,15 +382,15 @@
void
SBThread::StepOut ()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
bool stop_other_threads = true;
- m_lldb_object_sp->QueueThreadPlanForStepOut (abort_other_plans, NULL, false, stop_other_threads, eVoteYes, eVoteNoOpinion);
+ m_opaque_sp->QueueThreadPlanForStepOut (abort_other_plans, NULL, false, stop_other_threads, eVoteYes, eVoteNoOpinion);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -397,11 +398,11 @@
void
SBThread::StepInstruction (bool step_over)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -409,67 +410,29 @@
void
SBThread::RunToAddress (lldb::addr_t addr)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
bool stop_other_threads = true;
Address target_addr (NULL, addr);
- m_lldb_object_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ m_opaque_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
-void
-SBThread::Backtrace (uint32_t num_frames)
-{
- bool all_frames = false;
- if (num_frames < 1)
- all_frames = true;
-
- FILE *out = SBDebugger::GetOutputFileHandle();
- FILE *err = SBDebugger::GetErrorFileHandle();
-
- if ((out == NULL) || (err == NULL))
- return;
-
- if (m_lldb_object_sp)
- {
- if (out && err)
- {
- int max_num_frames = m_lldb_object_sp->GetStackFrameCount();
- int last_frame = max_num_frames;
-
- if (!all_frames && (num_frames < last_frame))
- last_frame = num_frames;
-
- StackFrameSP frame_sp;
- for (int i = 0; i < last_frame; ++i)
- {
- frame_sp = m_lldb_object_sp->GetStackFrameAtIndex (i);
- if (!frame_sp)
- break;
-
- SBFrame sb_frame (frame_sp);
- if (DisplaySingleFrameForCurrentContext ((FILE *) out, (FILE *) err, sb_frame, true, false, 0, 0) == false)
- break;
- }
- }
- }
-}
-
SBProcess
SBThread::GetProcess ()
{
SBProcess process;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
// Have to go up to the target so we can get a shared pointer to our process...
- process.SetProcess(m_lldb_object_sp->GetProcess().GetTarget().GetProcessSP());
+ process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
}
return process;
}
@@ -477,8 +440,8 @@
uint32_t
SBThread::GetNumFrames ()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetStackFrameCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetStackFrameCount();
return 0;
}
@@ -486,56 +449,56 @@
SBThread::GetFrameAtIndex (uint32_t idx)
{
SBFrame sb_frame;
- if (m_lldb_object_sp)
- sb_frame.SetFrame (m_lldb_object_sp->GetStackFrameAtIndex (idx));
+ if (m_opaque_sp)
+ sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx));
return sb_frame;
}
const lldb::SBThread &
SBThread::operator = (const lldb::SBThread &rhs)
{
- m_lldb_object_sp = rhs.m_lldb_object_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
return *this;
}
bool
SBThread::operator == (const SBThread &rhs) const
{
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBThread::operator != (const SBThread &rhs) const
{
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::Thread *
SBThread::GetLLDBObjectPtr ()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Thread *
SBThread::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Thread &
SBThread::operator*() const
{
- return *m_lldb_object_sp;
+ return *m_opaque_sp;
}
lldb_private::Thread *
SBThread::operator->()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Thread &
SBThread::operator*()
{
- return *m_lldb_object_sp;
+ return *m_opaque_sp;
}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index ab622c7..e381246 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -33,12 +33,12 @@
using namespace lldb_private;
SBValue::SBValue () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
- m_lldb_object_sp (value_sp)
+ m_opaque_sp (value_sp)
{
}
@@ -49,7 +49,7 @@
bool
SBValue::IsValid () const
{
- return (m_lldb_object_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
void
@@ -72,25 +72,25 @@
lldb_private::StreamFile out_stream (out_file);
- out_stream.Printf ("%s ", m_lldb_object_sp->GetName().AsCString (NULL));
- if (! m_lldb_object_sp->IsInScope (lldb_frame))
+ out_stream.Printf ("%s ", m_opaque_sp->GetName().AsCString (NULL));
+ if (! m_opaque_sp->IsInScope (lldb_frame))
out_stream.Printf ("[out-of-scope] ");
if (print_type)
{
- out_stream.Printf ("(%s) ", m_lldb_object_sp->GetTypeName().AsCString ("<unknown-type>"));
+ out_stream.Printf ("(%s) ", m_opaque_sp->GetTypeName().AsCString ("<unknown-type>"));
}
if (print_value)
{
ExecutionContextScope *exe_scope = frame->get();
- const char *val_cstr = m_lldb_object_sp->GetValueAsCString(exe_scope);
- const char *err_cstr = m_lldb_object_sp->GetError().AsCString();
+ const char *val_cstr = m_opaque_sp->GetValueAsCString(exe_scope);
+ const char *err_cstr = m_opaque_sp->GetError().AsCString();
if (!err_cstr)
{
- const char *sum_cstr = m_lldb_object_sp->GetSummaryAsCString(exe_scope);
+ const char *sum_cstr = m_opaque_sp->GetSummaryAsCString(exe_scope);
const bool is_aggregate =
- ClangASTContext::IsAggregateType (m_lldb_object_sp->GetOpaqueClangQualType());
+ ClangASTContext::IsAggregateType (m_opaque_sp->GetOpaqueClangQualType());
if (val_cstr)
out_stream.Printf ("= %s ", val_cstr);
@@ -100,13 +100,13 @@
if (is_aggregate)
{
out_stream.PutChar ('{');
- const uint32_t num_children = m_lldb_object_sp->GetNumChildren();
+ const uint32_t num_children = m_opaque_sp->GetNumChildren();
if (num_children)
{
out_stream.IndentMore();
for (uint32_t idx = 0; idx < num_children; ++idx)
{
- lldb::ValueObjectSP child_sp (m_lldb_object_sp->GetChildAtIndex (idx, true));
+ lldb::ValueObjectSP child_sp (m_opaque_sp->GetChildAtIndex (idx, true));
if (child_sp.get())
{
out_stream.EOL();
@@ -131,7 +131,7 @@
SBValue::GetName()
{
if (IsValid())
- return m_lldb_object_sp->GetName().AsCString();
+ return m_opaque_sp->GetName().AsCString();
else
return NULL;
}
@@ -140,7 +140,7 @@
SBValue::GetTypeName ()
{
if (IsValid())
- return m_lldb_object_sp->GetTypeName().AsCString();
+ return m_opaque_sp->GetTypeName().AsCString();
else
return NULL;
}
@@ -151,7 +151,7 @@
size_t result = 0;
if (IsValid())
- result = m_lldb_object_sp->GetByteSize();
+ result = m_opaque_sp->GetByteSize();
return result;
}
@@ -162,7 +162,7 @@
bool result = false;
if (IsValid())
- result = m_lldb_object_sp->IsInScope (frame.get());
+ result = m_opaque_sp->IsInScope (frame.get());
return result;
}
@@ -171,8 +171,8 @@
SBValue::GetValue (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetValueAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetValueAsCString(frame.get());
return value_string;
}
@@ -180,7 +180,7 @@
SBValue::GetValueDidChange ()
{
if (IsValid())
- return m_lldb_object_sp->GetValueDidChange();
+ return m_opaque_sp->GetValueDidChange();
return false;
}
@@ -188,8 +188,8 @@
SBValue::GetSummary (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetSummaryAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetSummaryAsCString(frame.get());
return value_string;
}
@@ -198,7 +198,7 @@
{
const char *value_string = NULL;
if (IsValid())
- value_string = m_lldb_object_sp->GetLocationAsCString(frame.get());
+ value_string = m_opaque_sp->GetLocationAsCString(frame.get());
return value_string;
}
@@ -207,7 +207,7 @@
{
bool success = false;
if (IsValid())
- success = m_lldb_object_sp->SetValueFromCString (frame.get(), value_str);
+ success = m_opaque_sp->SetValueFromCString (frame.get(), value_str);
return success;
}
@@ -218,7 +218,7 @@
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildAtIndex (idx, true);
+ child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
}
SBValue sb_value (child_sp);
@@ -229,7 +229,7 @@
SBValue::GetIndexOfChildWithName (const char *name)
{
if (IsValid())
- return m_lldb_object_sp->GetIndexOfChildWithName (ConstString(name));
+ return m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
return UINT32_MAX;
}
@@ -241,7 +241,7 @@
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildMemberWithName (str_name, true);
+ child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
}
SBValue sb_value (child_sp);
@@ -256,7 +256,7 @@
if (IsValid())
{
- num_children = m_lldb_object_sp->GetNumChildren();
+ num_children = m_opaque_sp->GetNumChildren();
}
return num_children;
@@ -269,7 +269,7 @@
if (IsValid())
{
- result = m_lldb_object_sp->GetValueIsValid();
+ result = m_opaque_sp->GetValueIsValid();
}
return result;
@@ -281,7 +281,7 @@
{
if (IsValid())
{
- if (m_lldb_object_sp->IsPointerType())
+ if (m_opaque_sp->IsPointerType())
{
return GetChildAtIndex(0);
}
@@ -296,53 +296,53 @@
if (IsValid())
{
- is_ptr_type = m_lldb_object_sp->IsPointerType();
+ is_ptr_type = m_opaque_sp->IsPointerType();
}
return is_ptr_type;
}
-lldb_private::ExecutionContext
-SBValue::GetCurrentExecutionContext ()
-{
- lldb_private::Process *process = NULL;
- lldb_private::Thread *thread = NULL;
- lldb_private::StackFrame *frame = NULL;
-
- SBTarget sb_target = SBDebugger::GetCurrentTarget();
- if (sb_target.IsValid())
- {
- SBProcess sb_process = sb_target.GetProcess();
- if (sb_process.IsValid())
- {
- process = sb_process.get();
- SBThread sb_thread = sb_process.GetCurrentThread();
- if (sb_thread.IsValid())
- {
- thread = sb_thread.GetLLDBObjectPtr();
- frame = thread->GetStackFrameAtIndex(0).get();
- lldb_private::ExecutionContext exe_context (process, thread, frame);
- return exe_context;
- }
- else
- {
- lldb_private::ExecutionContext exe_context (process, NULL, NULL);
- return exe_context;
- }
- }
- }
-
- lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
- return exe_context;
-}
-
-
+//lldb_private::ExecutionContext
+//SBValue::GetCurrentExecutionContext ()
+//{
+// lldb_private::Process *process = NULL;
+// lldb_private::Thread *thread = NULL;
+// lldb_private::StackFrame *frame = NULL;
+//
+// SBTarget sb_target = SBDebugger::GetCurrentTarget();
+// if (sb_target.IsValid())
+// {
+// SBProcess sb_process = sb_target.GetProcess();
+// if (sb_process.IsValid())
+// {
+// process = sb_process.get();
+// SBThread sb_thread = sb_process.GetCurrentThread();
+// if (sb_thread.IsValid())
+// {
+// thread = sb_thread.GetLLDBObjectPtr();
+// frame = thread->GetStackFrameAtIndex(0).get();
+// lldb_private::ExecutionContext exe_context (process, thread, frame);
+// return exe_context;
+// }
+// else
+// {
+// lldb_private::ExecutionContext exe_context (process, NULL, NULL);
+// return exe_context;
+// }
+// }
+// }
+//
+// lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
+// return exe_context;
+//}
+//
+//
void *
SBValue::GetOpaqueType()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetOpaqueClangQualType();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetOpaqueClangQualType();
return NULL;
}
@@ -350,23 +350,23 @@
lldb_private::ValueObject *
SBValue::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::ValueObject *
SBValue::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb::ValueObjectSP &
SBValue::operator*()
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
const lldb::ValueObjectSP &
SBValue::operator*() const
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
diff --git a/source/API/SBValueList.cpp b/source/API/SBValueList.cpp
index e7cbfad..4223fad 100644
--- a/source/API/SBValueList.cpp
+++ b/source/API/SBValueList.cpp
@@ -17,22 +17,22 @@
using namespace lldb_private;
SBValueList::SBValueList () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBValueList::SBValueList (const SBValueList &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*rhs));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
}
SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
}
SBValueList::~SBValueList ()
@@ -42,7 +42,7 @@
bool
SBValueList::IsValid () const
{
- return (m_lldb_object_ap.get() != NULL);
+ return (m_opaque_ap.get() != NULL);
}
const SBValueList &
@@ -51,9 +51,9 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*rhs));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
else
- m_lldb_object_ap.reset ();
+ m_opaque_ap.reset ();
}
return *this;
}
@@ -61,25 +61,25 @@
lldb_private::ValueObjectList *
SBValueList::operator->()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::ValueObjectList &
SBValueList::operator*()
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
const lldb_private::ValueObjectList *
SBValueList::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::ValueObjectList &
SBValueList::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
void
@@ -88,7 +88,7 @@
if (val_obj.get())
{
CreateIfNeeded ();
- m_lldb_object_ap->Append (*val_obj);
+ m_opaque_ap->Append (*val_obj);
}
}
@@ -98,7 +98,7 @@
if (val_obj_sp)
{
CreateIfNeeded ();
- m_lldb_object_ap->Append (val_obj_sp);
+ m_opaque_ap->Append (val_obj_sp);
}
}
@@ -107,8 +107,8 @@
SBValueList::GetValueAtIndex (uint32_t idx) const
{
SBValue sb_value;
- if (m_lldb_object_ap.get())
- *sb_value = m_lldb_object_ap->GetValueObjectAtIndex (idx);
+ if (m_opaque_ap.get())
+ *sb_value = m_opaque_ap->GetValueObjectAtIndex (idx);
return sb_value;
}
@@ -116,16 +116,16 @@
SBValueList::GetSize () const
{
uint32_t size = 0;
- if (m_lldb_object_ap.get())
- size = m_lldb_object_ap->GetSize();
+ if (m_opaque_ap.get())
+ size = m_opaque_ap->GetSize();
return size;
}
void
SBValueList::CreateIfNeeded ()
{
- if (m_lldb_object_ap.get() == NULL)
- m_lldb_object_ap.reset (new ValueObjectList());
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset (new ValueObjectList());
}
@@ -133,8 +133,8 @@
SBValueList::FindValueObjectByUID (lldb::user_id_t uid)
{
SBValue sb_value;
- if ( m_lldb_object_ap.get())
- *sb_value = m_lldb_object_ap->FindValueObjectByUID (uid);
+ if ( m_opaque_ap.get())
+ *sb_value = m_opaque_ap->FindValueObjectByUID (uid);
return sb_value;
}