windbg调试技巧 使用脚本文件

来源:互联网 发布:个人博客数据库 编辑:程序博客网 时间:2024/05/16 12:46


Using Script Files

使用脚本文件

Ascript file is a text file that contains a sequence of debuggercommands. There are a variety of ways for the debugger to load a script fileand execute it. A script file can contain commands to be executed sequentiallyor can use a more complex flow of execution.

一个脚本文件是一个文本文件包含一个调试命令的序列。有几种使得调试器加载一个脚本文件并执行它的方式。一个脚本文件可以包含顺序执行的命令或者也可以包含一个更加复杂的执行流

To execute a script file, you can do one of the following:

你可以通过以下方式之一执行一个脚本文件

  • (KD and CDB only; only when the debugger starts) Create a script file that is namedNtsd.ini and put it in the directory where you are starting the debugger from. The debugger automatically executes this file when the debugger starts. To use a different file for the startup script file, specify the path and file name by using the-cfcommand-line option or by using theIniFile entry in theTools.ini file.
  • (KDCDB;仅当调试器启动时)创建一个脚本文件名为ntsd.ini并且将其放进你启动调试器的目录中。当调试器启动时调试器会自动第执行这个文件.如果要使用一个不同的文件名作为启动脚本文件,可以通过-cf命令行参数或者使用tools.ini文件中的IniFile入口
  • (KD and CDB only; when each session starts) Create a script file and specify its path and file name by using the-cfrcommand-line option. The debugger automatically executes this script file when the debugger starts and every time that the target is restarted.
  • (KDCDB命令;当每一个会话开始时)创建一个脚本文件并通过使用-cfr命令行参数。调试器会在调试器启动时和目标每一次重启时执行这个脚本文件
  • Use the $<,$><,$$<, and $$>< commands to execute a script file after the debugger is running. For more information about the syntax, see$<, $><, $><, $$>< (Run Script File).
  • 使用$<,$><,$$<, $$><命令在调试器运行时执行一个脚本文件。语法的详细信息参见$<, $><, $><, $$>< (Run Script File).

The$>< and$$>< commands differ from the othermethods of running scripts in one important way. When you use these commands,the debugger opens the specified script file, replaces all carriage returnswith semicolons, and executes the resulting text as a single command block.These commands are useful for running scripts that contain debugger commandprograms. For more information about these programs, seeUsing Debugger Command Programs.X

$><$$>< 命令与其他的执行脚本的方式有很重要的不同。当你使用这些命令时,调试器打开特定的脚本文件,替换所有分号返回的负载,并且将结果文本以一个单个命令块的方式执行。这些命令对于包含调试器命令程序的脚本的运行非常有用。有关这些程序的更多信息参见Using Debugger Command Programs.X

 

You cannot use commands that are available only in WinDbg (such as.lsrcfix (Use Local Source Server),.lsrcpath (Set Local Source Path),.open (Open Source File), and.write_cmd_hist (Write Command History))in script files, even if the script file is executed in WinDbg. In addition,you cannot use the.beep (Speaker Beep),.cls (Clear Screen),.hh (Open HTML Help File),.idle_cmd (Set Idle Command),.remote (Create Remote.exe Server),kernel-mode.restart (Restart Kernel Connection),user-mode.restart (Restart Target Application),or.wtitle (Set Window Title) commands in ascript file.

你不能使用只有windbg允许的命令(例如.lsrcfix (Use Local Source Server),.lsrcpath (Set Local Source Path),.open (Open Source File), and.write_cmd_hist (Write Command History))在脚本文件中,就算脚本文件由windbg执行,附带地,你也不能在一个脚本文件中使用.beep (Speaker Beep), .cls (Clear Screen),.hh (Open HTML Help File),.idle_cmd (Set Idle Command),.remote (Create Remote.exe Server),内核模式.restart (Restart Kernel Connection),用户模式.restart (Restart Target Application),or.wtitle (Set Window Title)

Note  WinDbg supports thesame scripts as KD and CDB, with one minor exception. You can use the .remote_exit (Exit Debugging Client)command only in a script file that KD or CDB uses. You cannot exit from adebugging client though a script that is executed in WinDbg.

注意  WinDbg支持KDCDB相同的脚本文件,只有一个主要的例外。你可以仅在一个脚本文件中使用KDCDB使用的.remote_exit (Exit Debugging Client) 命令。你不能通过windbg执行的一个脚本文件从一个调试器客户端中退出

 

0 0
原创粉丝点击