You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/10/23 13:56:45 UTC

[GitHub] andrzej-kaczmarek opened a new pull request #1476: os: Add option to restore registers state on crash

andrzej-kaczmarek opened a new pull request #1476: os: Add option to restore registers state on crash
URL: https://github.com/apache/mynewt-core/pull/1476
 
 
   This adds a handy option to automatically restore registers state on crash to pre-crash state. The only register to set manually is PC, but this is also easier now with dedicated printout that specifies command to c&p to GDB. Here's how it works when enabled:
   
   Crash in GDB:
   ```
   (gdb) c
   Continuing.
   
   Program received signal SIGTRAP, Trace/breakpoint trap.
   0x0001116e in os_default_irq (tf=0x0) at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:218
   218	        __asm volatile (
   (gdb) bt
   #0  0x0001116e in os_default_irq (tf=0x0) at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:218
   #1  0x00000000 in ?? ()
   ```
   Output on console:
   ```
   002798 Unhandled interrupt (3), exception sp 0x20002d70
   002798  r0:0x00000000  r1:0x00000000  r2:0x000000ff  r3:0x00000000
   002798  r4:0x00000000  r5:0x00000000  r6:0x00000000  r7:0x00000000
   002798  r8:0x00000000  r9:0x00000000 r10:0x00000000 r11:0x00000000
   002798 r12:0x00000000  lr:0x00010bef  pc:0x0000fa6c psr:0x61000000
   002798 ICSR:0x00421803 HFSR:0x40000000 CFSR:0x02000000
   002798 BFAR:0xe000ed38 MMFAR:0xe000ed34
   002798 Use 'set $pc = 0x0000fa6c' to restore PC in gdb
   ```
   And back to GDB:
   ```
   (gdb) set $pc = 0x0000fa6c
   (gdb) frame 0
   #0  cmd_advertise_configure (argc=<optimized out>, argv=<optimized out>) at repos/apache-mynewt-nimble/apps/btshell/src/cmd.c:136
   136	    instance /= rc;
   (gdb) bt
   #0  cmd_advertise_configure (argc=<optimized out>, argv=<optimized out>) at repos/apache-mynewt-nimble/apps/btshell/src/cmd.c:136
   #1  0x00030d38 in shell_process_command (line=<optimized out>) at repos/apache-mynewt-core/sys/shell/src/shell.c:408
   #2  0x00030f4e in shell (ev=0x200070fc <shell_console_ev+16>) at repos/apache-mynewt-core/sys/shell/src/shell.c:458
   #3  0x000118ce in os_eventq_run (evq=<optimized out>) at repos/apache-mynewt-core/kernel/os/src/os_eventq.c:162
   #4  0x0000d6de in main (argc=<optimized out>, argv=<optimized out>) at repos/apache-mynewt-nimble/apps/btshell/src/main.c:2238
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services