4

.logopen is not the answer, because it lets the command output to the windbg console.

For example, !sosex.dumpgen 2 produces a helluva lot of output, which I do not want to see in the debugger console. Right now I am using the following:

.shell -i- -ci "!dumpgen 2" cmd /c more > D:\tmp\dumpgen2.log

My problem is that the more command is interactive and requires user input after outputting certain amount of data. This is a huge problem for me.

One solution could be running the debugger itself non interactively with a script and use the .logopen command there.

I wonder if I could achieve what I want while:

  1. Doing it from the interactive WinDbg session
  2. Using plain standard shell commands (which could also be cmd.exe or powershell.exe). I know that writing a small utility that just forwards stdin to stdout is a trivial piece of work, still I prefer not doing it.
mark
  • 59,016
  • 79
  • 296
  • 580

2 Answers2

8
.shell -i- -ci "!dumpgen 2" findstr "^" >D:\tmp\dumpgen2.log

^ will find the beginning of any line, so it should be a 1:1 copy.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
1

you can also use the gnuwin32 cat

C:\>dir /b foogg.txt   
File Not Found

C:>cdb -c ".shell -ci \"lm\" -o \"c:\\foogg.txt\" cat -" calc.exe

0:000> cdb: Reading initial command '.shell -ci "lm" -o "c:\\\\foogg.txt" cat -'

<.shell waiting 10 second(s) for process>
.shell: Process exited
0:000> q
quit:

check if file exists and print the contents

C:\>dir /b foogg.txt
foogg.txt

C:\>cat foogg.txt

start    end        module name
01000000 0101f000   calc       (deferred)
77c10000 77c68000   msvcrt     (deferred)
77dd0000 77e6b000   ADVAPI32   (deferred)
77e70000 77f02000   RPCRT4     (deferred)
77f10000 77f59000   GDI32      (deferred)
77f60000 77fd6000   SHLWAPI    (deferred)
77fe0000 77ff1000   Secur32    (deferred)
7c800000 7c8f6000   kernel32   (deferred)
7c900000 7c9b2000   ntdll      (pdb symbols)
7c9c0000 7d1d7000   SHELL32    (deferred)
7e410000 7e4a1000   USER32     (deferred)
blabb
  • 8,674
  • 1
  • 18
  • 27