zhangyu-duck opened a new pull request, #17938:
URL: https://github.com/apache/nuttx/pull/17938

   ## Summary
   
   When an exception occurs, dump the necessary information, such as:
   1. print trap type and reason
   2. dump address and data register, include upcsa and lowcsa
   3. dump special trap register
   
   ## Impact
   
   enhance dumpinfo
   
   ## Testing
   ```c
   int main(int argc, FAR char *argv[])
   {
     printf("Hello, World final!!\n");
     
     int *p = NULL;
     *p =4;
   
     return 0;
   }
   ``` 
   
   dumpinfo:
   nsh> hello
   Hello, World final!!
   tricore_internalprotrape: PANIC!!! Internal Protection Trap:
   tricore_internalprotrape:       Class 1 TID: 6 regs: 0x700322c0
   tricore_internalprotrape: Internal Protection Reason:
   tricore_internalprotrape:       Memory Protection Null Address
   dump_assert_info: Current Version: NuttX  12.12.0 6a048d2e87a Jan 15 2026 
17:09:57 tricore
   dump_assert_info: Assertion failed panic: at file: :0 task: hello process: 
hello 0x80026df0
   tricore_dump_lowcsa: LPCXI:00370C88     PC:80026DFE        A2:00000000       
 A3:F0000600
   tricore_dump_lowcsa: D0:00000000        D1:00000000        D2:00000015       
 D3:00000000
   tricore_dump_lowcsa: A4:70001B54        A5:7000A744        A6:800034E6       
 A7:7000A760
   tricore_dump_lowcsa: D4:7FFFFFFE        D5:00000003        D6:00000000       
 D7:7FFFFFFF
   
   tricore_dump_upcsa: UPCXI:00370C89     PSW:00000882       SP:7000A760        
A11:80011566
   tricore_dump_upcsa: D8:00000001        D9:70009F70        D10:00000000       
D11:00000000
   tricore_dump_upcsa: A12:80026DF0       A13:00000000       A14:00000000       
A15:00000000
   tricore_dump_upcsa: D12:00000000       D13:00000000       D14:00000000       
D15:00000000
   
   tricore_dump_trapctrl: PSTR:00000000      DSTR:00080000      DATR:00000000   
   DEADD:00000000
   
   and we know reason is "Memory Protection Null Address" and after disassembly 
we know pc: 80026DFE, which pointed to the correct exception instruction, and 
visit A2, which value is 0, indicates that a null pointer was indeed accessed.
   
   80026df0 <hello_main>:
   80026df0:   91 00 00 48     movh.a %a4,32768
   80026df4:   d9 44 51 33     lea %a4,[%a4]13521 <800034d1 <__thenan_df+0xa29>>
   80026df8:   6d 00 21 51     call 8003103a <printf>
   80026dfc:   a0 02           mov.a %a2,0
   80026dfe:   f4 22           st.a [%a2],%a2
   80026e00:   6d ff 4d 55     call 8001189a <abort>
   
   


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