You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/08 17:11:00 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5696: arch/sim: add all symbols support

xiaoxiang781216 commented on a change in pull request #5696:
URL: https://github.com/apache/incubator-nuttx/pull/5696#discussion_r821743925



##########
File path: libs/libc/sched/sched_dumpstack.c
##########
@@ -84,6 +88,25 @@ void sched_dumpstack(pid_t tid)
             }
         }
 #else
+
+#ifdef CONFIG_ARCH_SIM
+      if (g_symbol_offset == 0)
+        {
+          symtab = allsyms_findbyname("sched_dumpstack", NULL);
+          if (symtab)
+            {
+              g_symbol_offset = (uintptr_t)sched_dumpstack -
+                                (uintptr_t)symtab->sym_value;
+            }
+        }
+
+      for (i = 0; i < size; i++)
+        {
+          address[i] = (FAR void *)((uintptr_t)address[i] -
+                                    g_symbol_offset);

Review comment:
       change to:
   (uintptr_t)address[i] + g_symbol_offset

##########
File path: libs/libc/sched/sched_dumpstack.c
##########
@@ -84,6 +88,25 @@ void sched_dumpstack(pid_t tid)
             }
         }
 #else
+
+#ifdef CONFIG_ARCH_SIM
+      if (g_symbol_offset == 0)
+        {
+          symtab = allsyms_findbyname("sched_dumpstack", NULL);
+          if (symtab)
+            {
+              g_symbol_offset = (uintptr_t)sched_dumpstack -

Review comment:
       change to:
    g_symbol_offset = (uintptr_t)symtab->sym_value -
                                  (uintptr_t)sched_dumpstack;

##########
File path: libs/libc/sched/sched_dumpstack.c
##########
@@ -53,6 +53,10 @@
 
 void sched_dumpstack(pid_t tid)
 {
+#ifdef CONFIG_ARCH_SIM
+  FAR const struct symtab_s *symtab;
+  static uintptr_t g_symbol_offset;

Review comment:
       how to handle the user call allsyms_findbyname directly?

##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -59,6 +59,10 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
   ARCHOPTIMIZATION += -fprofile-arcs -ftest-coverage
 endif
 
+ifeq ($(CONFIG_SCHED_BACKTRACE),y)
+  ARCHOPTIMIZATION += -funwind-tables

Review comment:
       don't need

##########
File path: libs/libc/stdio/lib_libvsprintf.c
##########
@@ -1160,7 +1160,8 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
 
                           if (c == 'S')
                             {
-                              sprintf_internal(stream, "+%#x/%#x",
+                              sprintf_internal(stream,
+                                               "+%#" PRIxPTR "/%#" PRIxPTR,

Review comment:
       %jd %zu




-- 
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-unsubscribe@nuttx.apache.org

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