Some background info
Recently I have asked a question and received a great answer using .foreach. Now I have a dump with lots of very large char[] inside. I did
.logopen c:\mychararrays.log
!dumpheap -type System.Char[]
.logclose
I have stripped of all the human readable stuff like summary etc. Now the file has lots of lines with object address, method table and size:
03d74c88 52b8b680 5570670
042c4cf8 52b8b680 5762890
...
21a1d6e0 52b8b680 6010030
I have already used
.foreach /ps 2 /f (chararray "c:\mychararrays.log") { !do ${chararray} }
to dump out the .NET objects, but this will not dump the complete text of the char[], only the first 128 characters. And unfortunately, the beginning of those char[] is always the same.
The question
I want to do something like
.foreach /f (chararray "c:\mychararrays.log") { du <token 1 of line>+8 L? 0n<token 3 of line> }
for each line in order to print the complete char[]. By default WinDbg will separate tokens within a line and process them one by one, so there's only one token available for the command.
Solving it in Notepad++
I have already solved this by doing a regular expression replacement in Notepad++. I just want to know if there's a "native" WinDbg solution to this.
Find: ([^ ]*) [^ ]* ([^ ]*).*
Replace: du \1+8 L? 0n\2
And then running the result as a script:
$<c:\mychararrays.log
Note: This took a VERY long time, so I decided to switch to
Find: ([^ ]*) [^ ]* ([^ ]*).*
Replace: .writemem c:\s\1.txt \1+8 L? 0n\2
!help
didn't immediately reveal anything which would be helpful. Any suggestions for a command? – Balcom