set test "cxxclass"
set ::result_string {main_enter
call: 64
cons call: 64
meth call: 64 24
dest call: 42
call2: 24
cons call2: 24
meth call2: 24 40
dest call2: 42
main_exit}

set test_flags "additional_flags=-g"
set test_flags "$test_flags [sdt_includes]"
set test_flags "$test_flags compiler=g++"
# ppc64 needs a more restrictive constraint for the probe args
if {[regexp "^(x86_64|i.86)$" $::tcl_platform(machine)] == 0} {
set test_flags "$test_flags additional_flags=-DSTAP_SDT_ARG_CONSTRAINT=nr"
}

proc dyninst_kfails {index} {
  # The dyninst runtime isn't multi-arch, it only works on the
  # native architecture. PR14490.
  if {! [all_compile_flag_native_p $index]} {
    setup_kfail 14490 "*-*-*"
  }
}

for {set i 0} {$i < [all_compile_flags]} {incr i} {
  set extra_flag [all_compile_flag $i]
  set extra_name [all_compile_flag_name $i]

  set res [target_compile $srcdir/$subdir/$test.cxx $test.exe executable "$test_flags $extra_flag"]
  if { $res != "" } {
    verbose "target_compile failed: $res" 2
    fail "compiling $extra_name $test.c"
    untested "$extra_name $test.c compile"
    continue
  } else {
      pass "$extra_name $test.c compile"
  }

  if {[installtest_p]} {
    foreach runtime [get_runtime_list] {
      if {$runtime != ""} {
	if {[info procs ${runtime}_kfails] ne ""} { ${runtime}_kfails $i }
	stap_run3 "$test-$extra_name-$runtime" -w \
	  $srcdir/$subdir/$test.stp $test.exe -c ./$test.exe --runtime=$runtime
      } elseif {[uprobes_p]} {
	stap_run3 "$test-$extra_name" -w $srcdir/$subdir/$test.stp \
	  $test.exe -c ./$test.exe
      } else {
	untested "$test-$extra_name"
      }
    }
  } else {
    untested "$test-$extra_name"
  }
  catch {exec rm -f $test.exe}
}
