xiaoxiang781216 commented on code in PR #12585:
URL: https://github.com/apache/nuttx/pull/12585#discussion_r1659578074
##########
libs/libc/misc/lib_execinfo.c:
##########
@@ -88,3 +88,38 @@ void backtrace_symbols_fd(FAR void *const *buffer, int size,
int fd)
dprintf(fd, "%pS\n", buffer[i]);
}
}
+
+/****************************************************************************
+ * Name: backtrace_format
+ *
+ * Description:
+ * Format a backtrace into a buffer for dumping.
+ *
+ ****************************************************************************/
+
+FAR const char *backtrace_format(FAR char *buffer, int size,
+ FAR void *backtrace[], int depth)
+{
+ FAR const char *format = "%0*p ";
+ int i;
+
+ if (size < 1)
+ {
+ return NULL;
+ }
+
+ buffer[0] = '\0';
+ for (i = 0; i < depth && backtrace[i]; i++)
+ {
+ if (size - i * BACKTRACE_PTR_FMT_WIDTH <= 0)
Review Comment:
```suggestion
if ( i * BACKTRACE_PTR_FMT_WIDTH <= size)
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]