1 set board_info(localhost,isremote) 0
2 load_generic_config "unix"
4 # The default compiler for this target.
5 set_board_info compiler "[find_gcc]"
7 global outdir vg_basename
8 set vg_basename "$outdir/valgrind."
13 set GDB "valgrind --quiet --trace-children=no --child-silent-after-fork=yes --num-callers=50 --log-file=${vg_basename}%q{VGCOUNT} $GDB"
15 # Support for running gdb under valgrind and checking the results.
17 rename remote_spawn vg_remote_spawn
18 proc remote_spawn {args} {
19 global env vg_basename vg_count
22 set env(VGCOUNT) $vg_count
24 file delete -force ${vg_basename}$vg_count
25 set res [uplevel vg_remote_spawn $args]
30 rename gdb_exit vg_gdb_exit
31 proc gdb_exit {args} {
32 global vg_basename vg_count vg_reported
34 # We can sometimes see multiple consecutive calls to gdb_exit
35 # without an intervening spawn. In this case we only want to
36 # report the valgrind results once.
37 if {![info exists vg_reported($vg_count)]} {
38 set vg_reported($vg_count) 1
40 # FIXME: how can we name this test consistently across
42 if {[file exists ${vg_basename}$vg_count]
43 && [file size ${vg_basename}$vg_count] > 0} {
44 send_log "Valgrind output:\n"
45 set fd [open ${vg_basename}$vg_count]
49 fail "valgrind check $vg_count"
51 pass "valgrind check $vg_count"
55 return [uplevel vg_gdb_exit $args]
58 # Valgrind slows everything down, so boost the default timeout.
59 global gdb_test_timeout
60 set gdb_test_timeout [expr {20 * $gdb_test_timeout}]