[Lldb-commits] [lldb] r172636 - in /lldb/trunk: include/lldb/API/SBModule.h include/lldb/API/SBTarget.h scripts/Python/interface/SBModule.i scripts/Python/interface/SBTarget.i source/API/SBModule.cpp source/API/SBTarget.cpp
Enrico Granata
egranata at apple.com
Wed Jan 16 10:53:53 PST 2013
Author: enrico
Date: Wed Jan 16 12:53:52 2013
New Revision: 172636
URL: http://llvm.org/viewvc/llvm-project?rev=172636&view=rev
Log:
<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
Modified:
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/scripts/Python/interface/SBModule.i
lldb/trunk/scripts/Python/interface/SBTarget.i
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Wed Jan 16 12:53:52 2013
@@ -175,6 +175,22 @@
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);
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Wed Jan 16 12:53:52 2013
@@ -603,6 +603,19 @@
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 ();
Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Wed Jan 16 12:53:52 2013
@@ -248,6 +248,24 @@
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 ();
Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Wed Jan 16 12:53:52 2013
@@ -586,6 +586,21 @@
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 ();
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Wed Jan 16 12:53:52 2013
@@ -480,6 +480,15 @@
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)
{
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=172636&r1=172635&r2=172636&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Jan 16 12:53:52 2013
@@ -2232,6 +2232,15 @@
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()
{
More information about the lldb-commits
mailing list