Add a method on the ObjC Language Runtime that returns the runtime version.

llvm-svn: 123693
This commit is contained in:
Jim Ingham 2011-01-17 23:06:54 +00:00
parent bd91f50190
commit 5caed4e8a8
8 changed files with 32 additions and 15 deletions

View File

@ -58,6 +58,12 @@ public:
virtual ClangUtilityFunction *
CreateObjectChecker (const char *) = 0;
virtual lldb::ObjCRuntimeVersions
GetRuntimeVersion ()
{
return lldb::eObjC_VersionUnknown;
}
protected:
//------------------------------------------------------------------
// Classes that inherit from ObjCLanguageRuntime can see and modify these

View File

@ -633,6 +633,12 @@ typedef enum ExecutionResults
eExecutionTimedOut
} ExecutionResults;
typedef enum ObjCRuntimeVersions {
eObjC_VersionUnknown = 0,
eAppleObjC_V1 = 1,
eAppleObjC_V2 = 2
} ObjCRuntimeVersions;
} // namespace lldb

View File

@ -240,7 +240,7 @@ AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others
//------------------------------------------------------------------
// Static Functions
//------------------------------------------------------------------
enum AppleObjCRuntime::RuntimeVersions
enum lldb::ObjCRuntimeVersions
AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
{
ModuleList &images = process->GetTarget().GetImages();
@ -253,21 +253,21 @@ AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
objc_module_sp = module_sp;
ObjectFile *ofile = module_sp->GetObjectFile();
if (!ofile)
return eObjC_VersionUnknown;
return lldb::eObjC_VersionUnknown;
SectionList *sections = ofile->GetSectionList();
if (!sections)
return eObjC_VersionUnknown;
return lldb::eObjC_VersionUnknown;
SectionSP v1_telltale_section_sp = sections->FindSectionByName(ConstString ("__OBJC"));
if (v1_telltale_section_sp)
{
return eObjC_V1;
return lldb::eAppleObjC_V1;
}
return eObjC_V2;
return lldb::eAppleObjC_V2;
}
}
return eObjC_VersionUnknown;
return lldb::eObjC_VersionUnknown;
}
//------------------------------------------------------------------

View File

@ -27,12 +27,6 @@ class AppleObjCRuntime :
public lldb_private::ObjCLanguageRuntime
{
public:
enum RuntimeVersions {
eObjC_VersionUnknown = 0,
eObjC_V1 = 1,
eObjC_V2 = 2
};
~AppleObjCRuntime() { }
@ -73,7 +67,7 @@ protected:
static bool
AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp);
static enum AppleObjCRuntime::RuntimeVersions
static enum lldb::ObjCRuntimeVersions
GetObjCVersion (Process *process, ModuleSP &objc_module_sp);
//------------------------------------------------------------------

View File

@ -59,7 +59,7 @@ AppleObjCRuntimeV1::CreateInstance (Process *process, lldb::LanguageType languag
{
ModuleSP objc_module_sp;
if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == AppleObjCRuntime::eObjC_V1)
if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == lldb::eAppleObjC_V1)
return new AppleObjCRuntimeV1 (process);
else
return NULL;

View File

@ -64,6 +64,11 @@ public:
virtual void
SetExceptionBreakpoints ();
virtual lldb::ObjCRuntimeVersions
GetRuntimeVersion ()
{
return lldb::eAppleObjC_V1;
}
protected:
private:

View File

@ -65,7 +65,7 @@ AppleObjCRuntimeV2::CreateInstance (Process *process, lldb::LanguageType languag
{
ModuleSP objc_module_sp;
if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == AppleObjCRuntime::eObjC_V2)
if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == lldb::eAppleObjC_V2)
return new AppleObjCRuntimeV2 (process, objc_module_sp);
else
return NULL;

View File

@ -64,6 +64,12 @@ public:
virtual void
SetExceptionBreakpoints ();
virtual lldb::ObjCRuntimeVersions
GetRuntimeVersion ()
{
return lldb::eAppleObjC_V2;
}
protected: