[Lldb-commits] [lldb] r151404 - /lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py

Johnny Chen johnny.chen at apple.com
Fri Feb 24 15:12:08 PST 2012


Author: johnny
Date: Fri Feb 24 17:12:08 2012
New Revision: 151404

URL: http://llvm.org/viewvc/llvm-project?rev=151404&view=rev
Log:
Create an additional watchpoint during the test run and verify that the watchpoint fired has the expected watchpoint id.

Modified:
    lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py

Modified: lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=151404&r1=151403&r2=151404&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py (original)
+++ lldb/trunk/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py Fri Feb 24 17:12:08 2012
@@ -3,6 +3,7 @@
 """
 
 import os, time
+import re
 import unittest2
 import lldb
 from lldbtest import *
@@ -62,10 +63,20 @@
         # incrmenting the global pool by 2.
         self.expect("watchpoint set expression -w write -x 1 -- g_char_ptr", WATCHPOINT_CREATED,
             substrs = ['Watchpoint created', 'size = 1', 'type = w'])
+        # Get a hold of the watchpoint id just created, it is used later on to
+        # match the watchpoint id which is expected to be fired.
+        match = re.match("Watchpoint created: Watchpoint (.*):", self.res.GetOutput().splitlines()[0])
+        if match:
+            expected_wp_id = int(match.group(1), 0)
+        else:
+            self.fail("Grokking watchpoint id faailed!") 
+
         self.runCmd("expr unsigned val = *g_char_ptr; val")
         self.expect(self.res.GetOutput().splitlines()[0], exe=False,
             endstr = ' = 0')
 
+        self.runCmd("watchpoint set expression -w write -x 4 -- &g_thread_1")
+
         # Use the '-v' option to do verbose listing of the watchpoint.
         # The hit count should be 0 initially.
         self.expect("watchpoint list -v",
@@ -77,7 +88,7 @@
         # only once.  The stop reason of the thread should be watchpoint.
         self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
             substrs = ['stopped',
-                       'stop reason = watchpoint',
+                       'stop reason = watchpoint %d' % expected_wp_id,
                        self.violating_func])
 
         # Switch to the thread stopped due to watchpoint and issue some commands.





More information about the lldb-commits mailing list