chirping78 commented on code in PR #16095:
URL: https://github.com/apache/nuttx/pull/16095#discussion_r2020670293


##########
libs/libc/gdbstub/lib_gdbstub.c:
##########
@@ -671,22 +671,51 @@ static int gdb_recv_ack(FAR struct gdb_state_s *state)
 static ssize_t gdb_bin2hex(FAR void *buf, size_t buf_len,
                            FAR const void *data, size_t data_len)
 {
-  FAR const char *in = data;
+  size_t skip = (uintptr_t)data % 4;
+  size_t ret = data_len * 2;
   FAR char *out = buf;
-  size_t pos;
+  size_t total;
+  uint32_t in;
 
   if (buf_len < data_len * 2)
     {
       return -EOVERFLOW; /* Buffer too small */
     }
 
-  for (pos = 0; pos < data_len; pos++)
+  if (skip != 0)

Review Comment:
   The gdb command such as 'disass' or 'break' will read instruction from IROM.
   It's found the IROM memory cannot be read in byte, or memory exception will 
arise.
   
   Also updated the commit message to address why do this change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to