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 2021/12/09 05:58:57 UTC
[GitHub] [incubator-nuttx] anchao opened a new pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
anchao opened a new pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962
## Summary
arch/arm: add support of all symbols for debugging
libs/printf: add support for print symbol name
libc/allsyms: Load all symbols for debugging
Reference here:
https://github.com/torvalds/linux/blob/master/init/Kconfig#L1696-L1717
https://github.com/torvalds/linux/blob/master/lib/vsprintf.c#L2265-L2488
## Impact
N/A, new feature
## Testing
1. print the symbol name:
`syslog(LOG_EMERG, "[%2d] [<%p>] %pS\n", tid, address[i], address[i]);`
` [ EMERG] [ap] [10] [<0x2c3b1e58>] irq_dispatch+0x1c/0x40`
2. symbol on backtrace:
```
ap> mw -1
[ 134.366037] [10] [ EMERG] [ap] arm_usagefault: PANIC!!! Usage Fault:
[ 134.366158] [10] [ EMERG] [ap] arm_usagefault: IRQ: 6 regs: 0x3c321a78
[ 134.366243] [10] [ EMERG] [ap] arm_usagefault: BASEPRI: 000000e0 PRIMASK: 00000000 IPSR: 00000006 CONTROL: 00000004
[ 134.366346] [10] [ EMERG] [ap] arm_usagefault: CFSR: 01000000 HFSR: 00000000 DFSR: 00000000 BFAR: 50101002 AFSR: 00000000
[ 134.366458] [10] [ EMERG] [ap] arm_usagefault: Usage Fault Reason:
[ 134.366522] [10] [ EMERG] [ap] arm_usagefault: Unaligned access
[ 134.372285] [10] [ EMERG] [ap] up_assert: Assertion failed at file:armv8-m/arm_usagefault.c line: 113 task: init
[ 134.372463] [10] [ EMERG] [ap] backtrace:
[ 134.372512] [10] [ EMERG] [ap] [10] [<0x2c3c9376>] sched_dumpstack+0xe/0x4c
[ 134.373035] [10] [ EMERG] [ap] [10] [<0x2c3cd704>] vsyslog+0x18/0x28
[ 134.373571] [10] [ EMERG] [ap] [10] [<0x2c3cd726>] syslog+0x12/0x24
[ 134.374108] [10] [ EMERG] [ap] [10] [<0x2c3d59d4>] up_assert+0x48/0x414
[ 134.374655] [10] [ EMERG] [ap] [10] [<0x2c3cd704>] vsyslog+0x18/0x28
[ 134.375287] [10] [ EMERG] [ap] [10] [<0x2c3c60e0>] _assert+0x4/0x10
[ 134.376351] [10] [ EMERG] [ap] [10] [<0x2c3d62f4>] arm_usagefault+0xa8/0x138
[ 134.377540] [10] [ EMERG] [ap] [10] [<0x2c3b1e58>] irq_dispatch+0x1c/0x40
[ 134.378665] [10] [ EMERG] [ap] [10] [<0x2c3d587a>] arm_doirq+0x1a/0x2c
[ 134.379784] [10] [ EMERG] [ap] [10] [<0x2c3cffba>] exception_common+0x4a/0xac
[ 134.380963] [10] [ EMERG] [ap] [10] [<0x2c3f00b0>] nsh_parse_command+0x684/0xcf0
[ 134.382197] [10] [ EMERG] [ap] [10] [<0x2c449a18>] write+0x34/0x54
[ 134.383315] [10] [ EMERG] [ap] [10] [<0x2c3f61ee>] readline_putc+0x12/0x40
[ 134.384471] [10] [ EMERG] [ap] [10] [<0x2c3f439a>] nsh_session+0x92/0x168
[ 134.385631] [10] [ EMERG] [ap] [10] [<0x2c3f5726>] nsh_consolemain+0x1e/0x38
[ 134.386827] [10] [ EMERG] [ap] [10] [<0x2c3f5c54>] nsh_main+0x30/0x50
[ 134.387950] [10] [ EMERG] [ap] up_registerdump: R0: ffffffff R1: 00000000 R2: ffffffff R3: 00000000
[ 134.389089] [10] [ EMERG] [ap] up_registerdump: R4: 3c321cd0 R5: ffffffff R6: 00000000 FP: 3c321b50
[ 134.390248] [10] [ EMERG] [ap] up_registerdump: R8: 3c321bb8 SB: 00000002 SL: 2c477300 R11: 3c3214b8
[ 134.391396] [10] [ EMERG] [ap] up_registerdump: IP: feff766c SP: 3c321b50 LR: 2c3cc801 PC: 2c3f3dd8
[ 134.392544] [10] [ EMERG] [ap] up_registerdump: xPSR: 61070000 BASEPRI: 000000e0 CONTROL: 00000004
[ 134.393682] [10] [ EMERG] [ap] up_dumpstate: sp: 3c2ae2d8
[ 134.394397] [10] [ EMERG] [ap] up_dumpstate: IRQ stack:
[ 134.395056] [10] [ EMERG] [ap] up_dumpstate: base: 3c2adb80
[ 134.395771] [10] [ EMERG] [ap] up_dumpstate: size: 00000800
[ 134.396502] [10] [ EMERG] [ap] up_stackdump: 3c2ae2c0: 3c2f5c54 3c2ae2f8 2c3d5a9b 3c231dd8 3c231f70 00000800 000000e0 00000004
[ 134.397927] [10] [ EMERG] [ap] up_stackdump: 3c2ae2e0: 00000013 3c2321f4 00000013 3c2321f4 00000013 3c2321f4 00000013 3c2321f4
[ 134.399369] [10] [ EMERG] [ap] up_stackdump: 3c2ae300: 3c2ae310 01000000 00000000 00000000 3c2ae328 00000000 00000002 2c477300
[ 134.400809] [10] [ EMERG] [ap] up_stackdump: 3c2ae320: 3c3214b8 2c3c60e5 3c2ae340 2c3d62f9 00000000 00000000 50101002 00000000
[ 134.402250] [10] [ EMERG] [ap] up_stackdump: 3c2ae340: 0005705d 00000006 201dfee8 3c2ae808 3c321a78 00000006 3c2ae360 2c3b1e5b
[ 134.403682] [10] [ EMERG] [ap] up_dumpstate: sp: 3c321b50
[ 134.404395] [10] [ EMERG] [ap] up_dumpstate: User stack:
[ 134.405067] [10] [ EMERG] [ap] up_dumpstate: base: 3c3214c8
[ 134.405782] [10] [ EMERG] [ap] up_dumpstate: size: 000007f0
[ 134.406512] [10] [ EMERG] [ap] up_stackdump: 3c321b40: 00000000 00000000 00040000 00000000 3c2a3018 00000002 3c321b60 3c321cd0
[ 134.407938] [10] [ EMERG] [ap] up_stackdump: 3c321b60: 00000000 00000002 3c321b88 00000000 00000000 2c477300 3c3214b8 2c3f00b5
[ 134.409368] [10] [ EMERG] [ap] up_stackdump: 3c321b80: 00000000 00000004 3c321ba0 3c32213c 00000000 3c32213c 0000000d 2c449a1b
[ 134.410809] [10] [ EMERG] [ap] up_stackdump: 3c321ba0: 3c322142 3c3213e8 00000000 3c2b096c 3c321bb8 2c3f61f3 3c32213c 3c32213f
[ 134.412249] [10] [ EMERG] [ap] up_stackdump: 3c321bc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 134.413679] [10] [ EMERG] [ap] up_stackdump: 3c321be0: 00000000 00000000 00000000 00000000 00000000 00000000 3c321cd0 00000000
[ 134.415109] [10] [ EMERG] [ap] up_stackdump: 3c321c00: 00000000 3c2f5cdc 3c32213c 3c321cd0 3c321c30 3c234d3c 00050000 2c477300
[ 134.416540] [10] [ EMERG] [ap] up_stackdump: 3c321c20: 3c3214b8 2c3f439f 3c2a7324 3c321cd0 00000000 3c3214b8 3c321c50 3c321cd0
[ 134.417969] [10] [ EMERG] [ap] up_stackdump: 3c321c40: 00000001 3c3214b8 3c321c60 00000001 00050000 2c477300 3c3214b8 2c3f572b
[ 134.419400] [10] [ EMERG] [ap] up_stackdump: 3c321c60: 00000000 00000001 3c3214b8 2c47703c 3c321c78 2c3f5c59 000009e0 2c47703c
[ 134.420829] [10] [ EMERG] [ap] up_stackdump: 3c321c80: 3c321c98 00000064 2c47703c 2c3f5c25 3c321c98 2c3c9343 3c3214bc 3c321ca8
[ 134.422278] [10] [ EMERG] [ap] up_showtasks: PID PRI USED STACK FILLED CPU COMMAND
[ 134.423475] [10] [ EMERG] [ap] up_showtasks: ---- ---- 928 2048 45.3% ---- irq
[ 134.424711] [10] [ EMERG] [ap] up_dump_task: 0 0 512 3048 16.7% 99.4% Idle Task
[ 134.425934] [10] [ EMERG] [ap] up_dump_task: 1 224 304 2016 15.0% 0.0% hpwork
[ 134.427147] [10] [ EMERG] [ap] up_dump_task: 2 100 304 2016 15.0% 0.0% lpwork
[ 134.428350] [10] [ EMERG] [ap] up_dump_task: 4 224 856 2008 42.6% 0.0% rptun
[ 134.429552] [10] [ EMERG] [ap] up_dump_task: 5 224 876 2008 43.6% 0.0% rptun
[ 134.430754] [10] [ EMERG] [ap] up_dump_task: 6 224 872 2008 43.4% 0.0% rptun
[ 134.431957] [10] [ EMERG] [ap] up_dump_task: 7 224 848 2008 42.2% 0.0% rptun
[ 134.433204] [10] [ EMERG] [ap] up_dump_task: 8 101 500 4056 12.3% 0.0% bes_main
[ 134.434413] [10] [ EMERG] [ap] up_dump_task: 9 101 440 3000 14.6% 0.0% audio_flinger
[ 134.435676] [10] [ EMERG] [ap] up_dump_task: 10 100 1356 2032 66.7% 0.5% init
[ 134.436885] [10] [ EMERG] [ap] up_dump_task: 11 224 344 2008 17.1% 0.0% rpmsg-gpio-cp
[ 134.438170] [10] [ EMERG] [ap] up_dump_task: 12 80 596 2024 29.4% 0.0% usrsock
[ 134.439397] [10] [ EMERG] [ap] up_dump_task: 14 100 2556 4080 62.6% 0.0% kvdbd
[ 134.440596] [10] [ EMERG] [ap] up_dump_task: 15 100 608 2008 30.2% 0.0% rpmsg-uorb-tee
[ 134.441898] [10] [ EMERG] [ap] up_dump_task: 19 100 520 2008 25.8% 0.0% rpmsg-uorb-audio
[ 134.443220] [10] [ EMERG] [ap] up_dump_task: 20 100 520 2008 25.8% 0.0% rpmsg-uorb-cp
[ 134.444504] [10] [ EMERG] [ap] up_dump_task: 21 100 752 2000 37.6% 0.0% rpmsg-uorb-sensor
[ 134.445844] [10] [ EMERG] [ap] up_dump_task: 22 224 344 2008 17.1% 0.0% rpmsg-gpio-sens
[ 134.447139] [10] [ EMERG] [ap] backtrace:
[ 134.447632] [10] [ EMERG] [ap] [ 0] [<0x2c4763b8>] _start+0x50/0x68
[ 134.448767] [10] [ EMERG] [ap] [ 0] [<0x2c300056>] Boot_Loader+0x46/0
[ 134.449877] [10] [ EMERG] [ap] backtrace:
[ 134.450352] [10] [ EMERG] [ap] [ 1] [<0x2c3b758e>] work_thread+0x2a/0x6c
[ 134.451480] [10] [ EMERG] [ap] [ 1] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.452628] [10] [ EMERG] [ap] backtrace:
[ 134.453102] [10] [ EMERG] [ap] [ 2] [<0x2c3b758e>] work_thread+0x2a/0x6c
[ 134.454232] [10] [ EMERG] [ap] [ 2] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.455382] [10] [ EMERG] [ap] backtrace:
[ 134.455863] [10] [ EMERG] [ap] [ 4] [<0x2c3c1226>] rptun_thread+0x5a/0x448
[ 134.457009] [10] [ EMERG] [ap] [ 4] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.458154] [10] [ EMERG] [ap] backtrace:
[ 134.458636] [10] [ EMERG] [ap] [ 5] [<0x2c3c1226>] rptun_thread+0x5a/0x448
[ 134.459787] [10] [ EMERG] [ap] [ 5] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.460936] [10] [ EMERG] [ap] backtrace:
[ 134.461422] [10] [ EMERG] [ap] [ 6] [<0x2c3c1226>] rptun_thread+0x5a/0x448
[ 134.462571] [10] [ EMERG] [ap] [ 6] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.463723] [10] [ EMERG] [ap] backtrace:
[ 134.464207] [10] [ EMERG] [ap] [ 7] [<0x2c3c1226>] rptun_thread+0x5a/0x448
[ 134.465357] [10] [ EMERG] [ap] [ 7] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.466516] [10] [ EMERG] [ap] backtrace:
[ 134.466990] [10] [ EMERG] [ap] [ 8] [<0x2c3b3392>] pthread_sem_take+0x1a/0x2c
[ 134.468167] [10] [ EMERG] [ap] [ 8] [<0x2c3b307e>] pthread_cond_wait+0x46/0x88
[ 134.469339] [10] [ EMERG] [ap] [ 8] [<0x573c2>] osSignalWait+0x112/0x14c
[ 134.470444] [10] [ EMERG] [ap] [ 8] [<0x2c3b301c>] pthread_mutex_unlock+0x54/0x70
[ 134.471665] [10] [ EMERG] [ap] [ 8] [<0x2c4762fe>] bes_main+0x4e/0xb8
[ 134.472842] [10] [ EMERG] [ap] [ 8] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.473989] [10] [ EMERG] [ap] backtrace:
[ 134.474465] [10] [ EMERG] [ap] [ 9] [<0x2c3b3392>] pthread_sem_take+0x1a/0x2c
[ 134.475640] [10] [ EMERG] [ap] [ 9] [<0x2c3b307e>] pthread_cond_wait+0x46/0x88
[ 134.476825] [10] [ EMERG] [ap] [ 9] [<0x573c2>] osSignalWait+0x112/0x14c
[ 134.477926] [10] [ EMERG] [ap] [ 9] [<0x57498>] osMutexWait+0x64/0x7c
[ 134.479004] [10] [ EMERG] [ap] [ 9] [<0x2c46acd0>] af_thread+0x18/0x254
[ 134.480189] [10] [ EMERG] [ap] [ 9] [<0x2c3b66b2>] nxtask_start+0x3a/0x60
[ 134.481395] [10] [ EMERG] [ap] backtrace:
[ 134.481824] [10] [ EMERG] [ap] [10] [<0x2c3c9376>] sched_dumpstack+0xe/0x4c
[ 134.482997] [10] [ EMERG] [ap] [10] [<0x2c3b3d32>] nxsched_foreach+0x2e/0x60
[ 134.484156] [10] [ EMERG] [ap] [10] [<0x2c3d5bd6>] up_assert+0x24a/0x414
[ 134.485294] [10] [ EMERG] [ap] [10] [<0x2c3c9340>] nxtask_startup+0x40/0x68
[ 134.486451] [10] [ EMERG] [ap] [10] [<0x2c3c60e0>] _assert+0x4/0x10
[ 134.487523] [10] [ EMERG] [ap] [10] [<0x2c3d62f4>] arm_usagefault+0xa8/0x138
[ 134.488707] [10] [ EMERG] [ap] [10] [<0x2c3b1e58>] irq_dispatch+0x1c/0x40
[ 134.489823] [10] [ EMERG] [ap] [10] [<0x2c3d587a>] arm_doirq+0x1a/0x2c
[ 134.490945] [10] [ EMERG] [ap] [10] [<0x2c3cffba>] exception_common+0x4a/0xac
[ 134.492134] [10] [ EMERG] [ap] [10] [<0x2c3f00b0>] nsh_parse_command+0x684/0xcf0
[ 134.493366] [10] [ EMERG] [ap] [10] [<0x2c449a18>] write+0x34/0x54
[ 134.494494] [10] [ EMERG] [ap] [10] [<0x2c3f61ee>] readline_putc+0x12/0x40
[ 134.495661] [10] [ EMERG] [ap] [10] [<0x2c3f439a>] nsh_session+0x92/0x168
[ 134.496815] [10] [ EMERG] [ap] [10] [<0x2c3f5726>] nsh_consolemain+0x1e/0x38
[ 134.498005] [10] [ EMERG] [ap] [10] [<0x2c3f5c54>] nsh_main+0x30/0x50
[ 134.499123] [10] [ EMERG] [ap] [10] [<0x2c3c9340>] nxtask_startup+0x40/0x68
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962#issuecomment-992466611
LGTM.
--
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
[GitHub] [incubator-nuttx] anchao commented on a change in pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962#discussion_r765502549
##########
File path: arch/arm/src/Makefile
##########
@@ -156,6 +156,21 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ($(CONFIG_ALLSYMS),y)
Review comment:
on next phase, coming soon
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962#discussion_r767736195
##########
File path: libs/libc/stdio/lib_libvsprintf.c
##########
@@ -461,23 +487,59 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
if (c == 'p')
{
- if (fmt_char(fmt) == 'V')
+ unsigned char sub_c = fmt_char(fmt);
+
+ switch (sub_c)
{
- FAR struct va_format *vaf = va_arg(ap, void *);
+ case 'V':
+ {
+ FAR struct va_format *vaf = va_arg(ap, void *);
#ifdef va_copy
- va_list copy;
+ va_list copy;
- va_copy(copy, *vaf->va);
- vsprintf_internal(stream, NULL, 0, vaf->fmt, copy);
- va_end(copy);
+ va_copy(copy, *vaf->va);
+ vsprintf_internal(stream, NULL, 0, vaf->fmt, copy);
+ va_end(copy);
#else
- vsprintf_internal(stream, NULL, 0, vaf->fmt, *vaf->va);
+ vsprintf_internal(stream, NULL, 0, vaf->fmt, *vaf->va);
#endif
- continue;
- }
- else
- {
- fmt_ungetc(fmt);
+ continue;
+ }
+#ifdef CONFIG_ALLSYMS
+
+ case 'S':
+ case 's':
+ {
+ FAR const struct symtab_s *symbol;
+ FAR void *addr = va_arg(ap, FAR void *);
+ size_t symbolsize;
+
+ symbol = allsyms_findbyvalue(addr,
+ &symbolsize);
Review comment:
merge with the previous line?
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4962: [KALLSYMS] libc/allsyms: Load all symbols for debugging
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4962:
URL: https://github.com/apache/incubator-nuttx/pull/4962#discussion_r765484464
##########
File path: arch/arm/src/Makefile
##########
@@ -156,6 +156,21 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ($(CONFIG_ALLSYMS),y)
Review comment:
what's about other arch at least rsicv and xtensa?
--
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