diff options
author | Enrico Granata <egranata@apple.com> | 2013-01-16 18:53:52 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-01-16 18:53:52 +0000 |
commit | bcd80b47234b48e42ed9f8d557faef554034c47a (patch) | |
tree | 738019716f664aa8d95cd0bec40e41a152a5f400 | |
parent | 77f49a4902fdf3b73d54796c1579988477f6927e (diff) | |
download | bcm5719-llvm-bcd80b47234b48e42ed9f8d557faef554034c47a.tar.gz bcm5719-llvm-bcd80b47234b48e42ed9f8d557faef554034c47a.zip |
<rdar://problem/13021266>
Adding FindFirstGlobalVariable to SBModule and SBTarget
These calls work like FindGlobalVariables but they only return the first match found and so they can return an SBValue instead of an SBValueList for added convenience of use
llvm-svn: 172636
-rw-r--r-- | lldb/include/lldb/API/SBModule.h | 16 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBTarget.h | 13 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBModule.i | 18 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTarget.i | 15 | ||||
-rw-r--r-- | lldb/source/API/SBModule.cpp | 9 | ||||
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 9 |
6 files changed, 80 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBModule.h b/lldb/include/lldb/API/SBModule.h index d2e9903fd67..c75c4a151d3 100644 --- a/lldb/include/lldb/API/SBModule.h +++ b/lldb/include/lldb/API/SBModule.h @@ -175,6 +175,22 @@ public: const char *name, uint32_t max_matches); + //------------------------------------------------------------------ + /// Find the first global (or static) variable by name. + /// + /// @param[in] target + /// A valid SBTarget instance representing the debuggee. + /// + /// @param[in] name + /// The name of the global or static variable we are looking + /// for. + /// + /// @return + /// An SBValue that gets filled in with the found variable (if any). + //------------------------------------------------------------------ + lldb::SBValue + FindFirstGlobalVariable (lldb::SBTarget &target, const char *name); + lldb::SBType FindFirstType (const char* name); diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index ddc868aaa03..2d8c4b91a59 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -603,6 +603,19 @@ public: FindGlobalVariables (const char *name, uint32_t max_matches); + //------------------------------------------------------------------ + /// Find the first global (or static) variable by name. + /// + /// @param[in] name + /// The name of the global or static variable we are looking + /// for. + /// + /// @return + /// An SBValue that gets filled in with the found variable (if any). + //------------------------------------------------------------------ + lldb::SBValue + FindFirstGlobalVariable (const char* name); + void Clear (); diff --git a/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i index ee2d3b42c44..6142c39dfb9 100644 --- a/lldb/scripts/Python/interface/SBModule.i +++ b/lldb/scripts/Python/interface/SBModule.i @@ -248,6 +248,24 @@ public: const char *name, uint32_t max_matches); + %feature("docstring", " + //------------------------------------------------------------------ + /// Find the first global (or static) variable by name. + /// + /// @param[in] target + /// A valid SBTarget instance representing the debuggee. + /// + /// @param[in] name + /// The name of the global or static variable we are looking + /// for. + /// + /// @return + /// An SBValue that gets filled in with the found variable (if any). + //------------------------------------------------------------------ + ") FindFirstGlobalVariable; + lldb::SBValue + FindFirstGlobalVariable (lldb::SBTarget &target, const char *name); + lldb::ByteOrder GetByteOrder (); diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i index 88fcf036ee1..8d681e80653 100644 --- a/lldb/scripts/Python/interface/SBTarget.i +++ b/lldb/scripts/Python/interface/SBTarget.i @@ -586,6 +586,21 @@ public: FindGlobalVariables (const char *name, uint32_t max_matches); + %feature("docstring", " + //------------------------------------------------------------------ + /// Find the first global (or static) variable by name. + /// + /// @param[in] name + /// The name of the global or static variable we are looking + /// for. + /// + /// @return + /// An SBValue that gets filled in with the found variable (if any). + //------------------------------------------------------------------ + ") FindFirstGlobalVariable; + lldb::SBValue + FindFirstGlobalVariable (const char* name); + void Clear (); diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index f0c916ea048..219870c733c 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -480,6 +480,15 @@ SBModule::FindGlobalVariables (SBTarget &target, const char *name, uint32_t max_ return sb_value_list; } +lldb::SBValue +SBModule::FindFirstGlobalVariable (lldb::SBTarget &target, const char *name) +{ + SBValueList sb_value_list(FindGlobalVariables(target, name, 1)); + if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0) + return sb_value_list.GetValueAtIndex(0); + return SBValue(); +} + lldb::SBType SBModule::FindFirstType (const char *name_cstr) { diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 464143729fb..79b038b2766 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -2232,6 +2232,15 @@ SBTarget::FindGlobalVariables (const char *name, uint32_t max_matches) return sb_value_list; } +lldb::SBValue +SBTarget::FindFirstGlobalVariable (const char* name) +{ + SBValueList sb_value_list(FindGlobalVariables(name, 1)); + if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0) + return sb_value_list.GetValueAtIndex(0); + return SBValue(); +} + SBSourceManager SBTarget::GetSourceManager() { |