[Lldb-commits] [lldb] r200725 - Fix UnwindAssembly memory leak by defining and using a shared UnwindAssemblySP type.
Jean-Daniel Dupas
devlists at shadowlab.org
Mon Feb 3 15:49:49 PST 2014
Author: jddupas
Date: Mon Feb 3 17:49:47 2014
New Revision: 200725
URL: http://llvm.org/viewvc/llvm-project?rev=200725&view=rev
Log:
Fix UnwindAssembly memory leak by defining and using a shared UnwindAssemblySP type.
Modified:
lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
lldb/trunk/include/lldb/Symbol/UnwindTable.h
lldb/trunk/include/lldb/Target/UnwindAssembly.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Symbol/FuncUnwinders.cpp
lldb/trunk/source/Target/UnwindAssembly.cpp
Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original)
+++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Mon Feb 3 17:49:47 2014
@@ -31,7 +31,7 @@ public:
// instructions are finished for migrating breakpoints past the
// stack frame setup instructions when we don't have line table information.
- FuncUnwinders (lldb_private::UnwindTable& unwind_table, lldb_private::UnwindAssembly *assembly_profiler, AddressRange range);
+ FuncUnwinders (lldb_private::UnwindTable& unwind_table, const lldb::UnwindAssemblySP& assembly_profiler, AddressRange range);
~FuncUnwinders ();
@@ -77,7 +77,7 @@ public:
private:
UnwindTable& m_unwind_table;
- UnwindAssembly *m_assembly_profiler;
+ lldb::UnwindAssemblySP m_assembly_profiler;
AddressRange m_range;
Mutex m_mutex;
Modified: lldb/trunk/include/lldb/Symbol/UnwindTable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindTable.h?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/UnwindTable.h (original)
+++ lldb/trunk/include/lldb/Symbol/UnwindTable.h Mon Feb 3 17:49:47 2014
@@ -57,7 +57,7 @@ private:
bool m_initialized; // delay some initialization until ObjectFile is set up
- UnwindAssembly* m_assembly_profiler;
+ lldb::UnwindAssemblySP m_assembly_profiler;
DWARFCallFrameInfo* m_eh_frame;
Modified: lldb/trunk/include/lldb/Target/UnwindAssembly.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/UnwindAssembly.h?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/UnwindAssembly.h (original)
+++ lldb/trunk/include/lldb/Target/UnwindAssembly.h Mon Feb 3 17:49:47 2014
@@ -17,10 +17,11 @@
namespace lldb_private {
class UnwindAssembly :
+ public std::enable_shared_from_this<UnwindAssembly>,
public PluginInterface
{
public:
- static UnwindAssembly*
+ static lldb::UnwindAssemblySP
FindPlugin (const ArchSpec &arch);
virtual
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Mon Feb 3 17:49:47 2014
@@ -384,6 +384,7 @@ namespace lldb {
#ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren> ScriptedSyntheticChildrenSP;
#endif
+ typedef std::shared_ptr<lldb_private::UnwindAssembly> UnwindAssemblySP;
typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
typedef std::shared_ptr<lldb_private::Value> ValueSP;
Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original)
+++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Mon Feb 3 17:49:47 2014
@@ -28,7 +28,7 @@ using namespace lldb_private;
FuncUnwinders::FuncUnwinders
(
UnwindTable& unwind_table,
- UnwindAssembly *assembly_profiler,
+ const lldb::UnwindAssemblySP& assembly_profiler,
AddressRange range
) :
m_unwind_table(unwind_table),
Modified: lldb/trunk/source/Target/UnwindAssembly.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnwindAssembly.cpp?rev=200725&r1=200724&r2=200725&view=diff
==============================================================================
--- lldb/trunk/source/Target/UnwindAssembly.cpp (original)
+++ lldb/trunk/source/Target/UnwindAssembly.cpp Mon Feb 3 17:49:47 2014
@@ -15,7 +15,7 @@
using namespace lldb;
using namespace lldb_private;
-UnwindAssembly*
+UnwindAssemblySP
UnwindAssembly::FindPlugin (const ArchSpec &arch)
{
UnwindAssemblyCreateInstance create_callback;
@@ -24,9 +24,9 @@ UnwindAssembly::FindPlugin (const ArchSp
(create_callback = PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(idx)) != NULL;
++idx)
{
- std::unique_ptr<UnwindAssembly> assembly_profiler_ap (create_callback (arch));
+ UnwindAssemblySP assembly_profiler_ap (create_callback (arch));
if (assembly_profiler_ap.get ())
- return assembly_profiler_ap.release ();
+ return assembly_profiler_ap;
}
return NULL;
}
More information about the lldb-commits
mailing list