Exception Always First Chance?

Aug 9, 2013 at 9:07 AM
Edited Aug 9, 2013 at 9:08 AM
Hello,

I try to write a Exception monitor, following is my code

//pykd 0.2

import pykd
class ExceptionHandler(pykd.eventHandler):
def __init__(self):
    pykd.eventHandler.__init__(self)
    self.accessViolationOccured = False
    self.bOver=0

def is_over(self):
    return self.bOver

def onException(self, exceptInfo):

    self.accessViolationOccured = exceptInfo.ExceptionCode == 0xC0000005
    print exceptInfo

    if exceptInfo.FirstChance:
        return pykd.eventResult.NoChange

    if self.accessViolationOccured:
        type = exceptInfo.Parameters[0]
        addr = exceptInfo.Parameters[1]
        self.bOver=1
        return pykd.eventResult.Break

    return pykd.eventResult.NoChange
if name == 'main':
startComamnd = 'test.exe'
pykd.startProcess(startComamnd)
expHandler = ExceptionHandler()
try:
    while not expHandler.is_over():
        pykd.go()

except Exception, err:
    print err
==================
why exceptInfo.FirstChance is Always True?

and...
my test exception is
char * p=(char * )100;

but the addr is 0x100
addr = exceptInfo.Parameters[1]

bugs?

Aug 11, 2013 at 10:32 AM
"Exception Always First Chance": it is a bug: issue #12017
Aug 11, 2013 at 11:03 AM
Edited Aug 11, 2013 at 11:04 AM
"but the addr is 0x100" issue #12018
Aug 11, 2013 at 11:07 AM
xiaosai215:
you are genius of the bughunting :))
thank you very much.

I've fixed bug at 84628 CL, try to rebuild pykd. I'm going to make a release with these fixs soon.
Aug 23, 2013 at 8:22 AM
see 0.2.0.22, I hope the bug is gone
Sep 2, 2013 at 8:49 AM
yes, now it works well~ thanks