[Lldb-commits] [lldb] r251240 - Add lldb/unittests files to the Xcode lldb project.

2015-10-25 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Sun Oct 25 11:22:46 2015
New Revision: 251240

URL: http://llvm.org/viewvc/llvm-project?rev=251240&view=rev
Log:
Add lldb/unittests files to the Xcode lldb project.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=251240&r1=251239&r2=251240&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Oct 25 11:22:46 2015
@@ -1103,6 +1103,19 @@
23059A0F1958B319007B8189 /* SBUnixSignals.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBUnixSignals.cpp; path = source/API/SBUnixSignals.cpp; sourceTree = 
""; };
23059A111958B37B007B8189 /* SBUnixSignals.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBUnixSignals.h; 
path = include/lldb/API/SBUnixSignals.h; sourceTree = ""; };
23173F8B192BA93F005C708F /* lldb-x86-register-enums.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name 
= "lldb-x86-register-enums.h"; path = "Utility/lldb-x86-register-enums.h"; 
sourceTree = ""; };
+   2321F9381BDD332400BA9A93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = 
""; };
+   2321F9391BDD332400BA9A93 /* SocketAddressTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
SocketAddressTest.cpp; sourceTree = ""; };
+   2321F93A1BDD332400BA9A93 /* SocketTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
SocketTest.cpp; sourceTree = ""; };
+   2321F93B1BDD332400BA9A93 /* SymbolsTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
SymbolsTest.cpp; sourceTree = ""; };
+   2321F93D1BDD33CE00BA9A93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = 
""; };
+   2321F93E1BDD33CE00BA9A93 /* TestArgs.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TestArgs.cpp; 
sourceTree = ""; };
+   2321F9401BDD340D00BA9A93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = 
""; };
+   2321F9431BDD346100BA9A93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
+   2321F9441BDD346100BA9A93 /* StringExtractorTest.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = StringExtractorTest.cpp; sourceTree = ""; };
+   2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = TaskPoolTest.cpp; sourceTree = ""; };
+   2321F9461BDD346100BA9A93 /* UriParserTest.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = UriParserTest.cpp; sourceTree = ""; };
+   2321F94C1BDD360F00BA9A93 /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
+   2321F94D1BDD360F00BA9A93 /* PythonDataObjectsTests.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = PythonDataObjectsTests.cpp; sourceTree = ""; 
};
232CB60B191E00CC00EF39FC /* NativeBreakpoint.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = NativeBreakpoint.cpp; path = source/Host/common/NativeBreakpoint.cpp; 
sourceTree = ""; };
232CB60D191E00CC00EF39FC /* NativeBreakpointList.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = NativeBreakpointList.cpp; path = 
source/Host/common/NativeBreakpointList.cpp; sourceTree = ""; };
232CB60F191E00CC00EF39FC /* NativeProcessProtocol.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
lineEnding = 0; name = NativeProcessProtocol.cpp; path = 
source/Host/common/NativeProcessProtocol.cpp; sourceTree = ""; 
xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
@@ -2853,6 +2866,7 @@
26F5C22410F3D950009D5894 /* Tools */,
2690CD181A6DC0D000E717C8 /* lldb-mi */,
1AB674ADFE9D54B511CA2CBB /* Products */,
+   2321F9331BDD326500BA9A93 /* unittests */,
);
name = lldb;
sourceTree = "";
@@ -29

[Lldb-commits] [lldb] r251243 - Added some top-level unittests files that I missed in the last check-in.

2015-10-25 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Sun Oct 25 11:53:08 2015
New Revision: 251243

URL: http://llvm.org/viewvc/llvm-project?rev=251243&view=rev
Log:
Added some top-level unittests files that I missed in the last check-in.

I am also letting a debugserver-related project entry slide in
since Xcode seems to insist on inserting it, and when I remove it
the new files don't show up.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=251243&r1=251242&r2=251243&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Oct 25 11:53:08 2015
@@ -912,6 +912,13 @@
remoteGlobalIDString = 235AFBB5199BC6AD00897A4B;
remoteInfo = Linux;
};
+   239504C41BDD3FD700963CEA /* PBXContainerItemProxy */ = {
+   isa = PBXContainerItemProxy;
+   containerPortal = 265E9BE1115C2BAA00D0DCCB /* 
debugserver.xcodeproj */;
+   proxyType = 2;
+   remoteGlobalIDString = 456F67721AD46CE9002850C2;
+   remoteInfo = "debugserver-mini";
+   };
262CFC7111A450CB00946C6C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 265E9BE1115C2BAA00D0DCCB /* 
debugserver.xcodeproj */;
@@ -1141,6 +1148,8 @@
236124A71986B50E004EFC37 /* Socket.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Socket.h; path = 
include/lldb/Host/Socket.h; sourceTree = ""; };
2377C2F719E613C100737875 /* PipePosix.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = PipePosix.cpp; sourceTree = ""; };
237C577A19AF9D9F00213D59 /* HostInfoLinux.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HostInfoLinux.h; 
path = include/lldb/Host/linux/HostInfoLinux.h; sourceTree = SOURCE_ROOT; };
+   239504C21BDD3FD600963CEA /* gtest_common.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gtest_common.h; 
sourceTree = ""; };
+   239504C61BDD3FF300963CEA /* CMakeLists.txt */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 
CMakeLists.txt; sourceTree = ""; };
23AB052D199FF639003B8084 /* FreeBSDThread.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
FreeBSDThread.cpp; sourceTree = ""; };
23AB052E199FF639003B8084 /* FreeBSDThread.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FreeBSDThread.h; 
sourceTree = ""; };
23AB052F199FF639003B8084 /* ProcessFreeBSD.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
ProcessFreeBSD.cpp; sourceTree = ""; };
@@ -2924,6 +2933,8 @@
2321F9331BDD326500BA9A93 /* unittests */ = {
isa = PBXGroup;
children = (
+   239504C61BDD3FF300963CEA /* CMakeLists.txt */,
+   239504C21BDD3FD600963CEA /* gtest_common.h */,
2321F9371BDD32ED00BA9A93 /* Host */,
2321F93C1BDD339A00BA9A93 /* Interpreter */,
2321F93F1BDD33D800BA9A93 /* ScriptInterpreter 
*/,
@@ -3578,6 +3589,7 @@
isa = PBXGroup;
children = (
26CE05A0115C31E50022F371 /* debugserver */,
+   239504C51BDD3FD700963CEA /* debugserver */,
);
name = Products;
sourceTree = "";
@@ -5931,6 +5943,13 @@
 /* End PBXProject section */
 
 /* Begin PBXReferenceProxy section */
+   239504C51BDD3FD700963CEA /* debugserver */ = {
+   isa = PBXReferenceProxy;
+   fileType = "compiled.mach-o.executable";
+   path = debugserver;
+   remoteRef = 239504C41BDD3FD700963CEA /* 
PBXContainerItemProxy */;
+   sourceTree = BUILT_PRODUCTS_DIR;
+   };
26CE05A0115C31E50022F371 /* debugserver */ = {
isa = PBXReferenceProxy;
fileType = "compiled.mach-o.executable";


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r251261 - Xcode: added lldb-gtest target to build and run the gtests in the unittests directory.

2015-10-25 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Sun Oct 25 16:42:35 2015
New Revision: 251261

URL: http://llvm.org/viewvc/llvm-project?rev=251261&view=rev
Log:
Xcode: added lldb-gtest target to build and run the gtests in the unittests 
directory.

Also added a placeholder Editline gtest for some code that I'll add as soon
as I make sure this addition doesn't break any of the build bots.

This change also introduces some Xcode user-defined variables that I've used
to attempt to isolate the way Python is integrated into the build.  I don't have
the rest of LLDB using it yet, I'm using the gtests as my guinea pig on that.
Currently these are:
PYTHON_FRAMEWORK_PATH
PYTHON_VERSION_MAJOR
PYTHON_VERSION_MINOR

I will convert the rest over to it after this gets a little time to bake
and any kinks are worked out of it.

Added:
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-gtest.xcscheme
lldb/trunk/unittests/Editline/
lldb/trunk/unittests/Editline/CMakeLists.txt
lldb/trunk/unittests/Editline/EditlineTest.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=251261&r1=251260&r2=251261&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Oct 25 16:42:35 2015
@@ -68,6 +68,12 @@
23059A0719532B96007B8189 /* LinuxSignals.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23059A0519532B96007B8189 /* LinuxSignals.cpp */; 
};
23059A101958B319007B8189 /* SBUnixSignals.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23059A0F1958B319007B8189 /* SBUnixSignals.cpp 
*/; };
23059A121958B3B2007B8189 /* SBUnixSignals.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 23059A111958B37B007B8189 /* SBUnixSignals.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
+   2326CF441BDD643700A5CEAC /* liblldb-core.a in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2689FFCA13353D7A00698AC0 /* liblldb-core.a */; };
+   2326CF491BDD67D800A5CEAC /* libncurses.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2326CF471BDD67C100A5CEAC /* libncurses.dylib */; 
};
+   2326CF4B1BDD681800A5CEAC /* libz.dylib in Frameworks */ = {isa 
= PBXBuildFile; fileRef = 2326CF4A1BDD681800A5CEAC /* libz.dylib */; };
+   2326CF4D1BDD684B00A5CEAC /* libedit.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2326CF4C1BDD684B00A5CEAC /* libedit.dylib */; };
+   2326CF4F1BDD687800A5CEAC /* libpanel.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 2326CF4E1BDD687800A5CEAC /* libpanel.dylib */; };
+   2326CF521BDD693B00A5CEAC /* EditlineTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2326CF511BDD693B00A5CEAC /* EditlineTest.cpp */; 
};
232CB615191E00CD00EF39FC /* NativeBreakpoint.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 232CB60B191E00CC00EF39FC /* 
NativeBreakpoint.cpp */; };
232CB617191E00CD00EF39FC /* NativeBreakpointList.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 232CB60D191E00CC00EF39FC /* 
NativeBreakpointList.cpp */; };
232CB619191E00CD00EF39FC /* NativeProcessProtocol.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 232CB60F191E00CC00EF39FC /* 
NativeProcessProtocol.cpp */; };
@@ -78,6 +84,14 @@
236124A41986B4E2004EFC37 /* IOObject.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 236124A21986B4E2004EFC37 /* IOObject.cpp */; };
236124A51986B4E2004EFC37 /* Socket.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 236124A31986B4E2004EFC37 /* Socket.cpp */; };
2377C2F819E613C100737875 /* PipePosix.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 2377C2F719E613C100737875 /* PipePosix.cpp */; };
+   239504DE1BDD453200963CEA /* SocketAddressTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 2321F9391BDD332400BA9A93 /* 
SocketAddressTest.cpp */; };
+   239504DF1BDD453200963CEA /* SocketTest.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 2321F93A1BDD332400BA9A93 /* SocketTest.cpp */; };
+   239504E01BDD453200963CEA /* SymbolsTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2321F93B1BDD332400BA9A93 /* SymbolsTest.cpp */; 
};
+   239504E11BDD453E00963CEA /* TestArgs.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 2321F93E1BDD33CE00BA9A93 /* TestArgs.cpp */; };
+   239504E21BDD454500963CEA /* PythonDataObjectsTests.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 2321F94D1BDD360F00BA9A93 /* 
PythonDataObjectsTests.cpp */; };
+   239504E31BDD454B00963CEA /* StringExtractorTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2321F9441BDD346100BA9A93 /* 
StringExtractorTest.cpp */; };

[Lldb-commits] [lldb] r251264 - Fix a copy-and-paste error on new Editline test cmake configuration.

2015-10-25 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Sun Oct 25 16:54:56 2015
New Revision: 251264

URL: http://llvm.org/viewvc/llvm-project?rev=251264&view=rev
Log:
Fix a copy-and-paste error on new Editline test cmake configuration.

Modified:
lldb/trunk/unittests/Editline/CMakeLists.txt

Modified: lldb/trunk/unittests/Editline/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/CMakeLists.txt?rev=251264&r1=251263&r2=251264&view=diff
==
--- lldb/trunk/unittests/Editline/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Editline/CMakeLists.txt Sun Oct 25 16:54:56 2015
@@ -1,3 +1,3 @@
-add_lldb_unittest(HostTests
+add_lldb_unittest(EditlineTests
   EditlineTest.cpp
   )


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r251269 - Corrects return values and typos in Arm watchpoint code

2015-10-25 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Sun Oct 25 18:18:35 2015
New Revision: 251269

URL: http://llvm.org/viewvc/llvm-project?rev=251269&view=rev
Log:
Corrects return values and typos in Arm watchpoint code

This is just a trivial patch that corrects a couple of return value account to 
function's return type.
Also corrects typo in hardware breakpoint handler.


Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp?rev=251269&r1=251268&r2=251269&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp 
Sun Oct 25 18:18:35 2015
@@ -440,7 +440,7 @@ NativeRegisterContextLinux_arm::SetHardw
  if (bp_index == LLDB_INVALID_INDEX32)
  return LLDB_INVALID_INDEX32;
 
-// Add new or update existing watchpoint
+// Add new or update existing breakpoint
 if ((m_hbr_regs[bp_index].control & 1) == 0)
 {
 m_hbr_regs[bp_index].address = addr;
@@ -473,7 +473,7 @@ NativeRegisterContextLinux_arm::ClearHar
 error = ReadHardwareDebugInfo ();
 
 if (error.Fail())
-return LLDB_INVALID_INDEX32;
+return false;
 
 if (hw_idx >= m_max_hbp_supported)
 return false;
@@ -494,7 +494,7 @@ NativeRegisterContextLinux_arm::ClearHar
 WriteHardwareDebugRegs(eDREGTypeBREAK, hw_idx);
 
 if (error.Fail())
-return LLDB_INVALID_INDEX32;
+return false;
 
 return true;
 }
@@ -636,7 +636,7 @@ NativeRegisterContextLinux_arm::ClearHar
 error = ReadHardwareDebugInfo ();
 
 if (error.Fail())
-return LLDB_INVALID_INDEX32;
+return false;
 
 if (wp_index >= m_max_hwp_supported)
 return false;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14051: Fix for Arm watchpoint cache corruption in case of ptrace failure

2015-10-25 Thread Muhammad Omair Javaid via lldb-commits
omjavaid created this revision.
omjavaid added reviewers: tberghammer, clayborg.
omjavaid added a subscriber: lldb-commits.
Herald added subscribers: rengolin, aemerson.

Arm watchpoint handlers incorrectly updates watchpoint cache incase we have a 
ptrace failures.

This patch fixes this issue by reverting the cache to its previous state in 
case of a ptrace failure.

http://reviews.llvm.org/D14051

Files:
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -451,7 +451,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeBREAK, bp_index);
 
 if (error.Fail())
+{
+m_hbr_regs[bp_index].address = 0;
+m_hbr_regs[bp_index].control &= ~1;
+m_hbr_regs[bp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hbr_regs[bp_index].refcount++;
@@ -486,15 +492,26 @@
 }
 else if (m_hbr_regs[hw_idx].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hbr_regs[hw_idx].address;
+uint32_t tempControl = m_hbr_regs[hw_idx].control;
+uint32_t tempRefCount = m_hbr_regs[hw_idx].refcount;
+
 m_hbr_regs[hw_idx].control &= ~1;
 m_hbr_regs[hw_idx].address = 0;
 m_hbr_regs[hw_idx].refcount = 0;
 
 // PTRACE call to clear corresponding hardware breakpoint register.
 WriteHardwareDebugRegs(eDREGTypeBREAK, hw_idx);
 
 if (error.Fail())
-return LLDB_INVALID_INDEX32;
+{
+m_hbr_regs[hw_idx].control = tempControl;
+m_hbr_regs[hw_idx].address = tempAddr;
+m_hbr_regs[hw_idx].refcount = tempRefCount;
+
+return false;
+}
 
 return true;
 }
@@ -614,7 +631,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].address = 0;
+m_hwp_regs[wp_index].control &= ~1;
+m_hwp_regs[wp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hwp_regs[wp_index].refcount++;
@@ -649,6 +672,11 @@
 }
 else if (m_hwp_regs[wp_index].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
+uint32_t tempControl = m_hwp_regs[wp_index].control;
+uint32_t tempRefCount = m_hwp_regs[wp_index].refcount;
+
 // Update watchpoint in local cache
 m_hwp_regs[wp_index].control &= ~1;
 m_hwp_regs[wp_index].address = 0;
@@ -658,7 +686,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].control = tempControl;
+m_hwp_regs[wp_index].address = tempAddr;
+m_hwp_regs[wp_index].refcount = tempRefCount;
+
 return false;
+}
 
 return true;
 }
@@ -682,10 +716,18 @@
 if (error.Fail())
 return error;
 
+lldb::addr_t tempAddr = 0;
+uint32_t tempControl = 0, tempRefCount = 0;
+
 for (uint32_t i = 0; i < m_max_hwp_supported; i++)
 {
 if (m_hwp_regs[i].control & 0x01)
 {
+// Create a backup we can revert to in case of failure.
+tempAddr = m_hwp_regs[i].address;
+tempControl = m_hwp_regs[i].control;
+tempRefCount = m_hwp_regs[i].refcount;
+
 // Clear watchpoints in local cache
 m_hwp_regs[i].control &= ~1;
 m_hwp_regs[i].address = 0;
@@ -695,7 +737,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, i);
 
 if (error.Fail())
+{
+m_hwp_regs[i].control = tempControl;
+m_hwp_regs[i].address = tempAddr;
+m_hwp_regs[i].refcount = tempRefCount;
+
 return error;
+}
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits