forked from OSchip/llvm-project
remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. llvm-svn: 269877
This commit is contained in:
parent
a36a61d46a
commit
16ff860469
|
@ -13,13 +13,13 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Utility/Iterable.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -270,7 +270,7 @@ protected:
|
|||
Breakpoint &m_owner;
|
||||
collection m_locations; // Vector of locations, sorted by ID
|
||||
addr_map m_address_to_location;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
lldb::break_id_t m_next_id;
|
||||
BreakpointLocationCollection *m_new_location_recorder;
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
|
@ -297,7 +297,7 @@ private:
|
|||
// Consider adding an optimization where if there is only one
|
||||
// owner, we don't store a list. The usual case will be only one owner...
|
||||
BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site.
|
||||
Mutex m_owners_mutex; ///< This mutex protects the owners collection.
|
||||
std::recursive_mutex m_owners_mutex; ///< This mutex protects the owners collection.
|
||||
|
||||
static lldb::break_id_t
|
||||
GetNextID();
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointSite.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -189,16 +190,17 @@ public:
|
|||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_bp_site_list.size();
|
||||
}
|
||||
|
||||
bool
|
||||
IsEmpty() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_bp_site_list.empty();
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
|
||||
|
||||
|
@ -208,7 +210,7 @@ protected:
|
|||
collection::const_iterator
|
||||
GetIDConstIterator(lldb::break_id_t breakID) const;
|
||||
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
collection m_bp_site_list; // The breakpoint site list.
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -22,7 +23,6 @@
|
|||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -126,8 +126,8 @@ private:
|
|||
typedef std::set<lldb::ListenerSP> listener_collection;
|
||||
collection m_event_map;
|
||||
listener_collection m_listeners;
|
||||
|
||||
Mutex m_manager_mutex;
|
||||
|
||||
mutable std::recursive_mutex m_manager_mutex;
|
||||
|
||||
// A couple of comparator classes for find_if:
|
||||
|
||||
|
@ -625,7 +625,7 @@ protected:
|
|||
Broadcaster &m_broadcaster; ///< The broadcsater that this implements
|
||||
event_names_map m_event_names; ///< Optionally define event names for readability and logging for each event bit
|
||||
collection m_listeners; ///< A list of Listener / event_mask pairs that are listening to this broadcaster.
|
||||
Mutex m_listeners_mutex; ///< A mutex that protects \a m_listeners.
|
||||
std::recursive_mutex m_listeners_mutex; ///< A mutex that protects \a m_listeners.
|
||||
std::vector<lldb::ListenerSP> m_hijacking_listeners; // A simple mechanism to intercept events from a broadcaster
|
||||
std::vector<uint32_t> m_hijacking_masks; // At some point we may want to have a stack or Listener
|
||||
// collections, but for now this is just for private hijacking.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -21,7 +22,6 @@
|
|||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Error.h"
|
||||
#include "lldb/Host/HostThread.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -358,10 +358,10 @@ protected:
|
|||
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
|
||||
std::atomic<bool> m_read_thread_enabled;
|
||||
std::atomic<bool> m_read_thread_did_exit;
|
||||
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
|
||||
Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
|
||||
Mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
|
||||
Mutex m_synchronize_mutex;
|
||||
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
|
||||
std::recursive_mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
|
||||
std::mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
|
||||
std::mutex m_synchronize_mutex;
|
||||
ReadThreadBytesReceived m_callback;
|
||||
void *m_callback_baton;
|
||||
bool m_close_on_eof;
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
#include <stdint.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -34,11 +34,7 @@ class HistorySource
|
|||
public:
|
||||
typedef const void * HistoryEvent;
|
||||
|
||||
HistorySource () :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_events ()
|
||||
{
|
||||
}
|
||||
HistorySource() : m_mutex(), m_events() {}
|
||||
|
||||
virtual
|
||||
~HistorySource()
|
||||
|
@ -50,20 +46,20 @@ public:
|
|||
// onto the end of the history stack.
|
||||
|
||||
virtual HistoryEvent
|
||||
CreateHistoryEvent () = 0;
|
||||
|
||||
CreateHistoryEvent () = 0;
|
||||
|
||||
virtual void
|
||||
DeleteHistoryEvent (HistoryEvent event) = 0;
|
||||
|
||||
|
||||
virtual void
|
||||
DumpHistoryEvent (Stream &strm, HistoryEvent event) = 0;
|
||||
|
||||
virtual size_t
|
||||
GetHistoryEventCount() = 0;
|
||||
|
||||
|
||||
virtual HistoryEvent
|
||||
GetHistoryEventAtIndex (uint32_t idx) = 0;
|
||||
|
||||
|
||||
virtual HistoryEvent
|
||||
GetCurrentHistoryEvent () = 0;
|
||||
|
||||
|
@ -71,16 +67,16 @@ public:
|
|||
virtual int
|
||||
CompareHistoryEvents (const HistoryEvent lhs,
|
||||
const HistoryEvent rhs) = 0;
|
||||
|
||||
|
||||
virtual bool
|
||||
IsCurrentHistoryEvent (const HistoryEvent event) = 0;
|
||||
|
||||
private:
|
||||
typedef std::stack<HistoryEvent> collection;
|
||||
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
collection m_events;
|
||||
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (HistorySource);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -709,75 +710,70 @@ namespace lldb_private {
|
|||
class IOHandlerStack
|
||||
{
|
||||
public:
|
||||
IOHandlerStack () :
|
||||
m_stack(),
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_top (nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
IOHandlerStack() : m_stack(), m_mutex(), m_top(nullptr) {}
|
||||
|
||||
~IOHandlerStack() = default;
|
||||
|
||||
|
||||
size_t
|
||||
GetSize () const
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_stack.size();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Push (const lldb::IOHandlerSP& sp)
|
||||
Push(const lldb::IOHandlerSP &sp)
|
||||
{
|
||||
if (sp)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
sp->SetPopped (false);
|
||||
m_stack.push_back (sp);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
sp->SetPopped(false);
|
||||
m_stack.push_back(sp);
|
||||
// Set m_top the non-locking IsTop() call
|
||||
m_top = sp.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
IsEmpty () const
|
||||
IsEmpty() const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_stack.empty();
|
||||
}
|
||||
|
||||
|
||||
lldb::IOHandlerSP
|
||||
Top ()
|
||||
Top()
|
||||
{
|
||||
lldb::IOHandlerSP sp;
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_stack.empty())
|
||||
sp = m_stack.back();
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Pop ()
|
||||
Pop()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_stack.empty())
|
||||
{
|
||||
lldb::IOHandlerSP sp (m_stack.back());
|
||||
lldb::IOHandlerSP sp(m_stack.back());
|
||||
m_stack.pop_back();
|
||||
sp->SetPopped (true);
|
||||
sp->SetPopped(true);
|
||||
}
|
||||
// Set m_top the non-locking IsTop() call
|
||||
|
||||
m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
|
||||
}
|
||||
|
||||
Mutex &
|
||||
std::recursive_mutex &
|
||||
GetMutex()
|
||||
{
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
IsTop (const lldb::IOHandlerSP &io_handler_sp) const
|
||||
{
|
||||
|
@ -785,13 +781,12 @@ namespace lldb_private {
|
|||
}
|
||||
|
||||
bool
|
||||
CheckTopIOHandlerTypes (IOHandler::Type top_type, IOHandler::Type second_top_type)
|
||||
CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
const size_t num_io_handlers = m_stack.size();
|
||||
return (num_io_handlers >= 2 &&
|
||||
m_stack[num_io_handlers-1]->GetType() == top_type &&
|
||||
m_stack[num_io_handlers-2]->GetType() == second_top_type);
|
||||
return (num_io_handlers >= 2 && m_stack[num_io_handlers - 1]->GetType() == top_type &&
|
||||
m_stack[num_io_handlers - 2]->GetType() == second_top_type);
|
||||
}
|
||||
|
||||
ConstString
|
||||
|
@ -818,9 +813,9 @@ namespace lldb_private {
|
|||
protected:
|
||||
typedef std::vector<lldb::IOHandlerSP> collection;
|
||||
collection m_stack;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
IOHandler *m_top;
|
||||
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (IOHandlerStack);
|
||||
};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// C++ Includes
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -175,7 +176,7 @@ private:
|
|||
|
||||
std::string m_name;
|
||||
broadcaster_collection m_broadcasters;
|
||||
Mutex m_broadcasters_mutex; // Protects m_broadcasters
|
||||
std::recursive_mutex m_broadcasters_mutex; // Protects m_broadcasters
|
||||
event_collection m_events;
|
||||
Mutex m_events_mutex; // Protects m_broadcasters and m_events
|
||||
Condition m_events_condition;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -22,7 +23,6 @@
|
|||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/TimeValue.h"
|
||||
#include "lldb/Symbol/SymbolContextScope.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
static Module *
|
||||
GetAllocatedModuleAtIndex (size_t idx);
|
||||
|
||||
static Mutex *
|
||||
static std::recursive_mutex &
|
||||
GetAllocationModuleCollectionMutex();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
@ -986,8 +986,8 @@ public:
|
|||
// SymbolVendor, SymbolFile and ObjectFile member objects should
|
||||
// lock the module mutex to avoid deadlocks.
|
||||
//------------------------------------------------------------------
|
||||
Mutex &
|
||||
GetMutex () const
|
||||
std::recursive_mutex &
|
||||
GetMutex() const
|
||||
{
|
||||
return m_mutex;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ protected:
|
|||
//------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//------------------------------------------------------------------
|
||||
mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
|
||||
mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
|
||||
TimeValue m_mod_time; ///< The modification time for this module when it was created.
|
||||
ArchSpec m_arch; ///< The architecture for this module.
|
||||
UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/PathMappingList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -447,30 +447,24 @@ protected:
|
|||
class ModuleSpecList
|
||||
{
|
||||
public:
|
||||
ModuleSpecList () :
|
||||
m_specs(),
|
||||
m_mutex(Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
ModuleSpecList() : m_specs(), m_mutex() {}
|
||||
|
||||
ModuleSpecList (const ModuleSpecList &rhs) :
|
||||
m_specs(),
|
||||
m_mutex(Mutex::eMutexTypeRecursive)
|
||||
ModuleSpecList(const ModuleSpecList &rhs) : m_specs(), m_mutex()
|
||||
{
|
||||
Mutex::Locker lhs_locker(m_mutex);
|
||||
Mutex::Locker rhs_locker(rhs.m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
|
||||
m_specs = rhs.m_specs;
|
||||
}
|
||||
|
||||
~ModuleSpecList() = default;
|
||||
|
||||
ModuleSpecList &
|
||||
operator = (const ModuleSpecList &rhs)
|
||||
operator=(const ModuleSpecList &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
Mutex::Locker lhs_locker(m_mutex);
|
||||
Mutex::Locker rhs_locker(rhs.m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
|
||||
m_specs = rhs.m_specs;
|
||||
}
|
||||
return *this;
|
||||
|
@ -479,29 +473,29 @@ public:
|
|||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_specs.size();
|
||||
}
|
||||
|
||||
void
|
||||
Clear ()
|
||||
Clear()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_specs.clear();
|
||||
}
|
||||
|
||||
void
|
||||
Append (const ModuleSpec &spec)
|
||||
Append(const ModuleSpec &spec)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
m_specs.push_back (spec);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_specs.push_back(spec);
|
||||
}
|
||||
|
||||
void
|
||||
Append (const ModuleSpecList &rhs)
|
||||
Append(const ModuleSpecList &rhs)
|
||||
{
|
||||
Mutex::Locker lhs_locker(m_mutex);
|
||||
Mutex::Locker rhs_locker(rhs.m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
|
||||
m_specs.insert(m_specs.end(), rhs.m_specs.begin(), rhs.m_specs.end());
|
||||
}
|
||||
|
||||
|
@ -514,9 +508,9 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
|
||||
GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (i < m_specs.size())
|
||||
{
|
||||
module_spec = m_specs[i];
|
||||
|
@ -527,11 +521,11 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
|
||||
FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
bool exact_arch_match = true;
|
||||
for (auto spec: m_specs)
|
||||
for (auto spec : m_specs)
|
||||
{
|
||||
if (spec.Matches(module_spec, exact_arch_match))
|
||||
{
|
||||
|
@ -539,12 +533,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If there was an architecture, retry with a compatible arch
|
||||
if (module_spec.GetArchitecturePtr())
|
||||
{
|
||||
exact_arch_match = false;
|
||||
for (auto spec: m_specs)
|
||||
for (auto spec : m_specs)
|
||||
{
|
||||
if (spec.Matches(module_spec, exact_arch_match))
|
||||
{
|
||||
|
@ -556,41 +550,41 @@ public:
|
|||
match_module_spec.Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
FindMatchingModuleSpecs (const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
|
||||
FindMatchingModuleSpecs(const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
bool exact_arch_match = true;
|
||||
const size_t initial_match_count = matching_list.GetSize();
|
||||
for (auto spec: m_specs)
|
||||
for (auto spec : m_specs)
|
||||
{
|
||||
if (spec.Matches(module_spec, exact_arch_match))
|
||||
matching_list.Append (spec);
|
||||
matching_list.Append(spec);
|
||||
}
|
||||
|
||||
|
||||
// If there was an architecture, retry with a compatible arch if no matches were found
|
||||
if (module_spec.GetArchitecturePtr() && (initial_match_count == matching_list.GetSize()))
|
||||
{
|
||||
exact_arch_match = false;
|
||||
for (auto spec: m_specs)
|
||||
for (auto spec : m_specs)
|
||||
{
|
||||
if (spec.Matches(module_spec, exact_arch_match))
|
||||
matching_list.Append (spec);
|
||||
matching_list.Append(spec);
|
||||
}
|
||||
}
|
||||
return matching_list.GetSize() - initial_match_count;
|
||||
}
|
||||
|
||||
void
|
||||
Dump (Stream &strm)
|
||||
Dump(Stream &strm)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
uint32_t idx = 0;
|
||||
for (auto spec: m_specs)
|
||||
for (auto spec : m_specs)
|
||||
{
|
||||
strm.Printf("[%u] ", idx);
|
||||
spec.Dump (strm);
|
||||
spec.Dump(strm);
|
||||
strm.EOL();
|
||||
++idx;
|
||||
}
|
||||
|
@ -599,7 +593,7 @@ public:
|
|||
protected:
|
||||
typedef std::vector<ModuleSpec> collection; ///< The module collection type.
|
||||
collection m_specs; ///< The collection of modules.
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#ifndef liblldb_StreamCallback_h_
|
||||
#define liblldb_StreamCallback_h_
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -37,8 +37,8 @@ private:
|
|||
lldb::LogOutputCallback m_callback;
|
||||
void *m_baton;
|
||||
collection m_accumulated_data;
|
||||
Mutex m_collection_mutex;
|
||||
|
||||
std::mutex m_collection_mutex;
|
||||
|
||||
StreamString &FindStreamForThread(lldb::tid_t cur_tid);
|
||||
};
|
||||
|
||||
|
|
|
@ -12,50 +12,37 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class StreamTee : public Stream
|
||||
{
|
||||
public:
|
||||
StreamTee () :
|
||||
Stream (),
|
||||
m_streams_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_streams ()
|
||||
{
|
||||
}
|
||||
StreamTee() : Stream(), m_streams_mutex(), m_streams() {}
|
||||
|
||||
StreamTee (lldb::StreamSP &stream_sp):
|
||||
Stream (),
|
||||
m_streams_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_streams ()
|
||||
StreamTee(lldb::StreamSP &stream_sp) : Stream(), m_streams_mutex(), m_streams()
|
||||
{
|
||||
// No need to lock mutex during construction
|
||||
if (stream_sp)
|
||||
m_streams.push_back (stream_sp);
|
||||
m_streams.push_back(stream_sp);
|
||||
}
|
||||
|
||||
|
||||
StreamTee (lldb::StreamSP &stream_sp, lldb::StreamSP &stream_2_sp) :
|
||||
Stream (),
|
||||
m_streams_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_streams ()
|
||||
StreamTee(lldb::StreamSP &stream_sp, lldb::StreamSP &stream_2_sp) : Stream(), m_streams_mutex(), m_streams()
|
||||
{
|
||||
// No need to lock mutex during construction
|
||||
if (stream_sp)
|
||||
m_streams.push_back (stream_sp);
|
||||
m_streams.push_back(stream_sp);
|
||||
if (stream_2_sp)
|
||||
m_streams.push_back (stream_2_sp);
|
||||
m_streams.push_back(stream_2_sp);
|
||||
}
|
||||
|
||||
StreamTee (const StreamTee &rhs) :
|
||||
Stream (rhs),
|
||||
m_streams_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_streams() // Don't copy until we lock down "rhs"
|
||||
|
||||
StreamTee(const StreamTee &rhs) : Stream(rhs), m_streams_mutex(), m_streams()
|
||||
{
|
||||
Mutex::Locker locker (rhs.m_streams_mutex);
|
||||
// Don't copy until we lock down "rhs"
|
||||
std::lock_guard<std::recursive_mutex> guard(rhs.m_streams_mutex);
|
||||
m_streams = rhs.m_streams;
|
||||
}
|
||||
|
||||
|
@ -64,21 +51,22 @@ public:
|
|||
}
|
||||
|
||||
StreamTee &
|
||||
operator = (const StreamTee &rhs)
|
||||
operator=(const StreamTee &rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
if (this != &rhs)
|
||||
{
|
||||
Stream::operator=(rhs);
|
||||
Mutex::Locker lhs_locker (m_streams_mutex);
|
||||
Mutex::Locker rhs_locker (rhs.m_streams_mutex);
|
||||
m_streams = rhs.m_streams;
|
||||
std::lock_guard<std::recursive_mutex> lhs_locker(m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> rhs_locker(rhs.m_streams_mutex);
|
||||
m_streams = rhs.m_streams;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
Flush () override
|
||||
Flush() override
|
||||
{
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
collection::iterator pos, end;
|
||||
for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos)
|
||||
{
|
||||
|
@ -88,17 +76,17 @@ public:
|
|||
// to valid values.
|
||||
Stream *strm = pos->get();
|
||||
if (strm)
|
||||
strm->Flush ();
|
||||
strm->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
Write (const void *s, size_t length) override
|
||||
Write(const void *s, size_t length) override
|
||||
{
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
if (m_streams.empty())
|
||||
return 0;
|
||||
|
||||
|
||||
size_t min_bytes_written = SIZE_MAX;
|
||||
collection::iterator pos, end;
|
||||
for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos)
|
||||
|
@ -110,7 +98,7 @@ public:
|
|||
Stream *strm = pos->get();
|
||||
if (strm)
|
||||
{
|
||||
const size_t bytes_written = strm->Write (s, length);
|
||||
const size_t bytes_written = strm->Write(s, length);
|
||||
if (min_bytes_written > bytes_written)
|
||||
min_bytes_written = bytes_written;
|
||||
}
|
||||
|
@ -121,39 +109,39 @@ public:
|
|||
}
|
||||
|
||||
size_t
|
||||
AppendStream (const lldb::StreamSP &stream_sp)
|
||||
AppendStream(const lldb::StreamSP &stream_sp)
|
||||
{
|
||||
size_t new_idx = m_streams.size();
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
m_streams.push_back (stream_sp);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
m_streams.push_back(stream_sp);
|
||||
return new_idx;
|
||||
}
|
||||
|
||||
size_t
|
||||
GetNumStreams () const
|
||||
GetNumStreams() const
|
||||
{
|
||||
size_t result = 0;
|
||||
{
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
result = m_streams.size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
lldb::StreamSP
|
||||
GetStreamAtIndex (uint32_t idx)
|
||||
GetStreamAtIndex(uint32_t idx)
|
||||
{
|
||||
lldb::StreamSP stream_sp;
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
if (idx < m_streams.size())
|
||||
stream_sp = m_streams[idx];
|
||||
return stream_sp;
|
||||
}
|
||||
|
||||
void
|
||||
SetStreamAtIndex (uint32_t idx, const lldb::StreamSP& stream_sp)
|
||||
SetStreamAtIndex(uint32_t idx, const lldb::StreamSP &stream_sp)
|
||||
{
|
||||
Mutex::Locker locker (m_streams_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
|
||||
// Resize our stream vector as necessary to fit as many streams
|
||||
// as needed. This also allows this class to be used with hard
|
||||
// coded indexes that can be used contain many streams, not all
|
||||
|
@ -162,10 +150,10 @@ public:
|
|||
m_streams.resize(idx + 1);
|
||||
m_streams[idx] = stream_sp;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
typedef std::vector<lldb::StreamSP> collection;
|
||||
mutable Mutex m_streams_mutex;
|
||||
mutable std::recursive_mutex m_streams_mutex;
|
||||
collection m_streams;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -31,11 +31,7 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
ThreadSafeSTLMap() :
|
||||
m_collection (),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
ThreadSafeSTLMap() : m_collection(), m_mutex() {}
|
||||
|
||||
~ThreadSafeSTLMap()
|
||||
{
|
||||
|
@ -44,22 +40,22 @@ public:
|
|||
bool
|
||||
IsEmpty() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_collection.empty();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Clear()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_collection.clear();
|
||||
}
|
||||
|
||||
size_t
|
||||
Erase (const _Key& key)
|
||||
Erase(const _Key &key)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return EraseNoLock (key);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return EraseNoLock(key);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -69,10 +65,10 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
GetValueForKey (const _Key& key, _Tp &value) const
|
||||
GetValueForKey(const _Key &key, _Tp &value) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return GetValueForKeyNoLock (key, value);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return GetValueForKeyNoLock(key, value);
|
||||
}
|
||||
|
||||
// Call this if you have already manually locked the mutex using the
|
||||
|
@ -90,10 +86,10 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
GetFirstKeyForValue (const _Tp &value, _Key& key) const
|
||||
GetFirstKeyForValue(const _Tp &value, _Key &key) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return GetFirstKeyForValueNoLock (value, key);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return GetFirstKeyForValueNoLock(value, key);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -112,13 +108,10 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
LowerBound (const _Key& key,
|
||||
_Key& match_key,
|
||||
_Tp &match_value,
|
||||
bool decrement_if_not_equal) const
|
||||
LowerBound(const _Key &key, _Key &match_key, _Tp &match_value, bool decrement_if_not_equal) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return LowerBoundNoLock (key, match_key, match_value, decrement_if_not_equal);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return LowerBoundNoLock(key, match_key, match_value, decrement_if_not_equal);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -149,10 +142,10 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
SetValueForKey (const _Key& key, const _Tp &value)
|
||||
SetValueForKey(const _Key &key, const _Tp &value)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
SetValueForKeyNoLock (key, value);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
SetValueForKeyNoLock(key, value);
|
||||
}
|
||||
|
||||
// Call this if you have already manually locked the mutex using the
|
||||
|
@ -163,15 +156,15 @@ public:
|
|||
m_collection[key] = value;
|
||||
}
|
||||
|
||||
Mutex &
|
||||
GetMutex ()
|
||||
std::recursive_mutex &
|
||||
GetMutex()
|
||||
{
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
private:
|
||||
collection m_collection;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// For ThreadSafeSTLMap only
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
#define liblldb_ThreadSafeValue_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -25,28 +27,20 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
ThreadSafeValue() :
|
||||
m_value (),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
ThreadSafeValue() : m_value(), m_mutex() {}
|
||||
|
||||
ThreadSafeValue(const T& value) :
|
||||
m_value (value),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
ThreadSafeValue(const T &value) : m_value(value), m_mutex() {}
|
||||
|
||||
~ThreadSafeValue()
|
||||
{
|
||||
}
|
||||
|
||||
T
|
||||
GetValue () const
|
||||
GetValue() const
|
||||
{
|
||||
T value;
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
value = m_value;
|
||||
}
|
||||
return value;
|
||||
|
@ -61,9 +55,9 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
SetValue (const T& value)
|
||||
SetValue(const T &value)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
|
@ -75,15 +69,15 @@ public:
|
|||
m_value = value;
|
||||
}
|
||||
|
||||
Mutex &
|
||||
GetMutex ()
|
||||
std::recursive_mutex &
|
||||
GetMutex()
|
||||
{
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_value;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// For ThreadSafeValue only
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "lldb/Core/StringList.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Interpreter/OptionValue.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
|
|
@ -1034,35 +1034,32 @@ protected:
|
|||
class ChildrenManager
|
||||
{
|
||||
public:
|
||||
ChildrenManager() :
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_children(),
|
||||
m_children_count(0)
|
||||
{}
|
||||
|
||||
ChildrenManager() : m_mutex(), m_children(), m_children_count(0) {}
|
||||
|
||||
bool
|
||||
HasChildAtIndex (size_t idx)
|
||||
HasChildAtIndex(size_t idx)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return (m_children.find(idx) != m_children.end());
|
||||
}
|
||||
|
||||
ValueObject*
|
||||
GetChildAtIndex (size_t idx)
|
||||
|
||||
ValueObject *
|
||||
GetChildAtIndex(size_t idx)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
const auto iter = m_children.find(idx);
|
||||
return ((iter == m_children.end()) ? nullptr : iter->second);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetChildAtIndex (size_t idx, ValueObject* valobj)
|
||||
SetChildAtIndex(size_t idx, ValueObject *valobj)
|
||||
{
|
||||
ChildrenPair pair(idx,valobj); // we do not need to be mutex-protected to make a pair
|
||||
Mutex::Locker locker(m_mutex);
|
||||
// we do not need to be mutex-protected to make a pair
|
||||
ChildrenPair pair(idx, valobj);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_children.insert(pair);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetChildrenCount (size_t count)
|
||||
{
|
||||
|
@ -1074,20 +1071,20 @@ protected:
|
|||
{
|
||||
return m_children_count;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Clear(size_t new_count = 0)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_children_count = new_count;
|
||||
m_children.clear();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef std::map<size_t, ValueObject*> ChildrenMap;
|
||||
typedef ChildrenMap::iterator ChildrenIterator;
|
||||
typedef ChildrenMap::value_type ChildrenPair;
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
ChildrenMap m_children;
|
||||
size_t m_children_count;
|
||||
};
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class FormatCache
|
||||
|
@ -82,8 +82,8 @@ private:
|
|||
};
|
||||
typedef std::map<ConstString,Entry> CacheMap;
|
||||
CacheMap m_map;
|
||||
Mutex m_mutex;
|
||||
|
||||
std::recursive_mutex m_mutex;
|
||||
|
||||
uint64_t m_cache_hits;
|
||||
uint64_t m_cache_misses;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <atomic>
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -289,7 +290,7 @@ private:
|
|||
|
||||
std::atomic<uint32_t> m_last_revision;
|
||||
FormatCache m_format_cache;
|
||||
Mutex m_language_categories_mutex;
|
||||
std::recursive_mutex m_language_categories_mutex;
|
||||
LanguageCategories m_language_categories_map;
|
||||
NamedSummariesMap m_named_summaries_map;
|
||||
TypeCategoryMap m_categories_map;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -81,33 +82,27 @@ public:
|
|||
typedef std::map<KeyType, ValueSP> MapType;
|
||||
typedef typename MapType::iterator MapIterator;
|
||||
typedef std::function<bool(KeyType, const ValueSP&)> ForEachCallback;
|
||||
|
||||
FormatMap(IFormatChangeListener* lst) :
|
||||
m_map(),
|
||||
m_map_mutex(Mutex::eMutexTypeRecursive),
|
||||
listener(lst)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FormatMap(IFormatChangeListener *lst) : m_map(), m_map_mutex(), listener(lst) {}
|
||||
|
||||
void
|
||||
Add(KeyType name,
|
||||
const ValueSP& entry)
|
||||
Add(KeyType name, const ValueSP &entry)
|
||||
{
|
||||
if (listener)
|
||||
entry->GetRevision() = listener->GetCurrentRevision();
|
||||
else
|
||||
entry->GetRevision() = 0;
|
||||
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
m_map[name] = entry;
|
||||
if (listener)
|
||||
listener->Changed();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Delete (KeyType name)
|
||||
Delete(KeyType name)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
|
@ -116,34 +111,33 @@ public:
|
|||
listener->Changed();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Clear ()
|
||||
Clear()
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
m_map.clear();
|
||||
if (listener)
|
||||
listener->Changed();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Get(KeyType name,
|
||||
ValueSP& entry)
|
||||
Get(KeyType name, ValueSP &entry)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
entry = iter->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ForEach (ForEachCallback callback)
|
||||
ForEach(ForEachCallback callback)
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator pos, end = m_map.end();
|
||||
for (pos = m_map.begin(); pos != end; pos++)
|
||||
{
|
||||
|
@ -153,17 +147,17 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
GetCount ()
|
||||
{
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
|
||||
ValueSP
|
||||
GetValueAtIndex (size_t index)
|
||||
GetValueAtIndex(size_t index)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.begin();
|
||||
MapIterator end = m_map.end();
|
||||
while (index > 0)
|
||||
|
@ -175,11 +169,11 @@ public:
|
|||
}
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
|
||||
KeyType
|
||||
GetKeyAtIndex (size_t index)
|
||||
GetKeyAtIndex(size_t index)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.begin();
|
||||
MapIterator end = m_map.end();
|
||||
while (index > 0)
|
||||
|
@ -191,24 +185,24 @@ public:
|
|||
}
|
||||
return iter->first;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
MapType m_map;
|
||||
Mutex m_map_mutex;
|
||||
MapType m_map;
|
||||
std::recursive_mutex m_map_mutex;
|
||||
IFormatChangeListener* listener;
|
||||
|
||||
|
||||
MapType&
|
||||
map ()
|
||||
{
|
||||
return m_map;
|
||||
}
|
||||
|
||||
Mutex&
|
||||
mutex ()
|
||||
|
||||
std::recursive_mutex &
|
||||
mutex()
|
||||
{
|
||||
return m_map_mutex;
|
||||
}
|
||||
|
||||
|
||||
friend class FormattersContainer<KeyType, ValueType>;
|
||||
friend class FormatManager;
|
||||
};
|
||||
|
@ -332,24 +326,23 @@ protected:
|
|||
}
|
||||
|
||||
bool
|
||||
Delete_Impl (ConstString type, lldb::RegularExpressionSP *dummy)
|
||||
Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy)
|
||||
{
|
||||
Mutex& x_mutex = m_format_map.mutex();
|
||||
lldb_private::Mutex::Locker locker(x_mutex);
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
|
||||
{
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
m_format_map.listener->Changed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (::strcmp(type.AsCString(), regex->GetText()) == 0)
|
||||
{
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
m_format_map.listener->Changed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Get_Impl (ConstString type, MapValueType& entry, ConstString *dummy)
|
||||
|
@ -385,36 +378,34 @@ protected:
|
|||
}
|
||||
|
||||
bool
|
||||
Get_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
|
||||
Get_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy)
|
||||
{
|
||||
const char* key_cstr = key.AsCString();
|
||||
if (!key_cstr)
|
||||
return false;
|
||||
Mutex& x_mutex = m_format_map.mutex();
|
||||
lldb_private::Mutex::Locker locker(x_mutex);
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->Execute(key_cstr))
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GetExact_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
|
||||
{
|
||||
Mutex& x_mutex = m_format_map.mutex();
|
||||
lldb_private::Mutex::Locker locker(x_mutex);
|
||||
const char *key_cstr = key.AsCString();
|
||||
if (!key_cstr)
|
||||
return false;
|
||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (strcmp(regex->GetText(),key.AsCString()) == 0)
|
||||
if (regex->Execute(key_cstr))
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GetExact_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (strcmp(regex->GetText(), key.AsCString()) == 0)
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// C++ Includes
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -519,9 +520,9 @@ namespace lldb_private {
|
|||
bool m_enabled;
|
||||
|
||||
IFormatChangeListener* m_change_listener;
|
||||
|
||||
Mutex m_mutex;
|
||||
|
||||
|
||||
std::recursive_mutex m_mutex;
|
||||
|
||||
ConstString m_name;
|
||||
|
||||
std::vector<lldb::LanguageType> m_languages;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
@ -131,8 +132,8 @@ namespace lldb_private {
|
|||
return ptr.get() == other.get();
|
||||
}
|
||||
};
|
||||
|
||||
Mutex m_map_mutex;
|
||||
|
||||
std::recursive_mutex m_map_mutex;
|
||||
IFormatChangeListener* listener;
|
||||
|
||||
MapType m_map;
|
||||
|
@ -147,12 +148,13 @@ namespace lldb_private {
|
|||
{
|
||||
return m_active_categories;
|
||||
}
|
||||
|
||||
Mutex& mutex ()
|
||||
|
||||
std::recursive_mutex &
|
||||
mutex()
|
||||
{
|
||||
return m_map_mutex;
|
||||
}
|
||||
|
||||
|
||||
friend class FormattersContainer<KeyType, ValueType>;
|
||||
friend class FormatManager;
|
||||
};
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/DataBufferHeap.h"
|
||||
#include "lldb/Expression/IRMemoryMap.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
|
||||
|
|
|
@ -50,13 +50,13 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Host/Condition.h"
|
||||
#include "lldb/Host/ConnectionFileDescriptor.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/Predicate.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -359,7 +359,7 @@ namespace lldb_private {
|
|||
CompleteCallbackType m_completion_callback = nullptr;
|
||||
void * m_completion_callback_baton = nullptr;
|
||||
|
||||
Mutex m_output_mutex;
|
||||
std::mutex m_output_mutex;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/Condition.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
#include "lldb/lldb-private-forward.h"
|
||||
#include "lldb/Core/Error.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
// #include "lldb/Host/NativeBreakpoint.h"
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace lldb_private
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace lldb_private
|
|||
private:
|
||||
typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
|
||||
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
BreakpointMap m_breakpoints;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#ifndef liblldb_NativeProcessProtocol_h_
|
||||
#define liblldb_NativeProcessProtocol_h_
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/lldb-private-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
#include "lldb/Core/Error.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/MainLoop.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
|
@ -364,15 +364,15 @@ namespace lldb_private
|
|||
|
||||
std::vector<NativeThreadProtocolSP> m_threads;
|
||||
lldb::tid_t m_current_thread_id;
|
||||
mutable Mutex m_threads_mutex;
|
||||
mutable std::recursive_mutex m_threads_mutex;
|
||||
|
||||
lldb::StateType m_state;
|
||||
mutable Mutex m_state_mutex;
|
||||
mutable std::recursive_mutex m_state_mutex;
|
||||
|
||||
lldb_private::ExitType m_exit_type;
|
||||
int m_exit_status;
|
||||
std::string m_exit_description;
|
||||
Mutex m_delegates_mutex;
|
||||
std::recursive_mutex m_delegates_mutex;
|
||||
std::vector<NativeDelegate*> m_delegates;
|
||||
NativeBreakpointList m_breakpoint_list;
|
||||
NativeWatchpointList m_watchpoint_list;
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
// C++ Includes
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "lldb/lldb-forward.h"
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Connection.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/Pipe.h"
|
||||
#include "lldb/Host/Predicate.h"
|
||||
#include "lldb/Host/IOObject.h"
|
||||
|
@ -105,7 +105,7 @@ class ConnectionFileDescriptor : public Connection
|
|||
// the port number.
|
||||
|
||||
Pipe m_pipe;
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
std::atomic<bool> m_shutting_down; // This marks that we are shutting down so if we get woken up from
|
||||
// BytesAvailable to disconnect, we won't try to read again.
|
||||
bool m_waiting_for_accept;
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
|
||||
|
||||
#include "lldb/lldb-private-types.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace lldb_private
|
||||
{
|
||||
|
@ -29,13 +29,14 @@ class SystemLifetimeManager
|
|||
void Terminate();
|
||||
|
||||
private:
|
||||
Mutex m_mutex;
|
||||
std::unique_ptr<SystemInitializer> m_initializer;
|
||||
bool m_initialized;
|
||||
std::recursive_mutex m_mutex;
|
||||
std::unique_ptr<SystemInitializer> m_initializer;
|
||||
bool m_initialized;
|
||||
|
||||
// Noncopyable.
|
||||
SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
|
||||
SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
|
||||
// Noncopyable.
|
||||
SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
|
||||
SystemLifetimeManager &
|
||||
operator=(const SystemLifetimeManager &other) = delete;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -19,7 +20,6 @@
|
|||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
DISALLOW_COPY_AND_ASSIGN(CommandHistory);
|
||||
|
||||
typedef std::vector<std::string> History;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
History m_history;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "lldb/Core/DataExtractor.h"
|
||||
#include "lldb/Core/RangeMap.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef liblldb_FuncUnwinders_h
|
||||
#define liblldb_FuncUnwinders_h
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -119,7 +119,7 @@ private:
|
|||
UnwindTable& m_unwind_table;
|
||||
AddressRange m_range;
|
||||
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
|
||||
lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
|
||||
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#ifndef liblldb_JITLoaderList_h_
|
||||
#define liblldb_JITLoaderList_h_
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
private:
|
||||
std::vector<lldb::JITLoaderSP> m_jit_loaders_vec;
|
||||
lldb_private::Mutex m_jit_loaders_mutex;
|
||||
std::recursive_mutex m_jit_loaders_mutex;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -28,7 +29,6 @@
|
|||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/Interpreter/Options.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
// TODO pull NativeDelegate class out of NativeProcessProtocol so we
|
||||
// can just forward ref the NativeDelegate rather than include it here.
|
||||
|
@ -1079,7 +1079,8 @@ class ModuleCache;
|
|||
uint32_t m_update_os_version;
|
||||
ArchSpec m_system_arch; // The architecture of the kernel or the remote platform
|
||||
typedef std::map<uint32_t, ConstString> IDToNameMap;
|
||||
Mutex m_mutex; // Mutex for modifying Platform data structures that should only be used for non-reentrant code
|
||||
// Mutex for modifying Platform data structures that should only be used for non-reentrant code
|
||||
std::mutex m_mutex;
|
||||
IDToNameMap m_uid_map;
|
||||
IDToNameMap m_gid_map;
|
||||
size_t m_max_uid_name_len;
|
||||
|
@ -1112,9 +1113,9 @@ class ModuleCache;
|
|||
CalculateTrapHandlerSymbolNames () = 0;
|
||||
|
||||
const char *
|
||||
GetCachedUserName (uint32_t uid)
|
||||
GetCachedUserName(uint32_t uid)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
// return the empty string if our string is NULL
|
||||
// so we can tell when things were in the negative
|
||||
// cached (didn't find a valid user name, don't keep
|
||||
|
@ -1124,35 +1125,35 @@ class ModuleCache;
|
|||
}
|
||||
|
||||
const char *
|
||||
SetCachedUserName (uint32_t uid, const char *name, size_t name_len)
|
||||
SetCachedUserName(uint32_t uid, const char *name, size_t name_len)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
ConstString const_name (name);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
ConstString const_name(name);
|
||||
m_uid_map[uid] = const_name;
|
||||
if (m_max_uid_name_len < name_len)
|
||||
m_max_uid_name_len = name_len;
|
||||
// Const strings lives forever in our const string pool, so we can return the const char *
|
||||
return const_name.GetCString();
|
||||
return const_name.GetCString();
|
||||
}
|
||||
|
||||
void
|
||||
SetUserNameNotFound (uint32_t uid)
|
||||
SetUserNameNotFound(uint32_t uid)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_uid_map[uid] = ConstString();
|
||||
}
|
||||
|
||||
void
|
||||
ClearCachedUserNames ()
|
||||
ClearCachedUserNames()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_uid_map.clear();
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
GetCachedGroupName (uint32_t gid)
|
||||
GetCachedGroupName(uint32_t gid)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
// return the empty string if our string is NULL
|
||||
// so we can tell when things were in the negative
|
||||
// cached (didn't find a valid group name, don't keep
|
||||
|
@ -1162,28 +1163,28 @@ class ModuleCache;
|
|||
}
|
||||
|
||||
const char *
|
||||
SetCachedGroupName (uint32_t gid, const char *name, size_t name_len)
|
||||
SetCachedGroupName(uint32_t gid, const char *name, size_t name_len)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
ConstString const_name (name);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
ConstString const_name(name);
|
||||
m_gid_map[gid] = const_name;
|
||||
if (m_max_gid_name_len < name_len)
|
||||
m_max_gid_name_len = name_len;
|
||||
// Const strings lives forever in our const string pool, so we can return the const char *
|
||||
return const_name.GetCString();
|
||||
return const_name.GetCString();
|
||||
}
|
||||
|
||||
void
|
||||
SetGroupNameNotFound (uint32_t gid)
|
||||
SetGroupNameNotFound(uint32_t gid)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_gid_map[gid] = ConstString();
|
||||
}
|
||||
|
||||
void
|
||||
ClearCachedGroupNames ()
|
||||
ClearCachedGroupNames()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_gid_map.clear();
|
||||
}
|
||||
|
||||
|
@ -1236,20 +1237,15 @@ class ModuleCache;
|
|||
class PlatformList
|
||||
{
|
||||
public:
|
||||
PlatformList() :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_platforms (),
|
||||
m_selected_platform_sp()
|
||||
{
|
||||
}
|
||||
PlatformList() : m_mutex(), m_platforms(), m_selected_platform_sp() {}
|
||||
|
||||
~PlatformList() = default;
|
||||
|
||||
void
|
||||
Append (const lldb::PlatformSP &platform_sp, bool set_selected)
|
||||
Append(const lldb::PlatformSP &platform_sp, bool set_selected)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
m_platforms.push_back (platform_sp);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_platforms.push_back(platform_sp);
|
||||
if (set_selected)
|
||||
m_selected_platform_sp = m_platforms.back();
|
||||
}
|
||||
|
@ -1257,16 +1253,16 @@ class ModuleCache;
|
|||
size_t
|
||||
GetSize()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_platforms.size();
|
||||
}
|
||||
|
||||
lldb::PlatformSP
|
||||
GetAtIndex (uint32_t idx)
|
||||
GetAtIndex(uint32_t idx)
|
||||
{
|
||||
lldb::PlatformSP platform_sp;
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (idx < m_platforms.size())
|
||||
platform_sp = m_platforms[idx];
|
||||
}
|
||||
|
@ -1283,23 +1279,23 @@ class ModuleCache;
|
|||
/// processes.
|
||||
//------------------------------------------------------------------
|
||||
lldb::PlatformSP
|
||||
GetSelectedPlatform ()
|
||||
GetSelectedPlatform()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_selected_platform_sp && !m_platforms.empty())
|
||||
m_selected_platform_sp = m_platforms.front();
|
||||
|
||||
|
||||
return m_selected_platform_sp;
|
||||
}
|
||||
|
||||
void
|
||||
SetSelectedPlatform (const lldb::PlatformSP &platform_sp)
|
||||
SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
|
||||
{
|
||||
if (platform_sp)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
const size_t num_platforms = m_platforms.size();
|
||||
for (size_t idx=0; idx<num_platforms; ++idx)
|
||||
for (size_t idx = 0; idx < num_platforms; ++idx)
|
||||
{
|
||||
if (m_platforms[idx].get() == platform_sp.get())
|
||||
{
|
||||
|
@ -1307,21 +1303,21 @@ class ModuleCache;
|
|||
return;
|
||||
}
|
||||
}
|
||||
m_platforms.push_back (platform_sp);
|
||||
m_platforms.push_back(platform_sp);
|
||||
m_selected_platform_sp = m_platforms.back();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef std::vector<lldb::PlatformSP> collection;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
collection m_platforms;
|
||||
lldb::PlatformSP m_selected_platform_sp;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (PlatformList);
|
||||
};
|
||||
|
||||
|
||||
class OptionGroupPlatformRSync : public lldb_private::OptionGroup
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -31,11 +31,7 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
SectionLoadHistory () :
|
||||
m_stop_id_to_section_load_list(),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
SectionLoadHistory() : m_stop_id_to_section_load_list(), m_mutex() {}
|
||||
|
||||
~SectionLoadHistory()
|
||||
{
|
||||
|
@ -98,7 +94,7 @@ protected:
|
|||
|
||||
typedef std::map<uint32_t, lldb::SectionLoadListSP> StopIDToSectionLoadList;
|
||||
StopIDToSectionLoadList m_stop_id_to_section_load_list;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (SectionLoadHistory);
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Core/Section.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -29,13 +29,7 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
SectionLoadList () :
|
||||
m_addr_to_sect (),
|
||||
m_sect_to_addr (),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
|
||||
{
|
||||
}
|
||||
SectionLoadList() : m_addr_to_sect(), m_sect_to_addr(), m_mutex() {}
|
||||
|
||||
SectionLoadList (const SectionLoadList& rhs);
|
||||
|
||||
|
@ -84,7 +78,7 @@ protected:
|
|||
typedef llvm::DenseMap<const Section *, lldb::addr_t> sect_to_addr_collection;
|
||||
addr_to_sect_collection m_addr_to_sect;
|
||||
sect_to_addr_collection m_sect_to_addr;
|
||||
mutable Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -229,7 +229,7 @@ protected:
|
|||
//------------------------------------------------------------------
|
||||
collection m_target_list;
|
||||
lldb::TargetSP m_dummy_target_sp;
|
||||
mutable Mutex m_target_list_mutex;
|
||||
mutable std::recursive_mutex m_target_list_mutex;
|
||||
uint32_t m_selected_target_idx;
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Core/StructuredData.h"
|
||||
|
@ -1446,11 +1446,11 @@ protected:
|
|||
const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread for easy UI/command line access.
|
||||
lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this thread's current register state.
|
||||
lldb::StateType m_state; ///< The state of our process.
|
||||
mutable Mutex m_state_mutex; ///< Multithreaded protection for m_state.
|
||||
mutable std::recursive_mutex m_state_mutex; ///< Multithreaded protection for m_state.
|
||||
plan_stack m_plan_stack; ///< The stack of plans this thread is executing.
|
||||
plan_stack m_completed_plan_stack; ///< Plans that have been completed by this stop. They get deleted when the thread resumes.
|
||||
plan_stack m_discarded_plan_stack; ///< Plans that have been discarded by this stop. They get deleted when the thread resumes.
|
||||
mutable Mutex m_frame_mutex; ///< Multithreaded protection for m_state.
|
||||
mutable std::recursive_mutex m_frame_mutex; ///< Multithreaded protection for m_state.
|
||||
lldb::StackFrameListSP m_curr_frames_sp; ///< The stack frames that get lazily populated after a thread stops.
|
||||
lldb::StackFrameListSP m_prev_frames_sp; ///< The previous stack frames from the last time this thread stopped.
|
||||
int m_resume_signal; ///< The signal that should be used when continuing this thread.
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
|
@ -632,7 +632,7 @@ private:
|
|||
|
||||
ThreadPlanKind m_kind;
|
||||
std::string m_name;
|
||||
Mutex m_plan_complete_mutex;
|
||||
std::recursive_mutex m_plan_complete_mutex;
|
||||
LazyBool m_cached_plan_explains_stop;
|
||||
bool m_plan_complete;
|
||||
bool m_plan_private;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/StructuredData.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -25,11 +26,7 @@ protected:
|
|||
//------------------------------------------------------------------
|
||||
// Classes that inherit from Unwind can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
Unwind(Thread &thread) :
|
||||
m_thread (thread),
|
||||
m_unwind_mutex(Mutex::eMutexTypeRecursive)
|
||||
{
|
||||
}
|
||||
Unwind(Thread &thread) : m_thread(thread), m_unwind_mutex() {}
|
||||
|
||||
public:
|
||||
virtual
|
||||
|
@ -40,18 +37,17 @@ public:
|
|||
void
|
||||
Clear()
|
||||
{
|
||||
Mutex::Locker locker(m_unwind_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
|
||||
DoClear();
|
||||
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetFrameCount()
|
||||
{
|
||||
Mutex::Locker locker(m_unwind_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
|
||||
return DoGetFrameCount();
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
GetFramesUpTo (uint32_t end_idx)
|
||||
{
|
||||
|
@ -70,21 +66,19 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
GetFrameInfoAtIndex (uint32_t frame_idx,
|
||||
lldb::addr_t& cfa,
|
||||
lldb::addr_t& pc)
|
||||
GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, lldb::addr_t &pc)
|
||||
{
|
||||
Mutex::Locker locker(m_unwind_mutex);
|
||||
return DoGetFrameInfoAtIndex (frame_idx, cfa, pc);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
|
||||
return DoGetFrameInfoAtIndex(frame_idx, cfa, pc);
|
||||
}
|
||||
|
||||
|
||||
lldb::RegisterContextSP
|
||||
CreateRegisterContextForFrame (StackFrame *frame)
|
||||
CreateRegisterContextForFrame(StackFrame *frame)
|
||||
{
|
||||
Mutex::Locker locker(m_unwind_mutex);
|
||||
return DoCreateRegisterContextForFrame (frame);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
|
||||
return DoCreateRegisterContextForFrame(frame);
|
||||
}
|
||||
|
||||
|
||||
Thread &
|
||||
GetThread()
|
||||
{
|
||||
|
@ -110,7 +104,8 @@ protected:
|
|||
DoCreateRegisterContextForFrame (StackFrame *frame) = 0;
|
||||
|
||||
Thread &m_thread;
|
||||
Mutex m_unwind_mutex;
|
||||
std::recursive_mutex m_unwind_mutex;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (Unwind);
|
||||
};
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define utility_SharedCluster_h_
|
||||
|
||||
#include "lldb/Utility/SharingPtr.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
|
||||
|
@ -46,14 +45,12 @@ template <class T>
|
|||
class ClusterManager
|
||||
{
|
||||
public:
|
||||
ClusterManager () :
|
||||
m_objects(),
|
||||
m_external_ref(0),
|
||||
m_mutex(Mutex::eMutexTypeNormal) {}
|
||||
|
||||
~ClusterManager ()
|
||||
ClusterManager() : m_objects(), m_external_ref(0), m_mutex() {}
|
||||
|
||||
~ClusterManager()
|
||||
{
|
||||
for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(), end = m_objects.end(); pos != end; ++pos)
|
||||
for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(), end = m_objects.end(); pos != end;
|
||||
++pos)
|
||||
{
|
||||
T *object = *pos;
|
||||
delete object;
|
||||
|
@ -62,42 +59,44 @@ public:
|
|||
// Decrement refcount should have been called on this ClusterManager,
|
||||
// and it should have locked the mutex, now we will unlock it before
|
||||
// we destroy it...
|
||||
m_mutex.Unlock();
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
void ManageObject (T *new_object)
|
||||
|
||||
void
|
||||
ManageObject(T *new_object)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
m_objects.insert (new_object);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_objects.insert(new_object);
|
||||
}
|
||||
|
||||
typename lldb_private::SharingPtr<T> GetSharedPointer(T *desired_object)
|
||||
|
||||
typename lldb_private::SharingPtr<T>
|
||||
GetSharedPointer(T *desired_object)
|
||||
{
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
m_external_ref++;
|
||||
assert (m_objects.count(desired_object));
|
||||
assert(m_objects.count(desired_object));
|
||||
}
|
||||
return typename lldb_private::SharingPtr<T> (desired_object, new imp::shared_ptr_refcount<ClusterManager> (this));
|
||||
return typename lldb_private::SharingPtr<T>(desired_object, new imp::shared_ptr_refcount<ClusterManager>(this));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void DecrementRefCount ()
|
||||
void
|
||||
DecrementRefCount()
|
||||
{
|
||||
m_mutex.Lock();
|
||||
m_mutex.lock();
|
||||
m_external_ref--;
|
||||
if (m_external_ref == 0)
|
||||
delete this;
|
||||
else
|
||||
m_mutex.Unlock();
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
friend class imp::shared_ptr_refcount<ClusterManager>;
|
||||
|
||||
|
||||
llvm::SmallPtrSet<T *, 16> m_objects;
|
||||
int m_external_ref;
|
||||
Mutex m_mutex;
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -191,8 +191,8 @@ SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, voi
|
|||
// uses global collections and having two threads parsing the .lldbinit files can cause
|
||||
// mayhem. So to get around this for now we need to use a mutex to prevent bad things
|
||||
// from happening.
|
||||
static Mutex g_mutex(Mutex::eMutexTypeRecursive);
|
||||
Mutex::Locker locker(g_mutex);
|
||||
static std::recursive_mutex g_mutex;
|
||||
std::lock_guard<std::recursive_mutex> guard(g_mutex);
|
||||
|
||||
debugger.reset(Debugger::CreateInstance(callback, baton));
|
||||
|
||||
|
|
|
@ -24,13 +24,8 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
BreakpointLocationList::BreakpointLocationList(Breakpoint &owner) :
|
||||
m_owner (owner),
|
||||
m_locations(),
|
||||
m_address_to_location (),
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_next_id (0),
|
||||
m_new_location_recorder (nullptr)
|
||||
BreakpointLocationList::BreakpointLocationList(Breakpoint &owner)
|
||||
: m_owner(owner), m_locations(), m_address_to_location(), m_mutex(), m_next_id(0), m_new_location_recorder(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +34,7 @@ BreakpointLocationList::~BreakpointLocationList() = default;
|
|||
BreakpointLocationSP
|
||||
BreakpointLocationList::Create (const Address &addr, bool resolve_indirect_symbols)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
// The location ID is just the size of the location list + 1
|
||||
lldb::break_id_t bp_loc_id = ++m_next_id;
|
||||
BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr, LLDB_INVALID_THREAD_ID, m_owner.IsHardware(), resolve_indirect_symbols));
|
||||
|
@ -84,7 +79,7 @@ Compare (BreakpointLocationSP lhs, lldb::break_id_t val)
|
|||
BreakpointLocationSP
|
||||
BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::const_iterator end = m_locations.end();
|
||||
collection::const_iterator pos = std::lower_bound(m_locations.begin(), end, break_id, Compare);
|
||||
if (pos != end && (*pos)->GetID() == break_id)
|
||||
|
@ -97,7 +92,7 @@ size_t
|
|||
BreakpointLocationList::FindInModule (Module *module,
|
||||
BreakpointLocationCollection& bp_loc_list)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
const size_t orig_size = bp_loc_list.GetSize();
|
||||
collection::iterator pos, end = m_locations.end();
|
||||
|
||||
|
@ -116,7 +111,7 @@ BreakpointLocationList::FindInModule (Module *module,
|
|||
const BreakpointLocationSP
|
||||
BreakpointLocationList::FindByAddress (const Address &addr) const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
BreakpointLocationSP bp_loc_sp;
|
||||
if (!m_locations.empty())
|
||||
{
|
||||
|
@ -150,7 +145,7 @@ BreakpointLocationList::Dump (Stream *s) const
|
|||
{
|
||||
s->Printf("%p: ", static_cast<const void*>(this));
|
||||
//s->Indent();
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
s->Printf("BreakpointLocationList with %" PRIu64 " BreakpointLocations:\n", (uint64_t)m_locations.size());
|
||||
s->IndentMore();
|
||||
collection::const_iterator pos, end = m_locations.end();
|
||||
|
@ -162,7 +157,7 @@ BreakpointLocationList::Dump (Stream *s) const
|
|||
BreakpointLocationSP
|
||||
BreakpointLocationList::GetByIndex (size_t i)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
BreakpointLocationSP bp_loc_sp;
|
||||
if (i < m_locations.size())
|
||||
bp_loc_sp = m_locations[i];
|
||||
|
@ -173,7 +168,7 @@ BreakpointLocationList::GetByIndex (size_t i)
|
|||
const BreakpointLocationSP
|
||||
BreakpointLocationList::GetByIndex (size_t i) const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
BreakpointLocationSP bp_loc_sp;
|
||||
if (i < m_locations.size())
|
||||
bp_loc_sp = m_locations[i];
|
||||
|
@ -184,7 +179,7 @@ BreakpointLocationList::GetByIndex (size_t i) const
|
|||
void
|
||||
BreakpointLocationList::ClearAllBreakpointSites ()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator pos, end = m_locations.end();
|
||||
for (pos = m_locations.begin(); pos != end; ++pos)
|
||||
(*pos)->ClearBreakpointSite();
|
||||
|
@ -193,7 +188,7 @@ BreakpointLocationList::ClearAllBreakpointSites ()
|
|||
void
|
||||
BreakpointLocationList::ResolveAllBreakpointSites ()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator pos, end = m_locations.end();
|
||||
|
||||
for (pos = m_locations.begin(); pos != end; ++pos)
|
||||
|
@ -207,7 +202,7 @@ uint32_t
|
|||
BreakpointLocationList::GetHitCount () const
|
||||
{
|
||||
uint32_t hit_count = 0;
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::const_iterator pos, end = m_locations.end();
|
||||
for (pos = m_locations.begin(); pos != end; ++pos)
|
||||
hit_count += (*pos)->GetHitCount();
|
||||
|
@ -217,7 +212,7 @@ BreakpointLocationList::GetHitCount () const
|
|||
size_t
|
||||
BreakpointLocationList::GetNumResolvedLocations() const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
size_t resolve_count = 0;
|
||||
collection::const_iterator pos, end = m_locations.end();
|
||||
for (pos = m_locations.begin(); pos != end; ++pos)
|
||||
|
@ -231,7 +226,7 @@ BreakpointLocationList::GetNumResolvedLocations() const
|
|||
void
|
||||
BreakpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator pos, end = m_locations.end();
|
||||
|
||||
for (pos = m_locations.begin(); pos != end; ++pos)
|
||||
|
@ -244,7 +239,7 @@ BreakpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
|||
BreakpointLocationSP
|
||||
BreakpointLocationList::AddLocation (const Address &addr, bool resolve_indirect_symbols, bool *new_location)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (new_location)
|
||||
*new_location = false;
|
||||
|
@ -285,8 +280,8 @@ BreakpointLocationList::RemoveLocation (const lldb::BreakpointLocationSP &bp_loc
|
|||
{
|
||||
if (bp_loc_sp)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
m_address_to_location.erase (bp_loc_sp->GetAddress());
|
||||
|
||||
collection::iterator pos, end = m_locations.end();
|
||||
|
@ -305,7 +300,7 @@ BreakpointLocationList::RemoveLocation (const lldb::BreakpointLocationSP &bp_loc
|
|||
void
|
||||
BreakpointLocationList::RemoveInvalidLocations (const ArchSpec &arch)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
size_t idx = 0;
|
||||
// Don't cache m_location.size() as it will change since we might
|
||||
// remove locations from our vector...
|
||||
|
@ -341,7 +336,7 @@ BreakpointLocationList::RemoveInvalidLocations (const ArchSpec &arch)
|
|||
void
|
||||
BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection &new_locations)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
assert(m_new_location_recorder == nullptr);
|
||||
m_new_location_recorder = &new_locations;
|
||||
}
|
||||
|
@ -349,7 +344,7 @@ BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection
|
|||
void
|
||||
BreakpointLocationList::StopRecordingNewLocations ()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_new_location_recorder = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,17 +23,15 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
BreakpointSite::BreakpointSite(BreakpointSiteList *list,
|
||||
const BreakpointLocationSP& owner,
|
||||
lldb::addr_t addr,
|
||||
bool use_hardware) :
|
||||
StoppointLocation(GetNextID(), addr, 0, use_hardware),
|
||||
m_type (eSoftware), // Process subclasses need to set this correctly using SetType()
|
||||
m_saved_opcode(),
|
||||
m_trap_opcode(),
|
||||
m_enabled(false), // Need to create it disabled, so the first enable turns it on.
|
||||
m_owners(),
|
||||
m_owners_mutex(Mutex::eMutexTypeRecursive)
|
||||
BreakpointSite::BreakpointSite(BreakpointSiteList *list, const BreakpointLocationSP &owner, lldb::addr_t addr,
|
||||
bool use_hardware)
|
||||
: StoppointLocation(GetNextID(), addr, 0, use_hardware),
|
||||
m_type(eSoftware), // Process subclasses need to set this correctly using SetType()
|
||||
m_saved_opcode(),
|
||||
m_trap_opcode(),
|
||||
m_enabled(false), // Need to create it disabled, so the first enable turns it on.
|
||||
m_owners(),
|
||||
m_owners_mutex()
|
||||
{
|
||||
m_owners.Add(owner);
|
||||
}
|
||||
|
@ -61,7 +59,7 @@ BreakpointSite::GetNextID()
|
|||
bool
|
||||
BreakpointSite::ShouldStop (StoppointCallbackContext *context)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
IncrementHitCount();
|
||||
return m_owners.ShouldStop (context);
|
||||
}
|
||||
|
@ -69,7 +67,7 @@ BreakpointSite::ShouldStop (StoppointCallbackContext *context)
|
|||
bool
|
||||
BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
const size_t owner_count = m_owners.GetSize();
|
||||
for (size_t i = 0; i < owner_count; i++)
|
||||
{
|
||||
|
@ -96,7 +94,7 @@ BreakpointSite::Dump(Stream *s) const
|
|||
void
|
||||
BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
if (level != lldb::eDescriptionLevelBrief)
|
||||
s->Printf ("breakpoint site: %d at 0x%8.8" PRIx64, GetID(), GetLoadAddress());
|
||||
m_owners.GetDescription (s, level);
|
||||
|
@ -166,14 +164,14 @@ BreakpointSite::SetEnabled (bool enabled)
|
|||
void
|
||||
BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
m_owners.Add(owner);
|
||||
}
|
||||
|
||||
size_t
|
||||
BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
m_owners.Remove(break_id, break_loc_id);
|
||||
return m_owners.GetSize();
|
||||
}
|
||||
|
@ -181,28 +179,28 @@ BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_l
|
|||
size_t
|
||||
BreakpointSite::GetNumberOfOwners ()
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
return m_owners.GetSize();
|
||||
}
|
||||
|
||||
BreakpointLocationSP
|
||||
BreakpointSite::GetOwnerAtIndex (size_t index)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
return m_owners.GetByIndex (index);
|
||||
}
|
||||
|
||||
bool
|
||||
BreakpointSite::ValidForThisThread (Thread *thread)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
return m_owners.ValidForThisThread(thread);
|
||||
}
|
||||
|
||||
void
|
||||
BreakpointSite::BumpHitCounts()
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
|
||||
{
|
||||
loc_sp->BumpHitCount();
|
||||
|
@ -255,7 +253,7 @@ BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *in
|
|||
size_t
|
||||
BreakpointSite::CopyOwnersList (BreakpointLocationCollection &out_collection)
|
||||
{
|
||||
Mutex::Locker locker(m_owners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
|
||||
for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
|
||||
{
|
||||
out_collection.Add(loc_sp);
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
BreakpointSiteList::BreakpointSiteList() :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_bp_site_list()
|
||||
BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +34,7 @@ lldb::break_id_t
|
|||
BreakpointSiteList::Add(const BreakpointSiteSP &bp)
|
||||
{
|
||||
lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator iter = m_bp_site_list.find (bp_site_load_addr);
|
||||
|
||||
if (iter == m_bp_site_list.end())
|
||||
|
@ -81,7 +79,7 @@ BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
|
|||
bool
|
||||
BreakpointSiteList::Remove (lldb::break_id_t break_id)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator pos = GetIDIterator(break_id); // Predicate
|
||||
if (pos != m_bp_site_list.end())
|
||||
{
|
||||
|
@ -94,7 +92,7 @@ BreakpointSiteList::Remove (lldb::break_id_t break_id)
|
|||
bool
|
||||
BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator pos = m_bp_site_list.find(address);
|
||||
if (pos != m_bp_site_list.end())
|
||||
{
|
||||
|
@ -124,7 +122,7 @@ private:
|
|||
BreakpointSiteList::collection::iterator
|
||||
BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
|
||||
BreakpointSiteIDMatches(break_id)); // Predicate
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
|
|||
BreakpointSiteList::collection::const_iterator
|
||||
BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
|
||||
BreakpointSiteIDMatches(break_id)); // Predicate
|
||||
}
|
||||
|
@ -140,7 +138,7 @@ BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
|
|||
BreakpointSiteSP
|
||||
BreakpointSiteList::FindByID (lldb::break_id_t break_id)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
BreakpointSiteSP stop_sp;
|
||||
collection::iterator pos = GetIDIterator(break_id);
|
||||
if (pos != m_bp_site_list.end())
|
||||
|
@ -152,7 +150,7 @@ BreakpointSiteList::FindByID (lldb::break_id_t break_id)
|
|||
const BreakpointSiteSP
|
||||
BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
BreakpointSiteSP stop_sp;
|
||||
collection::const_iterator pos = GetIDConstIterator(break_id);
|
||||
if (pos != m_bp_site_list.end())
|
||||
|
@ -165,7 +163,7 @@ BreakpointSiteSP
|
|||
BreakpointSiteList::FindByAddress (lldb::addr_t addr)
|
||||
{
|
||||
BreakpointSiteSP found_sp;
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::iterator iter = m_bp_site_list.find(addr);
|
||||
if (iter != m_bp_site_list.end())
|
||||
found_sp = iter->second;
|
||||
|
@ -175,7 +173,7 @@ BreakpointSiteList::FindByAddress (lldb::addr_t addr)
|
|||
bool
|
||||
BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::const_iterator pos = GetIDConstIterator(bp_site_id);
|
||||
if (pos != m_bp_site_list.end())
|
||||
return pos->second->IsBreakpointAtThisSite (bp_id);
|
||||
|
@ -200,7 +198,7 @@ BreakpointSiteList::Dump (Stream *s) const
|
|||
void
|
||||
BreakpointSiteList::ForEach (std::function <void(BreakpointSite *)> const &callback)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
for (auto pair : m_bp_site_list)
|
||||
callback (pair.second.get());
|
||||
}
|
||||
|
@ -210,8 +208,8 @@ BreakpointSiteList::FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bo
|
|||
{
|
||||
if (lower_bound > upper_bound)
|
||||
return false;
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
collection::const_iterator lower, upper, pos;
|
||||
lower = m_bp_site_list.lower_bound(lower_bound);
|
||||
if (lower == m_bp_site_list.end()
|
||||
|
|
|
@ -1978,7 +1978,7 @@ FindModulesByName (Target *target,
|
|||
if (check_global_list)
|
||||
{
|
||||
// Check the global list
|
||||
Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex());
|
||||
const size_t num_modules = Module::GetNumberAllocatedModules();
|
||||
ModuleSP module_sp;
|
||||
for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
|
||||
|
@ -2470,7 +2470,7 @@ protected:
|
|||
else
|
||||
{
|
||||
// Check the global list
|
||||
Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex());
|
||||
|
||||
result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
|
||||
}
|
||||
|
@ -3291,16 +3291,20 @@ protected:
|
|||
}
|
||||
|
||||
size_t num_modules = 0;
|
||||
Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-nullptr.
|
||||
// Otherwise it will lock the AllocationModuleCollectionMutex when accessing
|
||||
// the global module list directly.
|
||||
|
||||
// This locker will be locked on the mutex in module_list_ptr if it is non-nullptr.
|
||||
// Otherwise it will lock the AllocationModuleCollectionMutex when accessing
|
||||
// the global module list directly.
|
||||
std::unique_lock<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex(), std::defer_lock);
|
||||
Mutex::Locker locker;
|
||||
|
||||
const ModuleList *module_list_ptr = nullptr;
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
if (argc == 0)
|
||||
{
|
||||
if (use_global_module_list)
|
||||
{
|
||||
locker.Lock (Module::GetAllocationModuleCollectionMutex());
|
||||
guard.lock();
|
||||
num_modules = Module::GetNumberAllocatedModules();
|
||||
}
|
||||
else
|
||||
|
@ -3331,6 +3335,7 @@ protected:
|
|||
|
||||
if (module_list_ptr != nullptr)
|
||||
{
|
||||
assert(use_global_module_list == false && "locking violation");
|
||||
locker.Lock(module_list_ptr->GetMutex());
|
||||
num_modules = module_list_ptr->GetSize();
|
||||
}
|
||||
|
|
|
@ -32,12 +32,8 @@ Broadcaster::Broadcaster(BroadcasterManagerSP manager_sp, const char *name) :
|
|||
static_cast<void*>(this), GetBroadcasterName().AsCString());
|
||||
}
|
||||
|
||||
Broadcaster::BroadcasterImpl::BroadcasterImpl (Broadcaster &broadcaster) :
|
||||
m_broadcaster(broadcaster),
|
||||
m_listeners (),
|
||||
m_listeners_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_hijacking_listeners(),
|
||||
m_hijacking_masks()
|
||||
Broadcaster::BroadcasterImpl::BroadcasterImpl(Broadcaster &broadcaster)
|
||||
: m_broadcaster(broadcaster), m_listeners(), m_listeners_mutex(), m_hijacking_listeners(), m_hijacking_masks()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -90,8 +86,8 @@ Broadcaster::BroadcasterImpl::ListenerIterator (std::function <bool (const lldb:
|
|||
void
|
||||
Broadcaster::BroadcasterImpl::Clear()
|
||||
{
|
||||
Mutex::Locker listeners_locker(m_listeners_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
// Make sure the listener forgets about this broadcaster. We do
|
||||
// this in the broadcaster in case the broadcaster object initiates
|
||||
// the removal.
|
||||
|
@ -152,7 +148,7 @@ Broadcaster::BroadcasterImpl::AddListener (const lldb::ListenerSP &listener_sp,
|
|||
if (!listener_sp)
|
||||
return 0;
|
||||
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
// See if we already have this listener, and if so, update its mask
|
||||
|
||||
|
@ -186,8 +182,8 @@ Broadcaster::BroadcasterImpl::AddListener (const lldb::ListenerSP &listener_sp,
|
|||
bool
|
||||
Broadcaster::BroadcasterImpl::EventTypeHasListeners (uint32_t event_type)
|
||||
{
|
||||
Mutex::Locker locker (m_listeners_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
if (!m_hijacking_listeners.empty() && event_type & m_hijacking_masks.back())
|
||||
return true;
|
||||
|
||||
|
@ -215,7 +211,7 @@ Broadcaster::BroadcasterImpl::RemoveListener (lldb_private::Listener *listener,
|
|||
{
|
||||
if (listener)
|
||||
{
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
collection::iterator pos = m_listeners.begin();
|
||||
// See if we already have this listener, and if so, update its mask
|
||||
while (pos != m_listeners.end())
|
||||
|
@ -275,7 +271,7 @@ Broadcaster::BroadcasterImpl::PrivateBroadcastEvent (EventSP &event_sp, bool uni
|
|||
|
||||
const uint32_t event_type = event_sp->GetType();
|
||||
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
ListenerSP hijacking_listener_sp;
|
||||
|
||||
|
@ -343,7 +339,7 @@ Broadcaster::BroadcasterImpl::BroadcastEventIfUnique (uint32_t event_type, Event
|
|||
bool
|
||||
Broadcaster::BroadcasterImpl::HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask)
|
||||
{
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS));
|
||||
if (log)
|
||||
|
@ -358,7 +354,7 @@ Broadcaster::BroadcasterImpl::HijackBroadcaster (const lldb::ListenerSP &listene
|
|||
bool
|
||||
Broadcaster::BroadcasterImpl::IsHijackedForEvent (uint32_t event_mask)
|
||||
{
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
if (!m_hijacking_listeners.empty())
|
||||
return (event_mask & m_hijacking_masks.back()) != 0;
|
||||
|
@ -381,7 +377,7 @@ Broadcaster::BroadcasterImpl::GetHijackingListenerName()
|
|||
void
|
||||
Broadcaster::BroadcasterImpl::RestoreBroadcaster ()
|
||||
{
|
||||
Mutex::Locker locker(m_listeners_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
|
||||
|
||||
if (!m_hijacking_listeners.empty())
|
||||
{
|
||||
|
@ -425,8 +421,7 @@ BroadcastEventSpec::operator< (const BroadcastEventSpec &rhs) const
|
|||
BroadcastEventSpec &
|
||||
BroadcastEventSpec::operator=(const BroadcastEventSpec &rhs) = default;
|
||||
|
||||
BroadcasterManager::BroadcasterManager() :
|
||||
m_manager_mutex(Mutex::eMutexTypeRecursive)
|
||||
BroadcasterManager::BroadcasterManager() : m_manager_mutex()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -439,8 +434,8 @@ BroadcasterManager::MakeBroadcasterManager()
|
|||
uint32_t
|
||||
BroadcasterManager::RegisterListenerForEvents (const lldb::ListenerSP &listener_sp, BroadcastEventSpec event_spec)
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
|
||||
collection::iterator iter = m_event_map.begin(), end_iter = m_event_map.end();
|
||||
uint32_t available_bits = event_spec.GetEventBits();
|
||||
|
||||
|
@ -463,7 +458,7 @@ BroadcasterManager::RegisterListenerForEvents (const lldb::ListenerSP &listener_
|
|||
bool
|
||||
BroadcasterManager::UnregisterListenerForEvents (const lldb::ListenerSP &listener_sp, BroadcastEventSpec event_spec)
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
bool removed_some = false;
|
||||
|
||||
if (m_listeners.erase(listener_sp) == 0)
|
||||
|
@ -508,8 +503,8 @@ BroadcasterManager::UnregisterListenerForEvents (const lldb::ListenerSP &listene
|
|||
ListenerSP
|
||||
BroadcasterManager::GetListenerForEventSpec (BroadcastEventSpec event_spec) const
|
||||
{
|
||||
Mutex::Locker locker(*(const_cast<Mutex *> (&m_manager_mutex)));
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
|
||||
collection::const_iterator iter, end_iter = m_event_map.end();
|
||||
iter = find_if (m_event_map.begin(), end_iter, BroadcastEventSpecMatches (event_spec));
|
||||
if (iter != end_iter)
|
||||
|
@ -521,7 +516,7 @@ BroadcasterManager::GetListenerForEventSpec (BroadcastEventSpec event_spec) cons
|
|||
void
|
||||
BroadcasterManager::RemoveListener(Listener *listener)
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
ListenerMatchesPointer predicate (listener);
|
||||
listener_collection::iterator iter = m_listeners.begin(), end_iter = m_listeners.end();
|
||||
|
||||
|
@ -543,7 +538,7 @@ BroadcasterManager::RemoveListener(Listener *listener)
|
|||
void
|
||||
BroadcasterManager::RemoveListener (const lldb::ListenerSP &listener_sp)
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
ListenerMatches predicate (listener_sp);
|
||||
|
||||
if (m_listeners.erase (listener_sp) == 0)
|
||||
|
@ -563,8 +558,8 @@ BroadcasterManager::RemoveListener (const lldb::ListenerSP &listener_sp)
|
|||
void
|
||||
BroadcasterManager::SignUpListenersForBroadcaster (Broadcaster &broadcaster)
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
|
||||
collection::iterator iter = m_event_map.begin(), end_iter = m_event_map.end();
|
||||
|
||||
while (iter != end_iter
|
||||
|
@ -578,7 +573,7 @@ BroadcasterManager::SignUpListenersForBroadcaster (Broadcaster &broadcaster)
|
|||
void
|
||||
BroadcasterManager::Clear ()
|
||||
{
|
||||
Mutex::Locker locker(m_manager_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
|
||||
listener_collection::iterator end_iter = m_listeners.end();
|
||||
|
||||
for (listener_collection::iterator iter = m_listeners.begin(); iter != end_iter; iter++)
|
||||
|
|
|
@ -33,31 +33,30 @@ Communication::GetStaticBroadcasterClass ()
|
|||
return class_name;
|
||||
}
|
||||
|
||||
Communication::Communication(const char *name) :
|
||||
Broadcaster(nullptr, name),
|
||||
m_connection_sp(),
|
||||
m_read_thread_enabled(false),
|
||||
m_read_thread_did_exit(false),
|
||||
m_bytes(),
|
||||
m_bytes_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_write_mutex(Mutex::eMutexTypeNormal),
|
||||
m_synchronize_mutex(Mutex::eMutexTypeNormal),
|
||||
m_callback(nullptr),
|
||||
m_callback_baton(nullptr),
|
||||
m_close_on_eof(true)
|
||||
Communication::Communication(const char *name)
|
||||
: Broadcaster(nullptr, name),
|
||||
m_connection_sp(),
|
||||
m_read_thread_enabled(false),
|
||||
m_read_thread_did_exit(false),
|
||||
m_bytes(),
|
||||
m_bytes_mutex(),
|
||||
m_write_mutex(),
|
||||
m_synchronize_mutex(),
|
||||
m_callback(nullptr),
|
||||
m_callback_baton(nullptr),
|
||||
m_close_on_eof(true)
|
||||
|
||||
{
|
||||
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
|
||||
"%p Communication::Communication (name = %s)",
|
||||
this, name);
|
||||
lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
|
||||
"%p Communication::Communication (name = %s)", this, name);
|
||||
|
||||
SetEventName(eBroadcastBitDisconnected, "disconnected");
|
||||
SetEventName(eBroadcastBitReadThreadGotBytes, "got bytes");
|
||||
SetEventName(eBroadcastBitReadThreadDidExit, "read thread did exit");
|
||||
SetEventName(eBroadcastBitReadThreadShouldExit, "read thread should exit");
|
||||
SetEventName(eBroadcastBitPacketAvailable, "packet available");
|
||||
SetEventName(eBroadcastBitNoMorePendingInput, "no more pending input");
|
||||
|
||||
SetEventName (eBroadcastBitDisconnected, "disconnected");
|
||||
SetEventName (eBroadcastBitReadThreadGotBytes, "got bytes");
|
||||
SetEventName (eBroadcastBitReadThreadDidExit, "read thread did exit");
|
||||
SetEventName (eBroadcastBitReadThreadShouldExit, "read thread should exit");
|
||||
SetEventName (eBroadcastBitPacketAvailable, "packet available");
|
||||
SetEventName (eBroadcastBitNoMorePendingInput, "no more pending input");
|
||||
|
||||
CheckInWithManager();
|
||||
}
|
||||
|
||||
|
@ -205,7 +204,7 @@ Communication::Write (const void *src, size_t src_len, ConnectionStatus &status,
|
|||
{
|
||||
lldb::ConnectionSP connection_sp (m_connection_sp);
|
||||
|
||||
Mutex::Locker locker(m_write_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_write_mutex);
|
||||
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
|
||||
"%p Communication::Write (src = %p, src_len = %" PRIu64 ") connection = %p",
|
||||
this,
|
||||
|
@ -277,7 +276,7 @@ Communication::JoinReadThread (Error *error_ptr)
|
|||
size_t
|
||||
Communication::GetCachedBytes (void *dst, size_t dst_len)
|
||||
{
|
||||
Mutex::Locker locker(m_bytes_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
|
||||
if (!m_bytes.empty())
|
||||
{
|
||||
// If DST is nullptr and we have a thread, then return the number
|
||||
|
@ -311,7 +310,7 @@ Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broad
|
|||
}
|
||||
else if (bytes != nullptr && len > 0)
|
||||
{
|
||||
Mutex::Locker locker(m_bytes_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
|
||||
m_bytes.append ((const char *)bytes, len);
|
||||
if (broadcast)
|
||||
BroadcastEventIfUnique (eBroadcastBitReadThreadGotBytes);
|
||||
|
@ -425,7 +424,7 @@ void
|
|||
Communication::SynchronizeWithReadThread ()
|
||||
{
|
||||
// Only one thread can do the synchronization dance at a time.
|
||||
Mutex::Locker locker(m_synchronize_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_synchronize_mutex);
|
||||
|
||||
// First start listening for the synchronization event.
|
||||
ListenerSP listener_sp(Listener::MakeListener("Communication::SyncronizeWithReadThread"));
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
@ -67,10 +68,10 @@ static size_t g_debugger_event_thread_stack_bytes = 8 * 1024 * 1024;
|
|||
|
||||
#pragma mark Static Functions
|
||||
|
||||
static Mutex &
|
||||
GetDebuggerListMutex ()
|
||||
static std::recursive_mutex &
|
||||
GetDebuggerListMutex()
|
||||
{
|
||||
static Mutex g_mutex(Mutex::eMutexTypeRecursive);
|
||||
static std::recursive_mutex g_mutex;
|
||||
return g_mutex;
|
||||
}
|
||||
|
||||
|
@ -469,7 +470,7 @@ Debugger::Terminate ()
|
|||
assert(lldb_initialized && "Debugger::Terminate called without a matching Debugger::Initialize!");
|
||||
|
||||
// Clear our master list of debugger objects
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
auto& debuggers = GetDebuggerList();
|
||||
for (const auto& debugger: debuggers)
|
||||
debugger->Clear();
|
||||
|
@ -605,7 +606,7 @@ Debugger::CreateInstance (lldb::LogOutputCallback log_callback, void *baton)
|
|||
DebuggerSP debugger_sp (new Debugger(log_callback, baton));
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
GetDebuggerList().push_back(debugger_sp);
|
||||
}
|
||||
debugger_sp->InstanceInitialize ();
|
||||
|
@ -622,7 +623,7 @@ Debugger::Destroy (DebuggerSP &debugger_sp)
|
|||
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList ();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
for (pos = debugger_list.begin (); pos != end; ++pos)
|
||||
|
@ -642,7 +643,7 @@ Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name)
|
|||
DebuggerSP debugger_sp;
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
|
||||
|
@ -664,7 +665,7 @@ Debugger::FindTargetWithProcessID (lldb::pid_t pid)
|
|||
TargetSP target_sp;
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
for (pos = debugger_list.begin(); pos != end; ++pos)
|
||||
|
@ -683,7 +684,7 @@ Debugger::FindTargetWithProcess (Process *process)
|
|||
TargetSP target_sp;
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
for (pos = debugger_list.begin(); pos != end; ++pos)
|
||||
|
@ -922,33 +923,33 @@ Debugger::GetSelectedExecutionContext ()
|
|||
}
|
||||
|
||||
void
|
||||
Debugger::DispatchInputInterrupt ()
|
||||
Debugger::DispatchInputInterrupt()
|
||||
{
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP reader_sp (m_input_reader_stack.Top());
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP reader_sp(m_input_reader_stack.Top());
|
||||
if (reader_sp)
|
||||
reader_sp->Interrupt();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::DispatchInputEndOfFile ()
|
||||
Debugger::DispatchInputEndOfFile()
|
||||
{
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP reader_sp (m_input_reader_stack.Top());
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP reader_sp(m_input_reader_stack.Top());
|
||||
if (reader_sp)
|
||||
reader_sp->GotEOF();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::ClearIOHandlers ()
|
||||
Debugger::ClearIOHandlers()
|
||||
{
|
||||
// The bottom input reader should be the main debugger input reader. We do not want to close that one here.
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
while (m_input_reader_stack.GetSize() > 1)
|
||||
{
|
||||
IOHandlerSP reader_sp (m_input_reader_stack.Top());
|
||||
IOHandlerSP reader_sp(m_input_reader_stack.Top());
|
||||
if (reader_sp)
|
||||
PopIOHandler (reader_sp);
|
||||
PopIOHandler(reader_sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,16 +1042,16 @@ Debugger::RunIOHandler (const IOHandlerSP& reader_sp)
|
|||
}
|
||||
|
||||
void
|
||||
Debugger::AdoptTopIOHandlerFilesIfInvalid (StreamFileSP &in, StreamFileSP &out, StreamFileSP &err)
|
||||
Debugger::AdoptTopIOHandlerFilesIfInvalid(StreamFileSP &in, StreamFileSP &out, StreamFileSP &err)
|
||||
{
|
||||
// Before an IOHandler runs, it must have in/out/err streams.
|
||||
// This function is called when one ore more of the streams
|
||||
// are nullptr. We use the top input reader's in/out/err streams,
|
||||
// or fall back to the debugger file handles, or we fall back
|
||||
// onto stdin/stdout/stderr as a last resort.
|
||||
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP top_reader_sp (m_input_reader_stack.Top());
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
IOHandlerSP top_reader_sp(m_input_reader_stack.Top());
|
||||
// If no STDIN has been set, then set it appropriately
|
||||
if (!in)
|
||||
{
|
||||
|
@ -1058,7 +1059,7 @@ Debugger::AdoptTopIOHandlerFilesIfInvalid (StreamFileSP &in, StreamFileSP &out,
|
|||
in = top_reader_sp->GetInputStreamFile();
|
||||
else
|
||||
in = GetInputFile();
|
||||
|
||||
|
||||
// If there is nothing, use stdin
|
||||
if (!in)
|
||||
in = StreamFileSP(new StreamFile(stdin, false));
|
||||
|
@ -1070,7 +1071,7 @@ Debugger::AdoptTopIOHandlerFilesIfInvalid (StreamFileSP &in, StreamFileSP &out,
|
|||
out = top_reader_sp->GetOutputStreamFile();
|
||||
else
|
||||
out = GetOutputFile();
|
||||
|
||||
|
||||
// If there is nothing, use stdout
|
||||
if (!out)
|
||||
out = StreamFileSP(new StreamFile(stdout, false));
|
||||
|
@ -1082,31 +1083,30 @@ Debugger::AdoptTopIOHandlerFilesIfInvalid (StreamFileSP &in, StreamFileSP &out,
|
|||
err = top_reader_sp->GetErrorStreamFile();
|
||||
else
|
||||
err = GetErrorFile();
|
||||
|
||||
|
||||
// If there is nothing, use stderr
|
||||
if (!err)
|
||||
err = StreamFileSP(new StreamFile(stdout, false));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::PushIOHandler (const IOHandlerSP& reader_sp)
|
||||
Debugger::PushIOHandler(const IOHandlerSP &reader_sp)
|
||||
{
|
||||
if (!reader_sp)
|
||||
return;
|
||||
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
|
||||
// Get the current top input reader...
|
||||
IOHandlerSP top_reader_sp (m_input_reader_stack.Top());
|
||||
|
||||
IOHandlerSP top_reader_sp(m_input_reader_stack.Top());
|
||||
|
||||
// Don't push the same IO handler twice...
|
||||
if (reader_sp == top_reader_sp)
|
||||
return;
|
||||
|
||||
// Push our new input reader
|
||||
m_input_reader_stack.Push (reader_sp);
|
||||
m_input_reader_stack.Push(reader_sp);
|
||||
reader_sp->Activate();
|
||||
|
||||
// Interrupt the top input reader to it will exit its Run() function
|
||||
|
@ -1119,12 +1119,12 @@ Debugger::PushIOHandler (const IOHandlerSP& reader_sp)
|
|||
}
|
||||
|
||||
bool
|
||||
Debugger::PopIOHandler (const IOHandlerSP& pop_reader_sp)
|
||||
Debugger::PopIOHandler(const IOHandlerSP &pop_reader_sp)
|
||||
{
|
||||
if (! pop_reader_sp)
|
||||
if (!pop_reader_sp)
|
||||
return false;
|
||||
|
||||
Mutex::Locker locker (m_input_reader_stack.GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
|
||||
|
||||
// The reader on the stop of the stack is done, so let the next
|
||||
// read on the stack refresh its prompt and if there is one...
|
||||
|
@ -1138,7 +1138,7 @@ Debugger::PopIOHandler (const IOHandlerSP& pop_reader_sp)
|
|||
|
||||
reader_sp->Deactivate();
|
||||
reader_sp->Cancel();
|
||||
m_input_reader_stack.Pop ();
|
||||
m_input_reader_stack.Pop();
|
||||
|
||||
reader_sp = m_input_reader_stack.Top();
|
||||
if (reader_sp)
|
||||
|
@ -1164,7 +1164,7 @@ Debugger::GetNumDebuggers()
|
|||
{
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
return GetDebuggerList().size();
|
||||
}
|
||||
return 0;
|
||||
|
@ -1177,9 +1177,9 @@ Debugger::GetDebuggerAtIndex (size_t index)
|
|||
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
|
||||
|
||||
if (index < debugger_list.size())
|
||||
debugger_sp = debugger_list[index];
|
||||
}
|
||||
|
@ -1194,7 +1194,7 @@ Debugger::FindDebuggerWithID (lldb::user_id_t id)
|
|||
|
||||
if (lldb_initialized)
|
||||
{
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
for (pos = debugger_list.begin(); pos != end; ++pos)
|
||||
|
|
|
@ -169,13 +169,13 @@ IOHandler::WaitForPop ()
|
|||
}
|
||||
|
||||
void
|
||||
IOHandlerStack::PrintAsync (Stream *stream, const char *s, size_t len)
|
||||
IOHandlerStack::PrintAsync(Stream *stream, const char *s, size_t len)
|
||||
{
|
||||
if (stream)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (m_top)
|
||||
m_top->PrintAsync (stream, s, len);
|
||||
m_top->PrintAsync(stream, s, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,12 +40,8 @@ namespace
|
|||
};
|
||||
} // anonymous namespace
|
||||
|
||||
Listener::Listener(const char *name) :
|
||||
m_name (name),
|
||||
m_broadcasters(),
|
||||
m_broadcasters_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_events (),
|
||||
m_events_mutex (Mutex::eMutexTypeNormal)
|
||||
Listener::Listener(const char *name)
|
||||
: m_name(name), m_broadcasters(), m_broadcasters_mutex(), m_events(), m_events_mutex(Mutex::eMutexTypeNormal)
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
|
||||
if (log != nullptr)
|
||||
|
@ -67,7 +63,7 @@ void
|
|||
Listener::Clear()
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
broadcaster_collection::iterator pos, end = m_broadcasters.end();
|
||||
for (pos = m_broadcasters.begin(); pos != end; ++pos)
|
||||
{
|
||||
|
@ -100,7 +96,7 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask
|
|||
// Scope for "locker"
|
||||
// Tell the broadcaster to add this object as a listener
|
||||
{
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());
|
||||
m_broadcasters.insert(std::make_pair(impl_wp, BroadcasterInfo(event_mask)));
|
||||
}
|
||||
|
@ -127,7 +123,7 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask
|
|||
// Scope for "locker"
|
||||
// Tell the broadcaster to add this object as a listener
|
||||
{
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());
|
||||
m_broadcasters.insert(std::make_pair(impl_wp,
|
||||
BroadcasterInfo(event_mask, callback, callback_user_data)));
|
||||
|
@ -158,7 +154,7 @@ Listener::StopListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask)
|
|||
{
|
||||
// Scope for "locker"
|
||||
{
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
m_broadcasters.erase (broadcaster->GetBroadcasterImpl());
|
||||
}
|
||||
// Remove the broadcaster from our set of broadcasters
|
||||
|
@ -175,7 +171,7 @@ Listener::BroadcasterWillDestruct (Broadcaster *broadcaster)
|
|||
{
|
||||
// Scope for "broadcasters_locker"
|
||||
{
|
||||
Mutex::Locker broadcasters_locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
m_broadcasters.erase (broadcaster->GetBroadcasterImpl());
|
||||
}
|
||||
|
||||
|
@ -474,7 +470,7 @@ size_t
|
|||
Listener::HandleBroadcastEvent (EventSP &event_sp)
|
||||
{
|
||||
size_t num_handled = 0;
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
Broadcaster *broadcaster = event_sp->GetBroadcaster();
|
||||
if (!broadcaster)
|
||||
return 0;
|
||||
|
@ -507,8 +503,8 @@ Listener::StartListeningForEventSpec (BroadcasterManagerSP manager_sp,
|
|||
|
||||
// The BroadcasterManager mutex must be locked before m_broadcasters_mutex
|
||||
// to avoid violating the lock hierarchy (manager before broadcasters).
|
||||
Mutex::Locker manager_locker(manager_sp->m_manager_mutex);
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
std::lock_guard<std::recursive_mutex> manager_guard(manager_sp->m_manager_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
|
||||
uint32_t bits_acquired = manager_sp->RegisterListenerForEvents(this->shared_from_this(), event_spec);
|
||||
if (bits_acquired)
|
||||
|
@ -530,8 +526,8 @@ Listener::StopListeningForEventSpec (BroadcasterManagerSP manager_sp,
|
|||
{
|
||||
if (!manager_sp)
|
||||
return false;
|
||||
|
||||
Mutex::Locker locker(m_broadcasters_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
|
||||
return manager_sp->UnregisterListenerForEvents (this->shared_from_this(), event_spec);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "lldb/Core/StreamFile.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/ThisThread.h"
|
||||
#include "lldb/Host/TimeValue.h"
|
||||
#include "lldb/Interpreter/Args.h"
|
||||
|
@ -147,8 +147,8 @@ Log::VAPrintf(const char *format, va_list args)
|
|||
|
||||
if (m_options.Test(LLDB_LOG_OPTION_THREADSAFE))
|
||||
{
|
||||
static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
|
||||
Mutex::Locker locker(g_LogThreadedMutex);
|
||||
static std::recursive_mutex g_LogThreadedMutex;
|
||||
std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
|
||||
stream_sp->PutCString(header.GetString().c_str());
|
||||
stream_sp->Flush();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ GetModuleCollection()
|
|||
return *g_module_collection;
|
||||
}
|
||||
|
||||
Mutex *
|
||||
std::recursive_mutex &
|
||||
Module::GetAllocationModuleCollectionMutex()
|
||||
{
|
||||
// NOTE: The mutex below must be leaked since the global module list in
|
||||
|
@ -80,23 +80,23 @@ Module::GetAllocationModuleCollectionMutex()
|
|||
// if it will tear itself down before the "g_module_collection_mutex" below
|
||||
// will. So we leak a Mutex object below to safeguard against that
|
||||
|
||||
static Mutex *g_module_collection_mutex = nullptr;
|
||||
static std::recursive_mutex *g_module_collection_mutex = nullptr;
|
||||
if (g_module_collection_mutex == nullptr)
|
||||
g_module_collection_mutex = new Mutex (Mutex::eMutexTypeRecursive); // NOTE: known leak
|
||||
return g_module_collection_mutex;
|
||||
g_module_collection_mutex = new std::recursive_mutex; // NOTE: known leak
|
||||
return *g_module_collection_mutex;
|
||||
}
|
||||
|
||||
size_t
|
||||
Module::GetNumberAllocatedModules ()
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
return GetModuleCollection().size();
|
||||
}
|
||||
|
||||
Module *
|
||||
Module::GetAllocatedModuleAtIndex (size_t idx)
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
ModuleCollection &modules = GetModuleCollection();
|
||||
if (idx < modules.size())
|
||||
return modules[idx];
|
||||
|
@ -140,44 +140,42 @@ namespace lldb {
|
|||
|
||||
#endif
|
||||
|
||||
Module::Module (const ModuleSpec &module_spec) :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_mod_time (),
|
||||
m_arch (),
|
||||
m_uuid (),
|
||||
m_file (),
|
||||
m_platform_file(),
|
||||
m_remote_install_file(),
|
||||
m_symfile_spec (),
|
||||
m_object_name (),
|
||||
m_object_offset (),
|
||||
m_object_mod_time (),
|
||||
m_objfile_sp (),
|
||||
m_symfile_ap (),
|
||||
m_type_system_map(),
|
||||
m_source_mappings (),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile (false),
|
||||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_file_has_changed (false),
|
||||
m_first_file_changed_log (false)
|
||||
Module::Module(const ModuleSpec &module_spec)
|
||||
: m_mutex(),
|
||||
m_mod_time(),
|
||||
m_arch(),
|
||||
m_uuid(),
|
||||
m_file(),
|
||||
m_platform_file(),
|
||||
m_remote_install_file(),
|
||||
m_symfile_spec(),
|
||||
m_object_name(),
|
||||
m_object_offset(),
|
||||
m_object_mod_time(),
|
||||
m_objfile_sp(),
|
||||
m_symfile_ap(),
|
||||
m_type_system_map(),
|
||||
m_source_mappings(),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile(false),
|
||||
m_did_load_symbol_vendor(false),
|
||||
m_did_parse_uuid(false),
|
||||
m_file_has_changed(false),
|
||||
m_first_file_changed_log(false)
|
||||
{
|
||||
// Scope for locker below...
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
GetModuleCollection().push_back(this);
|
||||
}
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void*>(this),
|
||||
module_spec.GetArchitecture().GetArchitectureName(),
|
||||
module_spec.GetFileSpec().GetPath().c_str(),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : "(",
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : ")");
|
||||
log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this),
|
||||
module_spec.GetArchitecture().GetArchitectureName(), module_spec.GetFileSpec().GetPath().c_str(),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : "(",
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : ")");
|
||||
|
||||
// First extract all module specifications from the file using the local
|
||||
// file path. If there are no specifications, then don't fill anything in
|
||||
|
@ -194,18 +192,18 @@ Module::Module (const ModuleSpec &module_spec) :
|
|||
ModuleSpec matching_module_spec;
|
||||
if (modules_specs.FindMatchingModuleSpec(module_spec, matching_module_spec) == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (module_spec.GetFileSpec())
|
||||
m_mod_time = module_spec.GetFileSpec().GetModificationTime();
|
||||
else if (matching_module_spec.GetFileSpec())
|
||||
m_mod_time = matching_module_spec.GetFileSpec().GetModificationTime();
|
||||
|
||||
|
||||
// Copy the architecture from the actual spec if we got one back, else use the one that was specified
|
||||
if (matching_module_spec.GetArchitecture().IsValid())
|
||||
m_arch = matching_module_spec.GetArchitecture();
|
||||
else if (module_spec.GetArchitecture().IsValid())
|
||||
m_arch = module_spec.GetArchitecture();
|
||||
|
||||
|
||||
// Copy the file spec over and use the specified one (if there was one) so we
|
||||
// don't use a path that might have gotten resolved a path in 'matching_module_spec'
|
||||
if (module_spec.GetFileSpec())
|
||||
|
@ -218,57 +216,53 @@ Module::Module (const ModuleSpec &module_spec) :
|
|||
m_platform_file = module_spec.GetPlatformFileSpec();
|
||||
else if (matching_module_spec.GetPlatformFileSpec())
|
||||
m_platform_file = matching_module_spec.GetPlatformFileSpec();
|
||||
|
||||
|
||||
// Copy the symbol file spec over
|
||||
if (module_spec.GetSymbolFileSpec())
|
||||
m_symfile_spec = module_spec.GetSymbolFileSpec();
|
||||
else if (matching_module_spec.GetSymbolFileSpec())
|
||||
m_symfile_spec = matching_module_spec.GetSymbolFileSpec();
|
||||
|
||||
|
||||
// Copy the object name over
|
||||
if (matching_module_spec.GetObjectName())
|
||||
m_object_name = matching_module_spec.GetObjectName();
|
||||
else
|
||||
m_object_name = module_spec.GetObjectName();
|
||||
|
||||
|
||||
// Always trust the object offset (file offset) and object modification
|
||||
// time (for mod time in a BSD static archive) of from the matching
|
||||
// module specification
|
||||
m_object_offset = matching_module_spec.GetObjectOffset();
|
||||
m_object_mod_time = matching_module_spec.GetObjectModificationTime();
|
||||
|
||||
}
|
||||
|
||||
Module::Module(const FileSpec& file_spec,
|
||||
const ArchSpec& arch,
|
||||
const ConstString *object_name,
|
||||
lldb::offset_t object_offset,
|
||||
const TimeValue *object_mod_time_ptr) :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_mod_time (file_spec.GetModificationTime()),
|
||||
m_arch (arch),
|
||||
m_uuid (),
|
||||
m_file (file_spec),
|
||||
m_platform_file(),
|
||||
m_remote_install_file (),
|
||||
m_symfile_spec (),
|
||||
m_object_name (),
|
||||
m_object_offset (object_offset),
|
||||
m_object_mod_time (),
|
||||
m_objfile_sp (),
|
||||
m_symfile_ap (),
|
||||
m_type_system_map(),
|
||||
m_source_mappings (),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile (false),
|
||||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_file_has_changed (false),
|
||||
m_first_file_changed_log (false)
|
||||
Module::Module(const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name,
|
||||
lldb::offset_t object_offset, const TimeValue *object_mod_time_ptr)
|
||||
: m_mutex(),
|
||||
m_mod_time(file_spec.GetModificationTime()),
|
||||
m_arch(arch),
|
||||
m_uuid(),
|
||||
m_file(file_spec),
|
||||
m_platform_file(),
|
||||
m_remote_install_file(),
|
||||
m_symfile_spec(),
|
||||
m_object_name(),
|
||||
m_object_offset(object_offset),
|
||||
m_object_mod_time(),
|
||||
m_objfile_sp(),
|
||||
m_symfile_ap(),
|
||||
m_type_system_map(),
|
||||
m_source_mappings(),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile(false),
|
||||
m_did_load_symbol_vendor(false),
|
||||
m_did_parse_uuid(false),
|
||||
m_file_has_changed(false),
|
||||
m_first_file_changed_log(false)
|
||||
{
|
||||
// Scope for locker below...
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
GetModuleCollection().push_back(this);
|
||||
}
|
||||
|
||||
|
@ -278,40 +272,37 @@ Module::Module(const FileSpec& file_spec,
|
|||
if (object_mod_time_ptr)
|
||||
m_object_mod_time = *object_mod_time_ptr;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void*>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(),
|
||||
m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
|
||||
m_object_name.IsEmpty() ? "" : ")");
|
||||
log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
|
||||
}
|
||||
|
||||
Module::Module () :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_mod_time (),
|
||||
m_arch (),
|
||||
m_uuid (),
|
||||
m_file (),
|
||||
m_platform_file(),
|
||||
m_remote_install_file (),
|
||||
m_symfile_spec (),
|
||||
m_object_name (),
|
||||
m_object_offset (0),
|
||||
m_object_mod_time (),
|
||||
m_objfile_sp (),
|
||||
m_symfile_ap (),
|
||||
m_type_system_map(),
|
||||
m_source_mappings (),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile (false),
|
||||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_file_has_changed (false),
|
||||
m_first_file_changed_log (false)
|
||||
Module::Module()
|
||||
: m_mutex(),
|
||||
m_mod_time(),
|
||||
m_arch(),
|
||||
m_uuid(),
|
||||
m_file(),
|
||||
m_platform_file(),
|
||||
m_remote_install_file(),
|
||||
m_symfile_spec(),
|
||||
m_object_name(),
|
||||
m_object_offset(0),
|
||||
m_object_mod_time(),
|
||||
m_objfile_sp(),
|
||||
m_symfile_ap(),
|
||||
m_type_system_map(),
|
||||
m_source_mappings(),
|
||||
m_sections_ap(),
|
||||
m_did_load_objfile(false),
|
||||
m_did_load_symbol_vendor(false),
|
||||
m_did_parse_uuid(false),
|
||||
m_file_has_changed(false),
|
||||
m_first_file_changed_log(false)
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
GetModuleCollection().push_back(this);
|
||||
}
|
||||
|
||||
|
@ -319,10 +310,10 @@ Module::~Module()
|
|||
{
|
||||
// Lock our module down while we tear everything down to make sure
|
||||
// we don't get any access to the module while it is being destroyed
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
// Scope for locker below...
|
||||
{
|
||||
Mutex::Locker locker (GetAllocationModuleCollectionMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
|
||||
ModuleCollection &modules = GetModuleCollection();
|
||||
ModuleCollection::iterator end = modules.end();
|
||||
ModuleCollection::iterator pos = std::find(modules.begin(), end, this);
|
||||
|
@ -357,7 +348,7 @@ Module::GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t hea
|
|||
}
|
||||
else
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (process_sp)
|
||||
{
|
||||
m_did_load_objfile = true;
|
||||
|
@ -405,7 +396,7 @@ Module::GetUUID()
|
|||
{
|
||||
if (!m_did_parse_uuid.load())
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_did_parse_uuid.load())
|
||||
{
|
||||
ObjectFile * obj_file = GetObjectFile ();
|
||||
|
@ -429,7 +420,7 @@ Module::GetTypeSystemForLanguage (LanguageType language)
|
|||
void
|
||||
Module::ParseAllDebugSymbols()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
size_t num_comp_units = GetNumCompileUnits();
|
||||
if (num_comp_units == 0)
|
||||
return;
|
||||
|
@ -484,7 +475,7 @@ Module::DumpSymbolContext(Stream *s)
|
|||
size_t
|
||||
Module::GetNumCompileUnits()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__,
|
||||
"Module::GetNumCompileUnits (module = %p)",
|
||||
static_cast<void*>(this));
|
||||
|
@ -497,7 +488,7 @@ Module::GetNumCompileUnits()
|
|||
CompUnitSP
|
||||
Module::GetCompileUnitAtIndex (size_t index)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
size_t num_comp_units = GetNumCompileUnits ();
|
||||
CompUnitSP cu_sp;
|
||||
|
||||
|
@ -513,7 +504,7 @@ Module::GetCompileUnitAtIndex (size_t index)
|
|||
bool
|
||||
Module::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")", vm_addr);
|
||||
SectionList *section_list = GetSectionList();
|
||||
if (section_list)
|
||||
|
@ -525,7 +516,7 @@ uint32_t
|
|||
Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc,
|
||||
bool resolve_tail_call_address)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
uint32_t resolved_flags = 0;
|
||||
|
||||
// Clear the result symbol context in case we don't find anything, but don't clear the target
|
||||
|
@ -675,7 +666,7 @@ Module::ResolveSymbolContextForFilePath
|
|||
uint32_t
|
||||
Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__,
|
||||
"Module::ResolveSymbolContextForFilePath (%s:%u, check_inlines = %s, resolve_scope = 0x%8.8x)",
|
||||
file_spec.GetPath().c_str(),
|
||||
|
@ -1037,7 +1028,7 @@ Module::GetSymbolVendor (bool can_create, lldb_private::Stream *feedback_strm)
|
|||
{
|
||||
if (!m_did_load_symbol_vendor.load())
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_did_load_symbol_vendor.load() && can_create)
|
||||
{
|
||||
ObjectFile *obj_file = GetObjectFile ();
|
||||
|
@ -1084,7 +1075,7 @@ Module::GetSpecificationDescription () const
|
|||
void
|
||||
Module::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (level >= eDescriptionLevelFull)
|
||||
{
|
||||
|
@ -1245,7 +1236,7 @@ Module::LogMessageVerboseBacktrace (Log *log, const char *format, ...)
|
|||
void
|
||||
Module::Dump(Stream *s)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
//s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
|
||||
s->Indent();
|
||||
s->Printf("Module %s%s%s%s\n",
|
||||
|
@ -1287,7 +1278,7 @@ Module::GetObjectFile()
|
|||
{
|
||||
if (!m_did_load_objfile.load())
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_did_load_objfile.load())
|
||||
{
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__,
|
||||
|
@ -1710,14 +1701,14 @@ Module::MatchesModuleSpec (const ModuleSpec &module_ref)
|
|||
bool
|
||||
Module::FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_source_mappings.FindFile (orig_spec, new_spec);
|
||||
}
|
||||
|
||||
bool
|
||||
Module::RemapSourceFile (const char *path, std::string &new_path) const
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_source_mappings.RemapPath(path, new_path);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,13 +18,8 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
|
||||
StreamCallback::StreamCallback (lldb::LogOutputCallback callback, void *baton) :
|
||||
Stream (0, 4, eByteOrderBig),
|
||||
m_callback (callback),
|
||||
m_baton (baton),
|
||||
m_accumulated_data (),
|
||||
m_collection_mutex ()
|
||||
StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
|
||||
: Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton), m_accumulated_data(), m_collection_mutex()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,7 +30,7 @@ StreamCallback::~StreamCallback ()
|
|||
StreamString &
|
||||
StreamCallback::FindStreamForThread(lldb::tid_t cur_tid)
|
||||
{
|
||||
Mutex::Locker locker(m_collection_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_collection_mutex);
|
||||
collection::iterator iter = m_accumulated_data.find (cur_tid);
|
||||
if (iter == m_accumulated_data.end())
|
||||
{
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
#include "lldb/Core/Timer.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -52,11 +52,10 @@ GetFileMutex()
|
|||
return *g_file_mutex_ptr;
|
||||
}
|
||||
|
||||
|
||||
static Mutex &
|
||||
static std::mutex &
|
||||
GetCategoryMutex()
|
||||
{
|
||||
static Mutex g_category_mutex(Mutex::eMutexTypeNormal);
|
||||
static std::mutex g_category_mutex;
|
||||
return g_category_mutex;
|
||||
}
|
||||
|
||||
|
@ -169,7 +168,7 @@ Timer::~Timer()
|
|||
}
|
||||
|
||||
// Keep total results for each category so we can dump results.
|
||||
Mutex::Locker locker (GetCategoryMutex());
|
||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
||||
TimerCategoryMap &category_map = GetCategoryMap();
|
||||
category_map[m_category] += timer_nsec_uint;
|
||||
}
|
||||
|
@ -240,7 +239,7 @@ CategoryMapIteratorSortCriterion (const TimerCategoryMap::const_iterator& lhs, c
|
|||
void
|
||||
Timer::ResetCategoryTimes ()
|
||||
{
|
||||
Mutex::Locker locker (GetCategoryMutex());
|
||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
||||
TimerCategoryMap &category_map = GetCategoryMap();
|
||||
category_map.clear();
|
||||
}
|
||||
|
@ -248,7 +247,7 @@ Timer::ResetCategoryTimes ()
|
|||
void
|
||||
Timer::DumpCategoryTimes (Stream *s)
|
||||
{
|
||||
Mutex::Locker locker (GetCategoryMutex());
|
||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
||||
TimerCategoryMap &category_map = GetCategoryMap();
|
||||
std::vector<TimerCategoryMap::const_iterator> sorted_iterators;
|
||||
TimerCategoryMap::const_iterator pos, end = category_map.end();
|
||||
|
|
|
@ -158,11 +158,13 @@ FormatCache::Entry::SetValidator (lldb::TypeValidatorImplSP validator_sp)
|
|||
m_validator_sp = validator_sp;
|
||||
}
|
||||
|
||||
FormatCache::FormatCache () :
|
||||
m_map(),
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
FormatCache::FormatCache()
|
||||
: m_map(),
|
||||
m_mutex()
|
||||
#ifdef LLDB_CONFIGURATION_DEBUG
|
||||
,m_cache_hits(0),m_cache_misses(0)
|
||||
,
|
||||
m_cache_hits(0),
|
||||
m_cache_misses(0)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
@ -181,7 +183,7 @@ FormatCache::GetEntry (const ConstString& type)
|
|||
bool
|
||||
FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
auto entry = GetEntry(type);
|
||||
if (entry.IsFormatCached())
|
||||
{
|
||||
|
@ -201,7 +203,7 @@ FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_s
|
|||
bool
|
||||
FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
auto entry = GetEntry(type);
|
||||
if (entry.IsSummaryCached())
|
||||
{
|
||||
|
@ -221,7 +223,7 @@ FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summar
|
|||
bool
|
||||
FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
auto entry = GetEntry(type);
|
||||
if (entry.IsSyntheticCached())
|
||||
{
|
||||
|
@ -241,7 +243,7 @@ FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& sy
|
|||
bool
|
||||
FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
auto entry = GetEntry(type);
|
||||
if (entry.IsValidatorCached())
|
||||
{
|
||||
|
@ -261,35 +263,35 @@ FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& va
|
|||
void
|
||||
FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
GetEntry(type).SetFormat(format_sp);
|
||||
}
|
||||
|
||||
void
|
||||
FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
GetEntry(type).SetSummary(summary_sp);
|
||||
}
|
||||
|
||||
void
|
||||
FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
GetEntry(type).SetSynthetic(synthetic_sp);
|
||||
}
|
||||
|
||||
void
|
||||
FormatCache::SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
GetEntry(type).SetValidator(validator_sp);
|
||||
}
|
||||
|
||||
void
|
||||
FormatCache::Clear ()
|
||||
{
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_map.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ FormatManager::Changed ()
|
|||
{
|
||||
++m_last_revision;
|
||||
m_format_cache.Clear ();
|
||||
Mutex::Locker lang_locker(m_language_categories_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
||||
for (auto& iter : m_language_categories_map)
|
||||
{
|
||||
if (iter.second)
|
||||
|
@ -181,7 +181,7 @@ void
|
|||
FormatManager::EnableAllCategories ()
|
||||
{
|
||||
m_categories_map.EnableAllCategories ();
|
||||
Mutex::Locker lang_locker(m_language_categories_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
||||
for (auto& iter : m_language_categories_map)
|
||||
{
|
||||
if (iter.second)
|
||||
|
@ -193,7 +193,7 @@ void
|
|||
FormatManager::DisableAllCategories ()
|
||||
{
|
||||
m_categories_map.DisableAllCategories ();
|
||||
Mutex::Locker lang_locker(m_language_categories_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
||||
for (auto& iter : m_language_categories_map)
|
||||
{
|
||||
if (iter.second)
|
||||
|
@ -502,7 +502,7 @@ void
|
|||
FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback)
|
||||
{
|
||||
m_categories_map.ForEach(callback);
|
||||
Mutex::Locker locker(m_language_categories_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
||||
for (const auto& entry : m_language_categories_map)
|
||||
{
|
||||
if (auto category_sp = entry.second->GetCategory())
|
||||
|
@ -712,7 +712,7 @@ FormatManager::GetCandidateLanguages (lldb::LanguageType lang_type)
|
|||
LanguageCategory*
|
||||
FormatManager::GetCategoryForLanguage (lldb::LanguageType lang_type)
|
||||
{
|
||||
Mutex::Locker locker(m_language_categories_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
||||
auto iter = m_language_categories_map.find(lang_type), end = m_language_categories_map.end();
|
||||
if (iter != end)
|
||||
return iter->second.get();
|
||||
|
@ -1055,22 +1055,22 @@ FormatManager::GetHardcodedValidator (FormattersMatchData& match_data)
|
|||
return retval_sp;
|
||||
}
|
||||
|
||||
FormatManager::FormatManager() :
|
||||
m_last_revision(0),
|
||||
m_format_cache(),
|
||||
m_language_categories_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_language_categories_map(),
|
||||
m_named_summaries_map(this),
|
||||
m_categories_map(this),
|
||||
m_default_category_name(ConstString("default")),
|
||||
m_system_category_name(ConstString("system")),
|
||||
m_vectortypes_category_name(ConstString("VectorTypes"))
|
||||
FormatManager::FormatManager()
|
||||
: m_last_revision(0),
|
||||
m_format_cache(),
|
||||
m_language_categories_mutex(),
|
||||
m_language_categories_map(),
|
||||
m_named_summaries_map(this),
|
||||
m_categories_map(this),
|
||||
m_default_category_name(ConstString("default")),
|
||||
m_system_category_name(ConstString("system")),
|
||||
m_vectortypes_category_name(ConstString("VectorTypes"))
|
||||
{
|
||||
LoadSystemFormatters();
|
||||
LoadVectorFormatters();
|
||||
|
||||
EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
|
||||
EnableCategory(m_system_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
|
||||
|
||||
EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
|
||||
EnableCategory(m_system_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,21 +18,20 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
|
||||
ConstString name,
|
||||
std::initializer_list<lldb::LanguageType> langs) :
|
||||
m_format_cont("format","regex-format",clist),
|
||||
m_summary_cont("summary","regex-summary",clist),
|
||||
m_filter_cont("filter","regex-filter",clist),
|
||||
TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
|
||||
std::initializer_list<lldb::LanguageType> langs)
|
||||
: m_format_cont("format", "regex-format", clist),
|
||||
m_summary_cont("summary", "regex-summary", clist),
|
||||
m_filter_cont("filter", "regex-filter", clist),
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
m_synth_cont("synth","regex-synth",clist),
|
||||
m_synth_cont("synth", "regex-synth", clist),
|
||||
#endif
|
||||
m_validator_cont("validator","regex-validator",clist),
|
||||
m_enabled(false),
|
||||
m_change_listener(clist),
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_name(name),
|
||||
m_languages()
|
||||
m_validator_cont("validator", "regex-validator", clist),
|
||||
m_enabled(false),
|
||||
m_change_listener(clist),
|
||||
m_mutex(),
|
||||
m_name(name),
|
||||
m_languages()
|
||||
{
|
||||
for (const lldb::LanguageType lang : langs)
|
||||
AddLanguage(lang);
|
||||
|
@ -673,7 +672,7 @@ TypeCategoryImpl::GetTypeNameSpecifierForValidatorAtIndex (size_t index)
|
|||
void
|
||||
TypeCategoryImpl::Enable (bool value, uint32_t position)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if ( (m_enabled = value) )
|
||||
m_enabled_position = position;
|
||||
if (m_change_listener)
|
||||
|
|
|
@ -20,22 +20,19 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
TypeCategoryMap::TypeCategoryMap (IFormatChangeListener* lst) :
|
||||
m_map_mutex(Mutex::eMutexTypeRecursive),
|
||||
listener(lst),
|
||||
m_map(),
|
||||
m_active_categories()
|
||||
TypeCategoryMap::TypeCategoryMap(IFormatChangeListener *lst)
|
||||
: m_map_mutex(), listener(lst), m_map(), m_active_categories()
|
||||
{
|
||||
ConstString default_cs("default");
|
||||
lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
|
||||
Add(default_cs,default_sp);
|
||||
Enable(default_cs,First);
|
||||
Add(default_cs, default_sp);
|
||||
Enable(default_cs, First);
|
||||
}
|
||||
|
||||
void
|
||||
TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
m_map[name] = entry;
|
||||
if (listener)
|
||||
listener->Changed();
|
||||
|
@ -44,7 +41,7 @@ TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
|
|||
bool
|
||||
TypeCategoryMap::Delete (KeyType name)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
|
@ -58,7 +55,7 @@ TypeCategoryMap::Delete (KeyType name)
|
|||
bool
|
||||
TypeCategoryMap::Enable (KeyType category_name, Position pos)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
ValueSP category;
|
||||
if (!Get(category_name,category))
|
||||
return false;
|
||||
|
@ -68,7 +65,7 @@ TypeCategoryMap::Enable (KeyType category_name, Position pos)
|
|||
bool
|
||||
TypeCategoryMap::Disable (KeyType category_name)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
ValueSP category;
|
||||
if (!Get(category_name,category))
|
||||
return false;
|
||||
|
@ -78,7 +75,7 @@ TypeCategoryMap::Disable (KeyType category_name)
|
|||
bool
|
||||
TypeCategoryMap::Enable (ValueSP category, Position pos)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
if (category.get())
|
||||
{
|
||||
Position pos_w = pos;
|
||||
|
@ -107,7 +104,7 @@ TypeCategoryMap::Enable (ValueSP category, Position pos)
|
|||
bool
|
||||
TypeCategoryMap::Disable (ValueSP category)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
if (category.get())
|
||||
{
|
||||
m_active_categories.remove_if(delete_matching_categories(category));
|
||||
|
@ -120,7 +117,7 @@ TypeCategoryMap::Disable (ValueSP category)
|
|||
void
|
||||
TypeCategoryMap::EnableAllCategories ()
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
std::vector<ValueSP> sorted_categories(m_map.size(), ValueSP());
|
||||
MapType::iterator iter = m_map.begin(), end = m_map.end();
|
||||
for (; iter != end; ++iter)
|
||||
|
@ -148,7 +145,7 @@ TypeCategoryMap::EnableAllCategories ()
|
|||
void
|
||||
TypeCategoryMap::DisableAllCategories ()
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
Position p = First;
|
||||
for (; false == m_active_categories.empty(); p++)
|
||||
{
|
||||
|
@ -160,7 +157,7 @@ TypeCategoryMap::DisableAllCategories ()
|
|||
void
|
||||
TypeCategoryMap::Clear ()
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
m_map.clear();
|
||||
m_active_categories.clear();
|
||||
if (listener)
|
||||
|
@ -170,7 +167,7 @@ TypeCategoryMap::Clear ()
|
|||
bool
|
||||
TypeCategoryMap::Get (KeyType name, ValueSP& entry)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
|
@ -181,7 +178,7 @@ TypeCategoryMap::Get (KeyType name, ValueSP& entry)
|
|||
bool
|
||||
TypeCategoryMap::Get (uint32_t pos, ValueSP& entry)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.begin();
|
||||
MapIterator end = m_map.end();
|
||||
while (pos > 0)
|
||||
|
@ -202,8 +199,8 @@ TypeCategoryMap::AnyMatches (ConstString type_name,
|
|||
const char** matching_category,
|
||||
TypeCategoryImpl::FormatCategoryItems* matching_type)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
MapIterator pos, end = m_map.end();
|
||||
for (pos = m_map.begin(); pos != end; pos++)
|
||||
{
|
||||
|
@ -220,8 +217,8 @@ TypeCategoryMap::AnyMatches (ConstString type_name,
|
|||
lldb::TypeFormatImplSP
|
||||
TypeCategoryMap::GetFormat (FormattersMatchData& match_data)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
uint32_t reason_why;
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
|
||||
|
@ -258,8 +255,8 @@ TypeCategoryMap::GetFormat (FormattersMatchData& match_data)
|
|||
lldb::TypeSummaryImplSP
|
||||
TypeCategoryMap::GetSummaryFormat (FormattersMatchData& match_data)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
uint32_t reason_why;
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
|
||||
|
@ -297,8 +294,8 @@ TypeCategoryMap::GetSummaryFormat (FormattersMatchData& match_data)
|
|||
lldb::SyntheticChildrenSP
|
||||
TypeCategoryMap::GetSyntheticChildren (FormattersMatchData& match_data)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
uint32_t reason_why;
|
||||
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
|
@ -337,8 +334,8 @@ TypeCategoryMap::GetSyntheticChildren (FormattersMatchData& match_data)
|
|||
lldb::TypeValidatorImplSP
|
||||
TypeCategoryMap::GetValidator (FormattersMatchData& match_data)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
uint32_t reason_why;
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
|
||||
|
@ -377,8 +374,8 @@ TypeCategoryMap::ForEach(ForEachCallback callback)
|
|||
{
|
||||
if (callback)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
// loop through enabled categories in respective order
|
||||
{
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
|
@ -408,8 +405,8 @@ TypeCategoryMap::ForEach(ForEachCallback callback)
|
|||
TypeCategoryImplSP
|
||||
TypeCategoryMap::GetAtIndex (uint32_t index)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
|
||||
if (index < m_map.size())
|
||||
{
|
||||
MapIterator pos, end = m_map.end();
|
||||
|
|
|
@ -247,7 +247,7 @@ IRExecutionUnit::GetRunnableInfo(Error &error,
|
|||
{
|
||||
lldb::ProcessSP process_sp(GetProcessWP().lock());
|
||||
|
||||
static Mutex s_runnable_info_mutex(Mutex::Type::eMutexTypeRecursive);
|
||||
static std::recursive_mutex s_runnable_info_mutex;
|
||||
|
||||
func_addr = LLDB_INVALID_ADDRESS;
|
||||
func_end = LLDB_INVALID_ADDRESS;
|
||||
|
@ -267,7 +267,7 @@ IRExecutionUnit::GetRunnableInfo(Error &error,
|
|||
return;
|
||||
};
|
||||
|
||||
Mutex::Locker runnable_info_mutex_locker(s_runnable_info_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
|
||||
|
||||
m_did_jit = true;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/FileSystem.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Utility/LLDBAssert.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
|
@ -227,9 +226,9 @@ namespace lldb_private
|
|||
GetHistory (const std::string &prefix)
|
||||
{
|
||||
typedef std::map<std::string, EditlineHistoryWP> WeakHistoryMap;
|
||||
static Mutex g_mutex (Mutex::eMutexTypeRecursive);
|
||||
static std::recursive_mutex g_mutex;
|
||||
static WeakHistoryMap g_weak_map;
|
||||
Mutex::Locker locker (g_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(g_mutex);
|
||||
WeakHistoryMap::const_iterator pos = g_weak_map.find (prefix);
|
||||
EditlineHistorySP history_sp;
|
||||
if (pos != g_weak_map.end())
|
||||
|
@ -587,9 +586,9 @@ Editline::GetCharacter (EditLineCharType * c)
|
|||
// (blocking operation), so we do not hold the mutex indefinitely. This gives a chance
|
||||
// for someone to interrupt us. After Read returns, immediately lock the mutex again and
|
||||
// check if we were interrupted.
|
||||
m_output_mutex.Unlock();
|
||||
m_output_mutex.unlock();
|
||||
int read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL);
|
||||
m_output_mutex.Lock();
|
||||
m_output_mutex.lock();
|
||||
if (m_editor_status == EditorStatus::Interrupted)
|
||||
{
|
||||
while (read_count > 0 && status == lldb::eConnectionStatusSuccess)
|
||||
|
@ -1284,7 +1283,7 @@ bool
|
|||
Editline::Interrupt()
|
||||
{
|
||||
bool result = true;
|
||||
Mutex::Locker locker(m_output_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_output_mutex);
|
||||
if (m_editor_status == EditorStatus::Editing) {
|
||||
fprintf(m_output_file, "^C\n");
|
||||
result = m_input_connection.InterruptRead();
|
||||
|
@ -1297,7 +1296,7 @@ bool
|
|||
Editline::Cancel()
|
||||
{
|
||||
bool result = true;
|
||||
Mutex::Locker locker(m_output_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_output_mutex);
|
||||
if (m_editor_status == EditorStatus::Editing) {
|
||||
MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);
|
||||
fprintf(m_output_file, ANSI_CLEAR_BELOW);
|
||||
|
@ -1338,8 +1337,8 @@ Editline::GetLine (std::string &line, bool &interrupted)
|
|||
ConfigureEditor (false);
|
||||
m_input_lines = std::vector<EditLineStringType>();
|
||||
m_input_lines.insert (m_input_lines.begin(), EditLineConstString(""));
|
||||
|
||||
Mutex::Locker locker(m_output_mutex);
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_output_mutex);
|
||||
|
||||
lldbassert(m_editor_status != EditorStatus::Editing);
|
||||
if (m_editor_status == EditorStatus::Interrupted)
|
||||
|
@ -1392,8 +1391,8 @@ Editline::GetLines (int first_line_number, StringList &lines, bool &interrupted)
|
|||
SetBaseLineNumber (first_line_number);
|
||||
m_input_lines = std::vector<EditLineStringType>();
|
||||
m_input_lines.insert (m_input_lines.begin(), EditLineConstString(""));
|
||||
|
||||
Mutex::Locker locker(m_output_mutex);
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_output_mutex);
|
||||
// Begin the line editing loop
|
||||
DisplayInput();
|
||||
SetCurrentLine (0);
|
||||
|
@ -1427,7 +1426,7 @@ Editline::GetLines (int first_line_number, StringList &lines, bool &interrupted)
|
|||
void
|
||||
Editline::PrintAsync (Stream *stream, const char *s, size_t len)
|
||||
{
|
||||
Mutex::Locker locker(m_output_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_output_mutex);
|
||||
if (m_editor_status == EditorStatus::Editing)
|
||||
{
|
||||
MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
NativeBreakpointList::NativeBreakpointList () :
|
||||
m_mutex (Mutex::eMutexTypeRecursive)
|
||||
NativeBreakpointList::NativeBreakpointList() : m_mutex()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,7 +28,7 @@ NativeBreakpointList::AddRef (lldb::addr_t addr, size_t size_hint, bool hardware
|
|||
if (log)
|
||||
log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64 ", size_hint = %lu, hardware = %s", __FUNCTION__, addr, size_hint, hardware ? "true" : "false");
|
||||
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// Check if the breakpoint is already set.
|
||||
auto iter = m_breakpoints.find (addr);
|
||||
|
@ -72,7 +71,7 @@ NativeBreakpointList::DecRef (lldb::addr_t addr)
|
|||
if (log)
|
||||
log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
|
||||
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// Check if the breakpoint is already set.
|
||||
auto iter = m_breakpoints.find (addr);
|
||||
|
@ -136,7 +135,7 @@ NativeBreakpointList::EnableBreakpoint (lldb::addr_t addr)
|
|||
if (log)
|
||||
log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
|
||||
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// Ensure we have said breakpoint.
|
||||
auto iter = m_breakpoints.find (addr);
|
||||
|
@ -159,7 +158,7 @@ NativeBreakpointList::DisableBreakpoint (lldb::addr_t addr)
|
|||
if (log)
|
||||
log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
|
||||
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// Ensure we have said breakpoint.
|
||||
auto iter = m_breakpoints.find (addr);
|
||||
|
@ -182,7 +181,7 @@ NativeBreakpointList::GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &brea
|
|||
if (log)
|
||||
log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
|
||||
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// Ensure we have said breakpoint.
|
||||
auto iter = m_breakpoints.find (addr);
|
||||
|
|
|
@ -26,22 +26,22 @@ using namespace lldb_private;
|
|||
// NativeProcessProtocol Members
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
NativeProcessProtocol::NativeProcessProtocol (lldb::pid_t pid) :
|
||||
m_pid (pid),
|
||||
m_threads (),
|
||||
m_current_thread_id (LLDB_INVALID_THREAD_ID),
|
||||
m_threads_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_state (lldb::eStateInvalid),
|
||||
m_state_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_exit_type (eExitTypeInvalid),
|
||||
m_exit_status (0),
|
||||
m_exit_description (),
|
||||
m_delegates_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_delegates (),
|
||||
m_breakpoint_list (),
|
||||
m_watchpoint_list (),
|
||||
m_terminal_fd (-1),
|
||||
m_stop_id (0)
|
||||
NativeProcessProtocol::NativeProcessProtocol(lldb::pid_t pid)
|
||||
: m_pid(pid),
|
||||
m_threads(),
|
||||
m_current_thread_id(LLDB_INVALID_THREAD_ID),
|
||||
m_threads_mutex(),
|
||||
m_state(lldb::eStateInvalid),
|
||||
m_state_mutex(),
|
||||
m_exit_type(eExitTypeInvalid),
|
||||
m_exit_status(0),
|
||||
m_exit_description(),
|
||||
m_delegates_mutex(),
|
||||
m_delegates(),
|
||||
m_breakpoint_list(),
|
||||
m_watchpoint_list(),
|
||||
m_terminal_fd(-1),
|
||||
m_stop_id(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ NativeProcessProtocol::SetExitStatus (ExitType exit_type, int status, const char
|
|||
NativeThreadProtocolSP
|
||||
NativeProcessProtocol::GetThreadAtIndex (uint32_t idx)
|
||||
{
|
||||
Mutex::Locker locker (m_threads_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
|
||||
if (idx < m_threads.size ())
|
||||
return m_threads[idx];
|
||||
return NativeThreadProtocolSP ();
|
||||
|
@ -137,7 +137,7 @@ NativeProcessProtocol::GetThreadByIDUnlocked (lldb::tid_t tid)
|
|||
NativeThreadProtocolSP
|
||||
NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
|
||||
{
|
||||
Mutex::Locker locker (m_threads_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
|
||||
return GetThreadByIDUnlocked (tid);
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ NativeProcessProtocol::SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t w
|
|||
// conceivable that if there are more threads than hardware
|
||||
// watchpoints available, some of the threads will fail to set
|
||||
// hardware watchpoints while software ones may be available.
|
||||
Mutex::Locker locker (m_threads_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
|
||||
for (auto thread_sp : m_threads)
|
||||
{
|
||||
assert (thread_sp && "thread list should not have a NULL thread!");
|
||||
|
@ -276,7 +276,7 @@ NativeProcessProtocol::RemoveWatchpoint (lldb::addr_t addr)
|
|||
|
||||
Error overall_error;
|
||||
|
||||
Mutex::Locker locker (m_threads_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
|
||||
for (auto thread_sp : m_threads)
|
||||
{
|
||||
assert (thread_sp && "thread list should not have a NULL thread!");
|
||||
|
@ -300,7 +300,7 @@ NativeProcessProtocol::RemoveWatchpoint (lldb::addr_t addr)
|
|||
bool
|
||||
NativeProcessProtocol::RegisterNativeDelegate (NativeDelegate &native_delegate)
|
||||
{
|
||||
Mutex::Locker locker (m_delegates_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
|
||||
if (std::find (m_delegates.begin (), m_delegates.end (), &native_delegate) != m_delegates.end ())
|
||||
return false;
|
||||
|
||||
|
@ -312,7 +312,7 @@ NativeProcessProtocol::RegisterNativeDelegate (NativeDelegate &native_delegate)
|
|||
bool
|
||||
NativeProcessProtocol::UnregisterNativeDelegate (NativeDelegate &native_delegate)
|
||||
{
|
||||
Mutex::Locker locker (m_delegates_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
|
||||
|
||||
const auto initial_size = m_delegates.size ();
|
||||
m_delegates.erase (remove (m_delegates.begin (), m_delegates.end (), &native_delegate), m_delegates.end ());
|
||||
|
@ -327,7 +327,7 @@ NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged (lldb::StateType s
|
|||
{
|
||||
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
|
||||
|
||||
Mutex::Locker locker (m_delegates_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
|
||||
for (auto native_delegate: m_delegates)
|
||||
native_delegate->ProcessStateChanged (this, state);
|
||||
|
||||
|
@ -354,7 +354,7 @@ NativeProcessProtocol::NotifyDidExec ()
|
|||
log->Printf ("NativeProcessProtocol::%s - preparing to call delegates", __FUNCTION__);
|
||||
|
||||
{
|
||||
Mutex::Locker locker (m_delegates_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
|
||||
for (auto native_delegate: m_delegates)
|
||||
native_delegate->DidExec (this);
|
||||
}
|
||||
|
@ -394,14 +394,14 @@ NativeProcessProtocol::DisableBreakpoint (lldb::addr_t addr)
|
|||
lldb::StateType
|
||||
NativeProcessProtocol::GetState () const
|
||||
{
|
||||
Mutex::Locker locker (m_state_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void
|
||||
NativeProcessProtocol::SetState (lldb::StateType state, bool notify_delegates)
|
||||
{
|
||||
Mutex::Locker locker (m_state_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
|
||||
|
||||
if (state == m_state)
|
||||
return;
|
||||
|
@ -426,8 +426,8 @@ NativeProcessProtocol::SetState (lldb::StateType state, bool notify_delegates)
|
|||
|
||||
uint32_t NativeProcessProtocol::GetStopID () const
|
||||
{
|
||||
Mutex::Locker locker (m_state_mutex);
|
||||
return m_stop_id;
|
||||
std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
|
||||
return m_stop_id;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "lldb/Core/Error.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Host/Debug.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
#include "lldb/Host/common/NativeProcessProtocol.h"
|
||||
|
||||
|
|
|
@ -556,10 +556,10 @@ LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &lau
|
|||
// On MacOSX CrashReporter will display a string for each shared library if
|
||||
// the shared library has an exported symbol named "__crashreporter_info__".
|
||||
|
||||
static Mutex&
|
||||
GetCrashReporterMutex ()
|
||||
static std::mutex &
|
||||
GetCrashReporterMutex()
|
||||
{
|
||||
static Mutex g_mutex;
|
||||
static std::mutex g_mutex;
|
||||
return g_mutex;
|
||||
}
|
||||
|
||||
|
@ -573,8 +573,8 @@ void
|
|||
Host::SetCrashDescriptionWithFormat (const char *format, ...)
|
||||
{
|
||||
static StreamString g_crash_description;
|
||||
Mutex::Locker locker (GetCrashReporterMutex ());
|
||||
|
||||
std::lock_guard<std::mutex> guard(GetCrashReporterMutex());
|
||||
|
||||
if (format)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -593,7 +593,7 @@ Host::SetCrashDescriptionWithFormat (const char *format, ...)
|
|||
void
|
||||
Host::SetCrashDescription (const char *cstr)
|
||||
{
|
||||
Mutex::Locker locker (GetCrashReporterMutex ());
|
||||
std::lock_guard<std::mutex> guard(GetCrashReporterMutex());
|
||||
static std::string g_crash_description;
|
||||
if (cstr)
|
||||
{
|
||||
|
|
|
@ -79,12 +79,12 @@ GetURLAddress(const char *url, const char *scheme)
|
|||
}
|
||||
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit)
|
||||
: Connection()
|
||||
, m_pipe()
|
||||
, m_mutex(Mutex::eMutexTypeRecursive)
|
||||
, m_shutting_down(false)
|
||||
, m_waiting_for_accept(false)
|
||||
, m_child_processes_inherit(child_processes_inherit)
|
||||
: Connection(),
|
||||
m_pipe(),
|
||||
m_mutex(),
|
||||
m_shutting_down(false),
|
||||
m_waiting_for_accept(false),
|
||||
m_child_processes_inherit(child_processes_inherit)
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
|
@ -92,30 +92,30 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit)
|
|||
}
|
||||
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
|
||||
: Connection()
|
||||
, m_pipe()
|
||||
, m_mutex(Mutex::eMutexTypeRecursive)
|
||||
, m_shutting_down(false)
|
||||
, m_waiting_for_accept(false)
|
||||
, m_child_processes_inherit(false)
|
||||
: Connection(),
|
||||
m_pipe(),
|
||||
m_mutex(),
|
||||
m_shutting_down(false),
|
||||
m_waiting_for_accept(false),
|
||||
m_child_processes_inherit(false)
|
||||
{
|
||||
m_write_sp.reset(new File(fd, owns_fd));
|
||||
m_read_sp.reset(new File(fd, false));
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)", static_cast<void *>(this), fd,
|
||||
owns_fd);
|
||||
log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)",
|
||||
static_cast<void *>(this), fd, owns_fd);
|
||||
OpenCommandPipe();
|
||||
}
|
||||
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(Socket* socket)
|
||||
: Connection()
|
||||
, m_pipe()
|
||||
, m_mutex(Mutex::eMutexTypeRecursive)
|
||||
, m_shutting_down(false)
|
||||
, m_waiting_for_accept(false)
|
||||
, m_child_processes_inherit(false)
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket)
|
||||
: Connection(),
|
||||
m_pipe(),
|
||||
m_mutex(),
|
||||
m_shutting_down(false),
|
||||
m_waiting_for_accept(false),
|
||||
m_child_processes_inherit(false)
|
||||
{
|
||||
InitializeSocket(socket);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ ConnectionFileDescriptor::IsConnected() const
|
|||
ConnectionStatus
|
||||
ConnectionFileDescriptor::Connect(const char *s, Error *error_ptr)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Connect (url = '%s')", static_cast<void *>(this), s);
|
||||
|
@ -374,10 +374,8 @@ ConnectionFileDescriptor::Disconnect(Error *error_ptr)
|
|||
|
||||
m_shutting_down = true;
|
||||
|
||||
Mutex::Locker locker;
|
||||
bool got_lock = locker.TryLock(m_mutex);
|
||||
|
||||
if (!got_lock)
|
||||
std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
|
||||
if (!locker.try_lock())
|
||||
{
|
||||
if (m_pipe.CanWrite())
|
||||
{
|
||||
|
@ -392,7 +390,7 @@ ConnectionFileDescriptor::Disconnect(Error *error_ptr)
|
|||
log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.",
|
||||
static_cast<void *>(this));
|
||||
}
|
||||
locker.Lock(m_mutex);
|
||||
locker.lock();
|
||||
}
|
||||
|
||||
Error error = m_read_sp->Close();
|
||||
|
@ -415,9 +413,8 @@ ConnectionFileDescriptor::Read(void *dst, size_t dst_len, uint32_t timeout_usec,
|
|||
{
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
|
||||
Mutex::Locker locker;
|
||||
bool got_lock = locker.TryLock(m_mutex);
|
||||
if (!got_lock)
|
||||
std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
|
||||
if (!locker.try_lock())
|
||||
{
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Read () failed to get the connection lock.", static_cast<void *>(this));
|
||||
|
|
|
@ -10,16 +10,13 @@
|
|||
#include "lldb/Initialization/SystemLifetimeManager.h"
|
||||
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Initialization/SystemInitializer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace lldb_private;
|
||||
|
||||
SystemLifetimeManager::SystemLifetimeManager()
|
||||
: m_mutex(Mutex::eMutexTypeRecursive)
|
||||
, m_initialized(false)
|
||||
SystemLifetimeManager::SystemLifetimeManager() : m_mutex(), m_initialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +29,7 @@ void
|
|||
SystemLifetimeManager::Initialize(std::unique_ptr<SystemInitializer> initializer,
|
||||
LoadPluginCallbackType plugin_callback)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!m_initialized)
|
||||
{
|
||||
assert(!m_initializer &&
|
||||
|
@ -48,7 +45,7 @@ SystemLifetimeManager::Initialize(std::unique_ptr<SystemInitializer> initializer
|
|||
void
|
||||
SystemLifetimeManager::Terminate()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (m_initialized)
|
||||
{
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
|
||||
CommandHistory::CommandHistory () :
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_history()
|
||||
CommandHistory::CommandHistory() : m_mutex(), m_history()
|
||||
{}
|
||||
|
||||
CommandHistory::~CommandHistory ()
|
||||
|
@ -27,21 +24,21 @@ CommandHistory::~CommandHistory ()
|
|||
size_t
|
||||
CommandHistory::GetSize () const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_history.size();
|
||||
}
|
||||
|
||||
bool
|
||||
CommandHistory::IsEmpty () const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
return m_history.empty();
|
||||
}
|
||||
|
||||
const char*
|
||||
CommandHistory::FindString (const char* input_str) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (!input_str)
|
||||
return nullptr;
|
||||
if (input_str[0] != g_repeat_char)
|
||||
|
@ -80,7 +77,7 @@ CommandHistory::FindString (const char* input_str) const
|
|||
const char*
|
||||
CommandHistory::GetStringAtIndex (size_t idx) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (idx < m_history.size())
|
||||
return m_history[idx].c_str();
|
||||
return nullptr;
|
||||
|
@ -95,7 +92,7 @@ CommandHistory::operator [] (size_t idx) const
|
|||
const char*
|
||||
CommandHistory::GetRecentmostString () const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (m_history.empty())
|
||||
return nullptr;
|
||||
return m_history.back().c_str();
|
||||
|
@ -105,7 +102,7 @@ void
|
|||
CommandHistory::AppendString (const std::string& str,
|
||||
bool reject_if_dupe)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (reject_if_dupe)
|
||||
{
|
||||
if (!m_history.empty())
|
||||
|
@ -120,7 +117,7 @@ CommandHistory::AppendString (const std::string& str,
|
|||
void
|
||||
CommandHistory::Clear ()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
m_history.clear();
|
||||
}
|
||||
|
||||
|
@ -129,7 +126,7 @@ CommandHistory::Dump (Stream& stream,
|
|||
size_t start_idx,
|
||||
size_t stop_idx) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
stop_idx = std::min(stop_idx + 1, m_history.size());
|
||||
for (size_t counter = start_idx;
|
||||
counter < stop_idx;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -22,7 +23,6 @@
|
|||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/Disassembler.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
// Opaque references to C++ Objects in LLVM's MC.
|
||||
namespace llvm
|
||||
|
@ -147,7 +147,7 @@ protected:
|
|||
void Lock(InstructionLLVMC *inst,
|
||||
const lldb_private::ExecutionContext *exe_ctx)
|
||||
{
|
||||
m_mutex.Lock();
|
||||
m_mutex.lock();
|
||||
m_inst = inst;
|
||||
m_exe_ctx = exe_ctx;
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ protected:
|
|||
{
|
||||
m_inst = NULL;
|
||||
m_exe_ctx = NULL;
|
||||
m_mutex.Unlock();
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
const lldb_private::ExecutionContext *m_exe_ctx;
|
||||
InstructionLLVMC *m_inst;
|
||||
lldb_private::Mutex m_mutex;
|
||||
std::mutex m_mutex;
|
||||
bool m_data_from_file;
|
||||
|
||||
std::unique_ptr<LLVMCDisassembler> m_disasm_ap;
|
||||
|
|
|
@ -452,16 +452,16 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress (lldb::addr_t addr, Proc
|
|||
//----------------------------------------------------------------------
|
||||
// Constructor
|
||||
//----------------------------------------------------------------------
|
||||
DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::addr_t kernel_addr) :
|
||||
DynamicLoader(process),
|
||||
m_kernel_load_address (kernel_addr),
|
||||
m_kernel(),
|
||||
m_kext_summary_header_ptr_addr (),
|
||||
m_kext_summary_header_addr (),
|
||||
m_kext_summary_header (),
|
||||
m_known_kexts (),
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_break_id (LLDB_INVALID_BREAK_ID)
|
||||
DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process, lldb::addr_t kernel_addr)
|
||||
: DynamicLoader(process),
|
||||
m_kernel_load_address(kernel_addr),
|
||||
m_kernel(),
|
||||
m_kext_summary_header_ptr_addr(),
|
||||
m_kext_summary_header_addr(),
|
||||
m_kext_summary_header(),
|
||||
m_known_kexts(),
|
||||
m_mutex(),
|
||||
m_break_id(LLDB_INVALID_BREAK_ID)
|
||||
{
|
||||
Error error;
|
||||
PlatformSP platform_sp(Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error));
|
||||
|
@ -470,7 +470,7 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::ad
|
|||
// shouldn't be done if kext loading is explicitly disabled.
|
||||
if (platform_sp.get() && GetGlobalProperties()->GetLoadKexts())
|
||||
{
|
||||
process->GetTarget().SetPlatform (platform_sp);
|
||||
process->GetTarget().SetPlatform(platform_sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ DynamicLoaderDarwinKernel::DidLaunch ()
|
|||
void
|
||||
DynamicLoaderDarwinKernel::Clear (bool clear_process)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id))
|
||||
m_process->ClearBreakpointSiteByID(m_break_id);
|
||||
|
@ -1131,7 +1131,7 @@ DynamicLoaderDarwinKernel::BreakpointHit (StoppointCallbackContext *context,
|
|||
bool
|
||||
DynamicLoaderDarwinKernel::ReadKextSummaryHeader ()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// the all image infos is already valid for this process stop ID
|
||||
|
||||
|
@ -1216,8 +1216,8 @@ DynamicLoaderDarwinKernel::ParseKextSummaries (const Address &kext_summary_addr,
|
|||
Log *log(GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf ("Kexts-changed breakpoint hit, there are %d kexts currently.\n", count);
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (!ReadKextSummaries (kext_summary_addr, count, kext_summaries))
|
||||
return false;
|
||||
|
@ -1438,8 +1438,8 @@ DynamicLoaderDarwinKernel::ReadKextSummaries (const Address &kext_summary_addr,
|
|||
bool
|
||||
DynamicLoaderDarwinKernel::ReadAllKextSummaries ()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (ReadKextSummaryHeader ())
|
||||
{
|
||||
if (m_kext_summary_header.entry_count > 0 && m_kext_summary_header_addr.IsValid())
|
||||
|
@ -1508,7 +1508,7 @@ DynamicLoaderDarwinKernel::PutToLog(Log *log) const
|
|||
if (log == NULL)
|
||||
return;
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
log->Printf("gLoadedKextSummaries = 0x%16.16" PRIx64 " { version=%u, entry_size=%u, entry_count=%u }",
|
||||
m_kext_summary_header_addr.GetFileAddress(),
|
||||
m_kext_summary_header.version,
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
@ -21,7 +22,6 @@
|
|||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/TimeValue.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
|
||||
class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader
|
||||
|
@ -361,7 +361,7 @@ protected:
|
|||
lldb_private::Address m_kext_summary_header_addr;
|
||||
OSKextLoadedKextSummaryHeader m_kext_summary_header;
|
||||
KextImageInfo::collection m_known_kexts;
|
||||
mutable lldb_private::Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
lldb::user_id_t m_break_id;
|
||||
|
||||
private:
|
||||
|
|
|
@ -138,18 +138,18 @@ DynamicLoaderMacOSXDYLD::CreateInstance (Process* process, bool force)
|
|||
//----------------------------------------------------------------------
|
||||
// Constructor
|
||||
//----------------------------------------------------------------------
|
||||
DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD (Process* process) :
|
||||
DynamicLoader(process),
|
||||
m_dyld(),
|
||||
m_dyld_module_wp(),
|
||||
m_dyld_all_image_infos_addr(LLDB_INVALID_ADDRESS),
|
||||
m_dyld_all_image_infos(),
|
||||
m_dyld_all_image_infos_stop_id (UINT32_MAX),
|
||||
m_break_id(LLDB_INVALID_BREAK_ID),
|
||||
m_dyld_image_infos(),
|
||||
m_dyld_image_infos_stop_id (UINT32_MAX),
|
||||
m_mutex(Mutex::eMutexTypeRecursive),
|
||||
m_process_image_addr_is_all_images_infos (false)
|
||||
DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD(Process *process)
|
||||
: DynamicLoader(process),
|
||||
m_dyld(),
|
||||
m_dyld_module_wp(),
|
||||
m_dyld_all_image_infos_addr(LLDB_INVALID_ADDRESS),
|
||||
m_dyld_all_image_infos(),
|
||||
m_dyld_all_image_infos_stop_id(UINT32_MAX),
|
||||
m_break_id(LLDB_INVALID_BREAK_ID),
|
||||
m_dyld_image_infos(),
|
||||
m_dyld_image_infos_stop_id(UINT32_MAX),
|
||||
m_mutex(),
|
||||
m_process_image_addr_is_all_images_infos(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ DynamicLoaderMacOSXDYLD::ProcessDidExec ()
|
|||
void
|
||||
DynamicLoaderMacOSXDYLD::Clear (bool clear_process)
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (LLDB_BREAK_ID_IS_VALID(m_break_id))
|
||||
m_process->GetTarget().RemoveBreakpointByID (m_break_id);
|
||||
|
@ -683,7 +683,7 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpointHit (void *baton,
|
|||
bool
|
||||
DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure ()
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
// the all image infos is already valid for this process stop ID
|
||||
if (m_process->GetStopID() == m_dyld_all_image_infos_stop_id)
|
||||
|
@ -974,8 +974,8 @@ DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress (lldb::addr_t image_in
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf ("Adding %d modules.\n", image_infos_count);
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (m_process->GetStopID() == m_dyld_image_infos_stop_id)
|
||||
return true;
|
||||
|
||||
|
@ -1097,8 +1097,8 @@ DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress (lldb::addr_t image
|
|||
{
|
||||
DYLDImageInfo::collection image_infos;
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (m_process->GetStopID() == m_dyld_image_infos_stop_id)
|
||||
return true;
|
||||
|
||||
|
@ -1239,8 +1239,8 @@ bool
|
|||
DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
if (m_process->GetStopID() == m_dyld_image_infos_stop_id
|
||||
|| m_dyld_image_infos.size() != 0)
|
||||
return false;
|
||||
|
@ -1678,7 +1678,7 @@ DynamicLoaderMacOSXDYLD::PutToLog(Log *log) const
|
|||
if (log == NULL)
|
||||
return;
|
||||
|
||||
Mutex::Locker locker(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
log->Printf("dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64 ", notify=0x%8.8" PRIx64 " }",
|
||||
m_dyld_all_image_infos.version,
|
||||
m_dyld_all_image_infos.dylib_info_count,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/StructuredData.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Utility/SafeMachO.h"
|
||||
|
||||
|
@ -374,7 +374,7 @@ protected:
|
|||
lldb::user_id_t m_break_id;
|
||||
DYLDImageInfo::collection m_dyld_image_infos; // Current shared libraries information
|
||||
uint32_t m_dyld_image_infos_stop_id; // The process stop ID that "m_dyld_image_infos" is valid for
|
||||
mutable lldb_private::Mutex m_mutex;
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
lldb_private::Process::Notifications m_notification_callbacks;
|
||||
bool m_process_image_addr_is_all_images_infos;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "lldb/Target/DynamicLoader.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
|
||||
class DynamicLoaderStatic : public lldb_private::DynamicLoader
|
||||
|
|
|
@ -499,11 +499,9 @@ ClassDescriptorV2::GetInstanceSize ()
|
|||
return 0;
|
||||
}
|
||||
|
||||
ClassDescriptorV2::iVarsStorage::iVarsStorage ():
|
||||
m_filled(false),
|
||||
m_ivars(),
|
||||
m_mutex(Mutex::eMutexTypeRecursive)
|
||||
{}
|
||||
ClassDescriptorV2::iVarsStorage::iVarsStorage() : m_filled(false), m_ivars(), m_mutex()
|
||||
{
|
||||
}
|
||||
|
||||
size_t
|
||||
ClassDescriptorV2::iVarsStorage::size ()
|
||||
|
@ -522,7 +520,7 @@ ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescrip
|
|||
{
|
||||
if (m_filled)
|
||||
return;
|
||||
Mutex::Locker lock(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
|
||||
if (log)
|
||||
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString("<unknown"));
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/ObjCLanguageRuntime.h"
|
||||
#include "AppleObjCRuntimeV2.h"
|
||||
|
||||
|
@ -247,7 +248,7 @@ private:
|
|||
private:
|
||||
bool m_filled;
|
||||
std::vector<iVarDescriptor> m_ivars;
|
||||
Mutex m_mutex;
|
||||
std::recursive_mutex m_mutex;
|
||||
};
|
||||
|
||||
// The constructor should only be invoked by the runtime as it builds its caches
|
||||
|
|
|
@ -379,27 +379,27 @@ ExtractRuntimeGlobalSymbol (Process* process,
|
|||
}
|
||||
}
|
||||
|
||||
AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process,
|
||||
const ModuleSP &objc_module_sp) :
|
||||
AppleObjCRuntime (process),
|
||||
m_get_class_info_code(),
|
||||
m_get_class_info_args (LLDB_INVALID_ADDRESS),
|
||||
m_get_class_info_args_mutex (Mutex::eMutexTypeNormal),
|
||||
m_get_shared_cache_class_info_code(),
|
||||
m_get_shared_cache_class_info_args (LLDB_INVALID_ADDRESS),
|
||||
m_get_shared_cache_class_info_args_mutex (Mutex::eMutexTypeNormal),
|
||||
m_decl_vendor_ap (),
|
||||
m_isa_hash_table_ptr (LLDB_INVALID_ADDRESS),
|
||||
m_hash_signature (),
|
||||
m_has_object_getClass (false),
|
||||
m_loaded_objc_opt (false),
|
||||
m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this,objc_module_sp)),
|
||||
m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this,objc_module_sp)),
|
||||
m_encoding_to_type_sp(),
|
||||
m_noclasses_warning_emitted(false)
|
||||
AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process, const ModuleSP &objc_module_sp)
|
||||
: AppleObjCRuntime(process),
|
||||
m_get_class_info_code(),
|
||||
m_get_class_info_args(LLDB_INVALID_ADDRESS),
|
||||
m_get_class_info_args_mutex(),
|
||||
m_get_shared_cache_class_info_code(),
|
||||
m_get_shared_cache_class_info_args(LLDB_INVALID_ADDRESS),
|
||||
m_get_shared_cache_class_info_args_mutex(),
|
||||
m_decl_vendor_ap(),
|
||||
m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS),
|
||||
m_hash_signature(),
|
||||
m_has_object_getClass(false),
|
||||
m_loaded_objc_opt(false),
|
||||
m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this, objc_module_sp)),
|
||||
m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
|
||||
m_encoding_to_type_sp(),
|
||||
m_noclasses_warning_emitted(false)
|
||||
{
|
||||
static const ConstString g_gdb_object_getClass("gdb_object_getClass");
|
||||
m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
|
||||
m_has_object_getClass =
|
||||
(objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1483,8 +1483,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table
|
|||
|
||||
if (class_infos_addr == LLDB_INVALID_ADDRESS)
|
||||
return false;
|
||||
|
||||
Mutex::Locker locker(m_get_class_info_args_mutex);
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_get_class_info_args_mutex);
|
||||
|
||||
// Fill in our function argument values
|
||||
arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
|
||||
|
@ -1735,9 +1735,9 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache()
|
|||
|
||||
if (class_infos_addr == LLDB_INVALID_ADDRESS)
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
|
||||
Mutex::Locker locker(m_get_shared_cache_class_info_args_mutex);
|
||||
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_get_shared_cache_class_info_args_mutex);
|
||||
|
||||
// Fill in our function argument values
|
||||
arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
|
||||
arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// C++ Includes
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
@ -353,11 +354,11 @@ private:
|
|||
|
||||
std::unique_ptr<UtilityFunction> m_get_class_info_code;
|
||||
lldb::addr_t m_get_class_info_args;
|
||||
Mutex m_get_class_info_args_mutex;
|
||||
std::mutex m_get_class_info_args_mutex;
|
||||
|
||||
std::unique_ptr<UtilityFunction> m_get_shared_cache_class_info_code;
|
||||
lldb::addr_t m_get_shared_cache_class_info_args;
|
||||
Mutex m_get_shared_cache_class_info_args_mutex;
|
||||
std::mutex m_get_shared_cache_class_info_args_mutex;
|
||||
|
||||
std::unique_ptr<DeclVendor> m_decl_vendor_ap;
|
||||
lldb::addr_t m_isa_hash_table_ptr;
|
||||
|
|
|
@ -751,8 +751,8 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, ValueList &dis
|
|||
|
||||
// Scope for mutex locker:
|
||||
{
|
||||
Mutex::Locker locker(m_impl_function_mutex);
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_impl_function_mutex);
|
||||
|
||||
// First stage is to make the ClangUtility to hold our injected function:
|
||||
|
||||
if (!m_impl_code.get())
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Expression/UtilityFunction.h"
|
||||
|
||||
namespace lldb_private
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
lldb::ProcessWP m_process_wp;
|
||||
lldb::ModuleSP m_objc_module_sp;
|
||||
std::unique_ptr<UtilityFunction> m_impl_code;
|
||||
Mutex m_impl_function_mutex;
|
||||
std::mutex m_impl_function_mutex;
|
||||
lldb::addr_t m_impl_fn_addr;
|
||||
lldb::addr_t m_impl_stret_fn_addr;
|
||||
lldb::addr_t m_msg_forward_addr;
|
||||
|
|
|
@ -35,7 +35,6 @@ typedef struct ar_hdr
|
|||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
||||
using namespace lldb;
|
||||
|
@ -226,7 +225,7 @@ ObjectContainerBSDArchive::Archive::FindObject (const ConstString &object_name,
|
|||
ObjectContainerBSDArchive::Archive::shared_ptr
|
||||
ObjectContainerBSDArchive::Archive::FindCachedArchive (const FileSpec &file, const ArchSpec &arch, const TimeValue &time, lldb::offset_t file_offset)
|
||||
{
|
||||
Mutex::Locker locker(Archive::GetArchiveCacheMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(Archive::GetArchiveCacheMutex());
|
||||
shared_ptr archive_sp;
|
||||
Archive::Map &archive_map = Archive::GetArchiveCache ();
|
||||
Archive::Map::iterator pos = archive_map.find (file);
|
||||
|
@ -281,7 +280,7 @@ ObjectContainerBSDArchive::Archive::ParseAndCacheArchiveForFile
|
|||
const size_t num_objects = archive_sp->ParseObjects ();
|
||||
if (num_objects > 0)
|
||||
{
|
||||
Mutex::Locker locker(Archive::GetArchiveCacheMutex ());
|
||||
std::lock_guard<std::recursive_mutex> guard(Archive::GetArchiveCacheMutex());
|
||||
Archive::GetArchiveCache().insert(std::make_pair(file, archive_sp));
|
||||
}
|
||||
else
|
||||
|
@ -299,14 +298,13 @@ ObjectContainerBSDArchive::Archive::GetArchiveCache ()
|
|||
return g_archive_map;
|
||||
}
|
||||
|
||||
Mutex &
|
||||
ObjectContainerBSDArchive::Archive::GetArchiveCacheMutex ()
|
||||
std::recursive_mutex &
|
||||
ObjectContainerBSDArchive::Archive::GetArchiveCacheMutex()
|
||||
{
|
||||
static Mutex g_archive_map_mutex (Mutex::eMutexTypeRecursive);
|
||||
static std::recursive_mutex g_archive_map_mutex;
|
||||
return g_archive_map_mutex;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ObjectContainerBSDArchive::Initialize()
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Symbol/ObjectContainer.h"
|
||||
|
@ -138,8 +140,8 @@ protected:
|
|||
static Map &
|
||||
GetArchiveCache ();
|
||||
|
||||
static lldb_private::Mutex &
|
||||
GetArchiveCacheMutex ();
|
||||
static std::recursive_mutex &
|
||||
GetArchiveCacheMutex();
|
||||
|
||||
static Archive::shared_ptr
|
||||
FindCachedArchive (const lldb_private::FileSpec &file,
|
||||
|
|
|
@ -2938,7 +2938,7 @@ ObjectFileELF::GetSymtab()
|
|||
return NULL;
|
||||
|
||||
uint64_t symbol_id = 0;
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
|
||||
// Sharable objects and dynamic executables usually have 2 distinct symbol
|
||||
// tables, one named ".symtab", and the other ".dynsym". The dynsym is a smaller
|
||||
|
@ -3102,7 +3102,7 @@ ObjectFileELF::Dump(Stream *s)
|
|||
return;
|
||||
}
|
||||
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
s->Printf("%p: ", static_cast<void *>(this));
|
||||
s->Indent();
|
||||
s->PutCString("ObjectFileELF");
|
||||
|
|
|
@ -158,7 +158,7 @@ ObjectFileJIT::GetSymtab()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (m_symtab_ap.get() == NULL)
|
||||
{
|
||||
m_symtab_ap.reset(new Symtab(this));
|
||||
|
@ -200,7 +200,7 @@ ObjectFileJIT::Dump (Stream *s)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
s->Printf("%p: ", static_cast<void*>(this));
|
||||
s->Indent();
|
||||
s->PutCString("ObjectFileJIT");
|
||||
|
|
|
@ -1217,7 +1217,7 @@ ObjectFileMachO::ParseHeader ()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
bool can_parse = false;
|
||||
lldb::offset_t offset = 0;
|
||||
m_data.SetByteOrder (endian::InlHostByteOrder());
|
||||
|
@ -1457,7 +1457,7 @@ ObjectFileMachO::GetSymtab()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (m_symtab_ap.get() == NULL)
|
||||
{
|
||||
m_symtab_ap.reset(new Symtab(this));
|
||||
|
@ -4755,7 +4755,7 @@ ObjectFileMachO::Dump (Stream *s)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
s->Printf("%p: ", static_cast<void*>(this));
|
||||
s->Indent();
|
||||
if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
|
||||
|
@ -4911,7 +4911,7 @@ ObjectFileMachO::GetUUID (lldb_private::UUID* uuid)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
|
||||
return GetUUID (m_header, m_data, offset, *uuid);
|
||||
}
|
||||
|
@ -4925,7 +4925,7 @@ ObjectFileMachO::GetDependentModules (FileSpecList& files)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
struct load_command load_cmd;
|
||||
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
|
||||
std::vector<std::string> rpath_paths;
|
||||
|
@ -5053,7 +5053,7 @@ ObjectFileMachO::GetEntryPointAddress ()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
struct load_command load_cmd;
|
||||
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
|
||||
uint32_t i;
|
||||
|
@ -5203,7 +5203,7 @@ ObjectFileMachO::GetNumThreadContexts ()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (!m_thread_context_offsets_valid)
|
||||
{
|
||||
m_thread_context_offsets_valid = true;
|
||||
|
@ -5237,7 +5237,7 @@ ObjectFileMachO::GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &th
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (!m_thread_context_offsets_valid)
|
||||
GetNumThreadContexts ();
|
||||
|
||||
|
@ -5373,7 +5373,7 @@ ObjectFileMachO::GetVersion (uint32_t *versions, uint32_t num_versions)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
struct dylib_command load_cmd;
|
||||
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
|
||||
uint32_t version_cmd = 0;
|
||||
|
@ -5428,7 +5428,7 @@ ObjectFileMachO::GetArchitecture (ArchSpec &arch)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
return GetArchitecture (m_header, m_data, MachHeaderSizeFromMagic(m_header.magic), arch);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "lldb/Core/FileSpecList.h"
|
||||
#include "lldb/Core/RangeMap.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -212,7 +212,7 @@ ObjectFilePECOFF::ParseHeader ()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
m_sect_headers.clear();
|
||||
m_data.SetByteOrder (eByteOrderLittle);
|
||||
lldb::offset_t offset = 0;
|
||||
|
@ -534,7 +534,7 @@ ObjectFilePECOFF::GetSymtab()
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (m_symtab_ap.get() == NULL)
|
||||
{
|
||||
SectionList *sect_list = GetSectionList();
|
||||
|
@ -689,7 +689,7 @@ ObjectFilePECOFF::CreateSections (SectionList &unified_section_list)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
const uint32_t nsects = m_sect_headers.size();
|
||||
ModuleSP module_sp (GetModule());
|
||||
for (uint32_t idx = 0; idx<nsects; ++idx)
|
||||
|
@ -847,7 +847,7 @@ ObjectFilePECOFF::Dump(Stream *s)
|
|||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
s->Printf("%p: ", static_cast<void*>(this));
|
||||
s->Indent();
|
||||
s->PutCString("ObjectFilePECOFF");
|
||||
|
|
|
@ -252,7 +252,7 @@ FileSpec
|
|||
PlatformAppleSimulator::GetCoreSimulatorPath()
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
if (!m_core_simulator_framework_path.hasValue())
|
||||
{
|
||||
const char *developer_dir = GetDeveloperDirectory();
|
||||
|
|
|
@ -304,7 +304,7 @@ EnumerateDirectoryCallback (void *baton, FileSpec::FileType file_type, const Fil
|
|||
const char *
|
||||
PlatformAppleTVSimulator::GetSDKDirectoryAsCString()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
if (m_sdk_directory.empty())
|
||||
{
|
||||
const char *developer_dir = GetDeveloperDirectory();
|
||||
|
|
|
@ -304,7 +304,7 @@ EnumerateDirectoryCallback (void *baton, FileSpec::FileType file_type, const Fil
|
|||
const char *
|
||||
PlatformAppleWatchSimulator::GetSDKDirectoryAsCString()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
if (m_sdk_directory.empty())
|
||||
{
|
||||
const char *developer_dir = GetDeveloperDirectory();
|
||||
|
|
|
@ -1015,7 +1015,7 @@ PlatformDarwin::ARMGetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch
|
|||
const char *
|
||||
PlatformDarwin::GetDeveloperDirectory()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
if (m_developer_directory.empty())
|
||||
{
|
||||
bool developer_dir_path_valid = false;
|
||||
|
@ -1572,10 +1572,10 @@ PlatformDarwin::AddClangModuleCompilationOptionsForSDKType (Target *target, std:
|
|||
FileSpec sysroot_spec;
|
||||
// Scope for mutex locker below
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
sysroot_spec = GetSDKDirectoryForModules(sdk_type);
|
||||
}
|
||||
|
||||
|
||||
if (sysroot_spec.IsDirectory())
|
||||
{
|
||||
options.push_back("-isysroot");
|
||||
|
|
|
@ -308,7 +308,7 @@ EnumerateDirectoryCallback (void *baton, FileSpec::FileType file_type, const Fil
|
|||
const char *
|
||||
PlatformiOSSimulator::GetSDKDirectoryAsCString()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
if (m_sdk_directory.empty())
|
||||
{
|
||||
const char *developer_dir = GetDeveloperDirectory();
|
||||
|
|
|
@ -229,7 +229,7 @@ ProcessFreeBSD::WillResume()
|
|||
void
|
||||
ProcessFreeBSD::SendMessage(const ProcessMessage &message)
|
||||
{
|
||||
Mutex::Locker lock(m_message_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_message_mutex);
|
||||
|
||||
switch (message.GetKind())
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ ProcessFreeBSD::ProcessFreeBSD(lldb::TargetSP target_sp, lldb::ListenerSP listen
|
|||
m_byte_order(endian::InlHostByteOrder()),
|
||||
m_monitor(NULL),
|
||||
m_module(NULL),
|
||||
m_message_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_message_mutex(),
|
||||
m_exit_now(false),
|
||||
m_seen_initial_stop(),
|
||||
m_resume_signo(0)
|
||||
|
@ -603,7 +603,7 @@ ProcessFreeBSD::RefreshStateAfterStop()
|
|||
if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
|
||||
log->Printf ("ProcessFreeBSD::%s(), message_queue size = %d", __FUNCTION__, (int)m_message_queue.size());
|
||||
|
||||
Mutex::Locker lock(m_message_mutex);
|
||||
std::lock_guard<std::recursive_mutex> guard(m_message_mutex);
|
||||
|
||||
// This method used to only handle one message. Changing it to loop allows
|
||||
// it to handle the case where we hit a breakpoint while handling a different
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <set>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "lldb/Target/Process.h"
|
||||
|
@ -212,7 +213,7 @@ protected:
|
|||
lldb_private::Module *m_module;
|
||||
|
||||
/// Message queue notifying this instance of inferior process state changes.
|
||||
lldb_private::Mutex m_message_mutex;
|
||||
std::recursive_mutex m_message_mutex;
|
||||
std::queue<ProcessMessage> m_message_queue;
|
||||
|
||||
/// Drive any exit events to completion.
|
||||
|
|
|
@ -1348,7 +1348,7 @@ ProcessMonitor::ServeOperation(OperationArgs *args)
|
|||
void
|
||||
ProcessMonitor::DoOperation(Operation *op)
|
||||
{
|
||||
Mutex::Locker lock(m_operation_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_operation_mutex);
|
||||
|
||||
m_operation = op;
|
||||
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
#include <signal.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "lldb/lldb-types.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Host/HostThread.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private
|
||||
{
|
||||
|
@ -223,7 +224,7 @@ private:
|
|||
|
||||
// current operation which must be executed on the privileged thread
|
||||
Operation *m_operation;
|
||||
lldb_private::Mutex m_operation_mutex;
|
||||
std::mutex m_operation_mutex;
|
||||
|
||||
// semaphores notified when Operation is ready to be processed and when
|
||||
// the operation is complete.
|
||||
|
|
|
@ -284,8 +284,8 @@ bool
|
|||
CommunicationKDP::CheckForPacket (const uint8_t *src, size_t src_len, DataExtractor &packet)
|
||||
{
|
||||
// Put the packet data into the buffer in a thread safe fashion
|
||||
Mutex::Locker locker(m_bytes_mutex);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
|
||||
|
||||
Log *log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PACKETS));
|
||||
|
||||
if (src && src_len > 0)
|
||||
|
|
|
@ -22,28 +22,24 @@ using namespace lldb_private;
|
|||
|
||||
// Constructor
|
||||
|
||||
HistoryThread::HistoryThread (lldb_private::Process &process,
|
||||
lldb::tid_t tid,
|
||||
std::vector<lldb::addr_t> pcs,
|
||||
uint32_t stop_id,
|
||||
bool stop_id_is_valid) :
|
||||
Thread (process, tid, true),
|
||||
m_framelist_mutex(),
|
||||
m_framelist(),
|
||||
m_pcs (pcs),
|
||||
m_stop_id (stop_id),
|
||||
m_stop_id_is_valid (stop_id_is_valid),
|
||||
m_extended_unwind_token (LLDB_INVALID_ADDRESS),
|
||||
m_queue_name (),
|
||||
m_thread_name (),
|
||||
m_originating_unique_thread_id (tid),
|
||||
m_queue_id (LLDB_INVALID_QUEUE_ID)
|
||||
HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs,
|
||||
uint32_t stop_id, bool stop_id_is_valid)
|
||||
: Thread(process, tid, true),
|
||||
m_framelist_mutex(),
|
||||
m_framelist(),
|
||||
m_pcs(pcs),
|
||||
m_stop_id(stop_id),
|
||||
m_stop_id_is_valid(stop_id_is_valid),
|
||||
m_extended_unwind_token(LLDB_INVALID_ADDRESS),
|
||||
m_queue_name(),
|
||||
m_thread_name(),
|
||||
m_originating_unique_thread_id(tid),
|
||||
m_queue_id(LLDB_INVALID_QUEUE_ID)
|
||||
{
|
||||
m_unwinder_ap.reset (new HistoryUnwind (*this, pcs, stop_id_is_valid));
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
|
||||
m_unwinder_ap.reset(new HistoryUnwind(*this, pcs, stop_id_is_valid));
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf ("%p HistoryThread::HistoryThread",
|
||||
static_cast<void*>(this));
|
||||
log->Printf("%p HistoryThread::HistoryThread", static_cast<void *>(this));
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
@ -78,7 +74,9 @@ HistoryThread::CreateRegisterContextForFrame (StackFrame *frame)
|
|||
lldb::StackFrameListSP
|
||||
HistoryThread::GetStackFrameList ()
|
||||
{
|
||||
Mutex::Locker (m_framelist_mutex); // FIXME do not throw away the lock after we acquire it..
|
||||
// FIXME do not throw away the lock after we acquire it..
|
||||
std::unique_lock<std::mutex> lock(m_framelist_mutex);
|
||||
lock.release();
|
||||
if (m_framelist.get() == NULL)
|
||||
{
|
||||
m_framelist.reset (new StackFrameList (*this, StackFrameListSP(), true));
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
|
@ -125,7 +126,7 @@ protected:
|
|||
virtual lldb::StackFrameListSP
|
||||
GetStackFrameList ();
|
||||
|
||||
mutable Mutex m_framelist_mutex;
|
||||
mutable std::mutex m_framelist_mutex;
|
||||
lldb::StackFrameListSP m_framelist;
|
||||
std::vector<lldb::addr_t> m_pcs;
|
||||
uint32_t m_stop_id;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue