DavidSpickett created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

During __do_global_dtors_aux glibc sets a flag that is right
next to the global variable. This is done using a store byte.

On QEMU the watchpoints are handled with a finer granularity
than real hardware, so this wasn't a problem. On Graviton 3
(and Mountain Jade, though this test won't run there) watchpoints
look at larger chunks of memory.

This means that the final continue actually stops in  __do_global_dtors_aux
instead of exiting.

We could fix this by padding the global to be away from the flag,
but that is fiddly and it is easier just to remove the watchpoint
before the final continue. We have already verified it worked by that
point.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154201

Files:
  lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py


Index: 
lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
===================================================================
--- 
lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
+++ 
lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
@@ -129,12 +129,15 @@
             substrs=["stop reason = watchpoint"],
         )
 
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # The hit count should now be 2.
+        self.expect("watchpoint list -v", substrs=["hit_count = 2"])
+
+        # On some hardware, during __do_global_dtors_aux a flag is set near
+        # the global which can trigger the watchpoint. So we must remove it.
+        self.runCmd("watchpoint delete 1")
         self.runCmd("process continue")
 
         # There should be no more watchpoint hit and the process status should
         # be 'exited'.
         self.expect("process status", substrs=["exited"])
-
-        # Use the '-v' option to do verbose listing of the watchpoint.
-        # The hit count should now be 2.
-        self.expect("watchpoint list -v", substrs=["hit_count = 2"])


Index: lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
===================================================================
--- lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
+++ lldb/test/API/commands/watchpoints/watch_tagged_addr/TestWatchTaggedAddress.py
@@ -129,12 +129,15 @@
             substrs=["stop reason = watchpoint"],
         )
 
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # The hit count should now be 2.
+        self.expect("watchpoint list -v", substrs=["hit_count = 2"])
+
+        # On some hardware, during __do_global_dtors_aux a flag is set near
+        # the global which can trigger the watchpoint. So we must remove it.
+        self.runCmd("watchpoint delete 1")
         self.runCmd("process continue")
 
         # There should be no more watchpoint hit and the process status should
         # be 'exited'.
         self.expect("process status", substrs=["exited"])
-
-        # Use the '-v' option to do verbose listing of the watchpoint.
-        # The hit count should now be 2.
-        self.expect("watchpoint list -v", substrs=["hit_count = 2"])
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to