summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-06-30 16:22:25 +0000
committerCaroline Tice <ctice@apple.com>2010-06-30 16:22:25 +0000
commitebc1bb277ccc583414b5695e10a708389a003b01 (patch)
treed58634deecd8330adec2efb0ea15915562ae90b7 /lldb/source/Core/Debugger.cpp
parent7764ae2c9862e05813617c2829f666968437637a (diff)
downloadbcm5719-llvm-ebc1bb277ccc583414b5695e10a708389a003b01.tar.gz
bcm5719-llvm-ebc1bb277ccc583414b5695e10a708389a003b01.zip
Add a unique ID to each debugger instance.
Add functions to look up debugger by id Add global variable to lldb python module, to hold debugger id Modify embedded Python interpreter to update the global variable with the id of its current debugger. Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL) as a valid value. The point of all this is so that, when you drop into the embedded interpreter from the command interpreter (or when doing Python-based breakpoint commands), there is a way for the Python side to find/get the correct debugger instance ( by checking debugger_unique_id, then calling SBDebugger::FindDebuggerWithID on it). llvm-svn: 107287
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 0b7676ca732..32b1bf3508a 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -24,6 +24,8 @@ using namespace lldb_private;
static uint32_t g_shared_debugger_refcount = 0;
+static lldb::user_id_t g_unique_id = 1;
+
void
Debugger::Initialize ()
{
@@ -115,6 +117,7 @@ Debugger::FindTargetWithProcessID (lldb::pid_t pid)
Debugger::Debugger () :
+ UserID (g_unique_id++),
m_input_comm("debugger.input"),
m_input_file (),
m_output_file (),
@@ -491,3 +494,21 @@ Debugger::UpdateExecutionContext (ExecutionContext *override_context)
}
}
+DebuggerSP
+Debugger::FindDebuggerWithID (lldb::user_id_t id)
+{
+ lldb::DebuggerSP debugger_sp;
+
+ Mutex::Locker locker (GetDebuggerListMutex ());
+ DebuggerList &debugger_list = GetDebuggerList();
+ DebuggerList::iterator pos, end = debugger_list.end();
+ for (pos = debugger_list.begin(); pos != end; ++pos)
+ {
+ if ((*pos).get()->GetID() == id)
+ {
+ debugger_sp = *pos;
+ break;
+ }
+ }
+ return debugger_sp;
+}
OpenPOWER on IntegriCloud