From d427d8192a5d3348cc3bb979c08d205836f852cd Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Wed, 28 May 2014 07:33:05 +0000 Subject: [PATCH] [0.3.x] added : excepttest.py git-svn-id: https://pykd.svn.codeplex.com/svn@88442 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd-0.3-2012.sln | 89 ++---------------------------------- test/scripts/ehexcepttest.py | 46 ------------------- test/scripts/excepttest.py | 45 ++++++++++++++++++ test/scripts/pykdtest.py | 13 +----- test/scripts/pykdtest.pyproj | 2 +- 5 files changed, 51 insertions(+), 144 deletions(-) delete mode 100644 test/scripts/ehexcepttest.py create mode 100644 test/scripts/excepttest.py diff --git a/pykd-0.3-2012.sln b/pykd-0.3-2012.sln index 11895bd..644e121 100644 --- a/pykd-0.3-2012.sln +++ b/pykd-0.3-2012.sln @@ -21,6 +21,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kdlib", "kdlibcpp\source\kdlib_vc110.vcxproj", "{3E9C538F-F060-4E86-AB7D-D44439615B63}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pykd", "pykd\pykd_vc110.vcxproj", "{C4C45791-0201-4406-BC5C-A384B01E3BF5}" + ProjectSection(ProjectDependencies) = postProject + {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} + EndProjectSection EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "pykdtest", "test\scripts\pykdtest.pyproj", "{3F0BE77E-19B0-4192-B432-44A25805BCB8}" ProjectSection(ProjectDependencies) = postProject @@ -35,18 +38,10 @@ Global Debug_2.7|Mixed Platforms = Debug_2.7|Mixed Platforms Debug_2.7|Win32 = Debug_2.7|Win32 Debug_2.7|x64 = Debug_2.7|x64 - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 Release_2.7|Any CPU = Release_2.7|Any CPU Release_2.7|Mixed Platforms = Release_2.7|Mixed Platforms Release_2.7|Win32 = Release_2.7|Win32 Release_2.7|x64 = Release_2.7|x64 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Any CPU.ActiveCfg = Debug|Win32 @@ -59,15 +54,6 @@ Global {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.ActiveCfg = Debug|x64 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.Build.0 = Debug|x64 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.Deploy.0 = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|x64.ActiveCfg = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|x64.Build.0 = Debug|x64 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Any CPU.ActiveCfg = Release|Win32 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Win32 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Mixed Platforms.Build.0 = Release|Win32 @@ -78,15 +64,6 @@ Global {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.ActiveCfg = Release|x64 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.Build.0 = Release|x64 {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.Deploy.0 = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Any CPU.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|x64.ActiveCfg = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|x64.Build.0 = Release|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Any CPU.ActiveCfg = Debug|Win32 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Win32 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Win32 @@ -97,15 +74,6 @@ Global {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.ActiveCfg = Debug|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Build.0 = Debug|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Deploy.0 = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|x64.ActiveCfg = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|x64.Build.0 = Debug|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Any CPU.ActiveCfg = Release|Win32 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Win32 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Mixed Platforms.Build.0 = Release|Win32 @@ -116,15 +84,6 @@ Global {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.ActiveCfg = Release|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.Build.0 = Release|x64 {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.Deploy.0 = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Any CPU.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|x64.ActiveCfg = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|x64.Build.0 = Release|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Any CPU.ActiveCfg = Debug_2.7|Win32 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug_2.7|Win32 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Mixed Platforms.Build.0 = Debug_2.7|Win32 @@ -135,15 +94,6 @@ Global {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.ActiveCfg = Debug_2.7|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.Build.0 = Debug_2.7|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.Deploy.0 = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Any CPU.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|x64.ActiveCfg = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|x64.Build.0 = Debug_2.7|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Any CPU.ActiveCfg = Release_2.7|Win32 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Mixed Platforms.ActiveCfg = Release_2.7|Win32 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Mixed Platforms.Build.0 = Release_2.7|Win32 @@ -154,15 +104,6 @@ Global {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.ActiveCfg = Release_2.7|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.Build.0 = Release_2.7|x64 {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.Deploy.0 = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Any CPU.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|x64.ActiveCfg = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|x64.Build.0 = Release_2.7|x64 {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Any CPU.ActiveCfg = Debug|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Any CPU.Build.0 = Debug|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -170,48 +111,24 @@ Global {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Win32.ActiveCfg = Debug|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Win32.Build.0 = Debug|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|x64.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Win32.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|x64.ActiveCfg = Debug|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Any CPU.ActiveCfg = Release|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Any CPU.Build.0 = Release|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Mixed Platforms.Build.0 = Release|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Win32.ActiveCfg = Release|Any CPU {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|x64.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Any CPU.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Win32.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|x64.ActiveCfg = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Any CPU.ActiveCfg = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Any CPU.Build.0 = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Win32.ActiveCfg = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|x64.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Win32.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|x64.ActiveCfg = Debug|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Any CPU.ActiveCfg = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Any CPU.Build.0 = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Mixed Platforms.Build.0 = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Win32.ActiveCfg = Release|Any CPU {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|x64.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Any CPU.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Win32.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/scripts/ehexcepttest.py b/test/scripts/ehexcepttest.py deleted file mode 100644 index 4ca4485..0000000 --- a/test/scripts/ehexcepttest.py +++ /dev/null @@ -1,46 +0,0 @@ -"""Exception event test""" - -import unittest -import target -import pykd -import testutils - -class ExceptionHandler(pykd.eventHandler): - def __init__(self): - pykd.eventHandler.__init__(self) - self.accessViolationOccured = False - - def onException(self, exceptInfo): - """Exception handler""" - - self.accessViolationOccured = exceptInfo.ExceptionCode == 0xC0000005 - - if self.accessViolationOccured: - self.param0 = exceptInfo.Parameters[0] - self.param1 = exceptInfo.Parameters[1] - return pykd.eventResult.Break - - return pykd.eventResult.NoChange - -class EhExceptionTest(unittest.TestCase): - """Exception event test""" - - def testException(self): - """Start new process and track exceptions""" - _locProcessId = pykd.startProcess( target.appPath + " -testExceptions" ) - with testutils.ContextCallIt( testutils.KillProcess(_locProcessId) ) as killStartedProcess : - exceptionHandler = ExceptionHandler() - - while not exceptionHandler.accessViolationOccured: - pykd.go() - - self.assertEqual( pykd.lastEvent(), pykd.eventType.Exception ) - - self.assertTrue( exceptionHandler.accessViolationOccured ) - self.assertEqual( exceptionHandler.param0, 1 ) # write - self.assertEqual( exceptionHandler.param1, 2 ) # addr - - exceptInfo = pykd.lastException() - self.assertEqual( exceptInfo.ExceptionCode, 0xC0000005 ) - self.assertEqual( exceptionHandler.param0, exceptInfo.Parameters[0] ) - self.assertEqual( exceptionHandler.param1, exceptInfo.Parameters[1] ) diff --git a/test/scripts/excepttest.py b/test/scripts/excepttest.py new file mode 100644 index 0000000..d06fb90 --- /dev/null +++ b/test/scripts/excepttest.py @@ -0,0 +1,45 @@ +"""Exception event test""" + +import unittest +import target +import pykd +import testutils + + +class ExceptionTest(unittest.TestCase): + """Exception event test""" + + def testExceptionHandler(self): + + class ExceptionHandler(pykd.eventHandler): + def __init__(self): + pykd.eventHandler.__init__(self) + + def onException(self, exceptInfo): + self.exceptInfo = exceptInfo + return pykd.eventResult.Break + + processId = pykd.startProcess( target.appPath + " exception" ) + with testutils.ContextCallIt( testutils.KillProcess(processId) ) as killStartedProcess : + exceptionHandler = ExceptionHandler() + + self.assertEqual( pykd.Break, pykd.go() ) + self.assertEqual( 0xC0000005, exceptionHandler.exceptInfo.exceptionCode) #0xC0000005 = Access violation + + def testSecondChance(self): + + class ExceptionHandler(pykd.eventHandler): + def __init__(self): + pykd.eventHandler.__init__(self) + + def onException(self, exceptInfo): + self.exceptInfo = exceptInfo + return pykd.eventResult.Proceed + + processId = pykd.startProcess( target.appPath + " exception" ) + with testutils.ContextCallIt( testutils.KillProcess(processId) ) as killStartedProcess : + exceptionHandler = ExceptionHandler() + self.assertEqual( pykd.Break, pykd.go() ) + self.assertEqual( True, exceptionHandler.exceptInfo.firstChance) + self.assertEqual( pykd.Break, pykd.go() ) + self.assertEqual( False, exceptionHandler.exceptInfo.firstChance) diff --git a/test/scripts/pykdtest.py b/test/scripts/pykdtest.py index 2cd526b..15adbb1 100644 --- a/test/scripts/pykdtest.py +++ b/test/scripts/pykdtest.py @@ -23,11 +23,7 @@ import regtest import stacktest import customtypestest import mspdbtest - - -#import ehexcepttest -#import ehstatustest -#import ehsymbolstest +import excepttest pykd.initialize() @@ -42,7 +38,6 @@ class StartProcessWithoutParamsTest(unittest.TestCase): class TerminateProcessTest(unittest.TestCase): def testKill(self): pykd.killProcess( target.processId ) - #pykd.detachProcess( target.processId ) def getTestSuite( singleName = "" ): if singleName == "": @@ -64,11 +59,7 @@ def getTestSuite( singleName = "" ): unittest.TestLoader().loadTestsFromTestCase( breakpoint.BreakpointTest ), unittest.TestLoader().loadTestsFromTestCase( stacktest.StackTest ), unittest.TestLoader().loadTestsFromTestCase( mspdbtest.MsPdbTest ), - - #unittest.TestLoader().loadTestsFromTestCase( localstest.LocalVarsTest ) - #unittest.TestLoader().loadTestsFromTestCase( ehexcepttest.EhExceptionTest ), - #unittest.TestLoader().loadTestsFromTestCase( ehstatustest.EhStatusTest ), - #unittest.TestLoader().loadTestsFromTestCase( ehsymbolstest.EhSymbolsTest ), + unittest.TestLoader().loadTestsFromTestCase( excepttest.ExceptionTest ), ] ) else: return unittest.TestSuite( diff --git a/test/scripts/pykdtest.pyproj b/test/scripts/pykdtest.pyproj index b6fee80..0ef356f 100644 --- a/test/scripts/pykdtest.pyproj +++ b/test/scripts/pykdtest.pyproj @@ -38,7 +38,7 @@ - +