Windbg .logopen 文件位置

Windbg .logopen file location

使用.logopen logfile.txt命令时,logfile.txt是在哪里创建的?我设法通过指定绝对路径解决了这个问题,但我想知道在提供相对路径时文件是在哪里创建的?

编辑

日志文件是在调用 windbg 的当前目录中创建的,而不是在 homedir 中,我总是从 运行 windbg 开始 运行 (winkey +r -> windbg) 显然它从 windbg 开始安装文件夹和继承目录似乎

从不同的文件夹启动 windbg 会在各自的当前目录中创建日志文件

>md windbglogtestone
>cd windbglogtestone
\windbglogtestone>cdb -c ".logopen mylog.txt;q" cdb
Microsoft (R) Windows Debugger Version 10.0.16299.15 X86

0:000> cdb: Reading initial command '.logopen mylog.txt;q'
Opened log file 'mylog.txt'
quit:

\windbglogtestone>cd ..

>md windbglogtestwo
>cd windbglogtestwo
\windbglogtestwo>cdb -c ".logopen mylog.txt;q" cdb
Microsoft (R) Windows Debugger Version 10.0.16299.15 X86

0:000> cdb: Reading initial command '.logopen mylog.txt;q'
Opened log file 'mylog.txt'
quit:

\windbglogtestwo>cd ..

>dir /s /b *my*.txt
\windbglogtestone\mylog.txt
\windbglogtestwo\mylog.txt

它是在主目录中创建的,其中 home 代表安装 windbg 的文件夹(通常是 c:\progra~\w..kits..\debug.....\x..)

请参见下面不同路径中的 windbg 安装

0:000> .logopen mylogfile.txt
Opened log file 'mylogfile.txt'
0:000> !homedir
Home directory is E:\windjs\windbg_16299\x86
0:000> .shell - dir *my*


 Directory of E:\windjs\windbg_16299\x86

02/14/2018  09:07 AM                 0 mylogfile.txt
               1 File(s)              0 bytes
               0 Dir(s)  102,247,899,136 bytes free
.shell: Process exited
Press ENTER to continue

回应 lieven 的评论,为什么 .shell 命令中的连字符

它代表一个空输入文件
可以将 input files 传递给 .shell 进行处理,而不是 windbg commands
使用 -i 而不是 -c
传递一个连字符表示没有输入文件
只需要完成指示的 shell 命令

对于版本 6.3.9600,WinDbg 帮助在 .hh .logfile 中说:

If you do not specify a path, the debugger uses the current directory.

对于我来说,我在程序文件目录中安装了 WinDbg。

5:kd> .dbgdbg
0:025> |
.  0    id: 29fc        attach  name: C:\Program Files (x86)\Windows Kits.1\Debuggers\x86\windbg.exe

使用 Process Monitor,我可以看到 WinDbg 试图在那里创建日志文件(但由于权限原因而失败)。

当我更改用于启动它的 WinDbg LNK 文件中的工作目录时,它会打开该目录中的日志文件。

我无法确认@blabbs 的回答,因为我的主目录是

5: kd> !homedir
Home directory is C:\ProgramData\dbg

在这两种情况下(运行 来自 %ProgramFiles% 和 运行 来自 D:\temp)。如果我更改 !homedir.logfile 的位置不受影响。