[英]How can I use cdb.exe in an interactive Powershell Remoting session
[英]Powershell: Call Debug Analyzer cdb.exe as Process
我需要調用 cdb.exe 作為進程來檢查幾秒鍾后終止進程。 有些轉儲無法分析,所以我必須再打一個電話。 在這里你可以看到我的代碼。 但它不起作用。 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 才能使Wait-Process 工作。
我認為您還需要查看雙引號字符串是如何擴展的。 我認為$UnzippedFIle.Fullname 可能會在 zip 文件的實際全名末尾添加文字“.FullName”。 我沒有你的環境,但我所做的基本測試表明了這一點。 嘗試將其打包在子表達式中,例如:
"-z $($unzippedFile.FullName), -c `".symfix;.reload;!analyze -v; q`""
讓我知道這是怎么回事。 謝謝。
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.