Advanced Debugging
About AdvDbg Consult Train Services Products Tools Community Contact  
欢迎光临 高端调试 登录 | 注册 | FAQ
 
  ACPI调试
Linux内核调试
Windows内核调试
 
  调试战役
调试原理
新工具观察
 
  Linux
Windows Vista
Windows
 
  Linux驱动
WDF
WDM
 
  PCI Express
PCI/PCI-X
USB
无线通信协议
 
  64位CPU
ARM
IA-32
  CPU Info Center
 
  ACPI标准
系统认证
Desktop
服务器
 
  Embedded Linux
嵌入式开发工具
VxWorks
WinCE
嵌入式Windows
 
  格蠹调试套件(GDK)
  格蠹学院
  小朱书店
  老雷的微博
  《软件调试》
  《格蠹汇编》
  《软件调试(第二版)》
沪ICP备11027180号-1

C/C++本地代码调试

帖子发起人: woodhead   发起时间: 2013-02-06 13:56 下午   回复: 4

Print Search
帖子排序:    
   2013-02-06, 13:56 下午
woodhead 离线,最后访问时间: 2017/1/22 1:14:57 woodhead

发帖数前100位
注册: 2013-02-06
发 贴: 13
求教一个异常问题,求思路
Reply Quote

软件出现的一个异常,报错弹框:Access violation at address 7C80983E in module 'kernel32.dll'. Write of address 00000000.动态库是vc写的, 可执行程序是cb写的,dbg符号已经导入,全部的符号都有,但还是看不懂哪引起的av错误。本人windbg菜鸟,刚买了张老师软件调试没多久,看了看dump,不知道如何下手了。请教各位高手,这种情况如何调试?求思路...

winbg部分调试信息:

0:000> kbn
 # ChildEBP RetAddr  Args to Child             
00 0012e244 77d19418 77d2770a 0017003a 00000000 ntdll!KiFastSystemCallRet
01 0012e27c 77d249c4 00710192 0017003a 00000001 user32!NtUserWaitMessage+0xc
02 0012e2a4 77d3a956 77d10000 0014e768 0017003a user32!InternalDialogBox+0xd0
03 0012e564 77d3a2bc 0012e6c0 00000000 ffffffff user32!SoftModalMessageBox+0x938
04 0012e6b4 77d663fd 0012e6c0 00000028 0017003a user32!MessageBoxWorker+0x2ba
05 0012e70c 77d664a2 0017003a 001576c0 0018b8c8 user32!MessageBoxTimeoutW+0x7a
06 0012e740 77d50877 0017003a 009ad67c 009ad6e4 user32!MessageBoxTimeoutA+0x9c
07 0012e760 77d5082f 0017003a 009ad67c 009ad6e4 user32!MessageBoxExA+0x1b
08 0012e77c 00459cc7 0017003a 009ad67c 009ad6e4 user32!MessageBoxA+0x45
09 0012e800 00459dde 00000010 0012f108 00459dff TestSwitch!_fastcall Forms::TApplication::HelpKeyword(const System::AnsiString)+0x3
0a 0012e928 00459bc3 00000000 0046604d 0046605c TestSwitch!_fastcall Forms::TApplication::SetShowHint(bool)+0x32
0b 0012f124 00418fc2 00000010 00000000 00000000 TestSwitch!_fastcall Forms::TApplication::InvokeHelp(unsigned short, int)+0x2f
0c 0012f13c 77d18734 005601f0 00000010 00000000 TestSwitch!_fastcall Classes::initialization()+0x36
0d 0012f168 77d18816 00af0fd5 005601f0 00000010 user32!InternalCallWinProc+0x28
0e 0012f1d0 77d28ea0 00000000 00af0fd5 005601f0 user32!UserCallWinProcCheckWow+0x150
0f 0012f224 77d28eec 007289f8 00000010 00000000 user32!DispatchClientMessage+0xa3
10 0012f24c 7c92e453 0012f25c 00000018 007289f8 user32!__fnDWORD+0x24
11 0012f270 77d194be 77d28e0d 005601f0 00000112 ntdll!KiUserCallbackDispatcher+0x13
12 0012f2c4 77d2c228 005601f0 00000112 0000f060 user32!NtUserMessageCall+0xc
13 0012f2e0 5adc3bc2 005601f0 00000112 0000f060 user32!RealDefWindowProcA+0x47
14 0012f2f8 5addc7f6 0012f324 003e43b0 0012f358 uxtheme!DoMsgDefault+0x2d
15 0012f308 5adc1ac7 003e43b0 0012f324 0012f424 uxtheme!OnDwpSysCommand+0x3d
16 0012f358 5addc2b1 5addc7cb 00000000 0000f060 uxtheme!_ThemeDefWindowProc+0x13a
17 0012f374 77d2f15c 005601f0 00000112 0000f060 uxtheme!ThemeDefWindowProcA+0x18
18 0012f3bc 77d18734 005601f0 00000112 0000f060 user32!DefWindowProcA+0x6b
19 0012f3e8 77d18816 0048ea58 005601f0 00000112 user32!InternalCallWinProc+0x28
1a 0012f450 77d2a013 00000000 0048ea58 005601f0 user32!UserCallWinProcCheckWow+0x150
1b 0012f480 77d2a998 0048ea58 005601f0 00000112 user32!CallWindowProcAorW+0x98
1c 0012f4a0 00466488 0048ea58 005601f0 00000112 user32!CallWindowProcA+0x1b
1d 0012f4e8 00455846 009a2600 0012f6ac 00409661 TestSwitch!_fastcall Controls::TWinControl::PaintControls(unsigned int, Controls::TControl *)+0xcc
1e 0012f504 00463513 008c04ce 0012f6ac 009a2600 TestSwitch!_fastcall Forms::TCustomForm::WMHelp(Messages::TWMHelp&)+0x72
1f 0012f62c 004663a4 0012f650 3f800000 3f800000 TestSwitch!_fastcall Controls::TControl::WMLButtonDown(Messages::TWMMouse&)+0xf
20 0012f674 0046601f 0012f688 00466037 0012f6a4 TestSwitch!_fastcall Controls::TWinControl::PaintWindow(unsigned int)+0x14
21 0012f6a4 00418fc2 00000112 0000f060 008c04ce TestSwitch!_fastcall Controls::TWinControl::WndProc(Messages::TMessage&)+0x5f
22 0012f6bc 77d18734 005601f0 00000112 0000f060 TestSwitch!_fastcall Classes::initialization()+0x36
23 0012f6e8 77d2bdf1 00af0fd5 005601f0 00000112 user32!InternalCallWinProc+0x28
24 0012f750 77d2927b 00000000 00af0fd5 005601f0 user32!UserCallWinProcCheckWow+0xea
25 0012f78c 77d292e3 007289f8 006de6f8 0000f060 user32!SendMessageWorker+0x4a5
26 0012f7ac 5ade8895 005601f0 00000112 0000f060 user32!SendMessageW+0x7f
27 0012f7d0 5adc1ac7 003e43b0 0012f7ec 0012f8ec uxtheme!OnDwpNcLButtonDown+0xa8
28 0012f820 5addc2b1 5ade87ed 00000000 00000014 uxtheme!_ThemeDefWindowProc+0x13a
29 0012f83c 77d2f15c 005601f0 000000a1 00000014 uxtheme!ThemeDefWindowProcA+0x18
2a 0012f884 77d18734 005601f0 000000a1 00000014 user32!DefWindowProcA+0x6b
2b 0012f8b0 77d18816 0048ea58 005601f0 000000a1 user32!InternalCallWinProc+0x28
2c 0012f918 77d2a013 00000000 0048ea58 005601f0 user32!UserCallWinProcCheckWow+0x150
2d 0012f948 77d2a998 0048ea58 005601f0 000000a1 user32!CallWindowProcAorW+0x98
2e 0012f968 00466488 0048ea58 005601f0 000000a1 user32!CallWindowProcA+0x1b
2f 0012f9c4 00463513 0012fbe4 0012fb6c 009a2600 TestSwitch!_fastcall Controls::TWinControl::PaintControls(unsigned int, Controls::TControl *)+0xcc
30 0012faec 004663a4 006b99d0 00000006 00050006 TestSwitch!_fastcall Controls::TControl::WMLButtonDown(Messages::TWMMouse&)+0xf
31 0012fb34 0046601f 0012fb48 00466037 0012fb64 TestSwitch!_fastcall Controls::TWinControl::PaintWindow(unsigned int)+0x14
32 0012fb64 00418fc2 000000a1 00000014 008c04ce TestSwitch!_fastcall Controls::TWinControl::WndProc(Messages::TMessage&)+0x5f
33 0012fb7c 77d18734 005601f0 000000a1 00000014 TestSwitch!_fastcall Classes::initialization()+0x36
34 0012fba8 77d18816 00af0fd5 005601f0 000000a1 user32!InternalCallWinProc+0x28
35 0012fc10 77d189cd 00000000 00af0fd5 005601f0 user32!UserCallWinProcCheckWow+0x150
36 0012fc70 77d196c7 0012fca0 00000001 0012fcec user32!DispatchMessageWorker+0x306
37 0012fc80 004598a8 0012fca0 0012fc00 00000000 user32!DispatchMessageA+0xf
38 0012fcec 00401667 00000000 0048f034 001423ba TestSwitch!_fastcall Forms::TApplication::Run()+0xe4
39 0012fd30 00489aef 00400000 00000000 001423ba TestSwitch!WinMain+0x4b
3a 0012fde0 77f44136 7c8106f5 0000001b 00000200 TestSwitch!c2064_4+0x63
3b 0012ffc0 7c817067 80000001 0d7dda84 7ffdf000 shlwapi!RegOpenKeyExWrapW+0x71
3c 0012fff0 00000000 00401000 00000000 78746341 kernel32!BaseProcessStart+0x23
0:000> da 009ad67c
009ad67c  "Access violation at address 7C80"
009ad69c  "983E in module 'kernel32.dll'. W"
009ad6bc  "rite of address 00000000."
0:000> dt 007289f8 tagMsg
Symbol tagMsg not found.


IP 地址: 已记录   报告
   2013-02-06, 16:13 下午
Raymond 离线,最后访问时间: 2020/7/3 3:40:25 格蠹老雷

发帖数前10位
注册: 2005-12-19
发 贴: 1,303
Re: 求教一个异常问题,求思路
Reply Quote

.ecxr 回到异常上下文

再kp看栈回溯

 


IP 地址: 已记录   报告
   2013-02-06, 17:31 下午
woodhead 离线,最后访问时间: 2017/1/22 1:14:57 woodhead

发帖数前100位
注册: 2013-02-06
发 贴: 13
Re: 求教一个异常问题,求思路
Reply Quote

谢谢张老师,我试了一下:

0:000> .ecxr
eax=7ffdf000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=00000005
eip=7c92120e esp=0100ffcc ebp=0100fff4 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246
ntdll!DbgBreakPoint:
7c92120e cc              int     3
0:000> kp
  *** Stack trace for last set context - .thread/.cxr resets it
ChildEBP RetAddr 
0100ffc8 7c970010 ntdll!DbgBreakPoint
0100fff4 00000000 ntdll!DbgUiRemoteBreakin+0x2d

 

我自己又看了看,上网找了找资料,如下流程:

0:000> !teb
TEB at 7ffde000
    ExceptionList:        0012e794
    StackBase:            00130000
    StackLimit:           00128000
    SubSystemTib:         00000000
    FiberData:            00001e00
    ArbitraryUserPointer: 00000000
    Self:                 7ffde000
    EnvironmentPointer:   00000000
    ClientId:             00001324 . 00001034
    RpcHandle:            00000000
    Tls Storage:          00143008
    PEB Address:          7ffdf000
    LastErrorValue:       2
    LastStatusValue:      c0000034
    Count Owned Locks:    0
    HardErrorMode:        0
0:000> dps 00128000 00130000

   ...

   00129208  7c92e46a ntdll!KiUserExceptionDispatcher+0xe

  ...

0:000> .cxr 00129238 
eax=00129508 ebx=03463980 ecx=00000000 edx=00000000 esi=00129584 edi=0012eac4
eip=7c812aeb esp=00129504 ebp=00129558 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
kernel32!RaiseException+0x53:
7c812aeb 5e              pop     esi
0:000> kp
  *** Stack trace for last set context - .thread/.cxr resets it
ChildEBP RetAddr 
00129558 0012956c kernel32!RaiseException+0x53
WARNING: Frame IP not in any known module. Following frames may be wrong.
0012956c 0012eac4 <Unloaded_L>+0x1f2de
00129570 0012ea80 <Unloaded_L>+0x24836
0012eac4 80000000 <Unloaded_L>+0x247f2
00000000 00000000 0x80000000

通过上面的代码,基本找出出错时的信息了,不知道这样看对不对

 


IP 地址: 已记录   报告
   2013-02-06, 20:39 下午
Raymond 离线,最后访问时间: 2020/7/3 3:40:25 格蠹老雷

发帖数前10位
注册: 2005-12-19
发 贴: 1,303
Re: 求教一个异常问题,求思路
Reply Quote

两次贴出的信息是针对同一个dump么?

 


IP 地址: 已记录   报告
   2013-02-07, 16:03 下午
woodhead 离线,最后访问时间: 2017/1/22 1:14:57 woodhead

发帖数前100位
注册: 2013-02-06
发 贴: 13
Re: 求教一个异常问题,求思路
Reply Quote
是同一个dump,是不是抓取dump的时机不太对?还有就是我上面分析的粉红色数据,两个之间的差值是什么意思呢?我当时没搞明白,只是照葫芦画瓢弄下来的。原文这部分没有说清楚
IP 地址: 已记录   报告
高端调试 » 软件调试 » C/C++本地代码调试 » Re: 求教一个异常问题,求思路

 
Legal Notice Privacy Statement Corporate Governance Corporate Governance
(C)2004-2020 ADVDBG.ORG All Rights Reserved.