Created
July 11, 2014 06:14
-
-
Save ghotz/12af5831135c27be42bc to your computer and use it in GitHub Desktop.
Parse unique stacks from WinDBG output generated with !uniqstack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse WinDBG !uniqstack output | |
$file = 'SQLDump0008.uniqstack.txt'; | |
$SearchLog = [regex] '\.\s{0,2}(?<thread>\d{1,4}).*?\r\n.*?\r\n.*?\r\n.*?\r\n.{8}`.{8} .{8}`.{8} (?<topstack>.*)\r\n'; | |
$log = [io.file]::ReadAllText($file); | |
$match = $SearchLog.Match($log); | |
$logentries = @(); | |
while ($match.Success) { | |
$logentry = new-object System.Object; | |
$logentry | add-member -membertype noteproperty -name thread -value $match.Groups['thread'].Value; | |
$logentry | add-member -membertype noteproperty -name topstack -value $match.Groups['topstack'].Value; | |
$logentries += $logentry | |
$match = $match.NextMatch(); | |
}; | |
$logentries | Export-Csv 'SQLDump0008.uniqstack.csv' -Delimiter ";" -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment