[Lldb-commits] [lldb] r360482 - Change the disabling of packet logging to be in TearDownHook lambdas.

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 16:22:15 PDT 2019


Author: jmolenda
Date: Fri May 10 16:22:15 2019
New Revision: 360482

URL: http://llvm.org/viewvc/llvm-project?rev=360482&view=rev
Log:
Change the disabling of packet logging to be in TearDownHook lambdas.


Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py?rev=360482&r1=360481&r2=360482&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py Fri May 10 16:22:15 2019
@@ -110,6 +110,9 @@ class TestArmRegisterDefinition(GDBRemot
         self.server.responder = MyResponder()
         if self.TraceOn():
             self.runCmd("log enable gdb-remote packets")
+            self.addTearDownHook(
+                    lambda: self.runCmd("log disable gdb-remote packets"))
+
         self.dbg.SetDefaultArchitecture("armv7em")
         target = self.dbg.CreateTargetWithFileAndArch(None, None)
 
@@ -126,6 +129,3 @@ class TestArmRegisterDefinition(GDBRemot
 
         pc_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("pc")
         self.assertEqual(pc_valobj.GetValueAsUnsigned(), 0x0800d22e)
-
-        if self.TraceOn():
-            self.runCmd("log disable gdb-remote packets")

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py?rev=360482&r1=360481&r2=360482&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py Fri May 10 16:22:15 2019
@@ -41,6 +41,8 @@ class TestNoWatchpointSupportInfo(GDBRem
         self.server.responder = MyResponder()
         if self.TraceOn():
             self.runCmd("log enable gdb-remote packets")
+            self.addTearDownHook(
+                lambda: self.runCmd("log disable gdb-remote packets"))
         self.dbg.SetDefaultArchitecture("x86_64")
         target = self.dbg.CreateTargetWithFileAndArch(None, None)
 
@@ -61,6 +63,3 @@ class TestNoWatchpointSupportInfo(GDBRem
             print("watchpoint failed: %s" % strm.GetData())
         self.assertTrue(wp.IsValid())
 
-        if self.TraceOn():
-            self.runCmd("log disable gdb-remote packets")
-

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py?rev=360482&r1=360481&r2=360482&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py Fri May 10 16:22:15 2019
@@ -35,6 +35,8 @@ class TestStopPCs(GDBRemoteTestBase):
         target = self.dbg.CreateTarget('')
         if self.TraceOn():
           self.runCmd("log enable gdb-remote packets")
+          self.addTearDownHook(
+                lambda: self.runCmd("log disable gdb-remote packets"))
         process = self.connect(target)
 
         self.assertEqual(process.GetNumThreads(), 2)
@@ -44,6 +46,3 @@ class TestStopPCs(GDBRemoteTestBase):
         self.assertEqual(th1.GetThreadID(), 0x2ff0d)
         self.assertEqual(th0.GetFrameAtIndex(0).GetPC(), 0x10001bc00)
         self.assertEqual(th1.GetFrameAtIndex(0).GetPC(), 0x10002bc00)
-
-        if self.TraceOn():
-          self.runCmd("log disable gdb-remote packets")

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=360482&r1=360481&r2=360482&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py Fri May 10 16:22:15 2019
@@ -115,6 +115,8 @@ class TestTargetXMLArch(GDBRemoteTestBas
         result = lldb.SBCommandReturnObject()
         if self.TraceOn():
             self.runCmd("log enable gdb-remote packets")
+            self.addTearDownHook(
+                    lambda: self.runCmd("log disable gdb-remote packets"))
 
         target = self.dbg.CreateTarget('')
         self.assertEqual('', target.GetTriple())
@@ -123,6 +125,3 @@ class TestTargetXMLArch(GDBRemoteTestBas
             interp.HandleCommand("target list", result)
             print(result.GetOutput())
         self.assertTrue(target.GetTriple().startswith('x86_64-unknown-unknown'))
-
-        if self.TraceOn():
-            self.runCmd("log disable gdb-remote packets")




More information about the lldb-commits mailing list