[Lldb-commits] [lldb] r162378 - in /lldb/trunk/examples/test: .lldb-loggings tmp/ tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt usage-lldb-loggings

Johnny Chen johnny.chen at apple.com
Wed Aug 22 11:48:13 PDT 2012


Author: johnny
Date: Wed Aug 22 13:48:13 2012
New Revision: 162378

URL: http://llvm.org/viewvc/llvm-project?rev=162378&view=rev
Log:
Demonstrate how to use the config file and the pre-flight functionality to route the lldb gdb-remote log messages
into individually named log destinations.  In the simple usage-lldb-loggings example, we ran two cases which resulted
in two lldb_log files.

Added:
    lldb/trunk/examples/test/.lldb-loggings
    lldb/trunk/examples/test/tmp/
    lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
    lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
    lldb/trunk/examples/test/usage-lldb-loggings

Added: lldb/trunk/examples/test/.lldb-loggings
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/.lldb-loggings?rev=162378&view=auto
==============================================================================
--- lldb/trunk/examples/test/.lldb-loggings (added)
+++ lldb/trunk/examples/test/.lldb-loggings Wed Aug 22 13:48:13 2012
@@ -0,0 +1,16 @@
+def pre_flight(self):
+    import os
+    import lldb
+    import lldbtest
+
+    dest = os.path.join("/tmp", "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id()))
+    print "\nEnabling lldb logging for test case:", self
+    print "with log destination:", dest
+    self.runCmd("log enable -f %s gdb-remote packets process" % dest)
+
+#def post_flight(test):
+#    __import__("lldb")
+#    __import__("lldbtest")
+#    print "\nRunning post-flight function:"
+#    print "for test case:", test
+

Added: lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt?rev=162378&view=auto
==============================================================================
--- lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt (added)
+++ lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt Wed Aug 22 13:48:13 2012
@@ -0,0 +1,55 @@
+com.apple.main-thread /Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver arguments:
+argv[0]="/Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver"
+argv[1]="localhost:14953"
+argv[2]="--native-regs"
+argv[3]="--setsid"
+argv[4]=NULL
+
+
+com.apple.main-thread Host::LaunchProcess (launch_info) => pid=55237, path='/Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver' err = 0x00000000
+com.apple.main-thread ProcessGDBRemote::StartAsyncThread ()
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc1883400, pid = 0) thread starting...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc1883400, pid = 0) listener.WaitForEvent (NULL, event_sp)...
+com.apple.main-thread <   1> send packet: +
+com.apple.main-thread history[1] tid=0x1307 <   1> send packet: +
+com.apple.main-thread <  19> send packet: $QStartNoAckMode#b0
+com.apple.main-thread <   1> read packet: +
+com.apple.main-thread <   6> read packet: $OK#9a
+com.apple.main-thread <   1> send packet: +
+com.apple.main-thread <  26> send packet: $QThreadSuffixSupported#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  27> send packet: $QListThreadsInStopReply#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  13> send packet: $qHostInfo#00
+com.apple.main-thread < 122> read packet: $cputype:16777223;cpusubtype:3;ostype:macosx;watchpoint_exceptions_received:after;vendor:apple;endian:little;ptrsize:8;#00
+com.apple.main-thread <  10> send packet: $vCont?#00
+com.apple.main-thread <  17> read packet: $vCont;c;C;s;S#00
+com.apple.main-thread <  27> send packet: $qVAttachOrWaitSupported#00
+com.apple.main-thread <   6> read packet: $OK#00
+
+...
+
+com.apple.main-thread ProcessGDBRemote::DoDestroy()
+com.apple.main-thread <   5> send packet: $k#00
+com.apple.main-thread error: failed to get response for 'k'
+com.apple.main-thread ProcessGDBRemote::DoDestroy - failed to send k packet
+com.apple.main-thread ProcessGDBRemote::StopAsyncThread ()
+ ProcessGDBRemote::AsyncThread (arg = 0x7fabc185e200, pid = 55239) Got an event of type: 2...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc185e200, pid = 55239) got eBroadcastBitAsyncThreadShouldExit...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc185e200, pid = 55239) thread exiting...
+com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fabc185e200, pid=55240, signo=2 (0x2), exit_status=-1)
+com.apple.main-thread <  18> send packet: $z0,100000e37,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  21> send packet: $z0,7fff5fc0d6e5,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  21> send packet: $z0,7fff8b132187,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread ProcessGDBRemote::DoDestroy()
+com.apple.main-thread <   5> send packet: $k#00
+com.apple.main-thread error: failed to get response for 'k'
+com.apple.main-thread ProcessGDBRemote::DoDestroy - failed to send k packet
+com.apple.main-thread ProcessGDBRemote::StopAsyncThread ()
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc18f8600, pid = 55243) Got an event of type: 2...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc18f8600, pid = 55243) got eBroadcastBitAsyncThreadShouldExit...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc18f8600, pid = 55243) thread exiting...
+com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fabc18f8600, pid=55244, signo=2 (0x2), exit_status=-1)

Added: lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt?rev=162378&view=auto
==============================================================================
--- lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt (added)
+++ lldb/trunk/examples/test/tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt Wed Aug 22 13:48:13 2012
@@ -0,0 +1,55 @@
+com.apple.main-thread /Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver arguments:
+argv[0]="/Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver"
+argv[1]="localhost:33231"
+argv[2]="--native-regs"
+argv[3]="--setsid"
+argv[4]=NULL
+
+
+com.apple.main-thread Host::LaunchProcess (launch_info) => pid=55287, path='/Volumes/data/lldb/svn/ToT/build/Debug/LLDB.framework/Versions/A/Resources/debugserver' err = 0x00000000
+com.apple.main-thread ProcessGDBRemote::StartAsyncThread ()
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc0997600, pid = 0) thread starting...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc0997600, pid = 0) listener.WaitForEvent (NULL, event_sp)...
+com.apple.main-thread <   1> send packet: +
+com.apple.main-thread history[1] tid=0x1307 <   1> send packet: +
+com.apple.main-thread <  19> send packet: $QStartNoAckMode#b0
+com.apple.main-thread <   1> read packet: +
+com.apple.main-thread <   6> read packet: $OK#9a
+com.apple.main-thread <   1> send packet: +
+com.apple.main-thread <  26> send packet: $QThreadSuffixSupported#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  27> send packet: $QListThreadsInStopReply#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  13> send packet: $qHostInfo#00
+com.apple.main-thread < 122> read packet: $cputype:16777223;cpusubtype:3;ostype:macosx;watchpoint_exceptions_received:after;vendor:apple;endian:little;ptrsize:8;#00
+com.apple.main-thread <  10> send packet: $vCont?#00
+com.apple.main-thread <  17> read packet: $vCont;c;C;s;S#00
+com.apple.main-thread <  27> send packet: $qVAttachOrWaitSupported#00
+com.apple.main-thread <   6> read packet: $OK#00
+
+...
+
+com.apple.main-thread ProcessGDBRemote::DoDestroy()
+com.apple.main-thread <   5> send packet: $k#00
+com.apple.main-thread error: failed to get response for 'k'
+com.apple.main-thread ProcessGDBRemote::DoDestroy - failed to send k packet
+com.apple.main-thread ProcessGDBRemote::StopAsyncThread ()
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc1882000, pid = 55289) Got an event of type: 2...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc1882000, pid = 55289) got eBroadcastBitAsyncThreadShouldExit...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc1882000, pid = 55289) thread exiting...
+com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fabc1882000, pid=55290, signo=2 (0x2), exit_status=-1)
+com.apple.main-thread <  18> send packet: $z0,100000e37,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  21> send packet: $z0,7fff5fc0d6e5,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread <  21> send packet: $z0,7fff8b132187,1#00
+com.apple.main-thread <   6> read packet: $OK#00
+com.apple.main-thread ProcessGDBRemote::DoDestroy()
+com.apple.main-thread <   5> send packet: $k#00
+com.apple.main-thread error: failed to get response for 'k'
+com.apple.main-thread ProcessGDBRemote::DoDestroy - failed to send k packet
+com.apple.main-thread ProcessGDBRemote::StopAsyncThread ()
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc0bed200, pid = 55292) Got an event of type: 2...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc0bed200, pid = 55292) got eBroadcastBitAsyncThreadShouldExit...
+<lldb.process.gdb-remote.async> ProcessGDBRemote::AsyncThread (arg = 0x7fabc0bed200, pid = 55292) thread exiting...
+com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fabc0bed200, pid=55293, signo=2 (0x2), exit_status=-1)

Added: lldb/trunk/examples/test/usage-lldb-loggings
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/usage-lldb-loggings?rev=162378&view=auto
==============================================================================
--- lldb/trunk/examples/test/usage-lldb-loggings (added)
+++ lldb/trunk/examples/test/usage-lldb-loggings Wed Aug 22 13:48:13 2012
@@ -0,0 +1,63 @@
+#
+# The following example shows how to utilize the pre-flight config file to route the lldb gdb-remote log messages
+# into individual log destinations.
+#
+# See also .lldb-loggings in this directory as well as the tmp dir which contains the two log files abridged due
+# to their log sizes.
+#
+
+[11:31:34] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
+config: {'pre_flight': <function pre_flight at 0x107042140>}
+LLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
+LLDB-165
+Path: /Volumes/data/lldb/svn/ToT
+URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
+Repository Root: https://johnny@llvm.org/svn/llvm-project
+Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
+Revision: 162231
+Node Kind: directory
+Schedule: normal
+Last Changed Author: johnny
+Last Changed Rev: 162228
+Last Changed Date: 2012-08-20 14:16:02 -0700 (Mon, 20 Aug 2012)
+
+
+lldb.pre_flight: def pre_flight(self):
+    import os
+    import lldb
+    import lldbtest
+
+    dest = os.path.join("/tmp", "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id()))
+    print "\nEnabling lldb logging for test case:", self
+    print "with log destination:", dest
+    self.runCmd("log enable -f %s gdb-remote packets process" % dest)
+
+lldb.post_flight: None
+
+Session logs for test failures/errors/unexpected successes will go into directory '2012-08-22-11_36_37'
+Command invoked: python ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
+compilers=['clang']
+
+Configuration: arch=x86_64 compiler=clang
+----------------------------------------------------------------------
+Collected 2 tests
+
+1: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
+   Test a sequence of breakpoint command add, list, and delete. ... 
+Enabling lldb logging for test case: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
+with log destination: /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
+ok
+2: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
+   Test a sequence of breakpoint command add, list, and delete. ... 
+Enabling lldb logging for test case: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
+with log destination: /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
+ok
+
+----------------------------------------------------------------------
+Ran 2 tests in 7.826s
+
+OK
+[11:36:44] johnny:/Volumes/data/lldb/svn/ToT/test $ ls -l /tmp/lldb_log*
+-rw-r-----  1 johnny  wheel  614614 Aug 22 11:36 /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
+-rw-r-----  1 johnny  wheel  614614 Aug 22 11:36 /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
+[11:37:09] johnny:/Volumes/data/lldb/svn/ToT/test $ 





More information about the lldb-commits mailing list