NTSD(Command Line)调试DMP格式文件

本文介绍如何使用NTSD命令行工具加载DMP格式的内存转储文件,并通过命令进行错误定位、查看源代码及变量值等操作,帮助开发者高效地分析和解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址


前言:之前介绍了利用VS2005进行Dump文件的调试,功能非常强大。但VS2005是一个大程序,本文将讨论利用NTSD的Command Line 实现Dump 文件的调试。

1、  载入DMP格式文件

利用CMD打开命令行窗口,切换到NTSD所在目录。利用命令载入DMP文件:

ntsd –z dumpfileName –y symbolPath –srcpath sourcecodePath

dumpfileName:DMP格式文件路径

symbolPath:PDB文件路径

sourcecodePath:程序的源代码路径

如图1.1,若载入成功,将弹出一个NTSD窗口,如图1.2。

Load

 

 

 

图1.1 载入DMP格式文件

Ntsd

图1.2 NTSD界面

红色的圈中显示了BUG的原因,函数IsPrefix 存在错误。0x36是错误相对于函数的偏移值。这个错误是一个Access Violation的异常,异常地址为00401036

Note

l  若路径中存在空格,需要用在路径前后加上引号。

l  若提示错误,根据提示查看是否由于dbghelp.dll不存在导致,安装的调试工具包中存在该动态库。

2、  定位与源代码

利用如下命令可以定位错误到源代码中:

lsp  –a 500

lsa  .

第一行命令用于设置显示的源代码行数,第二行命令将错误定位与错误行。如图:

lsp lsa

图1.3 Analysis Result: Line of Source Code Causing Crash

从图中可以看出,第13号是导致程序错误的位置。如果希望看到变量的值,使用命令:

x

若需要详细查看某个变量的值,使用命令:

??  variableName

variable

图1.4 Analysis Result: Value of Variable Causing Crash

 

Module Address of Your Application(显示程序模块地址)

Command:

x *!

Module

1.5 Application Module Information

It shows all the module address in your application.

 

Crash Stack Trace(显示程序调用堆栈)

If you want to trace the stack of application, use this command:

Command:

kb

stack track

1.6 Application Stack Trace

It shows that function main invokes function IsPrefix then application crashes.

For more commands of NTSD, refer to debugger.chm in Microsoft Debugger Tools package.


************* Preparing the environment for Debugger Extensions Gallery repositories ************** ExtensionRepository : Implicit UseExperimentalFeatureForNugetShare : true AllowNugetExeUpdate : true NonInteractiveNuget : true AllowNugetMSCredentialProviderInstall : true AllowParallelInitializationOfLocalRepositories : true EnableRedirectToChakraJsProvider : false -- Configuring repositories ----> Repository : LocalInstalled, Enabled: true ----> Repository : UserExtensions, Enabled: true >>>>>>>>>>>>> Preparing the environment for Debugger Extensions Gallery repositories completed, duration 0.000 seconds ************* Waiting for Debugger Extensions Gallery to Initialize ************** >>>>>>>>>>>>> Waiting for Debugger Extensions Gallery to Initialize completed, duration 0.015 seconds ----> Repository : UserExtensions, Enabled: true, Packages count: 0 ----> Repository : LocalInstalled, Enabled: true, Packages count: 44 Microsoft (R) Windows Debugger Version 10.0.27829.1001 AMD64 Copyright (c) Microsoft Corporation. All rights reserved. Loading Dump File [C:\Windows\Minidump\072425-40484-01.dmp] Mini Kernel Dump File: Only registers and stack trace are available ************* Path validation summary ************** Response Time (ms) Location Deferred srv* Symbol search path is: srv* Executable search path is: Windows 10 Kernel Version 26100 MP (16 procs) Free x64 Product: WinNt, suite: TerminalServer SingleUserTS Personal Kernel base = 0xfffff802`de600000 PsLoadedModuleList = 0xfffff802`df4f4c40 Debug session time: Thu Jul 24 13:19:52.572 2025 (UTC + 8:00) System Uptime: 0 days 0:38:49.409 Loading Kernel Symbols .. Press ctrl-c (cdb, kd, ntsd) or ctrl-break (windbg) to abort symbol loads that take too long. Run !sym noisy before .reload to track down problems loading symbols. ............................................................. ................................................................ ........................................................... Loading User Symbols Loading unloaded module list ........... For analysis of this file, run !analyze -v nt!KeBugCheckEx: fffff802`deb005d0 48894c2408 mov qword ptr [rsp+8],rcx ss:0018:fffff802`726a6e10=000000000000000a 0: kd> !analyze -v Loading Kernel Symbols ............................................................... ................................................................ ........................................................... Loading User Symbols Loading unloaded module list ........... ******************************************************************************* * * * Bugcheck Analysis * * * ******************************************************************************* IRQL_NOT_LESS_OR_EQUAL (a) An attempt was made to access a pageable (or completely invalid) address at an interrupt request level (IRQL) that is too high. This is usually caused by drivers using improper addresses. If a kernel debugger is available get the stack backtrace. Arguments: Arg1: 0000000007e70010, memory referenced Arg2: 0000000000000002, IRQL Arg3: 0000000000000000, bitfield : bit 0 : value 0 = read operation, 1 = write operation bit 3 : value 0 = not an execute operation, 1 = execute operation (only on chips which support this level of status) Arg4: fffff802de8ff1f8, address which referenced memory Debugging Details: ------------------ *** WARNING: Unable to verify timestamp for aicusbwifi.sys KEY_VALUES_STRING: 1 Key : Analysis.CPU.mSec Value: 984 Key : Analysis.Elapsed.mSec Value: 11951 Key : Analysis.IO.Other.Mb Value: 1 Key : Analysis.IO.Read.Mb Value: 1 Key : Analysis.IO.Write.Mb Value: 2 Key : Analysis.Init.CPU.mSec Value: 453 Key : Analysis.Init.Elapsed.mSec Value: 127094 Key : Analysis.Memory.CommitPeak.Mb Value: 114 Key : Analysis.Version.DbgEng Value: 10.0.27829.1001 Key : Analysis.Version.Description Value: 10.2503.24.01 amd64fre Key : Analysis.Version.Ext Value: 1.2503.24.1 Key : Bugcheck.Code.LegacyAPI Value: 0xa Key : Bugcheck.Code.TargetModel Value: 0xa Key : Dump.Attributes.AsUlong Value: 0x2180c Key : Dump.Attributes.DiagDataWrittenToHeader Value: 1 Key : Dump.Attributes.ErrorCode Value: 0x0 Key : Dump.Attributes.InsufficientDumpfileSize Value: 1 Key : Dump.Attributes.KernelGeneratedTriageDump Value: 1 Key : Dump.Attributes.LastLine Value: Dump completed successfully. Key : Dump.Attributes.ProgressPercentage Value: 0 Key : Dump.Attributes.RequiredDumpfileSize Value: 0x458e9834 Key : Failure.Bucket Value: AV_aicusbwifi!unknown_function Key : Failure.Exception.IP.Address Value: 0xfffff802de8ff1f8 Key : Failure.Exception.IP.Module Value: nt Key : Failure.Exception.IP.Offset Value: 0x2ff1f8 Key : Failure.Hash Value: {88a7df4e-1779-d31a-2348-fb551a42f896} Key : Hypervisor.Enlightenments.ValueHex Value: 0x7497cf94 Key : Hypervisor.Flags.AnyHypervisorPresent Value: 1 Key : Hypervisor.Flags.ApicEnlightened Value: 1 Key : Hypervisor.Flags.ApicVirtualizationAvailable Value: 0 Key : Hypervisor.Flags.AsyncMemoryHint Value: 0 Key : Hypervisor.Flags.CoreSchedulerRequested Value: 0 Key : Hypervisor.Flags.CpuManager Value: 1 Key : Hypervisor.Flags.DeprecateAutoEoi Value: 0 Key : Hypervisor.Flags.DynamicCpuDisabled Value: 1 Key : Hypervisor.Flags.Epf Value: 0 Key : Hypervisor.Flags.ExtendedProcessorMasks Value: 1 Key : Hypervisor.Flags.HardwareMbecAvailable Value: 1 Key : Hypervisor.Flags.MaxBankNumber Value: 0 Key : Hypervisor.Flags.MemoryZeroingControl Value: 0 Key : Hypervisor.Flags.NoExtendedRangeFlush Value: 0 Key : Hypervisor.Flags.NoNonArchCoreSharing Value: 1 Key : Hypervisor.Flags.Phase0InitDone Value: 1 Key : Hypervisor.Flags.PowerSchedulerQos Value: 0 Key : Hypervisor.Flags.RootScheduler Value: 0 Key : Hypervisor.Flags.SynicAvailable Value: 1 Key : Hypervisor.Flags.UseQpcBias Value: 0 Key : Hypervisor.Flags.Value Value: 38408431 Key : Hypervisor.Flags.ValueHex Value: 0x24a10ef Key : Hypervisor.Flags.VpAssistPage Value: 1 Key : Hypervisor.Flags.VsmAvailable Value: 1 Key : Hypervisor.RootFlags.AccessStats Value: 1 Key : Hypervisor.RootFlags.CrashdumpEnlightened Value: 1 Key : Hypervisor.RootFlags.CreateVirtualProcessor Value: 1 Key : Hypervisor.RootFlags.DisableHyperthreading Value: 0 Key : Hypervisor.RootFlags.HostTimelineSync Value: 1 Key : Hypervisor.RootFlags.HypervisorDebuggingEnabled Value: 0 Key : Hypervisor.RootFlags.IsHyperV Value: 1 Key : Hypervisor.RootFlags.LivedumpEnlightened Value: 1 Key : Hypervisor.RootFlags.MapDeviceInterrupt Value: 1 Key : Hypervisor.RootFlags.MceEnlightened Value: 1 Key : Hypervisor.RootFlags.Nested Value: 0 Key : Hypervisor.RootFlags.StartLogicalProcessor Value: 1 Key : Hypervisor.RootFlags.Value Value: 1015 Key : Hypervisor.RootFlags.ValueHex Value: 0x3f7 Key : Stack.Pointer Value: NMI BUGCHECK_CODE: a BUGCHECK_P1: 7e70010 BUGCHECK_P2: 2 BUGCHECK_P3: 0 BUGCHECK_P4: fffff802de8ff1f8 FILE_IN_CAB: 072425-40484-01.dmp TAG_NOT_DEFINED_202b: *** Unknown TAG in analysis list 202b DUMP_FILE_ATTRIBUTES: 0x2180c Insufficient Dumpfile Size Kernel Generated Triage Dump FAULTING_THREAD: fffff802df5d1640 READ_ADDRESS: fffff802df5c44c0: Unable to get MiVisibleState Unable to get NonPagedPoolStart Unable to get NonPagedPoolEnd Unable to get PagedPoolStart Unable to get PagedPoolEnd unable to get nt!MmSpecialPagesInUse 0000000007e70010 BLACKBOXBSD: 1 (!blackboxbsd) BLACKBOXNTFS: 1 (!blackboxntfs) BLACKBOXPNP: 1 (!blackboxpnp) BLACKBOXWINLOGON: 1 CUSTOMER_CRASH_COUNT: 1 PROCESS_NAME: System DPC_STACK_BASE: FFFFF802726B0FB0 STACK_TEXT: fffff802`726a6e08 fffff802`decb96e9 : 00000000`0000000a 00000000`07e70010 00000000`00000002 00000000`00000000 : nt!KeBugCheckEx fffff802`726a6e10 fffff802`decb49a8 : 00000000`00000001 ffffac07`e731c010 ffffac07`d3105490 00000000`00000002 : nt!KiBugCheckDispatch+0x69 fffff802`726a6f50 fffff802`de8ff1f8 : ffffac07`00000001 00000000`00000001 00000000`00000001 00000000`00000001 : nt!KiPageFault+0x468 fffff802`726a70e0 fffff802`de9bd2e5 : 00000000`00000618 00000000`00000001 ffffac07`d31002c0 ffffac07`e8024e48 : nt!RtlRbInsertNodeEx+0x3d8 fffff802`726a7140 fffff802`deaf749a : ffffac07`e91d4890 ffffac07`d3105480 ffffac07`00000000 00000000`0003a480 : nt!RtlpHpVsChunkSplit+0x905 fffff802`726a71e0 fffff802`de9bbede : ffffac07`d31002c3 fffff802`df4ee740 fffff802`0000002c fffff802`002c0000 : nt!RtlpHpVsSlotAllocate+0x29e fffff802`726a7240 fffff802`de8f91f3 : 00000000`0000028c fffff802`002c0000 00000000`0000002c fffff802`00000000 : nt!RtlpHpVsContextAllocate+0xd6 fffff802`726a72d0 fffff802`de8f7562 : 00000000`00000009 fffff802`df46ca40 00000000`486c7452 00000000`00000000 : nt!ExAllocateHeapPool+0x1c23 fffff802`726a7500 fffff802`df16b4fb : 00000000`00000042 00000000`0000028c 00000000`486c7452 fffff802`de8f92a1 : nt!ExpAllocatePoolWithTagFromNode+0x52 fffff802`726a7540 fffff802`dea5275a : 00000000`00000003 00000000`00000000 00000000`00000000 00000000`00000050 : nt!ExAllocatePool3+0xcb fffff802`726a75c0 fffff802`71963066 : ffffac07`e7169d88 fffff802`726a789a ffffac07`01500050 00000000`00000038 : nt!ExAllocatePoolWithTagPriority+0x11a fffff802`726a7610 fffff802`734b3a08 : ffffac07`dbf23910 fffff802`b503e068 00000000`00000000 00000000`00000000 : ndis!NdisAllocateMemoryWithTagPriority+0x26 fffff802`726a7640 ffffac07`dbf23910 : fffff802`b503e068 00000000`00000000 00000000`00000000 00000000`00000000 : aicusbwifi+0x53a08 fffff802`726a7648 fffff802`b503e068 : 00000000`00000000 00000000`00000000 00000000`00000000 000000e8`00000001 : 0xffffac07`dbf23910 fffff802`726a7650 fffff802`b503c798 : ffffac07`e7802200 00000000`00000000 00000000`00000000 fffff802`734985cb : USBXHCI!Bulk_MapStage+0xe8 fffff802`726a76c0 fffff802`7349933b : ffffac07`e551b030 ffffac07`e68576a0 fffff802`726a7800 00000000`00000000 : USBXHCI!Bulk_MapTransfers+0x88 fffff802`726a7730 ffffac07`e551b030 : ffffac07`e68576a0 fffff802`726a7800 00000000`00000000 00000001`00000000 : aicusbwifi+0x3933b fffff802`726a7738 ffffac07`e68576a0 : fffff802`726a7800 00000000`00000000 00000001`00000000 ffffac07`e780232e : 0xffffac07`e551b030 fffff802`726a7740 fffff802`726a7800 : 00000000`00000000 00000001`00000000 ffffac07`e780232e fffff802`726a789a : 0xffffac07`e68576a0 fffff802`726a7748 00000000`00000000 : 00000001`00000000 ffffac07`e780232e fffff802`726a789a fffff802`734c8d5a : 0xfffff802`726a7800 SYMBOL_NAME: aicusbwifi+53a08 MODULE_NAME: aicusbwifi IMAGE_NAME: aicusbwifi.sys STACK_COMMAND: .process /r /p 0xfffff802df5cef80; .thread 0xfffff802df5d1640 ; kb BUCKET_ID_FUNC_OFFSET: 53a08 FAILURE_BUCKET_ID: AV_aicusbwifi!unknown_function OSPLATFORM_TYPE: x64 OSNAME: Windows 10 FAILURE_ID_HASH: {88a7df4e-1779-d31a-2348-fb551a42f896} Followup: MachineOwner ---------
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值