)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"ee4ea8efe88d54088222183f1039cbb02efd6cfd","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"633589f1_d2595723","updated":"2026-03-24 12:12:10.000000000","message":"Thank you for the patch!\n\nUnfortunately there is a minor issue with the current approach -- the port number is duplicated. IMHO this makes the code more complex since these two values need to be kept consistent.\n\nMoreover, the solution does not scale well to the other services (telnet, etc.) since such services are not associated with a target.\n\nIMHO it breaks the object model a little: the port is a property of the service, not a property of the target.\n\nPlease consider an alternative solution -- an `service info` command that will report service independent parameters (`name`, `port`, etc.) from `struct service` and call a `service_driver`-specific helper for `service_driver`-specific info (e.g. target name for a `gdb` service) for each service from the `services` list in `server/server.c`.\nI\u0027d suggest for it to return a list of Tcl-dict-like strings (e.g. \"{{name gdb port 4444 ... gdb.target target1} {name gdb port 4445 ... gdb.target target2} ...}\".\nThis can be guarded by an option (like Git\u0027s `--porcelain`) and by default the command can return a more human-readable output.\nThe idea is similar to `riscv info` command (see `handle_info()` and `riscv013_print_info()`).\n\nIMHO this will be a much more scalable and maintainable solution, though it will require iterating over the list of services to get the port number.\n\nPlease let me know what you think","commit_id":"2418359158b45f8c1edacb0715be89268a85eff6"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"d9dd12720b90529fe74d14093d87a51251f75dcd","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1e247e3f_41347a8d","in_reply_to":"633589f1_d2595723","updated":"2026-03-26 10:30:38.000000000","message":"Updated! That was not too hard actually. I called the command \u0027services\u0027, and it just always outputs TCL code rather than having a --porcelain flag - that seemed simpler and it\u0027s not difficult to read anyway.\n\nIf this is ok I\u0027ll update the documentation.","commit_id":"2418359158b45f8c1edacb0715be89268a85eff6"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"f11ed89ac5a87251ee8515b349d6f7ec8ac164d2","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":4,"id":"6a1f112a_878ead16","updated":"2026-05-08 08:23:02.000000000","message":"Gentle poke... is this ok now?","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"541414f2_d0ae342c","updated":"2026-04-07 11:09:50.000000000","message":"Thanks for the review! I think I fixed almost everything. I wasn\u0027t sure what you meant for one of the comments.","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"43b5f98df9be4cc7f0326c9df98aa47d6993bf7e","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":4,"id":"e4f6e507_943223e2","in_reply_to":"6a1f112a_878ead16","updated":"2026-05-08 08:48:28.000000000","message":"Thanks for the patch Tim. I also thought about implementing something like this. However, my use case is a bit more complicated and unfortunately not covered by this patch :D\n\nI would prefer not to escape the service names, similar to the adapter names (see `adapter list`), we can expect only alphanumeric chars. This is not enforced yet but this is something for a different patch.","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"45f3adcb190533c91c65d30cf73988e5701366f9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"af65dfa5_42fadc2a","in_reply_to":"e4f6e507_943223e2","updated":"2026-05-08 09:05:49.000000000","message":"Ack","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"abb68178348ede21024cea327d4b50273224522e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"5bf9da5c_f04a562f","updated":"2026-06-26 08:01:23.000000000","message":"Any chance this could be merged? Is there anything left to do?","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"950531144eceb092baf5be18deb2e84f7d12985c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"f17498cf_75eeb004","updated":"2026-06-29 14:33:48.000000000","message":"LGTM","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"45f3adcb190533c91c65d30cf73988e5701366f9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"7719fe4a_8feab28e","updated":"2026-05-08 09:05:49.000000000","message":"Thanks for the quick reply. I fixed the TCL-\u003eTcl string. Is there anything left to do?","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"428676ca56941327312e84e072dfa2f0dd31d48b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"88e69a62_1dc06769","updated":"2026-07-02 07:55:27.000000000","message":"Thanks for the review! How come the \u0027Submit Requirements\u0027 still says Code-Review is unsatisfied? Does it need two reviews?","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"5aaa2b6098db8fa43ad34bf91fda06b1f4d19cd0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"deaecdf7_2468f817","updated":"2026-07-09 11:01:26.000000000","message":"This patch looks good to me.\n\nIt will be very useful when using OpenOCD as part of a more complex system to discover the actual port numbers.","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"5aaa2b6098db8fa43ad34bf91fda06b1f4d19cd0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"5dc918c7_a14795c4","in_reply_to":"88e69a62_1dc06769","updated":"2026-07-09 11:01:26.000000000","message":"All patches wait until one of the OpenOCD maintainers picks it up and approve it by assigning a +2 review score.","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"7131ae06c465e5904bce9b86aee1679d1b76874f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"389d0c66_f1211c77","updated":"2026-07-27 13:43:38.000000000","message":"Thanks for reviewing \u0026 merging this everyone! Slightly ironically today is my last day at the company where I needed this, but I\u0027m sure it will be useful elsewhere!","commit_id":"43441cd83b229c106ab505cda047da116d454023"}],"src/helper/command.c":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":1375,"context_line":"\t*dst++ \u003d \u0027\"\u0027;"},{"line_number":1376,"context_line":""},{"line_number":1377,"context_line":"\twhile (*src !\u003d \u0027\\0\u0027) {"},{"line_number":1378,"context_line":"\t\tif (*src \u003d\u003d \u0027[\u0027 || *src \u003d\u003d \u0027$\u0027 || *src \u003d\u003d \u0027\"\u0027 || *src \u003d\u003d \u0027\\\\\u0027)"},{"line_number":1379,"context_line":"\t\t\t*dst++ \u003d \u0027\\\\\u0027;"},{"line_number":1380,"context_line":"\t\t*dst++ \u003d *src++;"},{"line_number":1381,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"2c466d18_e51e54f5","line":1378,"updated":"2026-03-30 13:27:31.000000000","message":"If you like:\n```\nif (strchr(\"[$\\\"\\\\], *src)\n```","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":true,"context_lines":[{"line_number":1375,"context_line":"\t*dst++ \u003d \u0027\"\u0027;"},{"line_number":1376,"context_line":""},{"line_number":1377,"context_line":"\twhile (*src !\u003d \u0027\\0\u0027) {"},{"line_number":1378,"context_line":"\t\tif (*src \u003d\u003d \u0027[\u0027 || *src \u003d\u003d \u0027$\u0027 || *src \u003d\u003d \u0027\"\u0027 || *src \u003d\u003d \u0027\\\\\u0027)"},{"line_number":1379,"context_line":"\t\t\t*dst++ \u003d \u0027\\\\\u0027;"},{"line_number":1380,"context_line":"\t\t*dst++ \u003d *src++;"},{"line_number":1381,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"469c4c6e_5a6ae784","line":1378,"in_reply_to":"2c466d18_e51e54f5","updated":"2026-04-07 11:09:50.000000000","message":"I think I prefer the explicit \u0027if\u0027 if I have the choice! C string functions are not my friends :-D","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"45f3adcb190533c91c65d30cf73988e5701366f9","unresolved":false,"context_lines":[{"line_number":1375,"context_line":"\t*dst++ \u003d \u0027\"\u0027;"},{"line_number":1376,"context_line":""},{"line_number":1377,"context_line":"\twhile (*src !\u003d \u0027\\0\u0027) {"},{"line_number":1378,"context_line":"\t\tif (*src \u003d\u003d \u0027[\u0027 || *src \u003d\u003d \u0027$\u0027 || *src \u003d\u003d \u0027\"\u0027 || *src \u003d\u003d \u0027\\\\\u0027)"},{"line_number":1379,"context_line":"\t\t\t*dst++ \u003d \u0027\\\\\u0027;"},{"line_number":1380,"context_line":"\t\t*dst++ \u003d *src++;"},{"line_number":1381,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"438fcd0f_b0956034","line":1378,"in_reply_to":"469c4c6e_5a6ae784","updated":"2026-05-08 09:05:49.000000000","message":"Ack","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"dab8cfac39693a53b01539d0a1f7e8b0cd62d903","unresolved":true,"context_lines":[{"line_number":1359,"context_line":"\treturn ERROR_OK;"},{"line_number":1360,"context_line":"}"},{"line_number":1361,"context_line":""},{"line_number":1362,"context_line":"char *tcl_escape_alloc(const char *src)"},{"line_number":1363,"context_line":"{"},{"line_number":1364,"context_line":"\tassert(src);"},{"line_number":1365,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":5,"id":"f56e75ad_0327e661","line":1362,"updated":"2026-07-12 12:09:58.000000000","message":"We need this function, but I prefer a more generic approach passing through Jim Tcl and delegating the conversion to the Tcl environment.\nPlease see the implementation I propose in https://review.openocd.org/c/openocd/+/9782\n\nMy proposal also addresses my wish toward collecting such Tcl helper code in a single file.\n\nIf you think it\u0027s ok, please rebase this patch on top of 9782","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":false,"context_lines":[{"line_number":1359,"context_line":"\treturn ERROR_OK;"},{"line_number":1360,"context_line":"}"},{"line_number":1361,"context_line":""},{"line_number":1362,"context_line":"char *tcl_escape_alloc(const char *src)"},{"line_number":1363,"context_line":"{"},{"line_number":1364,"context_line":"\tassert(src);"},{"line_number":1365,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":5,"id":"c74d85bb_cf793129","line":1362,"in_reply_to":"bde18316_e8b453d0","updated":"2026-07-13 08:44:10.000000000","message":"It worked nice. Thanks","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"13b6f53e75a43c352ca1b2a16ca027eaf875885a","unresolved":true,"context_lines":[{"line_number":1359,"context_line":"\treturn ERROR_OK;"},{"line_number":1360,"context_line":"}"},{"line_number":1361,"context_line":""},{"line_number":1362,"context_line":"char *tcl_escape_alloc(const char *src)"},{"line_number":1363,"context_line":"{"},{"line_number":1364,"context_line":"\tassert(src);"},{"line_number":1365,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":5,"id":"bde18316_e8b453d0","line":1362,"in_reply_to":"f56e75ad_0327e661","updated":"2026-07-13 08:05:41.000000000","message":"Rebased (hopefully I did that right - I\u0027m not a Gerrit pro).","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"}],"src/helper/command.h":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":541,"context_line":" * escaping a few character. Returns a newly allocated string or"},{"line_number":542,"context_line":" * NULL on OOM. src cannot be NULL."},{"line_number":543,"context_line":" */"},{"line_number":544,"context_line":"char *tcl_escape(const char *src);"},{"line_number":545,"context_line":""},{"line_number":546,"context_line":"#endif /* OPENOCD_HELPER_COMMAND_H */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"23daae4e_6f01d704","line":544,"updated":"2026-03-30 13:27:31.000000000","message":"Please, mention the fact that the function allocates memory in the name.\nPerhaps something like:\n```\ntcl_escape_alloc(...)\n```","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":541,"context_line":" * escaping a few character. Returns a newly allocated string or"},{"line_number":542,"context_line":" * NULL on OOM. src cannot be NULL."},{"line_number":543,"context_line":" */"},{"line_number":544,"context_line":"char *tcl_escape(const char *src);"},{"line_number":545,"context_line":""},{"line_number":546,"context_line":"#endif /* OPENOCD_HELPER_COMMAND_H */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"7672fe19_15ace9ca","line":544,"in_reply_to":"23daae4e_6f01d704","updated":"2026-04-07 11:09:50.000000000","message":"Done","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"}],"src/server/gdb_server.c":[{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"43b5f98df9be4cc7f0326c9df98aa47d6993bf7e","unresolved":true,"context_lines":[{"line_number":3903,"context_line":""},{"line_number":3904,"context_line":"\tchar *cmd_name \u003d tcl_escape_alloc(gdb_service-\u003etarget-\u003ecmd_name);"},{"line_number":3905,"context_line":"\tif (!cmd_name) {"},{"line_number":3906,"context_line":"\t\tLOG_ERROR(\"Unable to escape TCL string\");"},{"line_number":3907,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":3908,"context_line":"\t}"},{"line_number":3909,"context_line":"\tcommand_print_sameline(cmd, \"target %s\", cmd_name);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"97fcf96b_5c31a958","line":3906,"updated":"2026-05-08 08:48:28.000000000","message":"TCL -\u003e Tcl","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"45f3adcb190533c91c65d30cf73988e5701366f9","unresolved":false,"context_lines":[{"line_number":3903,"context_line":""},{"line_number":3904,"context_line":"\tchar *cmd_name \u003d tcl_escape_alloc(gdb_service-\u003etarget-\u003ecmd_name);"},{"line_number":3905,"context_line":"\tif (!cmd_name) {"},{"line_number":3906,"context_line":"\t\tLOG_ERROR(\"Unable to escape TCL string\");"},{"line_number":3907,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":3908,"context_line":"\t}"},{"line_number":3909,"context_line":"\tcommand_print_sameline(cmd, \"target %s\", cmd_name);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"1ccba943_7e7e0f62","line":3906,"in_reply_to":"97fcf96b_5c31a958","updated":"2026-05-08 09:05:49.000000000","message":"Done","commit_id":"3ecbc76acd3e120b0ff6d7133f123ce67f3bce65"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":true,"context_lines":[{"line_number":3920,"context_line":"{"},{"line_number":3921,"context_line":"\tstruct gdb_service *gdb_service \u003d service-\u003epriv;"},{"line_number":3922,"context_line":""},{"line_number":3923,"context_line":"\tchar *cmd_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, gdb_service-\u003etarget-\u003ecmd_name);"},{"line_number":3924,"context_line":"\tif (!cmd_name) {"},{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"cfccfae4_1f8d55f4","line":3923,"updated":"2026-07-13 08:44:10.000000000","message":"Please instead take the pointer interp from `CMD_CTX-\u003einterp`, without importing `global_cmd_ctx`","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"1d5353b5723c1e5e334199eafb3bfa8242259d65","unresolved":false,"context_lines":[{"line_number":3920,"context_line":"{"},{"line_number":3921,"context_line":"\tstruct gdb_service *gdb_service \u003d service-\u003epriv;"},{"line_number":3922,"context_line":""},{"line_number":3923,"context_line":"\tchar *cmd_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, gdb_service-\u003etarget-\u003ecmd_name);"},{"line_number":3924,"context_line":"\tif (!cmd_name) {"},{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"27c2f7e6_dfa301a0","line":3923,"in_reply_to":"cfccfae4_1f8d55f4","updated":"2026-07-16 09:44:22.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"d10023cbaf558da950a810538db4c44042bb4c26","unresolved":false,"context_lines":[{"line_number":3920,"context_line":"{"},{"line_number":3921,"context_line":"\tstruct gdb_service *gdb_service \u003d service-\u003epriv;"},{"line_number":3922,"context_line":""},{"line_number":3923,"context_line":"\tchar *cmd_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, gdb_service-\u003etarget-\u003ecmd_name);"},{"line_number":3924,"context_line":"\tif (!cmd_name) {"},{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"8b0288a5_7640125f","line":3923,"in_reply_to":"cfccfae4_1f8d55f4","updated":"2026-07-13 10:17:39.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":true,"context_lines":[{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":3927,"context_line":"\t}"},{"line_number":3928,"context_line":"\tcommand_print_sameline(cmd, \"target %s\", cmd_name);"},{"line_number":3929,"context_line":"\tfree(cmd_name);"},{"line_number":3930,"context_line":"\treturn ERROR_OK;"},{"line_number":3931,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e71cd972_2f71133c","line":3928,"updated":"2026-07-13 08:44:10.000000000","message":"Use `command_print()` instead of `command_print_sameline()`. The reason in the other comment from mine","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"d10023cbaf558da950a810538db4c44042bb4c26","unresolved":false,"context_lines":[{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":3927,"context_line":"\t}"},{"line_number":3928,"context_line":"\tcommand_print_sameline(cmd, \"target %s\", cmd_name);"},{"line_number":3929,"context_line":"\tfree(cmd_name);"},{"line_number":3930,"context_line":"\treturn ERROR_OK;"},{"line_number":3931,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"3282502b_5976641b","line":3928,"in_reply_to":"e71cd972_2f71133c","updated":"2026-07-13 10:17:39.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"1d5353b5723c1e5e334199eafb3bfa8242259d65","unresolved":false,"context_lines":[{"line_number":3925,"context_line":"\t\tLOG_ERROR(\"Unable to escape Tcl string\");"},{"line_number":3926,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":3927,"context_line":"\t}"},{"line_number":3928,"context_line":"\tcommand_print_sameline(cmd, \"target %s\", cmd_name);"},{"line_number":3929,"context_line":"\tfree(cmd_name);"},{"line_number":3930,"context_line":"\treturn ERROR_OK;"},{"line_number":3931,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"d85ad217_3d823f77","line":3928,"in_reply_to":"e71cd972_2f71133c","updated":"2026-07-16 09:44:22.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"}],"src/server/server.c":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":832,"context_line":"{"},{"line_number":833,"context_line":"\tswitch (CMD_ARGC) {"},{"line_number":834,"context_line":"\tcase 0:"},{"line_number":835,"context_line":"\t\tcommand_print(CMD, \"{\");"},{"line_number":836,"context_line":"\t\tfor (struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":837,"context_line":"\t\t\tstruct sockaddr_in addr_in;"},{"line_number":838,"context_line":"\t\t\taddr_in.sin_port \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"3fabbdcb_36e3d859","line":835,"updated":"2026-03-30 13:27:31.000000000","message":"You don\u0027t need the outermost \u0027{\u0027/\u0027}\u0027. With the current implementation:\n```\n\u003e openocd \\\n  -c \u0027adapter driver dummy\u0027 \\\n  -c \u0027proc jtag_init {} {}\u0027 \\\n  -c init \\\n  -c \u0027after 100 {echo [lindex [services] 0]; shutdown};\u0027 \\\n  -d0\nOpen On-Chip Debugger 0.12.0+dev-04007-ged461f4b8 (2026-03-30-13:01)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\njtag_init\nafter#1\n\n  {name {tcl} port \"6666\" }\n  {name {telnet} port \"4444\" }\n\nshutdown command invoked\n```\nI\u0027d expect:\n```\nOpen On-Chip Debugger 0.12.0+dev-04007-ged461f4b8 (2026-03-30-13:01)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\njtag_init\nafter#1\nname {tcl} port \"6666\"\nshutdown command invoked\n```","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":832,"context_line":"{"},{"line_number":833,"context_line":"\tswitch (CMD_ARGC) {"},{"line_number":834,"context_line":"\tcase 0:"},{"line_number":835,"context_line":"\t\tcommand_print(CMD, \"{\");"},{"line_number":836,"context_line":"\t\tfor (struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":837,"context_line":"\t\t\tstruct sockaddr_in addr_in;"},{"line_number":838,"context_line":"\t\t\taddr_in.sin_port \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"7c156687_b0a5699f","line":835,"in_reply_to":"3fabbdcb_36e3d859","updated":"2026-04-07 11:09:50.000000000","message":"Ooops good point! I changed this and it now gives your expected output.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":833,"context_line":"\tswitch (CMD_ARGC) {"},{"line_number":834,"context_line":"\tcase 0:"},{"line_number":835,"context_line":"\t\tcommand_print(CMD, \"{\");"},{"line_number":836,"context_line":"\t\tfor (struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":837,"context_line":"\t\t\tstruct sockaddr_in addr_in;"},{"line_number":838,"context_line":"\t\t\taddr_in.sin_port \u003d 0;"},{"line_number":839,"context_line":"\t\t\tsocklen_t addr_in_size \u003d sizeof(addr_in);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"1535b503_b081abb1","line":836,"updated":"2026-03-30 13:27:31.000000000","message":"Please, consider making the service pointer constant.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":833,"context_line":"\tswitch (CMD_ARGC) {"},{"line_number":834,"context_line":"\tcase 0:"},{"line_number":835,"context_line":"\t\tcommand_print(CMD, \"{\");"},{"line_number":836,"context_line":"\t\tfor (struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":837,"context_line":"\t\t\tstruct sockaddr_in addr_in;"},{"line_number":838,"context_line":"\t\t\taddr_in.sin_port \u003d 0;"},{"line_number":839,"context_line":"\t\t\tsocklen_t addr_in_size \u003d sizeof(addr_in);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"f3fa5806_a8c17302","line":836,"in_reply_to":"1535b503_b081abb1","updated":"2026-04-07 11:09:50.000000000","message":"Done","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":842,"context_line":"\t\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t\t} else {"},{"line_number":847,"context_line":"\t\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"6ee5608f_4b3dd4cc","line":845,"updated":"2026-03-30 13:27:31.000000000","message":"AFAIU, you don\u0027t need `getsockname()`, you can just do `ntohs(c-\u003esin.sin_port)`.\nAlso, I\u0027d suggest to report the fields of the `service` as-is, without much logic, preserving the names of the fields (mentioning that the output of the command is version-dependent in the docs).\nIMHO this will be much clearer to the end user.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"950531144eceb092baf5be18deb2e84f7d12985c","unresolved":false,"context_lines":[{"line_number":842,"context_line":"\t\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t\t} else {"},{"line_number":847,"context_line":"\t\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"826533e2_4e49198f","line":845,"in_reply_to":"506ef255_0e500ba0","updated":"2026-06-29 14:33:48.000000000","message":"What I meant is that the dumping logic should not depend on the semantics of the fields. E.g. if you have a struct like:\n```\nstruct S {\n  int f1;\n  char *f2;\n}\n```\nIt would be reported as:\n```\n{f1 \u003cinteger value\u003e f2 \u003cstring\u003e}\n```\n\nIn any case, I don\u0027t think this is that important.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":true,"context_lines":[{"line_number":842,"context_line":"\t\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t\t} else {"},{"line_number":847,"context_line":"\t\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"506ef255_0e500ba0","line":845,"in_reply_to":"6ee5608f_4b3dd4cc","updated":"2026-04-07 11:09:50.000000000","message":"I tried removing `getsockname()`, but unfortunately that didn\u0027t work - if you do `gdb port 0` then `s-\u003esin.sin_port` is also 0.\n\n\u003e Also, I\u0027d suggest to report the fields of the service as-is, without much logic, preserving the names of the fields (mentioning that the output of the command is version-dependent in the docs).\n\nI\u0027m not sure I follow what you mean by this - can you expand?","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"428676ca56941327312e84e072dfa2f0dd31d48b","unresolved":false,"context_lines":[{"line_number":842,"context_line":"\t\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t\t} else {"},{"line_number":847,"context_line":"\t\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"302a4c11_ef940432","line":845,"in_reply_to":"826533e2_4e49198f","updated":"2026-07-02 07:55:27.000000000","message":"Oh I see. I guess that\u0027s a bit tricky to do automatically in C.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"},{"line_number":849,"context_line":"\t\t\t\tchar *port \u003d tcl_escape(s-\u003eport);"},{"line_number":850,"context_line":"\t\t\t\tif (!port) {"},{"line_number":851,"context_line":"\t\t\t\t\tLOG_ERROR(\"Unable to escape TCL string\");"},{"line_number":852,"context_line":"\t\t\t\t\treturn ERROR_FAIL;"},{"line_number":853,"context_line":"\t\t\t\t}"},{"line_number":854,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %s \", s-\u003ename, port);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"aec6b612_cb2038f5","line":851,"updated":"2026-03-30 13:27:31.000000000","message":"[nitpick]\nIt\u0027s Tcl, not TCL.\n\nAlso, please use `command_print` for reporting an error in a command handler.\n\nThe last line printed via `command_print()` or `command_print_sameline()` becomes the result of the execution. If the error code is non-zero, this result is considered an error message.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"},{"line_number":849,"context_line":"\t\t\t\tchar *port \u003d tcl_escape(s-\u003eport);"},{"line_number":850,"context_line":"\t\t\t\tif (!port) {"},{"line_number":851,"context_line":"\t\t\t\t\tLOG_ERROR(\"Unable to escape TCL string\");"},{"line_number":852,"context_line":"\t\t\t\t\treturn ERROR_FAIL;"},{"line_number":853,"context_line":"\t\t\t\t}"},{"line_number":854,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %s \", s-\u003ename, port);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"4c13b30c_39208a22","line":851,"in_reply_to":"0266fdaa_6d9cff27","updated":"2026-04-07 11:09:50.000000000","message":"Done","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"be9d5505e1c52bc5938afa3e6a3792a704aeca76","unresolved":true,"context_lines":[{"line_number":848,"context_line":"\t\t\t\t\t* allowed to contain basically any character. */"},{"line_number":849,"context_line":"\t\t\t\tchar *port \u003d tcl_escape(s-\u003eport);"},{"line_number":850,"context_line":"\t\t\t\tif (!port) {"},{"line_number":851,"context_line":"\t\t\t\t\tLOG_ERROR(\"Unable to escape TCL string\");"},{"line_number":852,"context_line":"\t\t\t\t\treturn ERROR_FAIL;"},{"line_number":853,"context_line":"\t\t\t\t}"},{"line_number":854,"context_line":"\t\t\t\tcommand_print_sameline(CMD, \"  {name {%s} port %s \", s-\u003ename, port);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"0266fdaa_6d9cff27","line":851,"in_reply_to":"aec6b612_cb2038f5","updated":"2026-03-30 13:47:12.000000000","message":"Correction: it\u0027s not the last line, it\u0027s all the output except for the last newline character (if present).","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":855,"context_line":"\t\t\t\tfree(port);"},{"line_number":856,"context_line":"\t\t\t}"},{"line_number":857,"context_line":"\t\t\tif (s-\u003eservice_info)"},{"line_number":858,"context_line":"\t\t\t\ts-\u003eservice_info(CMD, s);"},{"line_number":859,"context_line":"\t\t\tcommand_print(CMD, \"}\");"},{"line_number":860,"context_line":"\t\t}"},{"line_number":861,"context_line":"\t\tcommand_print(CMD, \"}\");"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"6af6170d_bc329487","line":858,"updated":"2026-03-30 13:27:31.000000000","message":"Please, use `CALL_COMMAND_HANDLER` macro.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":855,"context_line":"\t\t\t\tfree(port);"},{"line_number":856,"context_line":"\t\t\t}"},{"line_number":857,"context_line":"\t\t\tif (s-\u003eservice_info)"},{"line_number":858,"context_line":"\t\t\t\ts-\u003eservice_info(CMD, s);"},{"line_number":859,"context_line":"\t\t\tcommand_print(CMD, \"}\");"},{"line_number":860,"context_line":"\t\t}"},{"line_number":861,"context_line":"\t\tcommand_print(CMD, \"}\");"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"c831098f_6f15d993","line":858,"in_reply_to":"6af6170d_bc329487","updated":"2026-04-07 11:09:50.000000000","message":"Done","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":861,"context_line":"\t\tcommand_print(CMD, \"}\");"},{"line_number":862,"context_line":"\t\tbreak;"},{"line_number":863,"context_line":"\tdefault:"},{"line_number":864,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":865,"context_line":"\t}"},{"line_number":866,"context_line":"\treturn ERROR_OK;"},{"line_number":867,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"7188bed6_75036478","line":864,"updated":"2026-03-30 13:27:31.000000000","message":"Wouldn\u0027t an early-exit:\n```\nif (CMD_ARGC \u003e 0)\n    return ERROR_COMMAND_SYNTAX_ERROR;\n```\nbe more convenient?","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":861,"context_line":"\t\tcommand_print(CMD, \"}\");"},{"line_number":862,"context_line":"\t\tbreak;"},{"line_number":863,"context_line":"\tdefault:"},{"line_number":864,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":865,"context_line":"\t}"},{"line_number":866,"context_line":"\treturn ERROR_OK;"},{"line_number":867,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"792213da_0c646bcd","line":864,"in_reply_to":"7188bed6_75036478","updated":"2026-04-07 11:09:50.000000000","message":"Yes! Fixed.","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"d270be91e7692f52e0fa92a72a45a892f01c92ea","unresolved":true,"context_lines":[{"line_number":842,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t} else {"},{"line_number":847,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"b1516427_5962108e","line":845,"updated":"2026-07-09 12:22:54.000000000","message":"Please remove the `{}` around the service name. See my comment above.","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"13b6f53e75a43c352ca1b2a16ca027eaf875885a","unresolved":true,"context_lines":[{"line_number":842,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t} else {"},{"line_number":847,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"ee3642f2_4b0af1a0","line":845,"in_reply_to":"546d591f_73b28c91","updated":"2026-07-13 08:05:41.000000000","message":"Done. I don\u0027t believe any of the names currently contain special characters, but I think it\u0027s better to do it correctly anyway since that isn\u0027t enforced by the string type.","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"dab8cfac39693a53b01539d0a1f7e8b0cd62d903","unresolved":true,"context_lines":[{"line_number":842,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t} else {"},{"line_number":847,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"546d591f_73b28c91","line":845,"in_reply_to":"b1516427_5962108e","updated":"2026-07-12 12:09:58.000000000","message":"Or, if you expect it could contain some odd char (e.g. whitespace) use again `tcl_escape_alloc()`","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":false,"context_lines":[{"line_number":842,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":843,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":844,"context_line":"\t\t\t/* Note this assumes the name doesn\u0027t contain { or } which is currently the case. */"},{"line_number":845,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %hu \", s-\u003ename, ntohs(addr_in.sin_port));"},{"line_number":846,"context_line":"\t\t} else {"},{"line_number":847,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":848,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"b018db8b_502ad9dd","line":845,"in_reply_to":"ee3642f2_4b0af1a0","updated":"2026-07-13 08:44:10.000000000","message":"Done","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"d270be91e7692f52e0fa92a72a45a892f01c92ea","unresolved":true,"context_lines":[{"line_number":851,"context_line":"\t\t\t\tcommand_print(CMD, \"Unable to escape Tcl string\");"},{"line_number":852,"context_line":"\t\t\t\treturn ERROR_FAIL;"},{"line_number":853,"context_line":"\t\t\t}"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %s \", s-\u003ename, port);"},{"line_number":855,"context_line":"\t\t\tfree(port);"},{"line_number":856,"context_line":"\t\t}"},{"line_number":857,"context_line":"\t\tif (s-\u003eservice_info)"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"5233f023_d7f2f229","line":854,"updated":"2026-07-09 12:22:54.000000000","message":"Same here.","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"13b6f53e75a43c352ca1b2a16ca027eaf875885a","unresolved":false,"context_lines":[{"line_number":851,"context_line":"\t\t\t\tcommand_print(CMD, \"Unable to escape Tcl string\");"},{"line_number":852,"context_line":"\t\t\t\treturn ERROR_FAIL;"},{"line_number":853,"context_line":"\t\t\t}"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name {%s} port %s \", s-\u003ename, port);"},{"line_number":855,"context_line":"\t\t\tfree(port);"},{"line_number":856,"context_line":"\t\t}"},{"line_number":857,"context_line":"\t\tif (s-\u003eservice_info)"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"a960e6ad_18dd6de2","line":854,"in_reply_to":"5233f023_d7f2f229","updated":"2026-07-13 08:05:41.000000000","message":"Ack","commit_id":"f295f627a44829dc8e3745495eada73e3439c7bc"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":true,"context_lines":[{"line_number":838,"context_line":""},{"line_number":839,"context_line":"\tfor (const struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":840,"context_line":"\t\t/* Escape the name in case it contains special characters. */"},{"line_number":841,"context_line":"\t\tchar *escaped_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, s-\u003ename);"},{"line_number":842,"context_line":"\t\tif (!escaped_name) {"},{"line_number":843,"context_line":"\t\t\tcommand_print(CMD, \"Unable to escape Tcl string\");"},{"line_number":844,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"cb0a94e7_a0f8ea5b","line":841,"updated":"2026-07-13 08:44:10.000000000","message":"`s/global_cmd_ctx/CMD_CTX/` and drop importing `global_cmd_ctx`","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"d10023cbaf558da950a810538db4c44042bb4c26","unresolved":false,"context_lines":[{"line_number":838,"context_line":""},{"line_number":839,"context_line":"\tfor (const struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":840,"context_line":"\t\t/* Escape the name in case it contains special characters. */"},{"line_number":841,"context_line":"\t\tchar *escaped_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, s-\u003ename);"},{"line_number":842,"context_line":"\t\tif (!escaped_name) {"},{"line_number":843,"context_line":"\t\t\tcommand_print(CMD, \"Unable to escape Tcl string\");"},{"line_number":844,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"468b6222_db0682e9","line":841,"in_reply_to":"cb0a94e7_a0f8ea5b","updated":"2026-07-13 10:17:39.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"1d5353b5723c1e5e334199eafb3bfa8242259d65","unresolved":false,"context_lines":[{"line_number":838,"context_line":""},{"line_number":839,"context_line":"\tfor (const struct service *s \u003d services; s; s \u003d s-\u003enext) {"},{"line_number":840,"context_line":"\t\t/* Escape the name in case it contains special characters. */"},{"line_number":841,"context_line":"\t\tchar *escaped_name \u003d tcl_escape_alloc(global_cmd_ctx-\u003einterp, s-\u003ename);"},{"line_number":842,"context_line":"\t\tif (!escaped_name) {"},{"line_number":843,"context_line":"\t\t\tcommand_print(CMD, \"Unable to escape Tcl string\");"},{"line_number":844,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b4d28496_b1125dd7","line":841,"in_reply_to":"cb0a94e7_a0f8ea5b","updated":"2026-07-16 09:44:22.000000000","message":"Done","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"264b2c92b66740952ffaf883d2a02a17c37968f7","unresolved":true,"context_lines":[{"line_number":851,"context_line":"\t\tif (s-\u003etype \u003d\u003d CONNECTION_TCP \u0026\u0026"},{"line_number":852,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":853,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name %s port %hu \", escaped_name, ntohs(addr_in.sin_port));"},{"line_number":855,"context_line":"\t\t} else {"},{"line_number":856,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":857,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"48d0a409_9429aa0a","line":854,"updated":"2026-07-13 08:44:10.000000000","message":"From Tcl point of view either whitespace and newline are both valid field separators for a dict or an array.\nWe can make the output of this command either a valid Tcl and human readable by levering this Tcl property.\nPlease consider changing this as:\n```\ncommand_print(CMD, \"{\");\nif (s-\u003etype \u003d\u003d CONNECTION_TCP \u0026\u0026 ...) {\n\tcommand_print(CMD, \"    name %s port %hu\", ...);\n\t...\n} else {\n\tcommand_print(CMD, \"    name %s port %s\", ...);\n\t...\n}\ncommand_print(CMD, \"}\");\n```\nwith some indentation in the output, like 4 whitespaces.\nHaving also the same indentation in `gdb_service_info()` to beautify the output.\nMaybe it\u0027s too long having 3 lines per server, but it will work nice if we add more info later on.\n\nIt could be also optimize by merging the `{` in\n`\tcommand_print(CMD, \"{\\n    name %s port %...\", ...);`\nbut I prefer keeping them separate for code readability.","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"9b6388cea437aa52f7e3d3555cb0c849eef4dc88","unresolved":false,"context_lines":[{"line_number":851,"context_line":"\t\tif (s-\u003etype \u003d\u003d CONNECTION_TCP \u0026\u0026"},{"line_number":852,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":853,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name %s port %hu \", escaped_name, ntohs(addr_in.sin_port));"},{"line_number":855,"context_line":"\t\t} else {"},{"line_number":856,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":857,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"317c4f43_93301ef6","line":854,"in_reply_to":"3d3efe71_ba7508ac","updated":"2026-07-18 14:01:57.000000000","message":"Actually when `tcl_escape_alloc()` returns `NULL` is because OpenOCD runs out of memory.\nIt should not be reported through `command_print()` as there is no guarantee OpenOCD will survive.\n`LOG_ERROR(\"Out of memory\")` should be preferred, or a new version of https://review.openocd.org/c/9475","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"d10023cbaf558da950a810538db4c44042bb4c26","unresolved":false,"context_lines":[{"line_number":851,"context_line":"\t\tif (s-\u003etype \u003d\u003d CONNECTION_TCP \u0026\u0026"},{"line_number":852,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":853,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name %s port %hu \", escaped_name, ntohs(addr_in.sin_port));"},{"line_number":855,"context_line":"\t\t} else {"},{"line_number":856,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":857,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"64a3a63c_c4ff291d","line":854,"in_reply_to":"48d0a409_9429aa0a","updated":"2026-07-13 10:17:39.000000000","message":"Agree on your split in multiple lines, mush clean. Thanks","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"1d5353b5723c1e5e334199eafb3bfa8242259d65","unresolved":false,"context_lines":[{"line_number":851,"context_line":"\t\tif (s-\u003etype \u003d\u003d CONNECTION_TCP \u0026\u0026"},{"line_number":852,"context_line":"\t\t\ts-\u003eportnumber \u003d\u003d 0 \u0026\u0026"},{"line_number":853,"context_line":"\t\t\tgetsockname(s-\u003efd, (struct sockaddr *)\u0026addr_in, \u0026addr_in_size) \u003d\u003d 0) {"},{"line_number":854,"context_line":"\t\t\tcommand_print_sameline(CMD, \"{name %s port %hu \", escaped_name, ntohs(addr_in.sin_port));"},{"line_number":855,"context_line":"\t\t} else {"},{"line_number":856,"context_line":"\t\t\t/* Need to escape port because it could be a FIFO path which is"},{"line_number":857,"context_line":"\t\t\t * allowed to contain basically any character. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"3d3efe71_ba7508ac","line":854,"in_reply_to":"48d0a409_9429aa0a","updated":"2026-07-16 09:44:22.000000000","message":"Ah yeah that seems nicer. Output now looks like this:\n\n```\n{\n    name gdb\n    port 33801\n    target tap.cpu\n}\n```\n\nThe only slight awkwardness now is if it fails to escape the string you\u0027ll get somethin glike\n\n```\n{\n    name gdb\nUnable to escape Tcl string\n```\n\nBut that should only happen on allocation failure which is impossible on Linux and pretty unlikely in general. Hope that\u0027s ok!","commit_id":"807efdba7e542fc0e66feb064e8fa77b46a20a95"}],"src/server/server.h":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"093345938d44bd3ceeff0a11ed856f44c9a1be2d","unresolved":true,"context_lines":[{"line_number":85,"context_line":"\tint (*new_connection)(struct connection *connection);"},{"line_number":86,"context_line":"\tint (*input)(struct connection *connection);"},{"line_number":87,"context_line":"\tvoid (*service_dtor)(struct service *service);"},{"line_number":88,"context_line":"\tvoid (*service_info)(struct command_invocation *cmd, struct service *service);"},{"line_number":89,"context_line":"\tint (*connection_closed)(struct connection *connection);"},{"line_number":90,"context_line":"\tvoid (*keep_client_alive)(struct connection *connection);"},{"line_number":91,"context_line":"\tvoid *priv;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"337d1d3a_552c7816","line":88,"updated":"2026-03-30 13:27:31.000000000","message":"```\nCOMMAND_HELPER((*service_info), const struct service* service);\n```","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"},{"author":{"_account_id":1002502,"name":"Tim Hutt","email":"tdhutt@gmail.com","username":"Timmmm"},"change_message_id":"816c63eeb6c5dcfa52f88df5bef2cf07f54f8d4f","unresolved":false,"context_lines":[{"line_number":85,"context_line":"\tint (*new_connection)(struct connection *connection);"},{"line_number":86,"context_line":"\tint (*input)(struct connection *connection);"},{"line_number":87,"context_line":"\tvoid (*service_dtor)(struct service *service);"},{"line_number":88,"context_line":"\tvoid (*service_info)(struct command_invocation *cmd, struct service *service);"},{"line_number":89,"context_line":"\tint (*connection_closed)(struct connection *connection);"},{"line_number":90,"context_line":"\tvoid (*keep_client_alive)(struct connection *connection);"},{"line_number":91,"context_line":"\tvoid *priv;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"5be5568e_40dac6c6","line":88,"in_reply_to":"337d1d3a_552c7816","updated":"2026-04-07 11:09:50.000000000","message":"Done","commit_id":"ed461f4b891d25da02f4c6aa20761c1f3e602169"}]}
