<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Watchpoint::SetEnabled & therefore SBWatchpoint::SetEnabled don't actually disable a watchpoint"
   href="https://llvm.org/bugs/show_bug.cgi?id=30789">30789</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Watchpoint::SetEnabled & therefore SBWatchpoint::SetEnabled don't actually disable a watchpoint
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jingham@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is on MacOS x86_64:

Build the test case in functionalities/watchpoint/watchpoint_command/command
and do:

(lldb) b s -p "Set break"
Breakpoint 2: where = a.out`main + 63 at main.cpp:22, address =
0x0000000100000ecf
(lldb) run
Process 98597 launched: 'a.out' (x86_64)
&global=0x100001018
Process 98597 stopped
* thread #1: tid = 0x1740788, function: main , stop reason = breakpoint 2.1
    frame #0: 0x0000000100000ecf a.out`main at main.cpp:22
   19      int main(int argc, char** argv) {
   20          int local = 0;
   21          printf("&global=%p\n", &global);
-> 22          printf("about to write to 'global'...\n"); // Set break point at
this line.
   23          for (int i = 0; i < 10; ++i)
   24              modify(global);
   25      
(lldb) watch set variable global
Watchpoint created: Watchpoint 1: addr = 0x100001018 size = 4 state = enabled
type = w
    declare @ 'main.cpp:12'
    watchpoint spec = 'global'
    new value: 0
(lldb) c
Process 98597 resuming
about to write to 'global'...

Watchpoint 1 hit:
old value: 0
new value: 1
Process 98597 stopped
* thread #1: tid = 0x1740788, function: modify(int&) , stop reason = watchpoint
1
    frame #0: 0x0000000100000f53 a.out`modify(int&) at main.cpp:17
   14      
   15      static void modify(int32_t &var) {
   16          ++var;
-> 17      }
   18      
   19      int main(int argc, char** argv) {
   20          int local = 0;
(lldb) script lldb.target.FindWatchpointByID(1).SetEnabled(False)
(lldb) watch list
Number of supported hardware watchpoints: 4
Current watchpoints:
Watchpoint 1: addr = 0x100001018 size = 4 state = disabled type = w
    declare @ 'main.cpp:12'
    watchpoint spec = 'global'
    old value: 0
    new value: 1
(lldb) c
Process 98597 resuming
Process 98597 stopped
* thread #1: tid = 0x1740788, function: modify(int&) , stop reason =
EXC_BREAKPOINT (code=EXC_I386_SGL, subcode=0x100001018)
    frame #0: 0x0000000100000f53 a.out`modify(int&) at main.cpp:17
   14      
   15      static void modify(int32_t &var) {
   16          ++var;
-> 17      }
   18      
   19      int main(int argc, char** argv) {
   20          int local = 0;

So the watchpoint says it was disabled, but it actually didn't get disabled,
and we hit it on continue.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>