[英]Powershell: Call Debug Analyzer cdb.exe as Process
i need to call the cdb.exe as a Process to check to kill the process after a few seconds.我需要调用 cdb.exe 作为进程来检查几秒钟后终止进程。 Some Dumps cannot be analyzed so i have to do an other call.
有些转储无法分析,所以我必须再打一个电话。 Here you can see my code.
在这里你可以看到我的代码。 But it doesn't work.
但它不起作用。 The cdb.exe is not started correctly and i am not getting the output file.
cdb.exe 没有正确启动,我没有得到输出文件。
Do you have some advises for me?你对我有什么建议吗? The call "before" implementing the process part starts the cdb.exe
实现进程部分的调用“before”启动 cdb.exe
$maximumRuntimeSeconds = 3
$path = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe"
$process = Start-Process -FilePath $path "-z $unzippedFile.FullName, -c `".symfix;.reload;!analyze -v; q`""
try {
$process | Wait-Process -Timeout $maximumRuntimeSeconds -ErrorAction Stop > $outputFile
Write-Warning -Message 'Process successfully completed within timeout.'
}
catch {
Write-Warning -Message 'Process exceeded timeout, will be killed now.'
$process | Stop-Process -Force
}
# call before implementing Process
& "C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe" -z $unzippedFile.FullName -c ".symfix;.reload;!analyze -v; q" > $outputFile
-Passthru was needed to make Wait-Process work. -需要Passthru 才能使Wait-Process 工作。
I think you also need to look at how the double quoted string is expanding.我认为您还需要查看双引号字符串是如何扩展的。 I think $UnzippedFIle.Fullname might be adding a literal ".FullName" at the end of the actual fullname of the zip file.
我认为$UnzippedFIle.Fullname 可能会在 zip 文件的实际全名末尾添加文字“.FullName”。 I don't have your environment, but the rudementary tests I've done show that.
我没有你的环境,但我所做的基本测试表明了这一点。 Try packing it in a sub-expression like:
尝试将其打包在子表达式中,例如:
"-z $($unzippedFile.FullName), -c `".symfix;.reload;!analyze -v; q`""
Let me know how that goes.让我知道这是怎么回事。 Thanks.
谢谢。
C:\>dir /b ok.txt
File Not Found
C:\>type dodump.ps1
$path = "C:\Program Files\Windows Kits\10\Debuggers\x86\cdb.exe"
$process = Start-Process -PassThru -FilePath $path -ArgumentList "-z `"C:\calc.DMP`"" ,
"-c `".symfix;.reload;!analyze -v;q`"" -RedirectStandardOutput c:\\ok.txt
try {
$process | Wait-Process -Timeout 100 -ErrorAction Stop
Write-Host "Process finished within timeout"
}catch {
$process | Stop-Process
Write-Host "process killed"
}
Get-Content C:\ok.txt |Measure-Object -Line
C:\>powershell -f dodump.ps1
Process finished within timeout
Lines Words Characters Property
139
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.