diff options
-rw-r--r-- | lldb/include/lldb/Interpreter/ScriptInterpreterPython.h | 7 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadList.h | 2 | ||||
-rw-r--r-- | lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme | 10 | ||||
-rw-r--r-- | lldb/source/Core/Log.cpp | 25 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 86 | ||||
-rw-r--r-- | lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 35 | ||||
-rw-r--r-- | lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h | 1 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/ThreadList.cpp | 11 | ||||
-rw-r--r-- | lldb/source/lldb-log.cpp | 3 |
10 files changed, 129 insertions, 57 deletions
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h index 2dc42bc01f9..ba532808673 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -287,7 +287,7 @@ public: protected: bool - EnterSession (bool init_lldb_globals, + EnterSession (uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err); @@ -350,7 +350,8 @@ public: { AcquireLock = 0x0001, InitSession = 0x0002, - InitGlobals = 0x0004 + InitGlobals = 0x0004, + NoSTDIN = 0x0008 }; enum OnLeave @@ -375,7 +376,7 @@ public: DoAcquireLock (); bool - DoInitSession (bool init_lldb_globals, FILE *in, FILE *out, FILE *err); + DoInitSession (uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err); bool DoFreeLock (); diff --git a/lldb/include/lldb/Target/ThreadList.h b/lldb/include/lldb/Target/ThreadList.h index f4dfdb23ec0..65d9b74098a 100644 --- a/lldb/include/lldb/Target/ThreadList.h +++ b/lldb/include/lldb/Target/ThreadList.h @@ -45,6 +45,8 @@ public: void AddThread (const lldb::ThreadSP &thread_sp); + void + InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx); // Return the selected thread if there is one. Otherwise, return the thread // selected at index 0. lldb::ThreadSP diff --git a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme index 34560feaaeb..94ec47efe3e 100644 --- a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme +++ b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme @@ -100,6 +100,16 @@ ReferencedContainer = "container:lldb.xcodeproj"> </BuildableReference> </BuildableProductRunnable> + <CommandLineArguments> + <CommandLineArgument + argument = "/Volumes/work/gclayton/Documents/src/args/a.out" + isEnabled = "YES"> + </CommandLineArgument> + <CommandLineArgument + argument = "-o "settings set target.process.python-os-plugin-path /Volumes/work/gclayton/Documents/src/lldb/tot/examples/python/operating_system.py"" + isEnabled = "YES"> + </CommandLineArgument> + </CommandLineArguments> <EnvironmentVariables> <EnvironmentVariable key = "LLDB_LAUNCH_FLAG_DISABLE_ASLR" diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 8d659cfd752..b7dc056af6c 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -83,7 +83,10 @@ Log::GetMask() const void Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args) { - if (m_stream_sp) + // Make a copy of our stream shared pointer in case someone disables our + // log while we are logging and releases the stream + StreamSP stream_sp(m_stream_sp); + if (stream_sp) { static uint32_t g_sequence_id = 0; StreamString header; @@ -116,11 +119,11 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args) } header.PrintfVarArg (format, args); - m_stream_sp->Printf("%s\n", header.GetData()); + stream_sp->Printf("%s\n", header.GetData()); if (m_options.Test (LLDB_LOG_OPTION_BACKTRACE)) - Host::Backtrace (*m_stream_sp, 1024); - m_stream_sp->Flush(); + Host::Backtrace (*stream_sp, 1024); + stream_sp->Flush(); } } @@ -467,8 +470,11 @@ Log::GetVerbose() const if (m_options.Test(LLDB_LOG_OPTION_VERBOSE)) return true; - if (m_stream_sp) - return m_stream_sp->GetVerbose(); + // Make a copy of our stream shared pointer in case someone disables our + // log while we are logging and releases the stream + StreamSP stream_sp(m_stream_sp); + if (stream_sp) + return stream_sp->GetVerbose(); return false; } @@ -478,8 +484,11 @@ Log::GetVerbose() const bool Log::GetDebug() const { - if (m_stream_sp) - return m_stream_sp->GetDebug(); + // Make a copy of our stream shared pointer in case someone disables our + // log while we are logging and releases the stream + StreamSP stream_sp(m_stream_sp); + if (stream_sp) + return stream_sp->GetDebug(); return false; } diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 9b73a91b7ec..624a662e26b 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -85,7 +85,7 @@ ScriptInterpreterPython::Locker::Locker (ScriptInterpreterPython *py_interpreter DoAcquireLock(); if ((on_entry & InitSession) == InitSession) { - if (DoInitSession((on_entry & InitGlobals) == InitGlobals, in, out, err) == false) + if (DoInitSession(on_entry, in, out, err) == false) { // Don't teardown the session if we didn't init it. m_teardown_session = false; @@ -104,11 +104,11 @@ ScriptInterpreterPython::Locker::DoAcquireLock() } bool -ScriptInterpreterPython::Locker::DoInitSession(bool init_lldb_globals, FILE *in, FILE *out, FILE *err) +ScriptInterpreterPython::Locker::DoInitSession(uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err) { if (!m_python_interpreter) return false; - return m_python_interpreter->EnterSession (init_lldb_globals, in, out, err); + return m_python_interpreter->EnterSession (on_entry_flags, in, out, err); } bool @@ -377,7 +377,7 @@ ScriptInterpreterPython::LeaveSession () } bool -ScriptInterpreterPython::EnterSession (bool init_lldb_globals, +ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err) @@ -388,19 +388,19 @@ ScriptInterpreterPython::EnterSession (bool init_lldb_globals, if (m_session_is_active) { if (log) - log->Printf("ScriptInterpreterPython::EnterSession(init_lldb_globals=%i) session is already active, returning without doing anything", init_lldb_globals); + log->Printf("ScriptInterpreterPython::EnterSession(on_entry_flags=0x%" PRIx16 ") session is already active, returning without doing anything", on_entry_flags); return false; } if (log) - log->Printf("ScriptInterpreterPython::EnterSession(init_lldb_globals=%i)", init_lldb_globals); + log->Printf("ScriptInterpreterPython::EnterSession(on_entry_flags=0x%" PRIx16 ")", on_entry_flags); m_session_is_active = true; StreamString run_string; - if (init_lldb_globals) + if (on_entry_flags & Locker::InitGlobals) { run_string.Printf ( "run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64, m_dictionary_name.c_str(), GetCommandInterpreter().GetDebugger().GetID()); run_string.Printf ( "; lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%" PRIu64 ")", GetCommandInterpreter().GetDebugger().GetID()); @@ -430,7 +430,7 @@ ScriptInterpreterPython::EnterSession (bool init_lldb_globals, if (in == NULL || out == NULL || err == NULL) m_interpreter.GetDebugger().AdoptTopIOHandlerFilesIfInvalid (in_sp, out_sp, err_sp); - if (in == NULL && in_sp) + if (in == NULL && in_sp && (on_entry_flags & Locker::NoSTDIN) == 0) in = in_sp->GetFile().GetStream(); if (in) { @@ -1288,7 +1288,9 @@ ScriptInterpreterPython::OSPlugin_CreatePluginObject (const char *class_name, ll void* ret_val; { - Locker py_lock(this,Locker::AcquireLock,Locker::FreeLock); + Locker py_lock (this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); ret_val = g_swig_create_os_plugin (class_name, m_dictionary_name.c_str(), process_sp); @@ -1300,7 +1302,9 @@ ScriptInterpreterPython::OSPlugin_CreatePluginObject (const char *class_name, ll lldb::ScriptInterpreterObjectSP ScriptInterpreterPython::OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) { - Locker py_lock(this,Locker::AcquireLock,Locker::FreeLock); + Locker py_lock(this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); static char callee_name[] = "get_register_info"; @@ -1359,7 +1363,9 @@ ScriptInterpreterPython::OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP lldb::ScriptInterpreterObjectSP ScriptInterpreterPython::OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) { - Locker py_lock(this,Locker::AcquireLock,Locker::FreeLock); + Locker py_lock (this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); static char callee_name[] = "get_thread_info"; @@ -1445,7 +1451,9 @@ lldb::ScriptInterpreterObjectSP ScriptInterpreterPython::OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp, lldb::tid_t tid) { - Locker py_lock(this,Locker::AcquireLock,Locker::FreeLock); + Locker py_lock (this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); static char callee_name[] = "get_register_data"; static char *param_format = const_cast<char *>(GetPythonValueFormatString(tid)); @@ -1507,7 +1515,9 @@ ScriptInterpreterPython::OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP lldb::tid_t tid, lldb::addr_t context) { - Locker py_lock(this,Locker::AcquireLock,Locker::FreeLock); + Locker py_lock(this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); static char callee_name[] = "create_thread"; std::string param_format; @@ -1599,7 +1609,7 @@ ScriptInterpreterPython::GetDynamicSettings (lldb::ScriptInterpreterObjectSP plu PyObject *reply_pyobj = nullptr; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); TargetSP target_sp(target->shared_from_this()); reply_pyobj = (PyObject*)g_swig_plugin_get(plugin_module_sp->GetObject(),setting_name,target_sp); } @@ -1633,7 +1643,7 @@ ScriptInterpreterPython::CreateSyntheticScriptedProvider (const char *class_name void* ret_val; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_synthetic_script (class_name, python_interpreter->m_dictionary_name.c_str(), valobj); @@ -1724,14 +1734,14 @@ ScriptInterpreterPython::GetScriptedSummary (const char *python_function_name, && *python_function_name) { { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); { - Timer scoped_timer ("g_swig_typescript_callback","g_swig_typescript_callback"); - ret_val = g_swig_typescript_callback (python_function_name, - GetSessionDictionary().get(), - valobj, - &new_callee, - retval); + Timer scoped_timer ("g_swig_typescript_callback","g_swig_typescript_callback"); + ret_val = g_swig_typescript_callback (python_function_name, + GetSessionDictionary().get(), + valobj, + &new_callee, + retval); } } } @@ -1788,8 +1798,8 @@ ScriptInterpreterPython::BreakpointCallbackFunction { bool ret_val = true; { - Locker py_lock(python_interpreter); - ret_val = g_swig_breakpoint_callback (python_function_name, + Locker py_lock(python_interpreter, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); + ret_val = g_swig_breakpoint_callback (python_function_name, python_interpreter->m_dictionary_name.c_str(), stop_frame_sp, bp_loc_sp); @@ -1840,8 +1850,8 @@ ScriptInterpreterPython::WatchpointCallbackFunction { bool ret_val = true; { - Locker py_lock(python_interpreter); - ret_val = g_swig_watchpoint_callback (python_function_name, + Locker py_lock(python_interpreter, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); + ret_val = g_swig_watchpoint_callback (python_function_name, python_interpreter->m_dictionary_name.c_str(), stop_frame_sp, wp_sp); @@ -1872,7 +1882,7 @@ ScriptInterpreterPython::CalculateNumChildren (const lldb::ScriptInterpreterObje uint32_t ret_val = 0; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_calc_children (implementor); } @@ -1896,7 +1906,7 @@ ScriptInterpreterPython::GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& lldb::ValueObjectSP ret_val; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); void* child_ptr = g_swig_get_child_index (implementor,idx); if (child_ptr != NULL && child_ptr != Py_None) { @@ -1932,7 +1942,7 @@ ScriptInterpreterPython::GetIndexOfChildWithName (const lldb::ScriptInterpreterO int ret_val = UINT32_MAX; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_get_index_child (implementor, child_name); } @@ -1956,7 +1966,7 @@ ScriptInterpreterPython::UpdateSynthProviderInstance (const lldb::ScriptInterpre return ret_val; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_update_provider (implementor); } @@ -1980,7 +1990,7 @@ ScriptInterpreterPython::MightHaveChildrenSynthProviderInstance (const lldb::Scr return ret_val; { - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_mighthavechildren_provider (implementor); } @@ -2068,7 +2078,7 @@ ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function, } { ProcessSP process_sp(process->shared_from_this()); - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_run_script_keyword_process (impl_function, m_dictionary_name.c_str(), process_sp, output); if (!ret_val) error.SetErrorString("python script evaluation failed"); @@ -2100,7 +2110,7 @@ ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function, } { ThreadSP thread_sp(thread->shared_from_this()); - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_run_script_keyword_thread (impl_function, m_dictionary_name.c_str(), thread_sp, output); if (!ret_val) error.SetErrorString("python script evaluation failed"); @@ -2132,7 +2142,7 @@ ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function, } { TargetSP target_sp(target->shared_from_this()); - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_run_script_keyword_target (impl_function, m_dictionary_name.c_str(), target_sp, output); if (!ret_val) error.SetErrorString("python script evaluation failed"); @@ -2164,7 +2174,7 @@ ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function, } { StackFrameSP frame_sp(frame->shared_from_this()); - Locker py_lock(this); + Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); ret_val = g_swig_run_script_keyword_frame (impl_function, m_dictionary_name.c_str(), frame_sp, output); if (!ret_val) error.SetErrorString("python script evaluation failed"); @@ -2214,7 +2224,7 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname, // Before executing Pyton code, lock the GIL. Locker py_lock (this, - Locker::AcquireLock | (init_session ? Locker::InitSession : 0), + Locker::AcquireLock | (init_session ? Locker::InitSession : 0) | Locker::NoSTDIN, Locker::FreeAcquiredLock | (init_session ? Locker::TearDownSession : 0)); if (target_file.GetFileType() == FileSpec::eFileTypeInvalid || @@ -2455,8 +2465,8 @@ std::unique_ptr<ScriptInterpreterLocker> ScriptInterpreterPython::AcquireInterpreterLock () { std::unique_ptr<ScriptInterpreterLocker> py_lock(new Locker(this, - Locker::AcquireLock | Locker::InitSession, - Locker::FreeLock | Locker::TearDownSession)); + Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN, + Locker::FreeLock | Locker::TearDownSession)); return py_lock; } diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 37b32419735..7ca337e797d 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -190,6 +190,13 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive PythonList threads_list(m_interpreter->OSPlugin_ThreadsInfo(m_python_object_sp)); + + const uint32_t num_cores = core_thread_list.GetSize(false); + + // Make a map so we can keep track of which cores were used from the + // core_thread list. Any real threads/cores that weren't used should + // later be put back into the "new_thread_list". + std::vector<bool> core_used_map(num_cores, false); if (threads_list) { if (log) @@ -207,18 +214,26 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, PythonDictionary thread_dict(threads_list.GetItemAtIndex(i)); if (thread_dict) { - ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, NULL)); + ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, core_used_map, NULL)); if (thread_sp) new_thread_list.AddThread(thread_sp); } } } } - - // No new threads added from the thread info array gotten from python, just - // display the core threads. - if (new_thread_list.GetSize(false) == 0) - new_thread_list = core_thread_list; + + // Any real core threads that didn't end up backing a memory thread should + // still be in the main thread list, and they should be inserted at the beginning + // of the list + uint32_t insert_idx = 0; + for (uint32_t core_idx = 0; core_idx < num_cores; ++core_idx) + { + if (core_used_map[core_idx] == false) + { + new_thread_list.InsertThread (core_thread_list.GetThreadAtIndex(core_idx, false), insert_idx); + ++insert_idx; + } + } return new_thread_list.GetSize(false) > 0; } @@ -227,6 +242,7 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo (PythonDictionary &thread_dict, ThreadList &core_thread_list, ThreadList &old_thread_list, + std::vector<bool> &core_used_map, bool *did_create_ptr) { ThreadSP thread_sp; @@ -282,6 +298,10 @@ OperatingSystemPython::CreateThreadFromThreadInfo (PythonDictionary &thread_dict ThreadSP core_thread_sp (core_thread_list.GetThreadAtIndex(core_number, false)); if (core_thread_sp) { + // Keep track of which cores were set as the backing thread for memory threads... + if (core_number < core_used_map.size()) + core_used_map[core_number] = true; + ThreadSP backing_core_thread_sp (core_thread_sp->GetBackingThread()); if (backing_core_thread_sp) { @@ -398,12 +418,13 @@ OperatingSystemPython::CreateThread (lldb::tid_t tid, addr_t context) auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure thread_info_dict stays alive PythonDictionary thread_info_dict (m_interpreter->OSPlugin_CreateThread(m_python_object_sp, tid, context)); + std::vector<bool> core_used_map; if (thread_info_dict) { ThreadList core_threads(m_process); ThreadList &thread_list = m_process->GetThreadList(); bool did_create = false; - ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_info_dict, core_threads, thread_list, &did_create)); + ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_info_dict, core_threads, thread_list, core_used_map, &did_create)); if (did_create) thread_list.AddThread(thread_sp); return thread_sp; diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h index 077039e50d5..3b7dd264dc6 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -93,6 +93,7 @@ protected: CreateThreadFromThreadInfo (lldb_private::PythonDictionary &thread_dict, lldb_private::ThreadList &core_thread_list, lldb_private::ThreadList &old_thread_list, + std::vector<bool> &core_used_map, bool *did_create_ptr); DynamicRegisterInfo * diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index f3a0e349da7..e1989eb1dd1 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1170,7 +1170,11 @@ ProcessGDBRemote::DoResume () bool continue_packet_error = false; if (m_gdb_comm.HasAnyVContSupport ()) { - if (m_continue_c_tids.size() == num_threads) + if (m_continue_c_tids.size() == num_threads || + (m_continue_c_tids.empty() && + m_continue_C_tids.empty() && + m_continue_s_tids.empty() && + m_continue_S_tids.empty())) { // All threads are continuing, just send a "c" packet continue_packet.PutCString ("c"); diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index b6ffd3da442..4fffdac9a34 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -85,6 +85,17 @@ ThreadList::AddThread (const ThreadSP &thread_sp) m_threads.push_back(thread_sp); } +void +ThreadList::InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx) +{ + Mutex::Locker locker(GetMutex()); + if (idx < m_threads.size()) + m_threads.insert(m_threads.begin() + idx, thread_sp); + else + m_threads.push_back (thread_sp); +} + + uint32_t ThreadList::GetSize (bool can_update) { diff --git a/lldb/source/lldb-log.cpp b/lldb/source/lldb-log.cpp index c00d2e649e2..12ec3a546e1 100644 --- a/lldb/source/lldb-log.cpp +++ b/lldb/source/lldb-log.cpp @@ -156,7 +156,10 @@ lldb_private::DisableLog (const char **categories, Stream *feedback_strm) } log->GetMask().Reset (flag_bits); if (flag_bits == 0) + { + log->SetStream(lldb::StreamSP()); g_log_enabled = false; + } } return; |