[Lldb-commits] [lldb] r114537 - in /lldb/trunk: include/lldb/Core/PluginManager.h include/lldb/Utility/ArchVolatileRegs.h include/lldb/lldb-forward.h include/lldb/lldb-private-interfaces.h lldb.xcodeproj/project.pbxproj source/Core/PluginManager.cpp source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp source/Plugins/Process/Utility/ArchVolatileRegs-x86.h source/Utility/ArchVolatileRegs.cpp source/lldb.cpp
Jason Molenda
jmolenda at apple.com
Wed Sep 22 00:37:07 PDT 2010
Author: jmolenda
Date: Wed Sep 22 02:37:07 2010
New Revision: 114537
URL: http://llvm.org/viewvc/llvm-project?rev=114537&view=rev
Log:
Add a new ArchVolatileRegs plugin class to identify
whether a given register number is treated as volatile
or not for a given architecture/platform.
approx 450 lines of boilerplate, 50 lines of actual code. :)
Added:
lldb/trunk/include/lldb/Utility/ArchVolatileRegs.h
lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
lldb/trunk/source/Utility/ArchVolatileRegs.cpp
Modified:
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/lldb.cpp
Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Wed Sep 22 02:37:07 2010
@@ -213,6 +213,23 @@
static ArchDefaultUnwindPlanCreateInstance
GetArchDefaultUnwindPlanCreateCallbackForPluginName (const char *name);
+ //------------------------------------------------------------------
+ // ArchVolatileRegs
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const char *name,
+ const char *description,
+ ArchVolatileRegsCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin (ArchVolatileRegsCreateInstance create_callback);
+
+ static ArchVolatileRegsCreateInstance
+ GetArchVolatileRegsCreateCallbackAtIndex (uint32_t idx);
+
+ static ArchVolatileRegsCreateInstance
+ GetArchVolatileRegsCreateCallbackForPluginName (const char *name);
+
};
Added: lldb/trunk/include/lldb/Utility/ArchVolatileRegs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ArchVolatileRegs.h?rev=114537&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Utility/ArchVolatileRegs.h (added)
+++ lldb/trunk/include/lldb/Utility/ArchVolatileRegs.h Wed Sep 22 02:37:07 2010
@@ -0,0 +1,53 @@
+//===---------------------ArchVolatileRegs.h----- ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_ArchVolatileRegs_h_
+#define utility_ArchVolatileRegs_h_
+
+#include "lldb-private.h"
+#include "lldb/Core/PluginInterface.h"
+
+namespace lldb_private {
+
+class ArchVolatileRegs :
+ public PluginInterface
+{
+public:
+
+ virtual
+ ~ArchVolatileRegs();
+
+ // Given a register number (in the eRegisterKindLLDB register numbering
+ // scheme), returns true if the register is defined to be "volatile" in
+ // this architecture -- that is, a function is not required to preserve
+ // the contents of the register.
+ // If r8 is defined to be volatile, it means that a function can put
+ // values in that register without saving the previous contents.
+ // If r8 is defined to be non-volatile (preseved), a function must save
+ // the value in the register before it is used.
+
+ // The thread reference is needed to get a RegisterContext to look up by
+ // register names.
+
+ virtual bool
+ RegisterIsVolatile (lldb_private::Thread& thread, uint32_t regnum) = 0;
+
+ static ArchVolatileRegs*
+ FindPlugin (const ArchSpec &arch);
+
+protected:
+ ArchVolatileRegs();
+private:
+ DISALLOW_COPY_AND_ASSIGN (ArchVolatileRegs);
+};
+
+} // namespace lldb_private
+
+#endif //utility_ArchVolatileRegs_h_
+
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Wed Sep 22 02:37:07 2010
@@ -23,6 +23,7 @@
class AddressResolver;
class ArchSpec;
class ArchDefaultUnwindPlan;
+class ArchVolatileRegs;
class Args;
class Baton;
class Block;
Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Wed Sep 22 02:37:07 2010
@@ -30,6 +30,7 @@
typedef ThreadPlan * (*ThreadPlanShouldStopHereCallback) (ThreadPlan *current_plan, Flags &flags, void *baton);
typedef UnwindAssemblyProfiler* (*UnwindAssemblyProfilerCreateInstance) (const ArchSpec &arch);
typedef ArchDefaultUnwindPlan* (*ArchDefaultUnwindPlanCreateInstance) (const ArchSpec &arch);
+ typedef ArchVolatileRegs* (*ArchVolatileRegsCreateInstance) (const ArchSpec &arch);
} // namespace lldb_private
#endif // #if defined(__cplusplus)
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Sep 22 02:37:07 2010
@@ -369,6 +369,9 @@
961FAC19123605A200F93A47 /* ArchDefaultUnwindPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FAC18123605A200F93A47 /* ArchDefaultUnwindPlan.cpp */; };
961FAC1E12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FAC1C12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp */; };
961FAC1F12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 961FAC1D12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h */; };
+ 96A6D9C61249D96F00250B38 /* ArchVolatileRegs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96A6D9C51249D96F00250B38 /* ArchVolatileRegs.cpp */; };
+ 96A6D9C91249D98800250B38 /* ArchVolatileRegs-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96A6D9C71249D98800250B38 /* ArchVolatileRegs-x86.cpp */; };
+ 96A6D9CA1249D98800250B38 /* ArchVolatileRegs-x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 96A6D9C81249D98800250B38 /* ArchVolatileRegs-x86.h */; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1024,6 +1027,9 @@
9654F7B91197DA3F00F72B43 /* RemoteUnwindProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteUnwindProfile.h; sourceTree = "<group>"; };
9654F7BA1197DA3F00F72B43 /* unw_getcontext.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = unw_getcontext.s; sourceTree = "<group>"; };
9654F7BD1197DA3F00F72B43 /* UnwindCursor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = UnwindCursor.hpp; sourceTree = "<group>"; };
+ 96A6D9C51249D96F00250B38 /* ArchVolatileRegs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArchVolatileRegs.cpp; path = source/Utility/ArchVolatileRegs.cpp; sourceTree = "<group>"; };
+ 96A6D9C71249D98800250B38 /* ArchVolatileRegs-x86.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ArchVolatileRegs-x86.cpp"; path = "Utility/ArchVolatileRegs-x86.cpp"; sourceTree = "<group>"; };
+ 96A6D9C81249D98800250B38 /* ArchVolatileRegs-x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ArchVolatileRegs-x86.h"; path = "Utility/ArchVolatileRegs-x86.h"; sourceTree = "<group>"; };
9A19A6A51163BB7E00E0D453 /* SBValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBValue.h; path = include/lldb/API/SBValue.h; sourceTree = "<group>"; };
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBValue.cpp; path = source/API/SBValue.cpp; sourceTree = "<group>"; };
9A2771FB1135A35C00E6ADB6 /* ScriptInterpreterNone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScriptInterpreterNone.h; path = include/lldb/Interpreter/ScriptInterpreterNone.h; sourceTree = "<group>"; };
@@ -1554,6 +1560,7 @@
2682F168115ED9C800CCFF99 /* Utility */ = {
isa = PBXGroup;
children = (
+ 96A6D9C51249D96F00250B38 /* ArchVolatileRegs.cpp */,
961FAC18123605A200F93A47 /* ArchDefaultUnwindPlan.cpp */,
961FABE41235F15900F93A47 /* UnwindAssemblyProfiler.cpp */,
264723A511FA076E00DE380C /* CleanUp.h */,
@@ -1583,6 +1590,8 @@
26B4666E11A2080F00CF6220 /* Utility */ = {
isa = PBXGroup;
children = (
+ 96A6D9C71249D98800250B38 /* ArchVolatileRegs-x86.cpp */,
+ 96A6D9C81249D98800250B38 /* ArchVolatileRegs-x86.h */,
961FAC1C12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp */,
961FAC1D12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h */,
961FABE81235F26800F93A47 /* UnwindAssemblyProfiler-x86.cpp */,
@@ -2285,6 +2294,7 @@
2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */,
2618D959124056C700F2B8FE /* NameToDIE.h in Headers */,
26C72C94124322890068DC16 /* SBStream.h in Headers */,
+ 96A6D9CA1249D98800250B38 /* ArchVolatileRegs-x86.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2750,6 +2760,8 @@
2618D7921240116900F2B8FE /* SectionLoadList.cpp in Sources */,
2618D9EB12406FE600F2B8FE /* NameToDIE.cpp in Sources */,
26C72C961243229A0068DC16 /* SBStream.cpp in Sources */,
+ 96A6D9C61249D96F00250B38 /* ArchVolatileRegs.cpp in Sources */,
+ 96A6D9C91249D98800250B38 /* ArchVolatileRegs-x86.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Wed Sep 22 02:37:07 2010
@@ -1371,4 +1371,123 @@
return NULL;
}
+#pragma mark ArchVolatileRegs
+
+struct ArchVolatileRegsInstance
+{
+ ArchVolatileRegsInstance() :
+ name(),
+ description(),
+ create_callback(NULL)
+ {
+ }
+
+ std::string name;
+ std::string description;
+ ArchVolatileRegsCreateInstance create_callback;
+};
+
+typedef std::vector<ArchVolatileRegsInstance> ArchVolatileRegsInstances;
+
+static bool
+AccessArchVolatileRegsInstances (PluginAction action, ArchVolatileRegsInstance &instance, uint32_t index)
+{
+ static ArchVolatileRegsInstances g_plugin_instances;
+
+ switch (action)
+ {
+ case ePluginRegisterInstance:
+ if (instance.create_callback)
+ {
+ g_plugin_instances.push_back (instance);
+ return true;
+ }
+ break;
+
+ case ePluginUnregisterInstance:
+ if (instance.create_callback)
+ {
+ ArchVolatileRegsInstances::iterator pos, end = g_plugin_instances.end();
+ for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
+ {
+ if (pos->create_callback == instance.create_callback)
+ {
+ g_plugin_instances.erase(pos);
+ return true;
+ }
+ }
+ }
+ break;
+
+ case ePluginGetInstanceAtIndex:
+ if (index < g_plugin_instances.size())
+ {
+ instance = g_plugin_instances[index];
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ return false;
+}
+
+bool
+PluginManager::RegisterPlugin
+(
+ const char *name,
+ const char *description,
+ ArchVolatileRegsCreateInstance create_callback
+)
+{
+ if (create_callback)
+ {
+ ArchVolatileRegsInstance instance;
+ assert (name && name[0]);
+ instance.name = name;
+ if (description && description[0])
+ instance.description = description;
+ instance.create_callback = create_callback;
+ return AccessArchVolatileRegsInstances (ePluginRegisterInstance, instance, 0);
+ }
+ return false;
+}
+
+bool
+PluginManager::UnregisterPlugin (ArchVolatileRegsCreateInstance create_callback)
+{
+ if (create_callback)
+ {
+ ArchVolatileRegsInstance instance;
+ instance.create_callback = create_callback;
+ return AccessArchVolatileRegsInstances (ePluginUnregisterInstance, instance, 0);
+ }
+ return false;
+}
+
+ArchVolatileRegsCreateInstance
+PluginManager::GetArchVolatileRegsCreateCallbackAtIndex (uint32_t idx)
+{
+ ArchVolatileRegsInstance instance;
+ if (AccessArchVolatileRegsInstances (ePluginGetInstanceAtIndex, instance, idx))
+ return instance.create_callback;
+ return NULL;
+}
+
+ArchVolatileRegsCreateInstance
+PluginManager::GetArchVolatileRegsCreateCallbackForPluginName (const char *name)
+{
+ if (name && name[0])
+ {
+ ArchVolatileRegsInstance instance;
+ std::string ss_name(name);
+ for (uint32_t idx = 0; AccessArchVolatileRegsInstances (ePluginGetInstanceAtIndex, instance, idx); ++idx)
+ {
+ if (instance.name == ss_name)
+ return instance.create_callback;
+ }
+ }
+ return NULL;
+}
Added: lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp?rev=114537&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp (added)
+++ lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp Wed Sep 22 02:37:07 2010
@@ -0,0 +1,168 @@
+//===-- ArchVolatileRegs-x86.cpp --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ArchVolatileRegs-x86.h"
+
+#include "lldb/lldb-private.h"
+#include "lldb/Utility/ArchVolatileRegs.h"
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/RegisterContext.h"
+#include <set>
+
+using namespace lldb;
+using namespace lldb_private;
+
+bool
+ArchVolatileRegs_x86::RegisterIsVolatile (Thread& thread, uint32_t regnum)
+{
+ initialize_regset (thread);
+ if (m_non_volatile_regs.find (regnum) == m_non_volatile_regs.end())
+ return true;
+ else
+ return false;
+}
+
+lldb_private::ArchVolatileRegs *
+ArchVolatileRegs_x86::CreateInstance (const lldb_private::ArchSpec &arch)
+{
+ uint32_t cpu = arch.GetCPUType ();
+ if (cpu != CPU_TYPE_X86_64 && cpu != CPU_TYPE_I386)
+ return NULL;
+
+ return new ArchVolatileRegs_x86 (cpu);
+}
+
+ArchVolatileRegs_x86::ArchVolatileRegs_x86(int cpu) :
+ lldb_private::ArchVolatileRegs(),
+ m_cpu(cpu),
+ m_non_volatile_regs()
+{
+}
+
+void
+
+ArchVolatileRegs_x86::initialize_regset(Thread& thread)
+{
+ if (m_non_volatile_regs.size() > 0)
+ return;
+
+
+ RegisterContext *rctx = thread.GetRegisterContext();
+ const RegisterInfo *ri;
+
+ const char *x86_64_regnames[] = { "rbx",
+ "rsp",
+ "rbp",
+ "r12",
+ "r13",
+ "r14",
+ "r15",
+ "rip" };
+
+ const char *i386_regnames[] = { "ebx",
+ "ebp",
+ "esi",
+ "edi",
+ "esp",
+ "eip" };
+
+
+ const char **names;
+ int namecount;
+ if (m_cpu == CPU_TYPE_X86_64)
+ {
+ names = x86_64_regnames;
+ namecount = sizeof (x86_64_regnames) / sizeof (char *);
+ }
+ else
+ {
+ names = i386_regnames;
+ namecount = sizeof (i386_regnames) / sizeof (char *);
+ }
+
+ for (int i = 0; i < namecount; i++)
+ {
+ ri = rctx->GetRegisterInfoByName (names[i]);
+ if (ri)
+ m_non_volatile_regs.insert (ri->kinds[eRegisterKindLLDB]);
+ }
+}
+
+
+//------------------------------------------------------------------
+// PluginInterface protocol in ArchVolatileRegs_x86
+//------------------------------------------------------------------
+
+const char *
+ArchVolatileRegs_x86::GetPluginName()
+{
+ return "ArchVolatileRegs_x86";
+}
+
+const char *
+ArchVolatileRegs_x86::GetShortPluginName()
+{
+ return "archvolatileregs.x86";
+}
+
+
+uint32_t
+ArchVolatileRegs_x86::GetPluginVersion()
+{
+ return 1;
+}
+
+void
+ArchVolatileRegs_x86::GetPluginCommandHelp (const char *command, Stream *strm)
+{
+}
+
+Error
+ArchVolatileRegs_x86::ExecutePluginCommand (Args &command, Stream *strm)
+{
+ Error error;
+ error.SetErrorString("No plug-in command are currently supported.");
+ return error;
+}
+
+Log *
+ArchVolatileRegs_x86::EnablePluginLogging (Stream *strm, Args &command)
+{
+ return NULL;
+}
+
+void
+ArchVolatileRegs_x86::Initialize()
+{
+ PluginManager::RegisterPlugin (GetPluginNameStatic(),
+ GetPluginDescriptionStatic(),
+ CreateInstance);
+}
+
+void
+ArchVolatileRegs_x86::Terminate()
+{
+ PluginManager::UnregisterPlugin (CreateInstance);
+}
+
+
+const char *
+ArchVolatileRegs_x86::GetPluginNameStatic()
+{
+ return "ArchVolatileRegs_x86";
+}
+
+const char *
+ArchVolatileRegs_x86::GetPluginDescriptionStatic()
+{
+ return "i386 and x86_64 architecture volatile register information.";
+}
Added: lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h?rev=114537&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h (added)
+++ lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h Wed Sep 22 02:37:07 2010
@@ -0,0 +1,76 @@
+//===-- ArchVolatileRegs-x86.h ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ArchVolatileRegs_x86_h_
+#define liblldb_ArchVolatileRegs_x86_h_
+
+#include "lldb/lldb-private.h"
+#include "lldb/Utility/ArchVolatileRegs.h"
+#include <set>
+
+namespace lldb_private {
+
+class ArchVolatileRegs_x86 : public lldb_private::ArchVolatileRegs
+{
+public:
+
+ ~ArchVolatileRegs_x86 () { }
+
+ bool
+ RegisterIsVolatile (lldb_private::Thread& thread, uint32_t regnum);
+
+ static lldb_private::ArchVolatileRegs *
+ CreateInstance (const lldb_private::ArchSpec &arch);
+
+ //------------------------------------------------------------------
+ // PluginInterface protocol
+ //------------------------------------------------------------------
+ static void
+ Initialize();
+
+ static void
+ Terminate();
+
+ static const char *
+ GetPluginNameStatic();
+
+ static const char *
+ GetPluginDescriptionStatic();
+
+ virtual const char *
+ GetPluginName();
+
+ virtual const char *
+ GetShortPluginName();
+
+ virtual uint32_t
+ GetPluginVersion();
+
+ virtual void
+ GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
+
+ virtual lldb_private::Error
+ ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
+
+ virtual lldb_private::Log *
+ EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
+
+private:
+ ArchVolatileRegs_x86(int cpu); // Call CreateInstance instead.
+
+ void initialize_regset(lldb_private::Thread& thread);
+
+ int m_cpu;
+ std::set<int> m_non_volatile_regs;
+};
+
+
+} // namespace lldb_private
+
+#endif // liblldb_ArchVolatileRegs_x86_h_
Added: lldb/trunk/source/Utility/ArchVolatileRegs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchVolatileRegs.cpp?rev=114537&view=auto
==============================================================================
--- lldb/trunk/source/Utility/ArchVolatileRegs.cpp (added)
+++ lldb/trunk/source/Utility/ArchVolatileRegs.cpp Wed Sep 22 02:37:07 2010
@@ -0,0 +1,40 @@
+//===-- ArchVolatileRegs.cpp ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb-private.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/ArchVolatileRegs.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+ArchVolatileRegs*
+ArchVolatileRegs::FindPlugin (const ArchSpec &arch)
+{
+ ArchVolatileRegsCreateInstance create_callback;
+
+ for (uint32_t idx = 0;
+ (create_callback = PluginManager::GetArchVolatileRegsCreateCallbackAtIndex(idx)) != NULL;
+ ++idx)
+ {
+ std::auto_ptr<ArchVolatileRegs> default_volatile_regs_ap (create_callback (arch));
+ if (default_volatile_regs_ap.get ())
+ return default_volatile_regs_ap.release ();
+ }
+ return NULL;
+}
+
+ArchVolatileRegs::ArchVolatileRegs ()
+{
+}
+
+ArchVolatileRegs::~ArchVolatileRegs ()
+{
+}
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=114537&r1=114536&r2=114537&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Wed Sep 22 02:37:07 2010
@@ -24,6 +24,7 @@
#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
#include "Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h"
#include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
+#include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
#ifdef __APPLE__
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
@@ -66,7 +67,7 @@
SymbolFileDWARFDebugMap::Initialize();
SymbolFileSymtab::Initialize();
UnwindAssemblyProfiler_x86::Initialize();
- ArchDefaultUnwindPlan_x86::Initialize();
+ ArchVolatileRegs_x86::Initialize();
#ifdef __APPLE__
ABIMacOSX_i386::Initialize();
@@ -105,7 +106,7 @@
SymbolFileDWARFDebugMap::Terminate();
SymbolFileSymtab::Terminate();
UnwindAssemblyProfiler_x86::Terminate();
- ArchDefaultUnwindPlan_x86::Terminate();
+ ArchVolatileRegs_x86::Terminate();
#ifdef __APPLE__
DynamicLoaderMacOSXDYLD::Terminate();
More information about the lldb-commits
mailing list