)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"94d820d7_285852c4","updated":"2022-03-19 22:06:51.000000000","message":"This patch is welcome, I have noticed that not all is dumped on OpenOCD side.\nI\u0027m forced to dump on GDB side with \"set debug remote 1\".\nBut this patch is only partial. Any plan to extend it to full log?\nAnyway, better this than nothing.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"601bb06a_54ab9875","updated":"2022-03-21 09:25:53.000000000","message":"Hi Antonio,\n\nthank you for your feedback.\n\nAs for the logging of packets -\n\nI have added the logging of ACKs and NACKs as you suggested. If I missed something, let me know, I\u0027d be happy to further extend this.\n\n\nAs for the asserts -\n\n\u003e I\u0027m not in favor of adding assert().\n\u003e If there is some error that causes the invalid pointer it should be fixed.\n\u003e If the null pointer is a possible case, we should return error, but not assert().\n\u003e It\u0027s in my wish list to drop all the assert(), not to add any more.\n\nBroader point: \nIt seems we have different preference on how asserts should be used in code. Situations which are \"impossible\" (i.e. program error, not runtime error/input error) are, IMO, perfect places for assertions, which serve as: \n- documented invariants (for whoever reads the code or for formal tools), \n- first line of defense when making changes and accidentally breaking an invariant (\"continuous debugging\").\n\nFor that reason, I would advocate against removing existing (meaningful) asserts from the OpenOCD code, and would not hesitate to add more where suitable.\n\nNevertheless, I have removed the asserts from this patch, they\u0027re not too important.","commit_id":"513b4daea6a8c912ec53d31652e42e3e9320bfc6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a519a2e0a124d64ffa8918dbb314824cc247b965","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"20b3608c_2650d14f","updated":"2022-03-21 22:35:33.000000000","message":"Oops, it doesn\u0027t merge anymore in master branch. Can you please rebase it?","commit_id":"513b4daea6a8c912ec53d31652e42e3e9320bfc6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"4c58a3956fdd0065a5bfef0b96aa4e7730f88bde","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"2df19bb2_0d3d7c2b","updated":"2022-03-21 22:29:45.000000000","message":"Thanks","commit_id":"513b4daea6a8c912ec53d31652e42e3e9320bfc6"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"0ac586a87d25a5bb3cebf7447f7d2072d5fbea70","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"298ff570_b99ffaad","in_reply_to":"20b3608c_2650d14f","updated":"2022-03-22 06:42:28.000000000","message":"Thanks for the reminder. Rebased now.","commit_id":"513b4daea6a8c912ec53d31652e42e3e9320bfc6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"68d5f1fca1151b66e6b8b069e43d365bd81dfc47","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"753ad44d_dbb9df9a","updated":"2022-03-22 14:00:10.000000000","message":"Thanks!","commit_id":"c59575bd26e165e120db0bbecb33722650474851"}],"src/server/gdb_server.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":365,"context_line":"static void gdb_log_incoming_packet(struct connection *connection, char *packet)"},{"line_number":366,"context_line":"{"},{"line_number":367,"context_line":"\tassert(connection);"},{"line_number":368,"context_line":"\tassert(packet);"},{"line_number":369,"context_line":""},{"line_number":370,"context_line":"\tif (!LOG_LEVEL_IS(LOG_LVL_DEBUG))"},{"line_number":371,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"fd445e10_db0d3c8e","line":368,"updated":"2022-03-19 22:06:51.000000000","message":"I\u0027m not in favor of adding assert().\nIf there is some error that causes the invalid pointer it should be fixed.\nIf the null pointer is a possible case, we should return error, but not assert().\nIt\u0027s in my wish list to drop all the assert(), not to add any more.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":365,"context_line":"static void gdb_log_incoming_packet(struct connection *connection, char *packet)"},{"line_number":366,"context_line":"{"},{"line_number":367,"context_line":"\tassert(connection);"},{"line_number":368,"context_line":"\tassert(packet);"},{"line_number":369,"context_line":""},{"line_number":370,"context_line":"\tif (!LOG_LEVEL_IS(LOG_LVL_DEBUG))"},{"line_number":371,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"a08eae69_d5863fec","line":368,"in_reply_to":"fd445e10_db0d3c8e","updated":"2022-03-21 09:25:53.000000000","message":"Assert removed.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":371,"context_line":"\t\treturn;"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"\tstruct target *target \u003d get_target_from_connection(connection);"},{"line_number":374,"context_line":"\tassert(target);"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"\t/* Avoid dumping non-printable characters to the terminal */"},{"line_number":377,"context_line":"\tconst unsigned packet_len \u003d strlen(packet);"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"796687af_587f1f76","line":374,"updated":"2022-03-19 22:06:51.000000000","message":"also here. GDB connections must have a target, so this is useless","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":371,"context_line":"\t\treturn;"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"\tstruct target *target \u003d get_target_from_connection(connection);"},{"line_number":374,"context_line":"\tassert(target);"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"\t/* Avoid dumping non-printable characters to the terminal */"},{"line_number":377,"context_line":"\tconst unsigned packet_len \u003d strlen(packet);"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"373d09ff_f5941b18","line":374,"in_reply_to":"796687af_587f1f76","updated":"2022-03-21 09:25:53.000000000","message":"Assert removed.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":401,"context_line":"\tunsigned int packet_len, unsigned char checksum)"},{"line_number":402,"context_line":"{"},{"line_number":403,"context_line":"\tassert(connection);"},{"line_number":404,"context_line":"\tassert(packet_buf);"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"\tif (!LOG_LEVEL_IS(LOG_LVL_DEBUG))"},{"line_number":407,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3fb56bb1_53a55b9d","line":404,"updated":"2022-03-19 22:06:51.000000000","message":"same here","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":401,"context_line":"\tunsigned int packet_len, unsigned char checksum)"},{"line_number":402,"context_line":"{"},{"line_number":403,"context_line":"\tassert(connection);"},{"line_number":404,"context_line":"\tassert(packet_buf);"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"\tif (!LOG_LEVEL_IS(LOG_LVL_DEBUG))"},{"line_number":407,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"6404eede_6b924a11","line":404,"in_reply_to":"3fb56bb1_53a55b9d","updated":"2022-03-21 09:25:53.000000000","message":"Assert removed.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":407,"context_line":"\t\treturn;"},{"line_number":408,"context_line":""},{"line_number":409,"context_line":"\tstruct target *target \u003d get_target_from_connection(connection);"},{"line_number":410,"context_line":"\tassert(target);"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"\tif (find_nonprint_char(packet_buf, packet_len))"},{"line_number":413,"context_line":"\t\tLOG_TARGET_DEBUG(target, \"sending packet: $\u003cbinary-data-%u-bytes\u003e#%2.2x\","}],"source_content_type":"text/x-csrc","patch_set":2,"id":"51c086f8_eb0cb2e1","line":410,"updated":"2022-03-19 22:06:51.000000000","message":"and here","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":407,"context_line":"\t\treturn;"},{"line_number":408,"context_line":""},{"line_number":409,"context_line":"\tstruct target *target \u003d get_target_from_connection(connection);"},{"line_number":410,"context_line":"\tassert(target);"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"\tif (find_nonprint_char(packet_buf, packet_len))"},{"line_number":413,"context_line":"\t\tLOG_TARGET_DEBUG(target, \"sending packet: $\u003cbinary-data-%u-bytes\u003e#%2.2x\","}],"source_content_type":"text/x-csrc","patch_set":2,"id":"d556cc1e_9048a299","line":410,"in_reply_to":"51c086f8_eb0cb2e1","updated":"2022-03-21 09:25:53.000000000","message":"Assert removed.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":486,"context_line":"\t\tif (gdb_con-\u003enoack_mode)"},{"line_number":487,"context_line":"\t\t\tbreak;"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":490,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":491,"context_line":"\t\t\treturn retval;"},{"line_number":492,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3680997d_f18537cd","line":489,"updated":"2022-03-19 22:06:51.000000000","message":"here we get a char from GDB","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":486,"context_line":"\t\tif (gdb_con-\u003enoack_mode)"},{"line_number":487,"context_line":"\t\t\tbreak;"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":490,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":491,"context_line":"\t\t\treturn retval;"},{"line_number":492,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"0d5f734a_f8173c7e","line":489,"in_reply_to":"3680997d_f18537cd","updated":"2022-03-21 09:25:53.000000000","message":"Ack","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":490,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":491,"context_line":"\t\t\treturn retval;"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":494,"context_line":"\t\t\tbreak;"},{"line_number":495,"context_line":"\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":496,"context_line":"\t\t\t/* Stop sending output packets for now */"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3a66559c_07d5e87e","line":493,"updated":"2022-03-19 22:06:51.000000000","message":"this does not cause any log","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":490,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":491,"context_line":"\t\t\treturn retval;"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":494,"context_line":"\t\t\tbreak;"},{"line_number":495,"context_line":"\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":496,"context_line":"\t\t\t/* Stop sending output packets for now */"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"ae393f8d_54111310","line":493,"in_reply_to":"3a66559c_07d5e87e","updated":"2022-03-21 09:25:53.000000000","message":"I have added gdb_log_incoming_packet() as suggested.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":492,"context_line":""},{"line_number":493,"context_line":"\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":494,"context_line":"\t\t\tbreak;"},{"line_number":495,"context_line":"\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":496,"context_line":"\t\t\t/* Stop sending output packets for now */"},{"line_number":497,"context_line":"\t\t\tlog_remove_callback(gdb_log_callback, connection);"},{"line_number":498,"context_line":"\t\t\tLOG_WARNING(\"negative reply, retrying\");"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"0a7b273c_785ebb59","line":495,"updated":"2022-03-19 22:06:51.000000000","message":"neither this","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":492,"context_line":""},{"line_number":493,"context_line":"\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":494,"context_line":"\t\t\tbreak;"},{"line_number":495,"context_line":"\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":496,"context_line":"\t\t\t/* Stop sending output packets for now */"},{"line_number":497,"context_line":"\t\t\tlog_remove_callback(gdb_log_callback, connection);"},{"line_number":498,"context_line":"\t\t\tLOG_WARNING(\"negative reply, retrying\");"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"1401690a_d80a7e4a","line":495,"in_reply_to":"0a7b273c_785ebb59","updated":"2022-03-21 09:25:53.000000000","message":"I have added gdb_log_incoming_packet() as suggested.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":498,"context_line":"\t\t\tLOG_WARNING(\"negative reply, retrying\");"},{"line_number":499,"context_line":"\t\t} else if (reply \u003d\u003d 0x3) {"},{"line_number":500,"context_line":"\t\t\tgdb_con-\u003ectrl_c \u003d true;"},{"line_number":501,"context_line":"\t\t\tgdb_log_incoming_packet(connection, \"\u003cCtrl-C\u003e\");"},{"line_number":502,"context_line":"\t\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":503,"context_line":"\t\t\tif (retval !\u003d ERROR_OK)"},{"line_number":504,"context_line":"\t\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"03595a82_62c42598","line":501,"updated":"2022-03-19 22:06:51.000000000","message":"this is now logged, but...","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":498,"context_line":"\t\t\tLOG_WARNING(\"negative reply, retrying\");"},{"line_number":499,"context_line":"\t\t} else if (reply \u003d\u003d 0x3) {"},{"line_number":500,"context_line":"\t\t\tgdb_con-\u003ectrl_c \u003d true;"},{"line_number":501,"context_line":"\t\t\tgdb_log_incoming_packet(connection, \"\u003cCtrl-C\u003e\");"},{"line_number":502,"context_line":"\t\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":503,"context_line":"\t\t\tif (retval !\u003d ERROR_OK)"},{"line_number":504,"context_line":"\t\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"acb75661_07412ad0","line":501,"in_reply_to":"03595a82_62c42598","updated":"2022-03-21 09:25:53.000000000","message":"Ack","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"fff507d5198872940e84817c641b1760cb2db31c","unresolved":true,"context_lines":[{"line_number":502,"context_line":"\t\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":503,"context_line":"\t\t\tif (retval !\u003d ERROR_OK)"},{"line_number":504,"context_line":"\t\t\t\treturn retval;"},{"line_number":505,"context_line":"\t\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":506,"context_line":"\t\t\t\tbreak;"},{"line_number":507,"context_line":"\t\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":508,"context_line":"\t\t\t\t/* Stop sending output packets for now */"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"e0a816d8_cc0941ee","line":505,"updated":"2022-03-19 22:06:51.000000000","message":"...but this other one is not logged.\nIt would be nice to log everything.\nWe cannot add the logging directly inside gdb_get_char() because sometimes we call gdb_putback_char() to revert it.\nPlus gdb_get_char() is called in gdb_get_packet_inner().","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"},{"author":{"_account_id":1001667,"name":"Jan Matyas","email":"jan.matyas@codasip.com","username":"JanMatCodasip"},"change_message_id":"225ad0e126adb40004a8020e0a8f3807c0bfb06a","unresolved":false,"context_lines":[{"line_number":502,"context_line":"\t\t\tretval \u003d gdb_get_char(connection, \u0026reply);"},{"line_number":503,"context_line":"\t\t\tif (retval !\u003d ERROR_OK)"},{"line_number":504,"context_line":"\t\t\t\treturn retval;"},{"line_number":505,"context_line":"\t\t\tif (reply \u003d\u003d \u0027+\u0027)"},{"line_number":506,"context_line":"\t\t\t\tbreak;"},{"line_number":507,"context_line":"\t\t\telse if (reply \u003d\u003d \u0027-\u0027) {"},{"line_number":508,"context_line":"\t\t\t\t/* Stop sending output packets for now */"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"5a9f6aa0_e096dff2","line":505,"in_reply_to":"e0a816d8_cc0941ee","updated":"2022-03-21 09:25:53.000000000","message":"Added gdb_log_incoming_packet() for ACK and NACK, as suggested.","commit_id":"e7efbde0c51b6e1286a9664a03f4c61728046f6e"}]}
