hitHuang commented on code in PR #19479:
URL: https://github.com/apache/nuttx/pull/19479#discussion_r3610572845


##########
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:
   This was actually my original implementation. I simplified it because it 
felt a bit complex, but the silent-truncation risk you raised is real, so I'm 
going back to it. Tested and passing on both ksmp64 and smp. On the Kconfig 
option: I'd rather not add one — that would push an implementation detail of 
sched_backtrace() onto every caller, making them reason about a knob that 
should be transparent to them.



-- 
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]

Reply via email to