)]}'
{
  "commit": "c223d3738832011ced54e8415fa218934aebd0e4",
  "tree": "d3b9fe1cadd701f5d4f4fcc1e82e3f719b86bc57",
  "parents": [
    "ec48903170926f3827144525b50ddd3c6ae3fbf0"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Tue May 02 15:04:28 2023 +0100"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Fri Apr 12 18:54:08 2024 +0100"
  },
  "message": "Fix setting watchpoints when current thread is running\n\nCurrently, when the current thread is running, you can print global\nvariables.  However, if you try to set a watchpoint on the same\nglobals, GDB errors out, complaining that the selected thread is\nrunning.  Like so:\n\n (gdb) c\u0026\n Continuing.\n (gdb) p global\n $1 \u003d 1098377287\n (gdb) watch global\n Selected thread is running.\n\nThis patch makes setting the watchpoint work.  You\u0027ll now get:\n\n (gdb) c\u0026\n Continuing.\n (gdb) [New Thread 0x7ffff7d6e640 (LWP 434993)]\n [New Thread 0x7ffff756d640 (LWP 434994)]\n p global\n $1 \u003d 88168\n (gdb) watch global\n Hardware watchpoint 2: global\n (gdb) [Switching to Thread 0x7ffff7d6e640 (LWP 434993)]\n\n Thread 2 \"function0\" hit Hardware watchpoint 2: global\n\n Old value \u003d 185420\n New value \u003d 185423\n int_return () at threads.c:39\n 39      }\n\nThe problem is that update_watchpoint calls get_selected_frame\nunconditionally.  We can skip it if the watchpoint expression is only\nwatching globals.\n\nThis adds a testcase that exercises both all-stop and non-stop, and\nalso software and hardware watchpoints.  It is kfailed for software\nwatchpoints, as those require another fix not handled by this patch\n(the sw watchpoint doesn\u0027t fire because GDB doesn\u0027t force the\nrunning-free thread to switch to single-stepping).\n\nChange-Id: I68ca948541aea3edd4f70741f272f543187abe40\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ea89c40ce26d99190c9f2bd2f64187acc4ee7f24",
      "old_mode": 33188,
      "old_path": "gdb/breakpoint.c",
      "new_id": "6d8adc626643d137af02371d5151468f12b82691",
      "new_mode": 33188,
      "new_path": "gdb/breakpoint.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "3ba1cb21dfeed97e72dfbf1ab6a439c3dd9e0074",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/watchpoint-running.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d0510f8555cedd047a389b31f9b17c547280daa2",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/watchpoint-running.exp"
    }
  ]
}
