Skip to content

Commit 4d749c4

Browse files
Revert "Restart nSIM and GDB each time for GCC tests"
This reverts commit 880aefa.
1 parent 880aefa commit 4d749c4

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

dejagnu/baseboards/arc-nsim.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ set_board_info ldscript ""
6969
# Call to nsim_open will set the netport (used by gdb-comm) as well as setting
7070
# up nSim specific data.
7171
set port [exec [file dirname $env(DEJAGNU)]/get-random-port.sh]
72-
set_board_info nsim_port $port
72+
nsim_open $port
7373

7474
# GDB protocol to be used
7575
set_board_info gdb_protocol "remote"

dejagnu/nsim-extra.exp

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,31 +111,41 @@ proc arc-nsim_reboot { connhost args } {
111111
return 1
112112
}
113113

114-
# There are problems with GDB loading new application with `file` command, at
115-
# least when new file has same filename as the old one. That problem is
116-
# not-deterministic and I wasn't able to trace down the source, however I see
117-
# that this happened between 7.5 and 7.6. To avoid troubles - restart GDB
118-
# completely. Restarting nSIM is not really required if it's registers are
119-
# reset, however for a good measure it is better to restart it, at the price of
120-
# performance penalty for restarting, of course.
121-
rename gdb_comm_start arc_saved_gdb_comm_start
122-
123-
proc gdb_comm_leave { } {
124-
verbose "ARC specific gdb_comm_leave"
125-
nsim_close
126-
quit_gdb
127-
}
114+
# By default between tests GDB will do `target exec`, then will reconnect to
115+
# target with `target remote`. As a result target will be left at the state of
116+
# end of previous test, likely in `exit()`. When GDB will reconnect with new
117+
# application, it will automatically try to unwind trace using old register
118+
# values, that will happen immediately after `target remote` before `load` that
119+
# will overwrite PC register. Consequently old-register values will be used and
120+
# in some unfortunate cases that might cause a failed assert in GDB. To avoid
121+
# possible issues this board should redefine gdb_comm_go_idle, so before
122+
# disconnecting from target GDB will reset crucial registers to 0.
123+
rename gdb_comm_go_idle arc_saved_gdb_comm_go_idle
124+
125+
proc gdb_comm_go_idle {} {
126+
global gdb_prompt
127+
128+
# Original gdb_comm_go_idle does the same, so it is save to not call it.
129+
if {![board_info host exists fileid]} {
130+
return -1
131+
}
128132

129-
proc gdb_comm_start { dest } {
130-
global board board_info
133+
remote_send host "set \$pc=0\n"
134+
remote_expect host 10 {
135+
-re ".*$gdb_prompt $" {}
136+
}
131137

132-
if { ![info exists board] } {
133-
set board $dest
138+
remote_send host "set \$blink=0\n"
139+
remote_expect host 10 {
140+
-re ".*$gdb_prompt $" {}
134141
}
135142

136-
verbose "ARC specific gdb_comm_start"
137-
nsim_open [target_info nsim_port]
138-
arc_saved_gdb_comm_start $dest
143+
remote_send host "set \$lp_count=0\n"
144+
remote_expect host 10 {
145+
-re ".*$gdb_prompt $" {}
146+
}
147+
148+
arc_saved_gdb_comm_go_idle
139149
}
140150

141151
# vim: noexpandtab sts=4 ts=8:

0 commit comments

Comments
 (0)