)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1e979ca93f032b332fdb24565ddc5e118106dd20","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"c2789118_4f9c0f42","updated":"2025-09-22 20:15:09.000000000","message":"Thanks for the clarification!","commit_id":"48c26383e3e103987a266ec008d4387e85c2639b"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"026774bcd542f8b10619c1a1070dcdb912fcef63","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"8e6198fe_c3e904dd","updated":"2025-09-23 08:23:40.000000000","message":"Thanks!","commit_id":"706d374192eaacbe17431928a796bb3d2f92008e"}],"src/target/cortex_m.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1e979ca93f032b332fdb24565ddc5e118106dd20","unresolved":true,"context_lines":[{"line_number":2047,"context_line":"\t * But for 32-bit Thumb mode (Thumb-2) breakpoint, GDB provides \u0027kind \u003d 3\u0027 to"},{"line_number":2048,"context_line":"\t * be used to derive the length information. See:"},{"line_number":2049,"context_line":"\t * https://sourceware.org/gdb/current/onlinedocs/gdb.html/ARM-Breakpoint-Kinds.html"},{"line_number":2050,"context_line":"\t * Since a four byte breakpoint could be unaligned, potentially requiring two"},{"line_number":2051,"context_line":"\t * memory accesses to set or remove it, always use two bytes breakpoint."},{"line_number":2052,"context_line":"\t */"},{"line_number":2053,"context_line":"\tif (breakpoint-\u003elength \u003d\u003d 3) {"},{"line_number":2054,"context_line":"\t\tLOG_TARGET_DEBUG(target, \"Using a two byte breakpoint for 32bit Thumb-2 request\");"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"c643acc1_8e33cdee","line":2051,"range":{"start_line":2050,"start_character":12,"end_line":2051,"end_character":39},"updated":"2025-09-22 20:15:09.000000000","message":"It\u0027s true. Moreover I\u0027m not aware of a four byte breakpoint instruction working on bare metal Cortex-M. The instruction 0xf7f0, 0xa000 found in gdbserver/linux-aarch32-low.cc is disassembled as `udf` and produces hard-fault on bare metal. Probably the linux exception handler emulates the breakpoint on this code. OpenOCD cannot use this, so we\u0027re limited to the only BKPT instruction in Thumb/Thumb2 code, which is 2 byte long.","commit_id":"48c26383e3e103987a266ec008d4387e85c2639b"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"95e5a4c31c51333acc5a1428e108aafc557164ef","unresolved":false,"context_lines":[{"line_number":2047,"context_line":"\t * But for 32-bit Thumb mode (Thumb-2) breakpoint, GDB provides \u0027kind \u003d 3\u0027 to"},{"line_number":2048,"context_line":"\t * be used to derive the length information. See:"},{"line_number":2049,"context_line":"\t * https://sourceware.org/gdb/current/onlinedocs/gdb.html/ARM-Breakpoint-Kinds.html"},{"line_number":2050,"context_line":"\t * Since a four byte breakpoint could be unaligned, potentially requiring two"},{"line_number":2051,"context_line":"\t * memory accesses to set or remove it, always use two bytes breakpoint."},{"line_number":2052,"context_line":"\t */"},{"line_number":2053,"context_line":"\tif (breakpoint-\u003elength \u003d\u003d 3) {"},{"line_number":2054,"context_line":"\t\tLOG_TARGET_DEBUG(target, \"Using a two byte breakpoint for 32bit Thumb-2 request\");"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"74784b27_7ebffc52","line":2051,"range":{"start_line":2050,"start_character":12,"end_line":2051,"end_character":39},"in_reply_to":"c643acc1_8e33cdee","updated":"2025-09-23 07:44:41.000000000","message":"`udf` is \u0027permanent\u0027 undefined instruction. It generates an exception in userland that causes a context switch to the OS.\nInside an OS, GDB cannot debug directly an application, it has to use the API of the OS, e.g. `ptrace` for Linux\nhttps://man7.org/linux/man-pages/man2/ptrace.2.html\nNo way to convert `udf` in a debug event that halts the CPU for OpenOCD.\n\nYou are right, on armv8m there isn\u0027t a 4 byte BKPT instruction, so what I wrote is misleading. I will change it.\nAlso OpenOCD macro `ARMV5_T_BKPT(0x11)` generates a 4 bytes code that contains twice the 2 byte breakpoint instruction. I thought it was for convenience, instead it\u0027s because there is no other choice.","commit_id":"48c26383e3e103987a266ec008d4387e85c2639b"}]}
