#!/bin/sh  
# \
exec oagtclsh "$0" "$@"

set auto_path [linsert $auto_path 0  /usr/local/oag/apps/lib/$env(HOST_ARCH)]
set auto_path [linsert $auto_path 0 /usr/local/oag/lib_patch/$env(HOST_ARCH)]

set xmlFile [APSTmpDir]/[APSTmpString].xml
catch {eval exec /usr/local/oag/3rdParty/valgrind-3.19.0/bin/valgrind \
         --leak-check=full --track-origins=yes --xml-file=$xmlFile --xml=yes $argv} results
puts "$results"
after 500
if {[file exist $xmlFile]} {
    exec /usr/local/oag/3rdParty/valkyrie-2.0.0.qt5/bin/valkyrie --view-log $xmlFile &
}
after 5000
file delete $xmlFile
