foss-for-synopsys-dwc-arc-processors / binutils-gdb

A mirror of the upstream binutils-gdb repository for ARC specific work
GNU General Public License v2.0
13 stars 10 forks source link

[GDB] structs-tc tests causes nSIM to reset connection #48

Closed shahab-vahedi closed 3 years ago

shahab-vahedi commented 3 years ago

This is archived here for future references.

Problem

Within the arc-2020.09 toolchain, the gdb.base/structs.exp test fails:

(gdb) PASS: gdb.base/structs.exp: p/c L<n>; call 14 structs-tc
p/c fun15()
FAIL: gdb.base/structs.exp: p/c fun<n>(); call 15 structs-tc (timeout)
call Fun15(foo15)
FAIL: gdb.base/structs.exp: call Fun<n>(foo<n>); call 15 structs-tc (timeout)
p/c L15
FAIL: gdb.base/structs.exp: p/c L<n>; call 15 structs-tc (timeout)
p/c fun16()
FAIL: gdb.base/structs.exp: p/c fun<n>(); call 16 structs-tc (timeout)
...
Reading symbols from /gdb-testing/nsimgdb/outputs/gdb.base/structs/structs-ts...
(gdb) target remote :56281
Remote debugging using :56281
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Remote communication error.  Target disconnected.: Connection reset by peer.
...

This happens, because nSIM raises an exception:

/path/to/nsimdrv -gdb                            \
                 -port 1337                      \
                 -propsfile /path/to/arcem.props \
                 -on nsim_download_elf_sections  \
                 -p nsim_trace-output=trace.txt  \
                 -on trace                       \
                 objs/structs-tc

...
[0x000020bc] 0x1100003e               K       ld             0,[r1] : lw EXCEPTION [0x00006023] => 0x00000000
 EXCEPTION RAISED: 
    ECR      <= 0x000d0000 - VECTOR:MisalignedAccess
    ERET     <= 0x000020bc
    ERSTATUS <= 0x00000000
    BTA      <= 0x00000000
    EFA      <= 0x00006023
    PC       <= 0x00000000
    STATUS32 <= 0x00001020

Reproduction

See attached: gdb-structs-issue.zip

Solution

Add -prop=nsim_isa_disable_mem_align_check=1 flag while running nSIM.