)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"a756bd93c34229028e40e572f882c767ee16ca7b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"c30881f7_42efc87a","updated":"2021-11-04 11:03:43.000000000","message":"I like the possibility of redirecting the semihosting output to a TCP connection.\n\nFew general ideas for your consideration:\n\n- How about the semihosting output that was produced prior to client connecting. Would it make sense to buffer the contents, so that when a client connects, it receives all past semihosting output first.\n\n- Do you intend to support multiple clients or just one?\n\n- What would be the behavior of the operations when there is no client connected? Will the read() semihosting call block? Will write() return an error?\n\n- Take care about the return value of read_socket() and write_socket() and do proper checking. You can take a look at how it is done in jtag_vpi.c, for example. Maybe the socket read/write functions could be enhanced and the error handling put inside, so that it is reusable.\n\n","commit_id":"08278e261b71f286844d49a3042d22795ea189dd"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"39341bf43e3b703a03db05f180cb061ee8f0d05b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"07fe4bec_edc45248","updated":"2021-11-03 16:43:00.000000000","message":"Oleksij, could we continue working on this patch ?","commit_id":"08278e261b71f286844d49a3042d22795ea189dd"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"e8e5466b8ff46d65a936380523191e55fcdc5d62","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"9dc3ef1b_3fd955e0","in_reply_to":"07fe4bec_edc45248","updated":"2021-11-19 09:28:37.000000000","message":"Sorry, I was busy. So far it looks good for me. Can you please address/response to Jans questions.","commit_id":"08278e261b71f286844d49a3042d22795ea189dd"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"f0be6bc6df9eead69f5ac2b2f1871b238b2c5276","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"53ad2308_6d1f86e8","in_reply_to":"c30881f7_42efc87a","updated":"2021-12-06 23:07:54.000000000","message":"Thanks Oleksij, Jan,\n\nJan, please find my answers inline:\n\n\u003e How about the semihosting output that was produced prior to client connecting. Would it make sense to buffer the contents, so that when a client connects, it receives all past semihosting output first.\n\ncurrently we just return -1 and set sys_errno to EBADF\nsemihosting is not only printing chars, it could request from the user to write some inputs. so for consistency (error for both read and write) I would prefer to just return with error.\n\n\u003e Do you intend to support multiple clients or just one?\n\ncurrently, only one connection is accepted (per target).\nFYI, for tpiu I added the feature to retarget SWO message via TCP as well permitting multiple clients to receive the stream.\nBut in semihosting usecase, there is the READC and READC operation that requires to read user input from TCP client and having multiple clients will make this extra complex.\nI would prefer to keep single client for the moment to make this feature go in.\nthen we can discuss if we need to manage the headache of multiple clients.\n\n\n\u003e What would be the behavior of the operations when there is no client connected? Will the read() semihosting call block? Will write() return an error?\n\nwe just return with error\n\n\u003e Take care about the return value of read_socket() and write_socket() and do proper checking. You can take a look at how it is done in jtag_vpi.c, for example. Maybe the socket read/write functions could be enhanced and the error handling put inside, so that it is reusable.\n\nsure, that\u0027s a nice addition for stlink tcp server as well.\nhere we are using the server services infrastructure, so I limited the check to (1) and (2).\nI think in the future these could be pushed to connection_read and _write.\n\nPlease let me know if you have further comments.","commit_id":"08278e261b71f286844d49a3042d22795ea189dd"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":14,"id":"905f965b_88f9ca2e","updated":"2022-02-26 17:46:37.000000000","message":"Several points to check.\n\nPending commit https://review.openocd.org/6838/ modifies the prototype of add_service().\nTo avoid further rebase, later, would you mind pushing this on top of https://review.openocd.org/6771/ and verify that this still works after https://review.openocd.org/q/topic:keepalive ?","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"f494c7e0c997939e0e3f9c9ec68aa363973bb84c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":14,"id":"1d36cc75_65ecbd19","updated":"2022-02-25 16:23:20.000000000","message":"minor change to resolve a conflict","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":15,"id":"7e27ac37_bd65cfbc","updated":"2022-03-02 16:19:41.000000000","message":"Thanks Antonio,\n\nI have rebased this change on top of yours\nand started by the easy feedbacks ","commit_id":"e7b2f4efa6a243dc487a04a9401713e6d7139647"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2179556d83a3ee66ca1751c01b795559a719a05b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"ba36e966_5237fbae","updated":"2022-03-02 18:22:28.000000000","message":"a couple a memory leaks and one idea of re-coding that you are free to trash if you don\u0027t like","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"8ffd641a1fcdc91f95511f847fdeff0d03370e8f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":17,"id":"e488c86e_b8a7ac09","updated":"2022-03-04 22:43:19.000000000","message":"thanks","commit_id":"771f3660f570ab1ad93cc823fa7aca8271e99101"}],"doc/openocd.texi":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":9255,"context_line":"Redirect semihosting messages to a specified TCP port."},{"line_number":9256,"context_line":""},{"line_number":9257,"context_line":"This command redirects debug (READC, WRITEC and WRITE0) and stdio (READ, WRITE)"},{"line_number":9258,"context_line":"semihsoting opetations to the specified TCP port."},{"line_number":9259,"context_line":"The command allows to select which type of operations to redirect (debug, stdio, all (default))."},{"line_number":9260,"context_line":"Note: for stdio operations, only I/O from/to \u0027:tt\u0027 file descriptors are redirected."},{"line_number":9261,"context_line":"@end deffn"}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"23f597e4_3f7ffad1","line":9258,"updated":"2022-02-26 17:46:37.000000000","message":"s/semihsoting/semihosting/\ns/opetations/operations/","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"4596e34eefa669188656fa4287c3ef8cadd95039","unresolved":false,"context_lines":[{"line_number":9255,"context_line":"Redirect semihosting messages to a specified TCP port."},{"line_number":9256,"context_line":""},{"line_number":9257,"context_line":"This command redirects debug (READC, WRITEC and WRITE0) and stdio (READ, WRITE)"},{"line_number":9258,"context_line":"semihsoting opetations to the specified TCP port."},{"line_number":9259,"context_line":"The command allows to select which type of operations to redirect (debug, stdio, all (default))."},{"line_number":9260,"context_line":"Note: for stdio operations, only I/O from/to \u0027:tt\u0027 file descriptors are redirected."},{"line_number":9261,"context_line":"@end deffn"}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"7d32f391_b5e6c5a4","line":9258,"in_reply_to":"23f597e4_3f7ffad1","updated":"2022-03-02 16:50:46.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"9c2e98a30d8f249782af0db3da57e3a5acc3b9f7","unresolved":false,"context_lines":[{"line_number":9255,"context_line":"Redirect semihosting messages to a specified TCP port."},{"line_number":9256,"context_line":""},{"line_number":9257,"context_line":"This command redirects debug (READC, WRITEC and WRITE0) and stdio (READ, WRITE)"},{"line_number":9258,"context_line":"semihsoting opetations to the specified TCP port."},{"line_number":9259,"context_line":"The command allows to select which type of operations to redirect (debug, stdio, all (default))."},{"line_number":9260,"context_line":"Note: for stdio operations, only I/O from/to \u0027:tt\u0027 file descriptors are redirected."},{"line_number":9261,"context_line":"@end deffn"}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"c81bb113_53d4ccac","line":9258,"in_reply_to":"23f597e4_3f7ffad1","updated":"2022-03-02 16:56:07.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"}],"src/target/semihosting_common.c":[{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"ba1d1c7a6c340de7877dc81c6ed2e9d9f878a270","unresolved":false,"context_lines":[{"line_number":145,"context_line":"{"},{"line_number":146,"context_line":"\tif (semihosting-\u003eredirect_channel \u003d\u003d SEMIHOSTING_REDIRECT_TCP) {"},{"line_number":147,"context_line":"\t\tif (semihosting-\u003eredirect_connection) {"},{"line_number":148,"context_line":"\t\t\tif (fd \u003d\u003d semihosting-\u003estdout_fd || fd \u003d\u003d semihosting-\u003estderr_fd)"},{"line_number":149,"context_line":"\t\t\t\treturn connection_write(semihosting-\u003eredirect_connection, buf, size);"},{"line_number":150,"context_line":"\t\t\t/* else (the fd is not a \u0027:tt\u0027 file), fall back to default behavior */"},{"line_number":151,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"2e76d7c5_d5bc2fb4","line":148,"range":{"start_line":148,"start_character":3,"end_line":148,"end_character":68},"updated":"2020-04-03 12:18:08.000000000","message":"here is the filter dedicated for WRITE","commit_id":"77265304df4340e61426a154ee21b02db34a3951"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"ba1d1c7a6c340de7877dc81c6ed2e9d9f878a270","unresolved":false,"context_lines":[{"line_number":161,"context_line":"\treturn semihosting_write(semihosting, fd, \u0026c, 1) \u003d\u003d 1 ? c : EOF;"},{"line_number":162,"context_line":"}"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"static int semihosting_read(struct semihosting *semihosting, int fd, void *buf, int size)"},{"line_number":165,"context_line":"{"},{"line_number":166,"context_line":"\tif (semihosting-\u003eredirect_channel \u003d\u003d SEMIHOSTING_REDIRECT_TCP) {"},{"line_number":167,"context_line":"\t\tif (semihosting-\u003eredirect_connection) {"},{"line_number":168,"context_line":"\t\t\tif (fd \u003d\u003d semihosting-\u003estdin_fd)"},{"line_number":169,"context_line":"\t\t\t\t// return connection_write(semihosting-\u003eredirect_connection, buffer, size);"},{"line_number":170,"context_line":"\t\t\t\treturn -1;"},{"line_number":171,"context_line":"\t\t\t/* else (the fd is not a \u0027:tt\u0027 file), fall back to default behavior */"},{"line_number":172,"context_line":"\t\t}"},{"line_number":173,"context_line":"\t\t/* else: no connected client, fall back to default behavior */"},{"line_number":174,"context_line":"\t}"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"\t/* redirect to console */"},{"line_number":177,"context_line":"\treturn read(fd, buf, size);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"static int semihosting_getchar(struct semihosting *semihosting, int fd)"},{"line_number":181,"context_line":"{"},{"line_number":182,"context_line":"\tint c;"},{"line_number":183,"context_line":"\tif (semihosting-\u003eredirect_channel \u003d\u003d SEMIHOSTING_REDIRECT_TCP) {"},{"line_number":184,"context_line":"\t\tif (semihosting-\u003eredirect_connection) {"},{"line_number":185,"context_line":"\t\t\treturn EOF;"},{"line_number":186,"context_line":"\t\t}"},{"line_number":187,"context_line":"\t}"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"\t/* redirect to console */"},{"line_number":190,"context_line":"\treturn read(fd, \u0026c, 1) \u003e -1 ? c : EOF;"},{"line_number":191,"context_line":"}"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"/**"},{"line_number":194,"context_line":" * Portable implementation of ARM semihosting calls."}],"source_content_type":"text/x-csrc","patch_set":2,"id":"2e76d7c5_75d99b2b","line":191,"range":{"start_line":164,"start_character":0,"end_line":191,"end_character":1},"updated":"2020-04-03 12:18:08.000000000","message":"read from TCP is not completed yet.","commit_id":"77265304df4340e61426a154ee21b02db34a3951"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"static bool semihosting_redirect_check(struct semihosting *semihosting, int fd);"},{"line_number":147,"context_line":"static int semihosting_redirect_read(struct semihosting *semihosting, void *buf, int size);"},{"line_number":148,"context_line":"static int semihosting_redirect_write(struct semihosting *semihosting, void *buf, int size);"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"static int semihosting_write(struct semihosting *semihosting, int fd, void *buf, int size)"},{"line_number":151,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_fcab4e19","line":148,"updated":"2021-03-18 05:43:37.000000000","message":"resort the code to avoid clattering with extra declarations.","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"static bool semihosting_redirect_check(struct semihosting *semihosting, int fd);"},{"line_number":147,"context_line":"static int semihosting_redirect_read(struct semihosting *semihosting, void *buf, int size);"},{"line_number":148,"context_line":"static int semihosting_redirect_write(struct semihosting *semihosting, void *buf, int size);"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"static int semihosting_write(struct semihosting *semihosting, int fd, void *buf, int size)"},{"line_number":151,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_2210d05a","line":148,"in_reply_to":"ceda9b01_fcab4e19","updated":"2021-08-20 09:40:37.000000000","message":"Done","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1553,"context_line":"{"},{"line_number":1554,"context_line":"\tif (!semihosting-\u003etcp_connection) {"},{"line_number":1555,"context_line":"\t\tLOG_ERROR(\"No connected TCP client for semihosting\");"},{"line_number":1556,"context_line":"\t\treturn -1;"},{"line_number":1557,"context_line":"\t}"},{"line_number":1558,"context_line":""},{"line_number":1559,"context_line":"\tstruct semihosting_tcp_service *service \u003d semihosting-\u003etcp_connection-\u003eservice-\u003epriv;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_7c675e23","line":1556,"updated":"2021-03-18 05:43:37.000000000","message":"hm, after each operation \"errno\" is called, i assume we will get some misleading results if result is -1 and errno is probably 0.\ncurrently no idea how to solve it","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1553,"context_line":"{"},{"line_number":1554,"context_line":"\tif (!semihosting-\u003etcp_connection) {"},{"line_number":1555,"context_line":"\t\tLOG_ERROR(\"No connected TCP client for semihosting\");"},{"line_number":1556,"context_line":"\t\treturn -1;"},{"line_number":1557,"context_line":"\t}"},{"line_number":1558,"context_line":""},{"line_number":1559,"context_line":"\tstruct semihosting_tcp_service *service \u003d semihosting-\u003etcp_connection-\u003eservice-\u003epriv;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_821bbc81","line":1556,"in_reply_to":"ceda9b01_7c675e23","updated":"2021-08-20 09:40:37.000000000","message":"one idea is to move semihosting-\u003esys_errno setting to this function, I will preview this in PS10","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1559,"context_line":"\tstruct semihosting_tcp_service *service \u003d semihosting-\u003etcp_connection-\u003eservice-\u003epriv;"},{"line_number":1560,"context_line":""},{"line_number":1561,"context_line":"\tservice-\u003eerror \u003d ERROR_OK;"},{"line_number":1562,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 1;"},{"line_number":1563,"context_line":""},{"line_number":1564,"context_line":"\tint bytes_read \u003d connection_read(semihosting-\u003etcp_connection, buf, size);"},{"line_number":1565,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_bca5c645","line":1562,"updated":"2021-03-18 05:43:37.000000000","message":"input_pending is bool, please use true and false","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1559,"context_line":"\tstruct semihosting_tcp_service *service \u003d semihosting-\u003etcp_connection-\u003eservice-\u003epriv;"},{"line_number":1560,"context_line":""},{"line_number":1561,"context_line":"\tservice-\u003eerror \u003d ERROR_OK;"},{"line_number":1562,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 1;"},{"line_number":1563,"context_line":""},{"line_number":1564,"context_line":"\tint bytes_read \u003d connection_read(semihosting-\u003etcp_connection, buf, size);"},{"line_number":1565,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_420dd440","line":1562,"in_reply_to":"ceda9b01_bca5c645","updated":"2021-08-20 09:40:37.000000000","message":"indeed input_pending type changed after this PS8, I will fix this","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1563,"context_line":""},{"line_number":1564,"context_line":"\tint bytes_read \u003d connection_read(semihosting-\u003etcp_connection, buf, size);"},{"line_number":1565,"context_line":""},{"line_number":1566,"context_line":"\tif (bytes_read \u003c\u003d 0)"},{"line_number":1567,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1568,"context_line":""},{"line_number":1569,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_9c6c8207","line":1566,"updated":"2021-03-18 05:43:37.000000000","message":"what happens if we read less than requested?","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1563,"context_line":""},{"line_number":1564,"context_line":"\tint bytes_read \u003d connection_read(semihosting-\u003etcp_connection, buf, size);"},{"line_number":1565,"context_line":""},{"line_number":1566,"context_line":"\tif (bytes_read \u003c\u003d 0)"},{"line_number":1567,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1568,"context_line":""},{"line_number":1569,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_e2096835","line":1566,"in_reply_to":"ceda9b01_9c6c8207","updated":"2021-08-20 09:40:37.000000000","message":"we should read the available bytes and let the handling to library implementation in target level.\nif the target is not satisfied with the length, it will ask for more bytes by another read ...","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1566,"context_line":"\tif (bytes_read \u003c\u003d 0)"},{"line_number":1567,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1568,"context_line":""},{"line_number":1569,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 0;"},{"line_number":1570,"context_line":""},{"line_number":1571,"context_line":"\treturn bytes_read;"},{"line_number":1572,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_dca20a3b","line":1569,"updated":"2021-03-18 05:43:37.000000000","message":"hm... do we have a separate thread which is relaying on this flag? If yes, how it is actually synced between CPU cores?","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1566,"context_line":"\tif (bytes_read \u003c\u003d 0)"},{"line_number":1567,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1568,"context_line":""},{"line_number":1569,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d 0;"},{"line_number":1570,"context_line":""},{"line_number":1571,"context_line":"\treturn bytes_read;"},{"line_number":1572,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_0207cc20","line":1569,"in_reply_to":"ceda9b01_dca20a3b","updated":"2021-08-20 09:40:37.000000000","message":"each CPU core (target) do have a separate semihosting instance. so there is no concurrency on this flag.","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1571,"context_line":"\treturn bytes_read;"},{"line_number":1572,"context_line":"}"},{"line_number":1573,"context_line":""},{"line_number":1574,"context_line":"static int semihosting_redirect_write(struct semihosting *semihosting, void *buf, int size)"},{"line_number":1575,"context_line":"{"},{"line_number":1576,"context_line":"\tif (!semihosting-\u003etcp_connection) {"},{"line_number":1577,"context_line":"\t\tLOG_ERROR(\"No connected TCP client for semihosting\");"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_c500ee06","line":1574,"range":{"start_line":1574,"start_character":11,"end_line":1574,"end_character":37},"updated":"2021-08-20 09:40:37.000000000","message":"we need to set sys_errno here as well","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1595,"context_line":""},{"line_number":1596,"context_line":"\tif (!connection-\u003einput_pending) {"},{"line_number":1597,"context_line":"\t\t/* consume received data, not for semihosting IO */"},{"line_number":1598,"context_line":"\t\tconst int buf_len \u003d 100;"},{"line_number":1599,"context_line":"\t\tchar buf[buf_len];"},{"line_number":1600,"context_line":"\t\tint bytes_read \u003d connection_read(connection, buf, buf_len);"},{"line_number":1601,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_3c71d6dd","line":1598,"updated":"2021-03-18 05:43:37.000000000","message":"why 100? What if there is more?","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"68fdddf03d3f3a3f3b8c7664f0a74609b94250ff","unresolved":false,"context_lines":[{"line_number":1595,"context_line":""},{"line_number":1596,"context_line":"\tif (!connection-\u003einput_pending) {"},{"line_number":1597,"context_line":"\t\t/* consume received data, not for semihosting IO */"},{"line_number":1598,"context_line":"\t\tconst int buf_len \u003d 100;"},{"line_number":1599,"context_line":"\t\tchar buf[buf_len];"},{"line_number":1600,"context_line":"\t\tint bytes_read \u003d connection_read(connection, buf, buf_len);"},{"line_number":1601,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_a5fb6a10","line":1598,"in_reply_to":"ceda9b01_3c71d6dd","updated":"2021-08-20 09:40:37.000000000","message":"just a random number. I limited it to 100, in order to not use much stack for the \u0027buf\u0027 array.\nif there is more, semihosting_tcp_cnx_input will be called again by the underlying service (server.c:561 [server_loop])\n\nBTW: in openocd different sizes are used\n - telnet_server and jsp_server the size is 10*1024\n - tcl_server the size is 256\n - arm_tpiu_swo it\u0027s reading sizeof(long) just to check if the connection\n   is alive, as in tpiu we just write only to the connection\n - rtt_server is reading 1024\n - gdb_server is not using this connection_read function and instead\n   it\u0027s reading from the socket directly by the size of 16384","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1613,"context_line":""},{"line_number":1614,"context_line":"static int semihosting_tcp_cnx_closed(struct connection *connection)"},{"line_number":1615,"context_line":"{"},{"line_number":1616,"context_line":"\t/* nothing to do, no connection-\u003epriv to free */"},{"line_number":1617,"context_line":"\treturn ERROR_OK;"},{"line_number":1618,"context_line":"}"},{"line_number":1619,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_5c761ad7","line":1616,"updated":"2021-03-18 05:43:37.000000000","message":"do we really have nothing to free?","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1619,"context_line":""},{"line_number":1620,"context_line":"static void semihosting_tcp_close_cnx(struct semihosting *semihosting)"},{"line_number":1621,"context_line":"{"},{"line_number":1622,"context_line":"\tif (semihosting-\u003etcp_connection !\u003d NULL) {"},{"line_number":1623,"context_line":"\t\tstruct service *service \u003d semihosting-\u003etcp_connection-\u003eservice;"},{"line_number":1624,"context_line":"\t\tremove_service(service-\u003ename, service-\u003eport);"},{"line_number":1625,"context_line":"\t\tsemihosting-\u003etcp_connection \u003d NULL;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_fc7a6eb8","line":1622,"updated":"2021-03-18 05:43:37.000000000","message":"you are already using different NULL check style in this patch, be consequent.\nif (bla) / if (!bla)","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"50e13d96a55c8f4c4ebd015053e59fa2ac48eedd","unresolved":false,"context_lines":[{"line_number":1619,"context_line":""},{"line_number":1620,"context_line":"static void semihosting_tcp_close_cnx(struct semihosting *semihosting)"},{"line_number":1621,"context_line":"{"},{"line_number":1622,"context_line":"\tif (semihosting-\u003etcp_connection !\u003d NULL) {"},{"line_number":1623,"context_line":"\t\tstruct service *service \u003d semihosting-\u003etcp_connection-\u003eservice;"},{"line_number":1624,"context_line":"\t\tremove_service(service-\u003ename, service-\u003eport);"},{"line_number":1625,"context_line":"\t\tsemihosting-\u003etcp_connection \u003d NULL;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"2ecb373e_b15ad820","line":1622,"in_reply_to":"ceda9b01_fc7a6eb8","updated":"2021-08-20 11:05:05.000000000","message":"Done","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"50e13d96a55c8f4c4ebd015053e59fa2ac48eedd","unresolved":false,"context_lines":[{"line_number":1621,"context_line":"{"},{"line_number":1622,"context_line":"\tif (semihosting-\u003etcp_connection !\u003d NULL) {"},{"line_number":1623,"context_line":"\t\tstruct service *service \u003d semihosting-\u003etcp_connection-\u003eservice;"},{"line_number":1624,"context_line":"\t\tremove_service(service-\u003ename, service-\u003eport);"},{"line_number":1625,"context_line":"\t\tsemihosting-\u003etcp_connection \u003d NULL;"},{"line_number":1626,"context_line":"\t}"},{"line_number":1627,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"2ecb373e_11a96cdc","line":1624,"range":{"start_line":1624,"start_character":2,"end_line":1624,"end_character":47},"updated":"2021-08-20 11:05:05.000000000","message":"[1]","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1623,"context_line":"\t\tstruct service *service \u003d semihosting-\u003etcp_connection-\u003eservice;"},{"line_number":1624,"context_line":"\t\tremove_service(service-\u003ename, service-\u003eport);"},{"line_number":1625,"context_line":"\t\tsemihosting-\u003etcp_connection \u003d NULL;"},{"line_number":1626,"context_line":"\t}"},{"line_number":1627,"context_line":"}"},{"line_number":1628,"context_line":""},{"line_number":1629,"context_line":"/* -------------------------------------------------------------------------"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_1c7892be","line":1626,"updated":"2021-03-18 05:43:37.000000000","message":"do not hide complete function in to if statement\n\nin this case\nif (connection)\n    return","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"50e13d96a55c8f4c4ebd015053e59fa2ac48eedd","unresolved":false,"context_lines":[{"line_number":1623,"context_line":"\t\tstruct service *service \u003d semihosting-\u003etcp_connection-\u003eservice;"},{"line_number":1624,"context_line":"\t\tremove_service(service-\u003ename, service-\u003eport);"},{"line_number":1625,"context_line":"\t\tsemihosting-\u003etcp_connection \u003d NULL;"},{"line_number":1626,"context_line":"\t}"},{"line_number":1627,"context_line":"}"},{"line_number":1628,"context_line":""},{"line_number":1629,"context_line":"/* -------------------------------------------------------------------------"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"2ecb373e_519ff4b9","line":1626,"in_reply_to":"ceda9b01_1c7892be","updated":"2021-08-20 11:05:05.000000000","message":"Done","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"37090c72b7ea3827275fe53ee8801b370d42bdf4","unresolved":false,"context_lines":[{"line_number":1721,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"},{"line_number":1722,"context_line":""},{"line_number":1723,"context_line":"\tif (cfg !\u003d SEMIHOSTING_REDIRECT_CFG_NONE) {"},{"line_number":1724,"context_line":"\t\tstruct semihosting_tcp_service *service \u003d"},{"line_number":1725,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1726,"context_line":"\t\tif (!service) {"},{"line_number":1727,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ceda9b01_dc81aa93","line":1724,"updated":"2021-03-18 05:43:37.000000000","message":"i can\u0027t find place where it is freed.\nDo I see it correctly, we will allocate as many times as we have RAM on the system?","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"50e13d96a55c8f4c4ebd015053e59fa2ac48eedd","unresolved":false,"context_lines":[{"line_number":1721,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"},{"line_number":1722,"context_line":""},{"line_number":1723,"context_line":"\tif (cfg !\u003d SEMIHOSTING_REDIRECT_CFG_NONE) {"},{"line_number":1724,"context_line":"\t\tstruct semihosting_tcp_service *service \u003d"},{"line_number":1725,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1726,"context_line":"\t\tif (!service) {"},{"line_number":1727,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"2ecb373e_71a47005","line":1724,"in_reply_to":"ceda9b01_dc81aa93","updated":"2021-08-20 11:05:05.000000000","message":"this is freed in src/server/server.c:remove_service (free(tmp-\u003epriv))\nand remove_service is called in [1]","commit_id":"d8d2556f2680e70a66133a5ddb6bd981049cf89a"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"f0be6bc6df9eead69f5ac2b2f1871b238b2c5276","unresolved":true,"context_lines":[{"line_number":196,"context_line":""},{"line_number":197,"context_line":"\tint retval \u003d connection_write(semihosting-\u003etcp_connection, buf, size);"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"\tif (retval \u003c 0)"},{"line_number":200,"context_line":"\t\tlog_socket_error(service-\u003ename);"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\treturn retval;"},{"line_number":203,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"d929d418_7ff245a3","line":200,"range":{"start_line":199,"start_character":0,"end_line":200,"end_character":34},"updated":"2021-12-06 23:07:54.000000000","message":"(1)","commit_id":"d8bbd375c0226b17116179fa51f2277aef058940"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":196,"context_line":""},{"line_number":197,"context_line":"\tint retval \u003d connection_write(semihosting-\u003etcp_connection, buf, size);"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"\tif (retval \u003c 0)"},{"line_number":200,"context_line":"\t\tlog_socket_error(service-\u003ename);"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\treturn retval;"},{"line_number":203,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"58228a11_1321d096","line":200,"range":{"start_line":199,"start_character":0,"end_line":200,"end_character":34},"in_reply_to":"d929d418_7ff245a3","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"d8bbd375c0226b17116179fa51f2277aef058940"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"f0be6bc6df9eead69f5ac2b2f1871b238b2c5276","unresolved":true,"context_lines":[{"line_number":229,"context_line":"\tif (retval \u003c\u003d 0)"},{"line_number":230,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"\tif (retval \u003c 0)"},{"line_number":233,"context_line":"\t\tlog_socket_error(service-\u003ename);"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d false;"},{"line_number":236,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"9811a734_e48db0c1","line":233,"range":{"start_line":232,"start_character":0,"end_line":233,"end_character":34},"updated":"2021-12-06 23:07:54.000000000","message":"(2)","commit_id":"d8bbd375c0226b17116179fa51f2277aef058940"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":229,"context_line":"\tif (retval \u003c\u003d 0)"},{"line_number":230,"context_line":"\t\tservice-\u003eerror \u003d ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"\tif (retval \u003c 0)"},{"line_number":233,"context_line":"\t\tlog_socket_error(service-\u003ename);"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"\tsemihosting-\u003etcp_connection-\u003einput_pending \u003d false;"},{"line_number":236,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"a8e4da1e_9d4b2587","line":233,"range":{"start_line":232,"start_character":0,"end_line":233,"end_character":34},"in_reply_to":"9811a734_e48db0c1","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"d8bbd375c0226b17116179fa51f2277aef058940"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":180,"context_line":"\t/* check config against op */"},{"line_number":181,"context_line":"\tif (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_ALL \u0026\u0026 !op_is_debug \u0026\u0026 !op_is_stdio)"},{"line_number":182,"context_line":"\t\treturn false;"},{"line_number":183,"context_line":"\telse if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_DEBUG \u0026\u0026 !op_is_debug)"},{"line_number":184,"context_line":"\t\treturn false;"},{"line_number":185,"context_line":"\telse if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_STDIO \u0026\u0026 !op_is_stdio)"},{"line_number":186,"context_line":"\t\treturn false;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"bb87908b_7eb77a81","line":183,"updated":"2022-02-26 17:46:37.000000000","message":"no need for else after a return\nAlso below","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":180,"context_line":"\t/* check config against op */"},{"line_number":181,"context_line":"\tif (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_ALL \u0026\u0026 !op_is_debug \u0026\u0026 !op_is_stdio)"},{"line_number":182,"context_line":"\t\treturn false;"},{"line_number":183,"context_line":"\telse if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_DEBUG \u0026\u0026 !op_is_debug)"},{"line_number":184,"context_line":"\t\treturn false;"},{"line_number":185,"context_line":"\telse if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_STDIO \u0026\u0026 !op_is_stdio)"},{"line_number":186,"context_line":"\t\treturn false;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"eccdc63f_8bb3c097","line":183,"in_reply_to":"bb87908b_7eb77a81","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":279,"context_line":"\tint c;"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"\tif (semihosting_is_redirected(semihosting, fd))"},{"line_number":282,"context_line":"\t\treturn semihosting_redirect_read(semihosting, \u0026c, 1) \u003e 0 ? c : EOF;"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"\t/* default getchar */"},{"line_number":285,"context_line":"\treturn getchar();"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"b9a649a9_0ccf8c55","line":282,"updated":"2022-02-26 17:46:37.000000000","message":"A couple of big problems, here!\n1) \"c\" is of type int and it\u0027s not initialized. With this call you change one byte of \"c\". What\u0027s the result? 3 bytes over 4 are still uninitialized! What Valgrind say?\n2) It does not work on big-endian hosts, as you will change the most significant byte.\n\nUse an intermediate \"unsigned char\" for the read and then convert it to int.\nSimilar issue for putchar.","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"4596e34eefa669188656fa4287c3ef8cadd95039","unresolved":true,"context_lines":[{"line_number":279,"context_line":"\tint c;"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"\tif (semihosting_is_redirected(semihosting, fd))"},{"line_number":282,"context_line":"\t\treturn semihosting_redirect_read(semihosting, \u0026c, 1) \u003e 0 ? c : EOF;"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"\t/* default getchar */"},{"line_number":285,"context_line":"\treturn getchar();"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"b6473645_2ade8871","line":282,"in_reply_to":"b9a649a9_0ccf8c55","updated":"2022-03-02 16:50:46.000000000","message":"this is still pending","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"9c2e98a30d8f249782af0db3da57e3a5acc3b9f7","unresolved":false,"context_lines":[{"line_number":279,"context_line":"\tint c;"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"\tif (semihosting_is_redirected(semihosting, fd))"},{"line_number":282,"context_line":"\t\treturn semihosting_redirect_read(semihosting, \u0026c, 1) \u003e 0 ? c : EOF;"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"\t/* default getchar */"},{"line_number":285,"context_line":"\treturn getchar();"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"fe35097b_170dcb1c","line":282,"in_reply_to":"b9a649a9_0ccf8c55","updated":"2022-03-02 16:56:07.000000000","message":"well spotted !","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":887,"context_line":"\t\t\t\t\t\t\t * - 4-7 (\"w\") for stdout,"},{"line_number":888,"context_line":"\t\t\t\t\t\t\t * - 8-11 (\"a\") for stderr */"},{"line_number":889,"context_line":"\t\t\t\t\t\t\tif (mode \u003c 4) {"},{"line_number":890,"context_line":"\t\t\t\t\t\t\t\tsemihosting-\u003eresult \u003d semihosting-\u003estdin_fd"},{"line_number":891,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\t\t\u003d dup(STDIN_FILENO);"},{"line_number":892,"context_line":"\t\t\t\t\t\t\t\tsemihosting-\u003esys_errno \u003d errno;"},{"line_number":893,"context_line":"\t\t\t\t\t\t\t\tLOG_DEBUG(\"dup(STDIN)\u003d%d\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"1255c2d0_677faf38","line":890,"updated":"2022-02-26 17:46:37.000000000","message":"no, please don\u0027t use double assignment as it can be mistaken as \"a \u003d (b \u003d\u003d c);\"\nsemihosting-\u003eresult \u003d dup(STDIN_FILENO);\nsemihosting-\u003estdin_fd \u003d semihosting-\u003eresult;\nor\nint fd \u003d dup(STDIN_FILENO);\nsemihosting-\u003eresult \u003d fd;\nsemihosting-\u003estdin_fd \u003d fd;\n\nalso below","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":887,"context_line":"\t\t\t\t\t\t\t * - 4-7 (\"w\") for stdout,"},{"line_number":888,"context_line":"\t\t\t\t\t\t\t * - 8-11 (\"a\") for stderr */"},{"line_number":889,"context_line":"\t\t\t\t\t\t\tif (mode \u003c 4) {"},{"line_number":890,"context_line":"\t\t\t\t\t\t\t\tsemihosting-\u003eresult \u003d semihosting-\u003estdin_fd"},{"line_number":891,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\t\t\u003d dup(STDIN_FILENO);"},{"line_number":892,"context_line":"\t\t\t\t\t\t\t\tsemihosting-\u003esys_errno \u003d errno;"},{"line_number":893,"context_line":"\t\t\t\t\t\t\t\tLOG_DEBUG(\"dup(STDIN)\u003d%d\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"8c9241fe_61dd5c02","line":890,"in_reply_to":"1255c2d0_677faf38","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1708,"context_line":"\t\tchar buf[buf_len];"},{"line_number":1709,"context_line":"\t\tint bytes_read \u003d connection_read(connection, buf, buf_len);"},{"line_number":1710,"context_line":""},{"line_number":1711,"context_line":"\t\tif (bytes_read \u003d\u003d 0)"},{"line_number":1712,"context_line":"\t\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1713,"context_line":"\t\telse if (bytes_read \u003d\u003d -1) {"},{"line_number":1714,"context_line":"\t\t\tLOG_ERROR(\"error during read: %s\", strerror(errno));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"6b880f00_33b570f9","line":1711,"updated":"2022-02-26 17:46:37.000000000","message":"Use {} on both branches of if/then/else","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":1708,"context_line":"\t\tchar buf[buf_len];"},{"line_number":1709,"context_line":"\t\tint bytes_read \u003d connection_read(connection, buf, buf_len);"},{"line_number":1710,"context_line":""},{"line_number":1711,"context_line":"\t\tif (bytes_read \u003d\u003d 0)"},{"line_number":1712,"context_line":"\t\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1713,"context_line":"\t\telse if (bytes_read \u003d\u003d -1) {"},{"line_number":1714,"context_line":"\t\t\tLOG_ERROR(\"error during read: %s\", strerror(errno));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"c76eaa90_2f1f0af9","line":1711,"in_reply_to":"6b880f00_33b570f9","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1714,"context_line":"\t\t\tLOG_ERROR(\"error during read: %s\", strerror(errno));"},{"line_number":1715,"context_line":"\t\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1716,"context_line":"\t\t}"},{"line_number":1717,"context_line":"\t} else if (service-\u003eerror !\u003d ERROR_OK)"},{"line_number":1718,"context_line":"\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1719,"context_line":""},{"line_number":1720,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"05fb919f_79f3c5bf","line":1717,"updated":"2022-02-26 17:46:37.000000000","message":"same here","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":1714,"context_line":"\t\t\tLOG_ERROR(\"error during read: %s\", strerror(errno));"},{"line_number":1715,"context_line":"\t\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1716,"context_line":"\t\t}"},{"line_number":1717,"context_line":"\t} else if (service-\u003eerror !\u003d ERROR_OK)"},{"line_number":1718,"context_line":"\t\treturn ERROR_SERVER_REMOTE_CLOSED;"},{"line_number":1719,"context_line":""},{"line_number":1720,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"3b5e0ba2_90a83208","line":1717,"in_reply_to":"05fb919f_79f3c5bf","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1829,"context_line":"\t\t\telse if (strcmp(CMD_ARGV[2], \"all\") !\u003d 0)"},{"line_number":1830,"context_line":"\t\t\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1831,"context_line":"\t\t}"},{"line_number":1832,"context_line":"\t} else"},{"line_number":1833,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"dc6b5381_c3910d80","line":1832,"updated":"2022-02-26 17:46:37.000000000","message":"Use {} on every branch in the if/then/else","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":1829,"context_line":"\t\t\telse if (strcmp(CMD_ARGV[2], \"all\") !\u003d 0)"},{"line_number":1830,"context_line":"\t\t\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1831,"context_line":"\t\t}"},{"line_number":1832,"context_line":"\t} else"},{"line_number":1833,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"f9aaf78b_aba1784a","line":1832,"in_reply_to":"dc6b5381_c3910d80","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1832,"context_line":"\t} else"},{"line_number":1833,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"},{"line_number":1836,"context_line":""},{"line_number":1837,"context_line":"\tif (cfg !\u003d SEMIHOSTING_REDIRECT_CFG_NONE) {"},{"line_number":1838,"context_line":"\t\tstruct semihosting_tcp_service *service \u003d"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"3d199c8d_9b1876b3","line":1835,"updated":"2022-02-26 17:46:37.000000000","message":"Humm, imagine connection was already open (e.g. \"debug\") and you re-open it (e.g. \"all\").\nHere you close the old connection...","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"9c2e98a30d8f249782af0db3da57e3a5acc3b9f7","unresolved":true,"context_lines":[{"line_number":1832,"context_line":"\t} else"},{"line_number":1833,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"},{"line_number":1836,"context_line":""},{"line_number":1837,"context_line":"\tif (cfg !\u003d SEMIHOSTING_REDIRECT_CFG_NONE) {"},{"line_number":1838,"context_line":"\t\tstruct semihosting_tcp_service *service \u003d"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"c3f4cb4e_bcdd1a5e","line":1835,"in_reply_to":"3d199c8d_9b1876b3","updated":"2022-03-02 16:56:07.000000000","message":"yes, this was intentional, since the user could change the config and the tcp port as well\nso I thought that closing the connection is the correct thing to do.\nmoreover in the current implementation we accept only one connection per semihosting instance.\n\nDo you prefer that we check if it\u0027s only a cfg change (same port) and in that case keep the connection open and just update the redirect_dfg ?","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"11e88104a3bc0701d6084c9bb96dbb0e3db263bd","unresolved":false,"context_lines":[{"line_number":1832,"context_line":"\t} else"},{"line_number":1833,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1834,"context_line":""},{"line_number":1835,"context_line":"\tsemihosting_tcp_close_cnx(semihosting);"},{"line_number":1836,"context_line":""},{"line_number":1837,"context_line":"\tif (cfg !\u003d SEMIHOSTING_REDIRECT_CFG_NONE) {"},{"line_number":1838,"context_line":"\t\tstruct semihosting_tcp_service *service \u003d"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"b7d9e367_1ba05c7d","line":1835,"in_reply_to":"c3f4cb4e_bcdd1a5e","updated":"2022-03-04 21:27:59.000000000","message":"Ack","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1839,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1840,"context_line":"\t\tif (!service) {"},{"line_number":1841,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"},{"line_number":1842,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1843,"context_line":"\t\t}"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"07473aa5_68013a7d","line":1842,"updated":"2022-02-26 17:46:37.000000000","message":"... here you can exit for an error...","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":true,"context_lines":[{"line_number":1839,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1840,"context_line":"\t\tif (!service) {"},{"line_number":1841,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"},{"line_number":1842,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1843,"context_line":"\t\t}"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"635d9bfa_5f64e90c","line":1842,"in_reply_to":"07473aa5_68013a7d","updated":"2022-03-02 16:19:41.000000000","message":"what you mean by exit (there is already the return ERROR_FAIL, can we do more ?)","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"4596e34eefa669188656fa4287c3ef8cadd95039","unresolved":true,"context_lines":[{"line_number":1839,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1840,"context_line":"\t\tif (!service) {"},{"line_number":1841,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"},{"line_number":1842,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1843,"context_line":"\t\t}"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"69014143_956ff46c","line":1842,"in_reply_to":"635d9bfa_5f64e90c","updated":"2022-03-02 16:50:46.000000000","message":"1) line 1835 connection is closed\n2) here return ERROR_FAIL without updating semihosting-\u003eredirect_cfg\n3) line 1865 is not executed due the return here, so mismatch between connection status and semihosting-\u003eredirect_cfg","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"9c2e98a30d8f249782af0db3da57e3a5acc3b9f7","unresolved":false,"context_lines":[{"line_number":1839,"context_line":"\t\t\t\tcalloc(1, sizeof(struct semihosting_tcp_service));"},{"line_number":1840,"context_line":"\t\tif (!service) {"},{"line_number":1841,"context_line":"\t\t\tLOG_ERROR(\"Failed to allocate semihosting TCP service.\");"},{"line_number":1842,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1843,"context_line":"\t\t}"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"68a6a33c_a07cc018","line":1842,"in_reply_to":"635d9bfa_5f64e90c","updated":"2022-03-02 16:56:07.000000000","message":"sorry, now I understood the issue !","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"},{"line_number":1846,"context_line":""},{"line_number":1847,"context_line":""},{"line_number":1848,"context_line":"\t\tservice-\u003ename \u003d alloc_printf(\"%s semihosting service\", target_name(target));"},{"line_number":1849,"context_line":"\t\tif (!service-\u003ename) {"},{"line_number":1850,"context_line":"\t\t\tLOG_ERROR(\"Out of memory\");"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"a4c21ea8_70dc3620","line":1847,"updated":"2022-02-26 17:46:37.000000000","message":"(use only one empty line)","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"4596e34eefa669188656fa4287c3ef8cadd95039","unresolved":false,"context_lines":[{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"\t\tservice-\u003esemihosting \u003d semihosting;"},{"line_number":1846,"context_line":""},{"line_number":1847,"context_line":""},{"line_number":1848,"context_line":"\t\tservice-\u003ename \u003d alloc_printf(\"%s semihosting service\", target_name(target));"},{"line_number":1849,"context_line":"\t\tif (!service-\u003ename) {"},{"line_number":1850,"context_line":"\t\t\tLOG_ERROR(\"Out of memory\");"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"032f978d_6f7a7d0f","line":1847,"in_reply_to":"a4c21ea8_70dc3620","updated":"2022-03-02 16:50:46.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1862,"context_line":"\t\t}"},{"line_number":1863,"context_line":"\t}"},{"line_number":1864,"context_line":""},{"line_number":1865,"context_line":"\tsemihosting-\u003eredirect_cfg \u003d cfg;"},{"line_number":1866,"context_line":""},{"line_number":1867,"context_line":"\treturn ERROR_OK;"},{"line_number":1868,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"18f4b132_02cb3306","line":1865,"updated":"2022-02-26 17:46:37.000000000","message":"...but due to the error you don\u0027t arrive here. Connection is closed and semihosting-\u003eredirect_cfg report it\u0027s still open!","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"9c2e98a30d8f249782af0db3da57e3a5acc3b9f7","unresolved":false,"context_lines":[{"line_number":1862,"context_line":"\t\t}"},{"line_number":1863,"context_line":"\t}"},{"line_number":1864,"context_line":""},{"line_number":1865,"context_line":"\tsemihosting-\u003eredirect_cfg \u003d cfg;"},{"line_number":1866,"context_line":""},{"line_number":1867,"context_line":"\treturn ERROR_OK;"},{"line_number":1868,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"8d179c99_2b789b9e","line":1865,"in_reply_to":"18f4b132_02cb3306","updated":"2022-03-02 16:56:07.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":1986,"context_line":""},{"line_number":1987,"context_line":"const struct command_registration semihosting_common_handlers[] \u003d {"},{"line_number":1988,"context_line":"\t{"},{"line_number":1989,"context_line":"\t\t.name \u003d \"semihosting\","},{"line_number":1990,"context_line":"\t\t.handler \u003d handle_common_semihosting_command,"},{"line_number":1991,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":1992,"context_line":"\t\t.usage \u003d \"[\u0027enable\u0027|\u0027disable\u0027]\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"e66db5c3_72178d89","line":1989,"updated":"2022-02-26 17:46:37.000000000","message":"Woah! Even with all the scripting I have done to check struct command_registration I have missed these! Thanks for fixing them!","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":1986,"context_line":""},{"line_number":1987,"context_line":"const struct command_registration semihosting_common_handlers[] \u003d {"},{"line_number":1988,"context_line":"\t{"},{"line_number":1989,"context_line":"\t\t.name \u003d \"semihosting\","},{"line_number":1990,"context_line":"\t\t.handler \u003d handle_common_semihosting_command,"},{"line_number":1991,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":1992,"context_line":"\t\t.usage \u003d \"[\u0027enable\u0027|\u0027disable\u0027]\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"e3cc96dc_71d45d53","line":1989,"in_reply_to":"e66db5c3_72178d89","updated":"2022-03-02 16:19:41.000000000","message":"Ack","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"aead24eca839df18d5367b559f5fa5ca384568c0","unresolved":true,"context_lines":[{"line_number":2021,"context_line":"\t\t.help \u003d \"activate support for semihosting resumable exit\","},{"line_number":2022,"context_line":"\t},"},{"line_number":2023,"context_line":"\t{"},{"line_number":2024,"context_line":"\t\t\"semihosting_read_user_param\","},{"line_number":2025,"context_line":"\t\t.handler \u003d handle_common_semihosting_read_user_param_command,"},{"line_number":2026,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":2027,"context_line":"\t\t.usage \u003d \"\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"327a79a5_6bc70971","line":2024,"updated":"2022-02-26 17:46:37.000000000","message":"would you mind fixing this too?","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"4b5fad773439709449dce4bc47119a686df5e224","unresolved":false,"context_lines":[{"line_number":2021,"context_line":"\t\t.help \u003d \"activate support for semihosting resumable exit\","},{"line_number":2022,"context_line":"\t},"},{"line_number":2023,"context_line":"\t{"},{"line_number":2024,"context_line":"\t\t\"semihosting_read_user_param\","},{"line_number":2025,"context_line":"\t\t.handler \u003d handle_common_semihosting_read_user_param_command,"},{"line_number":2026,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":2027,"context_line":"\t\t.usage \u003d \"\","}],"source_content_type":"text/x-csrc","patch_set":14,"id":"282403b1_7aeaf23b","line":2024,"in_reply_to":"327a79a5_6bc70971","updated":"2022-03-02 16:19:41.000000000","message":"Done","commit_id":"a68928bbcfed7619c66d2763a1a7967d3da5c7df"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2179556d83a3ee66ca1751c01b795559a719a05b","unresolved":true,"context_lines":[{"line_number":200,"context_line":"\t\treturn false;"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\treturn true;"},{"line_number":203,"context_line":"}"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"static ssize_t semihosting_redirect_write(struct semihosting *semihosting, void *buf, int size)"},{"line_number":206,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"c895010e_cc9c087b","line":203,"updated":"2022-03-02 18:22:28.000000000","message":"I was looking for a more readable way to write this, but I\u0027m not sure I got it.\nAny idea? Mine is here, but longer ...\nstatic bool semihosting_is_redirected(struct semihosting *semihosting, int fd)\n{\n        bool op_is_read \u003d false;\n\n        if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_NONE)\n                return false;\n\n        switch (semihosting-\u003eop) {\n        case SEMIHOSTING_SYS_READC:\n                op_is_read \u003d true;\n                /* fall through */\n        case SEMIHOSTING_SYS_WRITEC:\n        case SEMIHOSTING_SYS_WRITE0:\n                /* op is debug */\n                if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_STDIO)\n                        return false;\n                break;\n\n        case SEMIHOSTING_SYS_READ:\n                op_is_read \u003d true;\n                /* fall through */\n        case SEMIHOSTING_SYS_WRITE:\n                /* op is stdio */\n                if (semihosting-\u003eredirect_cfg \u003d\u003d SEMIHOSTING_REDIRECT_CFG_DEBUG)\n                        return false;\n                break;\n\n        default:\n                /* op is other */\n                return false;\n        }\n\n        if (op_is_read) {\n                if (fd \u003d\u003d semihosting-\u003estdin_fd)\n                        return true;\n                return false;\n        }\n\n        /* op is write */\n        if (fd \u003d\u003d semihosting-\u003estdout_fd || fd \u003d\u003d semihosting-\u003estderr_fd)\n                return true;\n        return false;\n}","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"11e88104a3bc0701d6084c9bb96dbb0e3db263bd","unresolved":false,"context_lines":[{"line_number":200,"context_line":"\t\treturn false;"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\treturn true;"},{"line_number":203,"context_line":"}"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"static ssize_t semihosting_redirect_write(struct semihosting *semihosting, void *buf, int size)"},{"line_number":206,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"bb1fdb12_9f3316e3","line":203,"in_reply_to":"c895010e_cc9c087b","updated":"2022-03-04 21:27:59.000000000","message":"why not, I have changed it a very little bit","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2179556d83a3ee66ca1751c01b795559a719a05b","unresolved":true,"context_lines":[{"line_number":1735,"context_line":"\tstruct semihosting_tcp_service *service \u003d connection-\u003eservice-\u003epriv;"},{"line_number":1736,"context_line":"\tif (service)"},{"line_number":1737,"context_line":"\t\tfree(service-\u003ename);"},{"line_number":1738,"context_line":""},{"line_number":1739,"context_line":"\treturn ERROR_OK;"},{"line_number":1740,"context_line":"}"},{"line_number":1741,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"7ee40de9_2e2f7098","line":1738,"updated":"2022-03-02 18:22:28.000000000","message":"missing free(service)","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"11e88104a3bc0701d6084c9bb96dbb0e3db263bd","unresolved":false,"context_lines":[{"line_number":1735,"context_line":"\tstruct semihosting_tcp_service *service \u003d connection-\u003eservice-\u003epriv;"},{"line_number":1736,"context_line":"\tif (service)"},{"line_number":1737,"context_line":"\t\tfree(service-\u003ename);"},{"line_number":1738,"context_line":""},{"line_number":1739,"context_line":"\treturn ERROR_OK;"},{"line_number":1740,"context_line":"}"},{"line_number":1741,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"8bb073ed_131b8b12","line":1738,"in_reply_to":"7ee40de9_2e2f7098","updated":"2022-03-04 21:27:59.000000000","message":"Done","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2179556d83a3ee66ca1751c01b795559a719a05b","unresolved":true,"context_lines":[{"line_number":1868,"context_line":"\t\tservice-\u003ename \u003d alloc_printf(\"%s semihosting service\", target_name(target));"},{"line_number":1869,"context_line":"\t\tif (!service-\u003ename) {"},{"line_number":1870,"context_line":"\t\t\tLOG_ERROR(\"Out of memory\");"},{"line_number":1871,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1872,"context_line":"\t\t}"},{"line_number":1873,"context_line":""},{"line_number":1874,"context_line":"\t\tint ret \u003d add_service(\u0026semihosting_service_driver,"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"5104f6be_b4928854","line":1871,"updated":"2022-03-02 18:22:28.000000000","message":"missing free(service)","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"11e88104a3bc0701d6084c9bb96dbb0e3db263bd","unresolved":false,"context_lines":[{"line_number":1868,"context_line":"\t\tservice-\u003ename \u003d alloc_printf(\"%s semihosting service\", target_name(target));"},{"line_number":1869,"context_line":"\t\tif (!service-\u003ename) {"},{"line_number":1870,"context_line":"\t\t\tLOG_ERROR(\"Out of memory\");"},{"line_number":1871,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1872,"context_line":"\t\t}"},{"line_number":1873,"context_line":""},{"line_number":1874,"context_line":"\t\tint ret \u003d add_service(\u0026semihosting_service_driver,"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"9f4fbcfa_589b28dd","line":1871,"in_reply_to":"5104f6be_b4928854","updated":"2022-03-04 21:27:59.000000000","message":"Done","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2179556d83a3ee66ca1751c01b795559a719a05b","unresolved":true,"context_lines":[{"line_number":1877,"context_line":"\t\tif (ret !\u003d ERROR_OK) {"},{"line_number":1878,"context_line":"\t\t\tLOG_ERROR(\"failed to initialize %s\", service-\u003ename);"},{"line_number":1879,"context_line":"\t\t\tfree(service-\u003ename);"},{"line_number":1880,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1881,"context_line":"\t\t}"},{"line_number":1882,"context_line":"\t}"},{"line_number":1883,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"d4296fba_d8b62b22","line":1880,"updated":"2022-03-02 18:22:28.000000000","message":"missing free(service)","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"11e88104a3bc0701d6084c9bb96dbb0e3db263bd","unresolved":false,"context_lines":[{"line_number":1877,"context_line":"\t\tif (ret !\u003d ERROR_OK) {"},{"line_number":1878,"context_line":"\t\t\tLOG_ERROR(\"failed to initialize %s\", service-\u003ename);"},{"line_number":1879,"context_line":"\t\t\tfree(service-\u003ename);"},{"line_number":1880,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1881,"context_line":"\t\t}"},{"line_number":1882,"context_line":"\t}"},{"line_number":1883,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"af309d7a_121e8d36","line":1880,"in_reply_to":"d4296fba_d8b62b22","updated":"2022-03-04 21:27:59.000000000","message":"Done","commit_id":"0af2eb8edea2a3fdfe57aa2c811c9699633da2e6"}]}
