fix Issue 9788 - -profile doesn't work if exceptions are thrown in the running program
Merge pull request #1806 from WalterBright/fix9788

fix Issue 9788 - -profile doesn't work if exceptions are thrown in the r...