[Lldb-commits] [lldb] r269366 - Added missing makefile from patch D19124 (should fix the corresponding commit rL269340)
Author: cameron314 Date: Thu May 12 17:10:16 2016 New Revision: 269366 URL: http://llvm.org/viewvc/llvm-project?rev=269366&view=rev Log: Added missing makefile from patch D19124 (should fix the corresponding commit rL269340) Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile?rev=269366&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/Makefile Thu May 12 17:10:16 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r271209 - [LLDB] Make sure that indexing is done before clearing DIE info
Author: cameron314 Date: Mon May 30 10:32:51 2016 New Revision: 271209 URL: http://llvm.org/viewvc/llvm-project?rev=271209&view=rev Log: [LLDB] Make sure that indexing is done before clearing DIE info "ClearDIEs()" was being called too soon, before everyone was done using the DIEs. This fix delays the calls to ::ClearDIEs() until all compile units have been indexed. 1 - Call "::ExtractDIEsIfNeeded()" on all compile units on separate threads. See if each CU has the DIEs parsed and remember this. 2 - Index all compile units on separate threads. 3 - Clear any DIEs in any compile units that didn't have their DIEs parsed after all compile units have been indexed. Patch by phlav Differential Revision: http://reviews.llvm.org/D20738 Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=271209&r1=271208&r2=271209&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon May 30 10:32:51 2016 @@ -2162,6 +2162,9 @@ SymbolFileDWARF::Index () if (debug_info) { const uint32_t num_compile_units = GetNumCompileUnits(); +if (num_compile_units == 0) +return; + std::vector function_basename_index(num_compile_units); std::vector function_fullname_index(num_compile_units); std::vector function_method_index(num_compile_units); @@ -2170,7 +2173,8 @@ SymbolFileDWARF::Index () std::vector global_index(num_compile_units); std::vector type_index(num_compile_units); std::vector namespace_index(num_compile_units); - + +std::vector clear_cu_dies(num_compile_units, false); auto parser_fn = [this, debug_info, &function_basename_index, @@ -2183,25 +2187,62 @@ SymbolFileDWARF::Index () &namespace_index](uint32_t cu_idx) { DWARFCompileUnit* dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); -bool clear_dies = dwarf_cu->ExtractDIEsIfNeeded(false) > 1; - -dwarf_cu->Index(function_basename_index[cu_idx], -function_fullname_index[cu_idx], -function_method_index[cu_idx], -function_selector_index[cu_idx], -objc_class_selectors_index[cu_idx], -global_index[cu_idx], -type_index[cu_idx], -namespace_index[cu_idx]); - -// Keep memory down by clearing DIEs if this generate function -// caused them to be parsed -if (clear_dies) -dwarf_cu->ClearDIEs(true); - +if (dwarf_cu) +{ +dwarf_cu->Index(function_basename_index[cu_idx], +function_fullname_index[cu_idx], +function_method_index[cu_idx], +function_selector_index[cu_idx], +objc_class_selectors_index[cu_idx], +global_index[cu_idx], +type_index[cu_idx], +namespace_index[cu_idx]); +} return cu_idx; }; +auto extract_fn = [this, + debug_info, + num_compile_units](uint32_t cu_idx) +{ +DWARFCompileUnit* dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); +if (dwarf_cu) +{ +// dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the +// DIEs for a compile unit have already been parsed. +return std::make_pair(cu_idx, dwarf_cu->ExtractDIEsIfNeeded(false) > 1); +} +return std::make_pair(cu_idx, false); +}; + +// Create a task runner that extracts dies for each DWARF compile unit in a separate thread +TaskRunner> task_runner_extract; +for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) +task_runner_extract.AddTask(extract_fn, cu_idx); + + //-- +// First figure out which compile units didn't have their DIEs already +// parsed and remember this. If no DIEs were parsed prior to this index +// function call, we are going to want to clear the CU dies after we +// are done indexing to make sure we don't pull in all DWARF dies, but +// we need to wait until all compile units have been indexed in ca
[Lldb-commits] [lldb] r272682 - [lldb] Fixed race conditions on private state thread exit
Author: cameron314 Date: Tue Jun 14 11:22:45 2016 New Revision: 272682 URL: http://llvm.org/viewvc/llvm-project?rev=272682&view=rev Log: [lldb] Fixed race conditions on private state thread exit This patch fixes various races between the time the private state thread is signaled to exit and the time it actually exits (during which it no longer responds to events). Previously, this was consistently causing 2-second timeout delays on process detach/stop for us. This also prevents crashes that were caused by the thread controlling its own owning pointer while the controller was using it (copying the thread wrapper is not enough to mitigate this, since the internal thread object was getting reset anyway). Again, we were seeing this consistently. Differential Revision: http://reviews.llvm.org/D21296 Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=272682&r1=272681&r2=272682&view=diff == --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Tue Jun 14 11:22:45 2016 @@ -3309,9 +3309,13 @@ protected: bool PrivateStateThreadIsValid () const { -return m_private_state_thread.IsJoinable(); +lldb::StateType state = m_private_state.GetValue(); +return state != lldb::eStateInvalid && + state != lldb::eStateDetached && + state != lldb::eStateExited && + m_private_state_thread.IsJoinable(); } - + void ForceNextEventDelivery() { Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=272682&r1=272681&r2=272682&view=diff == --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Tue Jun 14 11:22:45 2016 @@ -4088,7 +4088,7 @@ Process::ResumePrivateStateThread () void Process::StopPrivateStateThread () { -if (PrivateStateThreadIsValid ()) +if (m_private_state_thread.IsJoinable ()) ControlPrivateStateThread (eBroadcastInternalStateControlStop); else { @@ -4110,21 +4110,23 @@ Process::ControlPrivateStateThread (uint if (log) log->Printf ("Process::%s (signal = %d)", __FUNCTION__, signal); -// Signal the private state thread. First we should copy this is case the -// thread starts exiting since the private state thread will NULL this out -// when it exits +// Signal the private state thread +if (m_private_state_thread.IsJoinable()) { -HostThread private_state_thread(m_private_state_thread); -if (private_state_thread.IsJoinable()) +// Broadcast the event. +// It is important to do this outside of the if below, because +// it's possible that the thread state is invalid but that the +// thread is waiting on a control event instead of simply being +// on its way out (this should not happen, but it apparently can). +if (log) +log->Printf ("Sending control event of type: %d.", signal); +std::shared_ptr event_receipt_sp(new EventDataReceipt()); +m_private_state_control_broadcaster.BroadcastEvent(signal, event_receipt_sp); + +// Wait for the event receipt or for the private state thread to exit +bool receipt_received = false; +if (PrivateStateThreadIsValid()) { -if (log) -log->Printf ("Sending control event of type: %d.", signal); -// Send the control event and wait for the receipt or for the private state -// thread to exit -std::shared_ptr event_receipt_sp(new EventDataReceipt()); -m_private_state_control_broadcaster.BroadcastEvent(signal, event_receipt_sp); - -bool receipt_received = false; while (!receipt_received) { bool timed_out = false; @@ -4137,23 +4139,24 @@ Process::ControlPrivateStateThread (uint if (!receipt_received) { // Check if the private state thread is still around. If it isn't then we are done waiting -if (!m_private_state_thread.IsJoinable()) -break; // Private state thread exited, we are done +if (!PrivateStateThreadIsValid()) +break; // Private state thread exited or is exiting, we are done } } - -if (signal == eBroadcastInternalStateControlStop) -{ -thread_result_t result = NULL; -private_state_thread.Join(&result); -} } -else + +
[Lldb-commits] [lldb] r374195 - [LLDB] Fix for synthetic children memory leak
Author: cameron314 Date: Wed Oct 9 11:27:33 2019 New Revision: 374195 URL: http://llvm.org/viewvc/llvm-project?rev=374195&view=rev Log: [LLDB] Fix for synthetic children memory leak The lifetime of a ValueObject and all its derivative ValueObjects (children, clones, etc.) is managed by a ClusterManager. These objects are only destroyed when every shared pointer to any of the managed objects in the cluster is destroyed. This means that no object in the cluster can store a shared pointer to another object in the cluster without creating a memory leak of the entire cluster. However, some of the synthetic children front-end implementations do exactly this; this patch fixes that. Differential Revision: https://reviews.llvm.org/D68641 Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp?rev=374195&r1=374194&r2=374195&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp Wed Oct 9 11:27:33 2019 @@ -30,8 +30,15 @@ public: ValueObjectSP GetChildAtIndex(size_t idx) override; private: + // The lifetime of a ValueObject and all its derivative ValueObjects + // (children, clones, etc.) is managed by a ClusterManager. These + // objects are only destroyed when every shared pointer to any of them + // is destroyed, so we must not store a shared pointer to any ValueObject + // derived from our backend ValueObject (since we're in the same cluster). + // Value objects created from raw data (i.e. in a different cluster) must + // be referenced via shared pointer to keep them alive, however. std::vector m_elements; - ValueObjectSP m_first; + ValueObject* m_first = nullptr; CompilerType m_bool_type; ByteOrder m_byte_order = eByteOrderInvalid; uint8_t m_byte_size = 0; @@ -50,7 +57,7 @@ BitsetFrontEnd::BitsetFrontEnd(ValueObje bool BitsetFrontEnd::Update() { m_elements.clear(); - m_first.reset(); + m_first = nullptr; TargetSP target_sp = m_backend.GetTargetSP(); if (!target_sp) @@ -63,7 +70,7 @@ bool BitsetFrontEnd::Update() { m_elements.assign(size, ValueObjectSP()); - m_first = m_backend.GetChildMemberWithName(ConstString("__first_"), true); + m_first = m_backend.GetChildMemberWithName(ConstString("__first_"), true).get(); return false; } @@ -86,7 +93,7 @@ ValueObjectSP BitsetFrontEnd::GetChildAt chunk = m_first->GetChildAtIndex(idx / *bit_size, true); } else { type = m_first->GetCompilerType(); -chunk = m_first; +chunk = m_first->GetSP(); } if (!type || !chunk) return {}; Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp?rev=374195&r1=374194&r2=374195&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp Wed Oct 9 11:27:33 2019 @@ -31,7 +31,6 @@ public: private: size_t m_size = 0; - ValueObjectSP m_base_sp; }; } // namespace Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp?rev=374195&r1=374194&r2=374195&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp Wed Oct 9 11:27:33 2019 @@ -38,16 +38,21 @@ public: } private: - ValueObjectSP m_container_sp; + // The lifetime of a ValueObject and all its derivative ValueObjects + // (children, clones, etc.) is managed by a ClusterManager. These + // objects are only destroyed when every shared pointer to any of them + // is destroyed, so we must not store a shared pointer to any ValueObject + // derived from our backend ValueObject (since we're in the same cluster). + ValueObject* m_container_sp = nullptr; }; } // namespace bool QueueFrontEnd::Update() { - m_container_sp.reset(); + m_container_sp = nullptr; ValueObjectSP c_sp = m_backend.GetChildMemberWithName(ConstStrin
[Lldb-commits] [lldb] r374231 - [LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195
Author: cameron314 Date: Wed Oct 9 14:15:48 2019 New Revision: 374231 URL: http://llvm.org/viewvc/llvm-project?rev=374231&view=rev Log: [LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195 Differential Revision: https://reviews.llvm.org/D68641 Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp?rev=374231&r1=374230&r2=374231&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp Wed Oct 9 14:15:48 2019 @@ -79,7 +79,9 @@ ValueObjectSP TupleFrontEnd::GetChildAtI m_elements[idx] = elem_sp->Clone(ConstString(llvm::formatv("[{0}]", idx).str())).get(); - return m_elements[idx]->GetSP(); + if (m_elements[idx]) +return m_elements[idx]->GetSP(); + return ValueObjectSP(); } SyntheticChildrenFrontEnd * Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp?rev=374231&r1=374230&r2=374231&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp Wed Oct 9 14:15:48 2019 @@ -90,7 +90,7 @@ bool LibStdcppTupleSyntheticFrontEnd::Mi lldb::ValueObjectSP LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(size_t idx) { - if (idx < m_members.size()) + if (idx < m_members.size() && m_members[idx]) return m_members[idx]->GetSP(); return lldb::ValueObjectSP(); } Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=374231&r1=374230&r2=374231&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Wed Oct 9 14:15:48 2019 @@ -118,11 +118,11 @@ bool LibStdcppUniquePtrSyntheticFrontEnd lldb::ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) { - if (idx == 0) + if (idx == 0 && m_ptr_obj) return m_ptr_obj->GetSP(); - if (idx == 1) + if (idx == 1 && m_del_obj) return m_del_obj->GetSP(); - if (idx == 2) + if (idx == 2 && m_obj_obj) return m_obj_obj->GetSP(); return lldb::ValueObjectSP(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits