Changes between Version 1 and Version 2 of Debugging/sis
- Timestamp:
- 07/31/17 13:45:07 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Debugging/sis
v1 v2 1 1 2 [[TOC( sis, depth=3)]]2 [[TOC(Debugging/sis, depth=2)]] 3 3 4 4 = SIS SPARC Simulator = … … 68 68 }}} 69 69 70 The above trace shows a data trap (trap type 0x9) at address 0x4002565c (ld [ %g2 ], %i3). The load address in %g2 is 0x40FFFCD0, which is not a valid Leon2 address. To see which code generates this trap, we will need some symbolic information. Since SIS does not support debug symbols, we must turn to gdb with built-in sis: \70 The above trace shows a data trap (trap type 0x9) at address 0x4002565c (ld [ %g2 ], %i3). The load address in %g2 is 0x40FFFCD0, which is not a valid Leon2 address. To see which code generates this trap, we will need some symbolic information. Since SIS does not support debug symbols, we must turn to gdb with built-in sis: 71 71 72 72 === Debugging with SIS in gdb === … … 105 105 at ../../../../../../gcc-7.1.0/newlib/libc/string/memcpy.c:87 106 106 87 ../../../../../../gcc-7.1.0/newlib/libc/string/memcpy.c: No such file or directory. 107 108 (gdb) bt 109 #0 memcpy (dst0=0x40fffcd0, src0=0xfffff000, len0=32) 110 at ../../../../../../gcc-7.1.0/newlib/libc/string/memcpy.c:87 111 #1 0x4001487c in ambapp_scan2 (abus=0x40039320 <ambapp_plb>, ioarea=4293918720, 112 memfunc=0x400255f0 <memcpy>, parent=0x0, root=0x40039320 <ambapp_plb>) 113 at /home/jiri/ibm/src/rtems/rtems.git/c/src/lib/libbsp/sparc/leon3/../../sparc/shared/amba/ambapp.c:177 114 #2 0x4001429c in amba_initialize () 115 at /home/jiri/ibm/src/rtems/rtems.git/c/src/lib/libbsp/sparc/leon3/amba/amba.c:99 116 #3 0x4001d148 in rtems_initialize_executive () 117 at /home/jiri/ibm/src/rtems/rtems.git/c/src/../../cpukit/sapi/src/exinit.c:138 118 #4 0x400134d4 in boot_card (cmdline=0x0) 119 at /home/jiri/ibm/src/rtems/rtems.git/c/src/lib/libbsp/sparc/leon3/../../shared/bootcard.c:78 120 #5 0x400010c8 in zerobss () 121 at /home/jiri/ibm/src/rtems/rtems.git/c/src/lib/libbsp/sparc/leon3/../../sparc/shared/start/start.S:372 122 107 123 (gdb) up 108 124 #1 0x4001487c in ambapp_scan2 (abus=0x40039320 <ambapp_plb>, ioarea=4293918720, … … 124 140 }}} 125 141 126 We can no tsee that the data trap occurs in memcpy, called by ambapp_scan2. The cause to the trap is rather trivial, we are trying to run a leon3 binary with sis configured for leon2! Running the binary with sis in leon3 mode will give us the desired result:142 We can now see that the data trap occurs in memcpy, called by ambapp_scan2. The cause to the trap is rather trivial, we are trying to run a leon3 binary with sis configured for leon2! Running the binary with sis in leon3 mode will give us the desired result: 127 143 128 144 {{{ … … 145 161 LOCAL: Hey I'm in base class constructor number 6 for 0x4003da68. 146 162 LOCAL: Hey I'm in base class constructor number 7 for 0x4003da74. 147 LOCAL: Hey I'm in derived class constructor number 8 for 0x4003da74. 148 IO Stream not tested 149 LOCAL: Hey I'm in derived class destructor number 8 for 4003DA74. 150 Derived class - Instantiation order 8 151 LOCAL: Hey I'm in base class destructor number 7 for 4003DA74. 152 Derived class - Instantiation order 8 153 LOCAL: Hey I'm in base class destructor number 6 for 4003DA68. 154 Derived class - Instantiation order 6 155 LOCAL: Hey I'm in base class destructor number 5 for 4003DA5C. 156 Derived class - Instantiation order 5 157 LOCAL: Hey I'm in base class destructor number 4 for 4003DA50. 158 Derived class - Instantiation order 5 159 *** TESTING C++ EXCEPTIONS *** 160 161 foo_function() catch block called: 162 < foo_function() throw this exception > 163 Success catching a char * exception 164 foo_function() re-throwing execption... 165 throw std::runtime: caught: thrown std::runtime object 166 throw an instance based exception 167 RtemsException raised=File:/home/jiri/ibm/src/rtems/rtems.git/c/src/../../testsuites/samples/cdtest/main.cc, Line:227, Error=55 168 Success catching RtemsException... 169 RtemsException ---> File:/home/jiri/ibm/src/rtems/rtems.git/c/src/../../testsuites/samples/cdtest/main.cc, Line:227, Error=55 170 Exceptions are working properly. 171 Global Dtors should be called after this line.... 172 GLOBAL: Hey I'm in derived class destructor number 3 for 400389FC. 173 Derived class - Instantiation order 3 163 . 164 . 165 . 166 . 174 167 GLOBAL: Hey I'm in base class destructor number 2 for 400389FC. 175 168 Derived class - Instantiation order 3 … … 181 174 }}} 182 175 183 To run the binary again, the gdb load command must be given followed by run.184 185 === Running test suites with SIS and rtems-test er===176 To run the binary again, the gdb '''load''' command must be given followed by '''run'''. 177 178 === Running test suites with SIS and rtems-test === 186 179 187 180 SIS can run the RTEMS test suites for erc32, leon2 and leon3 bsp in an automatic way using the rtems-test script. The test suites are available in the RTEMS build or install directory if RTEMS was configured with --enable-tests. Below is how to run the tests for leon3, but it works equally well erc32 and leon2. The tests will run in about 2 - 3 minutes on a high-end desktop. … … 248 241 }}} 249 242 243 Link to DDD image: https://gaisler.org/gdb/doc/ddd1.png