From 1b282f9619f68a60d4b8f4dd0c68b0a07e1a1293 Mon Sep 17 00:00:00 2001 From: Greg Clayton <gclayton@apple.com> Date: Thu, 13 Oct 2011 18:08:26 +0000 Subject: [PATCH] Cleaned up the SBWatchpoint public API. llvm-svn: 141876 --- lldb/include/lldb/API/SBDefines.h | 2 +- lldb/include/lldb/API/SBError.h | 1 + lldb/include/lldb/API/SBStream.h | 2 +- lldb/include/lldb/API/SBTarget.h | 26 +++---- lldb/include/lldb/API/SBValue.h | 52 +++++++++++++ ...{SBWatchpointLocation.h => SBWatchpoint.h} | 42 +++++----- lldb/lldb.xcodeproj/project.pbxproj | 35 ++++----- .../xcshareddata/xcschemes/lldb-tool.xcscheme | 2 +- lldb/scripts/Python/build-swig-Python.sh | 4 +- lldb/scripts/Python/interface/SBTarget.i | 40 +++++----- lldb/scripts/Python/interface/SBValue.i | 6 ++ ...{SBWatchpointLocation.i => SBWatchpoint.i} | 24 +++--- lldb/scripts/Python/modify-python-lldb.py | 2 +- lldb/scripts/Python/python-extensions.swig | 4 +- lldb/scripts/lldb.swig | 4 +- lldb/source/API/SBTarget.cpp | 73 ++++++++--------- lldb/source/API/SBValue.cpp | 28 +++++++ ...atchpointLocation.cpp => SBWatchpoint.cpp} | 78 +++++++++++-------- 18 files changed, 260 insertions(+), 165 deletions(-) rename lldb/include/lldb/API/{SBWatchpointLocation.h => SBWatchpoint.h} (57%) rename lldb/scripts/Python/interface/{SBWatchpointLocation.i => SBWatchpoint.i} (75%) rename lldb/source/API/{SBWatchpointLocation.cpp => SBWatchpoint.cpp} (69%) diff --git a/lldb/include/lldb/API/SBDefines.h b/lldb/include/lldb/API/SBDefines.h index 5731b91798c7..42642f9dcee7 100644 --- a/lldb/include/lldb/API/SBDefines.h +++ b/lldb/include/lldb/API/SBDefines.h @@ -63,7 +63,7 @@ class SBType; class SBTypeList; class SBValue; class SBValueList; -class SBWatchpointLocation; +class SBWatchpoint; } diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index 97155814747f..3b6b90f74d9f 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/include/lldb/API/SBError.h @@ -81,6 +81,7 @@ protected: friend class SBThread; friend class SBTarget; friend class SBValue; + friend class SBWatchpoint; lldb_private::Error * get(); diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h index 33ded973cef3..44e3a81185d9 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -77,7 +77,7 @@ protected: friend class SBTarget; friend class SBThread; friend class SBValue; - friend class SBWatchpointLocation; + friend class SBWatchpoint; #ifndef SWIG diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index 27f9022bb94e..a06d6a55d56f 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -16,7 +16,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpecList.h" #include "lldb/API/SBType.h" -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" namespace lldb { @@ -452,28 +452,28 @@ public: DeleteAllBreakpoints (); uint32_t - GetNumWatchpointLocations () const; + GetNumWatchpoints () const; - lldb::SBWatchpointLocation - GetLastCreatedWatchpointLocation (); - - lldb::SBWatchpointLocation - GetWatchpointLocationAtIndex (uint32_t idx) const; + lldb::SBWatchpoint + GetWatchpointAtIndex (uint32_t idx) const; bool - WatchpointLocationDelete (watch_id_t watch_id); + DeleteWatchpoint (lldb::watch_id_t watch_id); - lldb::SBWatchpointLocation - FindWatchpointLocationByID (watch_id_t watch_id); + lldb::SBWatchpoint + FindWatchpointByID (lldb::watch_id_t watch_id); + + lldb::SBWatchpoint + WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write); bool - EnableAllWatchpointLocations (); + EnableAllWatchpoints (); bool - DisableAllWatchpointLocations (); + DisableAllWatchpoints (); bool - DeleteAllWatchpointLocations (); + DeleteAllWatchpoints (); lldb::SBBroadcaster GetBroadcaster () const; diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 85607385b3c9..371dd70194e6 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -275,6 +275,58 @@ public: SBValue (const lldb::ValueObjectSP &value_sp); + //------------------------------------------------------------------ + /// Watch this value if it resides in memory. + /// + /// Sets a watchpoint on the value. + /// + /// @param[in] resolve_location + /// Resolve the location of this value once and watch its address. + /// This value must currently be set to \b true as watching all + /// locations of a variable or a variable path is not yet supported, + /// though we plan to support it in the future. + /// + /// @param[in] read + /// Stop when this value is accessed. + /// + /// @param[in] write + /// Stop when this value is modified + /// + /// @return + /// An SBWatchpoint object. This object might not be valid upon + /// return due to a value not being contained in memory, too + /// large, or watchpoint resources are not available or all in + /// use. + //------------------------------------------------------------------ + lldb::SBWatchpoint + Watch (bool resolve_location, bool read, bool write); + + //------------------------------------------------------------------ + /// Watch this value that this value points to in memory + /// + /// Sets a watchpoint on the value. + /// + /// @param[in] resolve_location + /// Resolve the location of this value once and watch its address. + /// This value must currently be set to \b true as watching all + /// locations of a variable or a variable path is not yet supported, + /// though we plan to support it in the future. + /// + /// @param[in] read + /// Stop when this value is accessed. + /// + /// @param[in] write + /// Stop when this value is modified + /// + /// @return + /// An SBWatchpoint object. This object might not be valid upon + /// return due to a value not being contained in memory, too + /// large, or watchpoint resources are not available or all in + /// use. + //------------------------------------------------------------------ + lldb::SBWatchpoint + WatchPointee (bool resolve_location, bool read, bool write); + #ifndef SWIG // this must be defined in the .h file because synthetic children as implemented in the core // currently rely on being able to extract the SharedPointer out of an SBValue. if the implementation diff --git a/lldb/include/lldb/API/SBWatchpointLocation.h b/lldb/include/lldb/API/SBWatchpoint.h similarity index 57% rename from lldb/include/lldb/API/SBWatchpointLocation.h rename to lldb/include/lldb/API/SBWatchpoint.h index 632ccd5369fa..16cebb963df9 100644 --- a/lldb/include/lldb/API/SBWatchpointLocation.h +++ b/lldb/include/lldb/API/SBWatchpoint.h @@ -1,4 +1,4 @@ -//===-- SBWatchpointLocation.h ----------------------------------*- C++ -*-===// +//===-- SBWatchpoint.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,43 +7,46 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_SBWatchpointLocation_h_ -#define LLDB_SBWatchpointLocation_h_ +#ifndef LLDB_SBWatchpoint_h_ +#define LLDB_SBWatchpoint_h_ #include "lldb/API/SBDefines.h" namespace lldb { -class SBWatchpointLocation +class SBWatchpoint { public: - SBWatchpointLocation (); + SBWatchpoint (); - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); + SBWatchpoint (const lldb::SBWatchpoint &rhs); - ~SBWatchpointLocation (); + ~SBWatchpoint (); #ifndef SWIG - const lldb::SBWatchpointLocation & - operator = (const lldb::SBWatchpointLocation &rhs); + const lldb::SBWatchpoint & + operator = (const lldb::SBWatchpoint &rhs); #endif + lldb::SBError + GetError (); + watch_id_t - GetID () const; + GetID (); bool IsValid() const; /// With -1 representing an invalid hardware index. int32_t - GetHardwareIndex () const; + GetHardwareIndex (); lldb::addr_t - GetWatchAddress () const; + GetWatchAddress (); size_t - GetWatchSize() const; + GetWatchSize(); void SetEnabled(bool enabled); @@ -52,7 +55,7 @@ public: IsEnabled (); uint32_t - GetHitCount () const; + GetHitCount (); uint32_t GetIgnoreCount (); @@ -64,7 +67,7 @@ public: GetDescription (lldb::SBStream &description, DescriptionLevel level); #ifndef SWIG - SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp); + SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp); #endif private: @@ -73,17 +76,14 @@ private: #ifndef SWIG lldb_private::WatchpointLocation * - operator->() const; + operator->(); lldb_private::WatchpointLocation * - get() const; + get(); lldb::WatchpointLocationSP & operator *(); - const lldb::WatchpointLocationSP & - operator *() const; - #endif lldb::WatchpointLocationSP m_opaque_sp; @@ -92,4 +92,4 @@ private: } // namespace lldb -#endif // LLDB_SBWatchpointLocation_h_ +#endif // LLDB_SBWatchpoint_h_ diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 3c646daf0490..50c8fcd97044 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -452,8 +452,8 @@ B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; }; B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; }; B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; }; - B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpointLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */; }; + B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1368,9 +1368,9 @@ B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = "<group>"; }; B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = "<group>"; }; B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = "<group>"; }; - B2A58721143119810092BFBA /* SBWatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBWatchpointLocation.h; path = include/lldb/API/SBWatchpointLocation.h; sourceTree = "<group>"; }; - B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBWatchpointLocation.cpp; path = source/API/SBWatchpointLocation.cpp; sourceTree = "<group>"; }; - B2A5872514313B480092BFBA /* SBWatchpointLocation.i */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = SBWatchpointLocation.i; sourceTree = "<group>"; }; + B2A58721143119810092BFBA /* SBWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBWatchpoint.h; path = include/lldb/API/SBWatchpoint.h; sourceTree = "<group>"; }; + B2A58723143119D50092BFBA /* SBWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBWatchpoint.cpp; path = source/API/SBWatchpoint.cpp; sourceTree = "<group>"; }; + B2A5872514313B480092BFBA /* SBWatchpoint.i */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = SBWatchpoint.i; sourceTree = "<group>"; }; B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -1732,7 +1732,7 @@ 2611FF11142D83060017FEA3 /* SBType.i */, 2611FF12142D83060017FEA3 /* SBValue.i */, 2611FF13142D83060017FEA3 /* SBValueList.i */, - B2A5872514313B480092BFBA /* SBWatchpointLocation.i */, + B2A5872514313B480092BFBA /* SBWatchpoint.i */, ); name = interface; path = scripts/Python/interface; @@ -1842,8 +1842,8 @@ 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */, 9A357582116CFDEE00E8ED2F /* SBValueList.h */, 9A35758D116CFE0F00E8ED2F /* SBValueList.cpp */, - B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */, - B2A58721143119810092BFBA /* SBWatchpointLocation.h */, + B2A58723143119D50092BFBA /* SBWatchpoint.cpp */, + B2A58721143119810092BFBA /* SBWatchpoint.h */, ); name = API; sourceTree = "<group>"; @@ -2882,7 +2882,7 @@ 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */, 4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */, 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */, - B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */, + B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3171,7 +3171,7 @@ 4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */, 4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */, 26B82840142D020F002DBC64 /* SBSection.cpp in Sources */, - B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */, + B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3577,6 +3577,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -3613,6 +3614,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( __STDC_CONSTANT_MACROS, @@ -3646,7 +3648,6 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -3661,7 +3662,6 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; INSTALL_PATH = /Developer/usr/bin; ONLY_ACTIVE_ARCH = NO; @@ -3673,7 +3673,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; INSTALL_PATH = /Developer/usr/bin; ONLY_ACTIVE_ARCH = NO; @@ -3687,7 +3686,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -3739,7 +3737,6 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -3826,7 +3823,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_CURRENT_VERSION = 80; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( @@ -3865,7 +3861,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_CURRENT_VERSION = 80; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( @@ -3904,6 +3899,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( __STDC_CONSTANT_MACROS, @@ -3938,7 +3934,6 @@ buildSettings = { COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3969,7 +3964,6 @@ COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -4047,7 +4041,6 @@ CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4096,7 +4089,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = dwarf; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4127,7 +4119,6 @@ buildSettings = { COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", diff --git a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme index 6e12c06c956d..387037908829 100644 --- a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme +++ b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme @@ -86,7 +86,7 @@ launchStyle = "0" useCustomWorkingDirectory = "NO" customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach" - buildConfiguration = "Debug" + buildConfiguration = "Release" ignoresPersistentStateOnLaunch = "YES" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index 69da019a0b50..d7191221a774 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -72,7 +72,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\ " ${SRC_ROOT}/include/lldb/API/SBType.h"\ " ${SRC_ROOT}/include/lldb/API/SBValue.h"\ " ${SRC_ROOT}/include/lldb/API/SBValueList.h"\ -" ${SRC_ROOT}/include/lldb/API/SBWatchpointLocation.h"\ +" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\ @@ -108,7 +108,7 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBType.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\ -" ${SRC_ROOT}/scripts/Python/interface/SBWatchpointLocation.i" +" ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i" if [ $Debug == 1 ] then diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i index f93128d2e192..9c628a621ffc 100644 --- a/lldb/scripts/Python/interface/SBTarget.i +++ b/lldb/scripts/Python/interface/SBTarget.i @@ -442,28 +442,32 @@ public: DeleteAllBreakpoints (); uint32_t - GetNumWatchpointLocations () const; - - lldb::SBWatchpointLocation - GetLastCreatedWatchpointLocation (); - - lldb::SBWatchpointLocation - GetWatchpointLocationAtIndex (uint32_t idx) const; - + GetNumWatchpoints () const; + + lldb::SBWatchpoint + GetWatchpointAtIndex (uint32_t idx) const; + bool - WatchpointLocationDelete (watch_id_t watch_id); - - lldb::SBWatchpointLocation - FindWatchpointLocationByID (watch_id_t watch_id); - + DeleteWatchpoint (lldb::watch_id_t watch_id); + + lldb::SBWatchpoint + FindWatchpointByID (lldb::watch_id_t watch_id); + bool - EnableAllWatchpointLocations (); - + EnableAllWatchpoints (); + bool - DisableAllWatchpointLocations (); - + DisableAllWatchpoints (); + bool - DeleteAllWatchpointLocations (); + DeleteAllWatchpoints (); + + lldb::SBWatchpoint + WatchAddress (lldb::addr_t addr, + size_t size, + bool read, + bool write); + lldb::SBBroadcaster GetBroadcaster () const; diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i index 8792464b2451..439e0abb7f72 100644 --- a/lldb/scripts/Python/interface/SBValue.i +++ b/lldb/scripts/Python/interface/SBValue.i @@ -278,6 +278,12 @@ public: lldb::SBFrame GetFrame(); + lldb::SBWatchpoint + Watch (bool resolve_location, bool read, bool write); + + lldb::SBWatchpoint + WatchPointee (bool resolve_location, bool read, bool write); + bool GetDescription (lldb::SBStream &description); diff --git a/lldb/scripts/Python/interface/SBWatchpointLocation.i b/lldb/scripts/Python/interface/SBWatchpoint.i similarity index 75% rename from lldb/scripts/Python/interface/SBWatchpointLocation.i rename to lldb/scripts/Python/interface/SBWatchpoint.i index a5e21ddb894c..5ddba459aaa8 100644 --- a/lldb/scripts/Python/interface/SBWatchpointLocation.i +++ b/lldb/scripts/Python/interface/SBWatchpoint.i @@ -1,4 +1,4 @@ -//===-- SWIG Interface for SBWatchpointLocation -----------------*- C++ -*-===// +//===-- SWIG Interface for SBWatchpoint -----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -18,22 +18,22 @@ settable options. See also SBTarget.watchpoint_location_iter() for for example usage of iterating through the watchpoint locations of the target." -) SBWatchpointLocation; -class SBWatchpointLocation +) SBWatchpoint; +class SBWatchpoint { public: - SBWatchpointLocation (); + SBWatchpoint (); - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); + SBWatchpoint (const lldb::SBWatchpoint &rhs); - ~SBWatchpointLocation (); + ~SBWatchpoint (); watch_id_t - GetID () const; + GetID (); bool - IsValid() const; + IsValid(); %feature("docstring", " //------------------------------------------------------------------ @@ -41,13 +41,13 @@ public: //------------------------------------------------------------------ ") GetHardwareIndex; int32_t - GetHardwareIndex () const; + GetHardwareIndex (); lldb::addr_t - GetWatchAddress () const; + GetWatchAddress (); size_t - GetWatchSize() const; + GetWatchSize(); void SetEnabled(bool enabled); @@ -56,7 +56,7 @@ public: IsEnabled (); uint32_t - GetHitCount () const; + GetHitCount (); uint32_t GetIgnoreCount (); diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py index 645d7de0d6b3..15f42a46009a 100644 --- a/lldb/scripts/Python/modify-python-lldb.py +++ b/lldb/scripts/Python/modify-python-lldb.py @@ -236,7 +236,7 @@ d = { 'SBBreakpoint': ('GetNumLocations', 'GetLocationAtIndex'), # e = { 'SBAddress': ['GetFileAddress', 'GetModule'], 'SBBreakpoint': ['GetID'], - 'SBWatchpointLocation': ['GetID'], + 'SBWatchpoint': ['GetID'], 'SBFileSpec': ['GetFilename', 'GetDirectory'], 'SBModule': ['GetFileSpec', 'GetUUIDString'], 'SBType': ['GetByteSize', 'GetName'] diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 5c302ba6f861..52ec68e46f18 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -160,8 +160,8 @@ return PyString_FromString (description.GetData()); } } -%extend lldb::SBWatchpointLocation { - PyObject *lldb::SBWatchpointLocation::__repr__ (){ +%extend lldb::SBWatchpoint { + PyObject *lldb::SBWatchpoint::__repr__ (){ lldb::SBStream description; $self->GetDescription (description, lldb::eDescriptionLevelVerbose); return PyString_FromString (description.GetData()); diff --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig index 1996aabb2ebe..a4218ccdc9ad 100644 --- a/lldb/scripts/lldb.swig +++ b/lldb/scripts/lldb.swig @@ -79,7 +79,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions #include "lldb/API/SBType.h" #include "lldb/API/SBValue.h" #include "lldb/API/SBValueList.h" -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" %} /* Various liblldb typedefs that SWIG needs to know about. */ @@ -132,7 +132,7 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions %include "./Python/interface/SBType.i" %include "./Python/interface/SBValue.i" %include "./Python/interface/SBValueList.i" -%include "./Python/interface/SBWatchpointLocation.i" +%include "./Python/interface/SBWatchpoint.i" %include "./Python/python-extensions.swig" diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 64af22a721eb..3cdfe1d23e5c 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -883,7 +883,7 @@ SBTarget::DeleteAllBreakpoints () } uint32_t -SBTarget::GetNumWatchpointLocations () const +SBTarget::GetNumWatchpoints () const { if (m_opaque_sp) { @@ -893,31 +893,10 @@ SBTarget::GetNumWatchpointLocations () const return 0; } -SBWatchpointLocation -SBTarget::GetLastCreatedWatchpointLocation () +SBWatchpoint +SBTarget::GetWatchpointAtIndex (uint32_t idx) const { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - - SBWatchpointLocation sb_watchpoint_location; - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - sb_watchpoint_location = m_opaque_sp->GetLastCreatedWatchpointLocation(); - } - - if (log) - { - log->Printf ("SBTarget(%p)::GetLastCreateWatchpointLocation () => SBWatchpointLocation(%p)", - m_opaque_sp.get(), sb_watchpoint_location.get()); - } - - return sb_watchpoint_location; -} - -SBWatchpointLocation -SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const -{ - SBWatchpointLocation sb_watchpoint_location; + SBWatchpoint sb_watchpoint_location; if (m_opaque_sp) { // The watchpoint location list is thread safe, no need to lock @@ -927,7 +906,7 @@ SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const } bool -SBTarget::WatchpointLocationDelete (watch_id_t wp_id) +SBTarget::DeleteWatchpoint (watch_id_t wp_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -946,29 +925,51 @@ SBTarget::WatchpointLocationDelete (watch_id_t wp_id) return result; } -SBWatchpointLocation -SBTarget::FindWatchpointLocationByID (watch_id_t wp_id) +SBWatchpoint +SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - SBWatchpointLocation sb_watchpoint_location; + SBWatchpoint sb_watchpoint; if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + *sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); } if (log) { - log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpointLocation(%p)", - m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint_location.get()); + log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpoint(%p)", + m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint.get()); } - return sb_watchpoint_location; + return sb_watchpoint; +} + +lldb::SBWatchpoint +SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write) +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBWatchpoint sb_watchpoint; + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + // TODO: Johnny fill this in + //*sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + } + + if (log) + { + log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)", + m_opaque_sp.get(), addr, (uint32_t) size, sb_watchpoint.get()); + } + + return sb_watchpoint; } bool -SBTarget::EnableAllWatchpointLocations () +SBTarget::EnableAllWatchpoints () { if (m_opaque_sp) { @@ -980,7 +981,7 @@ SBTarget::EnableAllWatchpointLocations () } bool -SBTarget::DisableAllWatchpointLocations () +SBTarget::DisableAllWatchpoints () { if (m_opaque_sp) { @@ -992,7 +993,7 @@ SBTarget::DisableAllWatchpointLocations () } bool -SBTarget::DeleteAllWatchpointLocations () +SBTarget::DeleteAllWatchpoints () { if (m_opaque_sp) { diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 37a524495e70..8afd5641201c 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -1097,3 +1097,31 @@ SBValue::GetData () return sb_data; } + +lldb::SBWatchpoint +SBValue::Watch (bool resolve_location, bool read, bool write) +{ + lldb::SBWatchpoint sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); + if (target) + { + Mutex::Locker api_locker (target->GetAPIMutex()); + // TODO: Johnny fill this in + } + return sb_watchpoint; +} + +lldb::SBWatchpoint +SBValue::WatchPointee (bool resolve_location, bool read, bool write) +{ + lldb::SBWatchpoint sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); + if (target) + { + Mutex::Locker api_locker (target->GetAPIMutex()); + // TODO: Johnny fill this in + } + return sb_watchpoint; +} + + diff --git a/lldb/source/API/SBWatchpointLocation.cpp b/lldb/source/API/SBWatchpoint.cpp similarity index 69% rename from lldb/source/API/SBWatchpointLocation.cpp rename to lldb/source/API/SBWatchpoint.cpp index 33b035ff11fc..a921ea120f53 100644 --- a/lldb/source/API/SBWatchpointLocation.cpp +++ b/lldb/source/API/SBWatchpoint.cpp @@ -1,4 +1,4 @@ -//===-- SBWatchpointLocation.cpp --------------------------------*- C++ -*-===// +//===-- SBWatchpoint.cpp --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBDebugger.h" @@ -26,12 +26,12 @@ using namespace lldb; using namespace lldb_private; -SBWatchpointLocation::SBWatchpointLocation () : +SBWatchpoint::SBWatchpoint () : m_opaque_sp () { } -SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp) : +SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp) : m_opaque_sp (watch_loc_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -40,18 +40,18 @@ SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationSP &wa { SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationsSP &watch_loc_sp" + log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationsSP &watch_loc_sp" "=%p) => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } -SBWatchpointLocation::SBWatchpointLocation(const SBWatchpointLocation &rhs) : +SBWatchpoint::SBWatchpoint(const SBWatchpoint &rhs) : m_opaque_sp (rhs.m_opaque_sp) { } -const SBWatchpointLocation & -SBWatchpointLocation::operator = (const SBWatchpointLocation &rhs) +const SBWatchpoint & +SBWatchpoint::operator = (const SBWatchpoint &rhs) { if (this != &rhs) m_opaque_sp = rhs.m_opaque_sp; @@ -59,12 +59,12 @@ SBWatchpointLocation::operator = (const SBWatchpointLocation &rhs) } -SBWatchpointLocation::~SBWatchpointLocation () +SBWatchpoint::~SBWatchpoint () { } watch_id_t -SBWatchpointLocation::GetID () const +SBWatchpoint::GetID () { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -75,22 +75,41 @@ SBWatchpointLocation::GetID () const if (log) { if (watch_id == LLDB_INVALID_WATCH_ID) - log->Printf ("SBWatchpointLocation(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get()); + log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get()); else - log->Printf ("SBWatchpointLocation(%p)::GetID () => %u", m_opaque_sp.get(), watch_id); + log->Printf ("SBWatchpoint(%p)::GetID () => %u", m_opaque_sp.get(), watch_id); } return watch_id; } bool -SBWatchpointLocation::IsValid() const +SBWatchpoint::IsValid() const { return m_opaque_sp.get() != NULL; +#if 0 + if (m_opaque_sp) + return m_opaque_sp->GetError().Success(); + return false; +#endif +} + +SBError +SBWatchpoint::GetError () +{ + SBError sb_error; +#if 0 + if (m_opaque_sp) + { + // TODO: Johnny fill this in + sb_error.ref() = m_opaque_sp->GetError(); + } +#endif + return sb_error; } int32_t -SBWatchpointLocation::GetHardwareIndex () const +SBWatchpoint::GetHardwareIndex () { int32_t hw_index = -1; @@ -104,7 +123,7 @@ SBWatchpointLocation::GetHardwareIndex () const } addr_t -SBWatchpointLocation::GetWatchAddress () const +SBWatchpoint::GetWatchAddress () { addr_t ret_addr = LLDB_INVALID_ADDRESS; @@ -118,7 +137,7 @@ SBWatchpointLocation::GetWatchAddress () const } size_t -SBWatchpointLocation::GetWatchSize () const +SBWatchpoint::GetWatchSize () { size_t watch_size = 0; @@ -132,7 +151,7 @@ SBWatchpointLocation::GetWatchSize () const } void -SBWatchpointLocation::SetEnabled (bool enabled) +SBWatchpoint::SetEnabled (bool enabled) { if (m_opaque_sp) { @@ -142,7 +161,7 @@ SBWatchpointLocation::SetEnabled (bool enabled) } bool -SBWatchpointLocation::IsEnabled () +SBWatchpoint::IsEnabled () { if (m_opaque_sp) { @@ -154,7 +173,7 @@ SBWatchpointLocation::IsEnabled () } uint32_t -SBWatchpointLocation::GetHitCount () const +SBWatchpoint::GetHitCount () { uint32_t count = 0; if (m_opaque_sp) @@ -165,13 +184,13 @@ SBWatchpointLocation::GetHitCount () const LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBWatchpointLocation(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); + log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); return count; } uint32_t -SBWatchpointLocation::GetIgnoreCount () +SBWatchpoint::GetIgnoreCount () { if (m_opaque_sp) { @@ -183,7 +202,7 @@ SBWatchpointLocation::GetIgnoreCount () } void -SBWatchpointLocation::SetIgnoreCount (uint32_t n) +SBWatchpoint::SetIgnoreCount (uint32_t n) { if (m_opaque_sp) { @@ -193,7 +212,7 @@ SBWatchpointLocation::SetIgnoreCount (uint32_t n) } bool -SBWatchpointLocation::GetDescription (SBStream &description, DescriptionLevel level) +SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level) { if (m_opaque_sp) { @@ -209,26 +228,19 @@ SBWatchpointLocation::GetDescription (SBStream &description, DescriptionLevel le } lldb_private::WatchpointLocation * -SBWatchpointLocation::operator->() const +SBWatchpoint::operator->() { return m_opaque_sp.get(); } lldb_private::WatchpointLocation * -SBWatchpointLocation::get() const +SBWatchpoint::get() { return m_opaque_sp.get(); } lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() +SBWatchpoint::operator *() { return m_opaque_sp; } - -const lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() const -{ - return m_opaque_sp; -} -