{"action":"closed","issue":{"url":"https://api.github.com/repos/riscv/riscv-openocd/issues/295","repository_url":"https://api.github.com/repos/riscv/riscv-openocd","labels_url":"https://api.github.com/repos/riscv/riscv-openocd/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/riscv/riscv-openocd/issues/295/comments","events_url":"https://api.github.com/repos/riscv/riscv-openocd/issues/295/events","html_url":"https://github.com/riscv/riscv-openocd/issues/295","id":354499907,"node_id":"MDU6SXNzdWUzNTQ0OTk5MDc=","number":295,"title":"gdb assumes watchpoints fire after the write happened","user":{"login":"timsifive","id":16123885,"node_id":"MDQ6VXNlcjE2MTIzODg1","avatar_url":"https://avatars1.githubusercontent.com/u/16123885?v=4","gravatar_id":"","url":"https://api.github.com/users/timsifive","html_url":"https://github.com/timsifive","followers_url":"https://api.github.com/users/timsifive/followers","following_url":"https://api.github.com/users/timsifive/following{/other_user}","gists_url":"https://api.github.com/users/timsifive/gists{/gist_id}","starred_url":"https://api.github.com/users/timsifive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timsifive/subscriptions","organizations_url":"https://api.github.com/users/timsifive/orgs","repos_url":"https://api.github.com/users/timsifive/repos","events_url":"https://api.github.com/users/timsifive/events{/privacy}","received_events_url":"https://api.github.com/users/timsifive/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-08-27T22:22:43Z","updated_at":"2018-11-07T21:08:42Z","closed_at":"2018-11-07T21:08:42Z","author_association":"COLLABORATOR","body":"The RISC-V spec recommends write triggers fire before the write actually occurred. This causes gdb to not fire on watchpoints, because gdb attempts to only halt when the memory value actually changed. To do that it reads the memory the watchpoint was set at, and if it's the same as when the watchpoint was set then it automatically resumes. (See `case WP_VALUE_NOT_CHANGED` in bpstat_check_watchpoint() in gdb/breakpoint.c.)\r\n\r\nSolutions that come to mind:\r\n1. Have OpenOCD single step if it detects this. That makes gdb happy, but now users lose the ability to see what the memory value was before the write happened.\r\n2. Change this gdb behavior when debugging RISC-V targets.\r\n\r\nI'm not a fan of any of these.\r\n\r\n@craigblackmore FYI."}}
{"actor":{"display_login":"timsifive"}}