Quantcast
Channel: Python extension for WinDbg
Viewing all articles
Browse latest Browse all 1625

New Post: Exception Always First Chance?

$
0
0
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?


Viewing all articles
Browse latest Browse all 1625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>