)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"ce1f564efa86e5468b7b63d983ca0c03782cb9d8","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"4627645f_23c51ffe","updated":"2021-11-18 13:37:32.000000000","message":"Antonio, I shortly tested the change and no go for me.\nWhat gdb version do you use?\nI tried with rather old\n  GNU gdb (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 8.3.0.20190709-git\nfrom Windows to Linux with OpenOCD. Tested connecting both at the OpenOCD start and while busy (sleep 10000 from telnet) and in either case gdb complains.","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"648b18947f9f671d34a91e1ec0acc5d938e30f72","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"c2c8be4c_fa0b68e1","updated":"2021-11-18 22:18:27.000000000","message":"Reproduced also on GDB 11.1\ntyping \"sleep 60000\" in telnet works, while fails with\nopenocd -f configfile.cfg -c \u0027init;sleep 60000\u0027\nI think the reason is that the string \u0027init;sleep 60000\u0027 is passed to and execute by jimtcl; it\u0027s jimtcl that parses the whole string and executes it one command at a time. This is passed before executing \u0027init\u0027 (that is executed later in the string), so before entering in the server_loop().\nAs you propose, the solution should be to modify \"init\".","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"472984b850e6df8a98185c4521e3094e0cffa044","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"55651a2d_0c8de067","in_reply_to":"4627645f_23c51ffe","updated":"2021-11-18 14:03:36.000000000","message":"Thanks for testing it.\n\"GNU gdb (GDB) 11.1\" in Arch Linux. Will check with older version too.","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fe06d6c643c90bf7f89bef9ca42072e23ba1d94d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"c755da9e_80a3b2ef","in_reply_to":"55651a2d_0c8de067","updated":"2021-11-18 15:25:25.000000000","message":"Another test, GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2 (multiarch), on the same linux pc: with sleep 10000 from telnet works as expected.\nUnfortunately\n  openocd -f openocd.cfg -c \u0027init;sleep 10000\u0027\n\ndidn\u0027t work.\nAfter simple tweak looks promising.","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"14e04b90845a5734e0ff46045b7be8518e6a493a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"80162e48_3deaceed","in_reply_to":"c755da9e_80a3b2ef","updated":"2021-11-18 15:28:21.000000000","message":"Also retried with gdb 8.3 from Windows and works same as 9.2. I did something wrong in the first test.","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4179fbee4b35a6e44ad5ce0630905efed8460d12","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"af99d640_04f1b22c","updated":"2021-11-19 09:55:01.000000000","message":"I can confirm the change works. Tested with both gdb 8.3 and 9.2\nI tested also with more complex config: stm32h745 and stm32h7a3 (swd multidrop) and two gdb instances connecting - checked if \u0027target current\u0027 during gdb-attach event and in gdb is properly set. No problems.\n\nUnfortunately a more realistic time consuming startup, doing load_image to RAM, works only with targets which calls keep_alive during memory ops - riscv surprisingly does, cortex_m does not. But this is a different topic.","commit_id":"cefe1a0a638e7005d5be26655b2f310f44efe268"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"53c140e2fb041d813fa8227377a05452896e6c79","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"3c767018_097537e7","updated":"2021-11-18 22:48:12.000000000","message":"v2 works for -c \u0027init;sleep 60000\u0027\nBut only GDB server is open by \"init\". Telnet and tcl are opened later! But this is something to be fixed in another patch, not related with this GDB issue.\nI should change the commit message to report this is for GDB","commit_id":"cefe1a0a638e7005d5be26655b2f310f44efe268"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b6fe80bd1aec817f992938cd78dda72c9f527c80","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"e6f4066b_9bf38bb6","updated":"2021-12-09 17:22:41.000000000","message":"No changes here, I only moved in a separate patch the keep-alive of sleep command.\nI still need to address the review comments.\nThe good news is that with 6768 and 6771 it now works with LLDB too!\nI\u0027m fighting with the llvm method to upstream patches in order to provide two fixes upstream. Anyway, even if I succeed to get lldb fixed, we need to deal with legacy lldb installation, so 6771 is still necessarily.","commit_id":"05dffed0211381167f60a454a28614e9f6af50e7"}],"src/openocd.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fe06d6c643c90bf7f89bef9ca42072e23ba1d94d","unresolved":true,"context_lines":[{"line_number":181,"context_line":"\tgdb_target_add_all(all_targets);"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"\ttarget_register_event_callback(log_target_callback_event_handler, CMD_CTX);"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"\treturn ERROR_OK;"},{"line_number":186,"context_line":"}"},{"line_number":187,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"f401fe06_a3a918d8","line":184,"updated":"2021-11-18 15:25:25.000000000","message":"I tried\n  prepare_keep_alive(CMD_CTX);\n\nhere. Connection is accepted in time, but some part of server init is not yet done (perhaps server_init()) and socket to gdb is closed.\n\n  (gdb) set debug remote 1\n  (gdb) target remote :3333 (intentionally not extended-remote to be able disconnect by kill)\n  Remote debugging using :3333\n  Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;forkevents+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;xmlRegisters\u003di386#6a...putpkt: Junk:\n\nnew lines from keep alive\n\n  Ack\n  Packet received: PacketSize\u003d4000;qXfer:memory-map:read+;qXfer:features:read+qXfer:threads:read+;QStartNoAckMode+;vContSupported+\n  Packet qSupported (supported-packets) is supported\n  Sending packet: $vMustReplyEmpty#3a...Ack\n  Remote connection closed","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4179fbee4b35a6e44ad5ce0630905efed8460d12","unresolved":false,"context_lines":[{"line_number":181,"context_line":"\tgdb_target_add_all(all_targets);"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"\ttarget_register_event_callback(log_target_callback_event_handler, CMD_CTX);"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"\treturn ERROR_OK;"},{"line_number":186,"context_line":"}"},{"line_number":187,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"f9597892_20d340fe","line":184,"in_reply_to":"e1cc216b_65dba9c8","updated":"2021-11-19 09:55:01.000000000","message":"It\u0027s ok, I missed copy_command_context() in add_connection()","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"575cc4789fa68eb73faa566a8b6e227fb07e0a62","unresolved":true,"context_lines":[{"line_number":181,"context_line":"\tgdb_target_add_all(all_targets);"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"\ttarget_register_event_callback(log_target_callback_event_handler, CMD_CTX);"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"\treturn ERROR_OK;"},{"line_number":186,"context_line":"}"},{"line_number":187,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e1cc216b_65dba9c8","line":184,"in_reply_to":"f401fe06_a3a918d8","updated":"2021-11-18 16:12:13.000000000","message":"\u003e   prepare_keep_alive(CMD_CTX);\n\nCMD_CTX is obviously wrong. Tried global_cmd_ctx, communication with gdb is little bit longer\n  ...\n  Sending packet: $vMustReplyEmpty#3a...Ack\n  Packet received:\n  Sending packet: $QStartNoAckMode#b0...Ack\n  Packet received: OK\n  Sending packet: $Hg0#df...\n\nbut again\n  Remote connection closed","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"}],"src/server/server.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1c36c3cfca2e140d9a2e09a0645a0dae4314dc85","unresolved":true,"context_lines":[{"line_number":144,"context_line":"\t\t\tnext \u003d c-\u003enext;"},{"line_number":145,"context_line":"\t\t\tif (c-\u003efd \u003d\u003d -1 || !FD_ISSET(c-\u003efd, \u0026keep_alive_accepted_fds))"},{"line_number":146,"context_line":"\t\t\t\tcontinue;"},{"line_number":147,"context_line":"\t\t\tint retval \u003d service-\u003enew_connection(c, ADD_CONNECTION_BOTTOM);"},{"line_number":148,"context_line":"\t\t\tif (retval !\u003d ERROR_OK)"},{"line_number":149,"context_line":"\t\t\t\tremove_connection(service, c);"},{"line_number":150,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"4c524a10_340a37b5","line":147,"updated":"2021-11-18 16:37:16.000000000","message":"Looks like keep_alive_accepted() calls new_connection() more than once.\nTried put here\n  keep_alive_accepted \u003d false;\n\nand gdb initial handshake finally finishes!","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fe06d6c643c90bf7f89bef9ca42072e23ba1d94d","unresolved":true,"context_lines":[{"line_number":655,"context_line":"\t\t\t\t}"},{"line_number":656,"context_line":"\t\t\t}"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"\t\t\tprepare_keep_alive(command_context);"},{"line_number":659,"context_line":""},{"line_number":660,"context_line":"\t\t\t/* handle activity on connections */"},{"line_number":661,"context_line":"\t\t\tif (service-\u003econnections) {"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e9c25832_66d35e0a","line":658,"range":{"start_line":658,"start_character":3,"end_line":658,"end_character":39},"updated":"2021-11-18 15:25:25.000000000","message":"Too late here","commit_id":"5cf99c6678d4f5c0affc8dca1fc012af5ed442b4"}],"src/server/server.h":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4179fbee4b35a6e44ad5ce0630905efed8460d12","unresolved":true,"context_lines":[{"line_number":61,"context_line":"\tstruct connection *next;"},{"line_number":62,"context_line":"};"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"typedef int (*new_connection_handler_t)(struct connection *connection, enum add_connection_mode mode);"},{"line_number":65,"context_line":"typedef int (*input_handler_t)(struct connection *connection);"},{"line_number":66,"context_line":"typedef int (*connection_closed_handler_t)(struct connection *connection);"},{"line_number":67,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"9be3c082_a73e75b4","line":64,"range":{"start_line":64,"start_character":71,"end_line":64,"end_character":100},"updated":"2021-11-19 09:55:01.000000000","message":"I think the mode parameter is not a good choice.\nIf you added additional handler for starting keep-alive mode, then all other services could stay untouched. And server.c code would know whether the service implements keep-alive or not (and would not have to call empty stubs).","commit_id":"cefe1a0a638e7005d5be26655b2f310f44efe268"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"7fbaaff2b42dcea9c1a1b702adf0b13fa40144fb","unresolved":true,"context_lines":[{"line_number":61,"context_line":"\tstruct connection *next;"},{"line_number":62,"context_line":"};"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"typedef int (*new_connection_handler_t)(struct connection *connection, enum add_connection_mode mode);"},{"line_number":65,"context_line":"typedef int (*input_handler_t)(struct connection *connection);"},{"line_number":66,"context_line":"typedef int (*connection_closed_handler_t)(struct connection *connection);"},{"line_number":67,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"2da75894_6845504c","line":64,"range":{"start_line":64,"start_character":71,"end_line":64,"end_character":100},"in_reply_to":"9be3c082_a73e75b4","updated":"2021-11-19 11:10:27.000000000","message":"In current implementation I need to split the new_connection() in two parts:\n- the TOP that does the minimum to accept keep_alive(), currently on GDB only;\n- the BOTTOM that does the rest for a full connection outside keep_alive().\nI have easily made the split by passing the enum\n\nIt should be more complex by physically splitting the function and passing the two function pointers during add_service(). I will not explore this way.\n\nMaybe I can pass to add_service() only the TOP, and let the TOP call the BOTTOM only if we are not in keep_alive(). The logic could be more complex to maintain, but let\u0027s see if it can be implemented cleanly.","commit_id":"cefe1a0a638e7005d5be26655b2f310f44efe268"}]}
