如何制作“.cmdtree” WinDbg 启动时的窗口停靠?

发布于 2024-08-29 08:19:26 字数 394 浏览 6 评论 0原文

我已经关注Tess Ferrandez 的博客,用于在 WinDbg 中设置自定义主题。

我还开始使用 -c ".cmdtree c:\mycmdtree.txt" 自动启动 WinDbg

这可以正确地将我的 cmdtree 文件打开为命令窗口,但我无法使其正确停靠。问题似乎是“命令”窗口只能在打开 DMP 文件后打开,但打开 DMP 文件会将您切换出“基本”工作区,因此不会保存对工作区的任何更改。

有什么想法吗?

I have followed Tess Ferrandez' blog for setting up a custom theme in WinDbg.

I have also started launching WinDbg automatically with -c ".cmdtree c:\mycmdtree.txt"

This correctly opens my cmdtree file as a commands window, but I can't get it to dock properly. The problem appears to be that 'commands' windows can only be opened after you have opened a DMP file, but opening a DMP file switches you out of the 'base' workspace, therefore any changes to your workspace aren't saved.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱花落人离去 2024-09-05 08:19:27

这对我来说是默认停靠命令窗口的:

  1. 打开 WinDbg。不要打开转储文件。只需打开应用程序。
  2. 单击菜单“视图”-“命令”
  3. 单击菜单“窗口”-“全部停靠”
  4. 单击菜单“文件”-“保存工作区”

This worked for me to dock the command window by default:

  1. Open WinDbg. Do not open a dump file. Just open the app.
  2. Click the menu View - Command
  3. Click the menu Window - Dock All
  4. Click the menu File - Save Workspace
一曲琵琶半遮面シ 2024-09-05 08:19:26

这个简单的请求结果非常复杂。 WinDbg 的窗口位置保存在工作区中。 WinDbg 有几个默认工作区:

  • Base - 这是在开始调试之前使用的工作区(没有打开转储,没有打开 exe,不附加到任何东西)
  • 每个转储文件 - 对于您打开的每个转储,您都有一个该文件的工作区
  • 每个可执行文件 - 对于您打开的每个可执行文件。
  • 用户模式 ​​- 当您进行实时用户模式调试时使用
  • 内核模式 - 当您进行内核模式调试时使用
  • 每台机器架构 - 1 表示 x64,1 表示 x86,& 1 1 用于 IA64
  • Remote - 在远程调试时使用

对于任何给定类型的调试(即实时用户模式或事后转储分析),您通常最终会得到 Base+您的调试类型的设置组合。

如果打开转储文件,您将获得 BASE+Per 转储文件
如果您进行用户模式调试,您将获得 BASE+用户模式
如果您对 x64 机器进行实时内核调试,您将得到 BASE+Kernel-mode+x64

您在任何给定模式下所做的所有更改都保存在最后重叠的工作区中。这意味着,如果我们打开一个转储文件(因此我们是 Base+Per 转储),对设置的任何更改都将保存在该转储的工作区中。

除了内置工作区及其所有组合之外,还有命名的(客户)工作区。当您转到“文件”>“文件”时,就会出现这些情况。保存工作区,并提供一个名称来保存所有设置,然后您可以使用 -W 命令行参数在启动 Windbg 时启用这些设置。

回到你的问题。如何打开 .cmdtree?在基础工作区中你不能。许多窗口仅当调试器不处于休眠状态(在其基本工作区中)时才可用。一旦调试器进入任何活动状态,这些窗口就可用。

您遇到的问题是,为了按照您想要的方式设置所有内容,您必须让调试器处于活动状态(exe 打开、转储打开、实时调试),并且当您保存窗口布局时,它还会保存您打开、转储或实时调试的 exe 文件。

最好的选择是只做您已经在做的事情,即仅使用注册表中的 -c (HKEY_CLASSES_ROOT\WinDbg.DumpFile.1\shell\Open\command)。这将允许您在每次进行转储分析时双击转储并获取这些命令行选项。然后,您可以创建一个包含命令行的 Windbg 快捷方式,以便这些设置将应用于您执行的其他类型的调试。

这是上面的 regkey 的命令行:

"c:\debuggers\x64\windbg.exe" -z "%1" -Q -W Internal -c ".load Winde.dll;.enable_unicode 1;.ignore_missing_pages 1; .logopen /t C:\Users\jasone\Logs\debug.log;aS .p /r; as.t .thread /p /r; as !p !t !thread; .f .frame; as dv dv /V /i /t; as .f .frame"

这是做什么的?

启动调试器,附加到转储文件,不提示保存工作区设置,打开我的“内部”工作区(我创建的命名工作区),然后运行这些命令来加载调试器扩展、设置首选项并创建别名,使我的生活更轻松。

This simple request turns out to really complicated. WinDbg's window positions are saved in a workspace. WinDbg has several default workspaces:

  • Base - this is the workspace that is used before you start debugging (no dump open, no exe open, not attached to anything)
  • Per dump file - for each dump you open, you have a workspace for this file
  • Per executable file - for each executable file you open.
  • User-mode - used when you are live user-mode debugging
  • Kernel-mode - used when you are kernel-mode debugging
  • Per machine architecture - 1 for x64, 1 for x86, & 1 for IA64
  • Remote - used when you are remote debugging

For any given type of debug (i.e. Live user-mode or post-mortem dump analysis) you usually end up with a combination of settings of Base+Your type of debug.

If you open a dump file, you get BASE+Per dump file
If you live user-mode debug, you get BASE+User-mode
If you live kernel debug a x64 machine, you get BASE+Kernel-mode+x64

All the changes you make in any given mode are saved in the workspace that was overlapped last. This means that if we open a dump file (so we are Base+Per dump), any changes to settings would be saved in the workspace for this dump.

In addition to the built in workspaces and all of their combinations, there are named (customer) workspaces. These would be when you go to File > Save Workspace, and provide a name to save all you settings which you could then enable on launch of Windbg using the -W command line argument.

Back to your question. How can I get the .cmdtree to open? In the base workspace you can't. Many of the windows are only available when the debugger is NOT in the dormant state (in its BASE workspace). Once you get the debugger into any of its active states, then these windows are available.

The problem you run into is that in order to get everything setup the way you want it, you have to have the debugger in an active state (an exe open, a dump open, live debugging) and when you go to save you window layout, it is also going to save which exe you had open, or dump, or live debug you were doing.

Your best bet is to just do what you were already doing, which is to just use the -c in the registry (HKEY_CLASSES_ROOT\WinDbg.DumpFile.1\shell\Open\command). This will allow you to just double click a dump and get these command line options every time you are doing dump analysis. You can then create a shortcut to windbg that also incorporates the command line so these settings will be applied for the other types of debugging you do.

Here is my command line from the regkey above:

"c:\debuggers\x64\windbg.exe" -z "%1" -Q -W Internal -c ".load winde.dll;.enable_unicode 1;.ignore_missing_pages 1;.logopen /t C:\Users\jasone\Logs\debug.log;aS .p .process /p /r; aS .t .thread /p /r; aS !p !process; aS !t !thread; aS .f .frame; aS dv dv /V /i /t; aS .f .frame"

What does this do?

Launches the debugger, attaches to dump file, NO prompt to save workspace settings, Open my "Internal" workspace (a named workspace I created), and run these commands to load debugger extensions, setup preferences, and create aliases that make my life easier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文