linguini1 commented on code in PR #19479:
URL: https://github.com/apache/nuttx/pull/19479#discussion_r3610506215
##########
sched/sched/sched_backtrace.c:
##########
@@ -28,15 +28,32 @@
#include <nuttx/sched.h>
#include <nuttx/init.h>
+#include <string.h>
+
#include "sched.h"
#ifdef CONFIG_ARCH_HAVE_BACKTRACE
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_SMP) && defined(CONFIG_ARCH_ADDRENV)
+
+/* Depth of the scratch buffer used to relay a remote backtrace back to
+ * the caller; requests beyond this are truncated.
+ */
+
+#define BACKTRACE_SCRATCH_DEPTH 32
Review Comment:
Maybe this could be a Kconfig option? I wonder if there's a better way than
silently truncating though, that seems like it could become an issue eventually
that will be hard to track down.
##########
sched/sched/sched_backtrace.c:
##########
@@ -121,25 +143,41 @@ int sched_backtrace(pid_t tid, FAR void **buffer, int
size, int skip)
tcb->task_state == TSTATE_TASK_RUNNING)
{
struct backtrace_arg_s arg;
+ bool need_restore;
+#ifdef CONFIG_ARCH_ADDRENV
+ FAR void *scratch[BACKTRACE_SCRATCH_DEPTH];
+ FAR void **dest = scratch;
Review Comment:
These declarations must be at the top of the function for C standard
compatibility.
--
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]