Hey again,
I'm trying to automate some stuff so I used the console version of Microsoft debugger cdb.
So I wrote bat file:
-G for close cdb after process termination
-c for loading script with parameter
(Python 2.7.10, pykd-0.3.0.32-py27-win32)
and %1 for target name.
the commad line I run is:
"startCdb.bat c:\windows\syswow64\notepad.exe"
now, when I close notepad, cdb crush, but, when python script is not included (script2.txt), cdb exit gracefully.
files:
startCdb.bat:
```
"C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\cdb" -G -c "$$>a<C:\Temp\script.txt C:\Temp\test.py " %1
```
script.txt
```
.echo Test script has been loaded
.echo Loading pykd
.load pykd.pyd
.echo run python script
!py ${$arg1}
```
script2.txt
```
.echo Test script has been loaded
.echo Loading pykd
.load pykd.pyd
.echo run python script
```
test.py
```
def main():
try:
# createFileW = module("kernel32").CreateFileW
# bp = setBp(createFileW, createFileBreakpoint)
go()
except Exception as e:
print "Exception: {0}".format(e)
pass
if __name__ == "__main__":
main()
```
Comments: ** Comment from web user: kernelnet **
I'm trying to automate some stuff so I used the console version of Microsoft debugger cdb.
So I wrote bat file:
-G for close cdb after process termination
-c for loading script with parameter
(Python 2.7.10, pykd-0.3.0.32-py27-win32)
and %1 for target name.
the commad line I run is:
"startCdb.bat c:\windows\syswow64\notepad.exe"
now, when I close notepad, cdb crush, but, when python script is not included (script2.txt), cdb exit gracefully.
files:
startCdb.bat:
```
"C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\cdb" -G -c "$$>a<C:\Temp\script.txt C:\Temp\test.py " %1
```
script.txt
```
.echo Test script has been loaded
.echo Loading pykd
.load pykd.pyd
.echo run python script
!py ${$arg1}
```
script2.txt
```
.echo Test script has been loaded
.echo Loading pykd
.load pykd.pyd
.echo run python script
```
test.py
```
def main():
try:
# createFileW = module("kernel32").CreateFileW
# bp = setBp(createFileW, createFileBreakpoint)
go()
except Exception as e:
print "Exception: {0}".format(e)
pass
if __name__ == "__main__":
main()
```
Comments: ** Comment from web user: kernelnet **
Try upgrade to 0.3.0.33 and read: http://pykd.codeplex.com/discussions/646458