简体   繁体   中英

qt app crash but is not reproduced easily,I have captured the dump stack and how to find out the source code by the stack

  1. Qt app crash but is not reproduced easily
  2. I have captured the dump stack and how to find out the source code by the stack

compile tool: mingw

OS: windows

I work with android(linux) always before, we can use addr2line to find out the crash source code.

So:

How can we find out the source code function or line when app was tested by the test engineer and it crash with dump stack?

In the final,try my best,I find two ways to debug the crash app offline:


First , we can use the addr2line.exe, which is located at {mingw path}/bin. For example, if you get the crash log like that:

 "E:\\\\qt\\\\untitled5.exe" "Exception Addr: 00904B21 :Module: C:\\\\Qt\\\\Qt5.9.0\\\\5.9\\\\mingw53_32\\\\bin\\\\Qt5Widgetsd.dll" "Exception Code: C0000005 :Read Address: 00000000" "Instruction: 8B 01 8B 40 34 C7 04 24 00 00 00 00 FF D0 83 EC" "Registers: " "EAX: 00904B1E EBX: 185304C8 ECX: 00000000 EDX: 18500048" "ESI: 1851DD60 EDI: 755E16DD ESP: 0028FD20 EBP: 0028FD68" "EIP: 00904B21 EFlags: 00010202" "00904B21 :C:\\\\Qt\\\\Qt5.9.0\\\\5.9\\\\mingw53_32\\\\bin\\\\Qt5Widgetsd.dll" "0040187C :E:\\\\qt\\\\untitled5.exe" "004017AB :E:\\\\qt\\\\untitled5.exe" "004016BC :E:\\\\qt\\\\untitled5.exe" "00403B45 :E:\\\\qt\\\\untitled5.exe" 

and we use addr2line to find out the crash point

 C:\\Qt\\Qt5.9.0\\Tools\\mingw530_32\\bin>addr2line.exe -f -ee:\\qt\\untitled5.exe 0040187C 004017AB 004016BC 00403B45 _ZN4testC2Ev E:\\qt\\untitled5/test.cpp:6 _ZN10MainWindowC2EP7QWidget E:\\qt\\untitled5/mainwindow.cpp:12 _Z5qMainiPPc E:\\qt\\untitled5/main.cpp:35 WinMain@16 c:\\Users\\qt\\work\\qt\\qtbase\\src\\winmain/qtmain_win.cpp:104 


second ,use ExcHndl, one part of Dr.mingw. It is a good tool I think. The github project link: enter link description here

adn it also has an sample, you will not miss it. And it has an crash report like that:

 Error occurred on Wednesday, September 6, 2017 at 14:25:57. untitled5.exe caused an Access Violation at location 008F4B21 in module Qt5Widgetsd.dll Reading from location 00000000. Registers: eax=008f4b1e ebx=005ff278 ecx=00000000 edx=184b0048 esi=005fdf48 edi=755e16dd eip=008f4b21 esp=0028fd20 ebp=0028fd68 iopl=0 nv up ei pl nz na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 AddrPC Params 008F4B21 00000001 00000000 00000001 Qt5Widgetsd.dll!hide [c:/Users/qt/work/qt/qtbase/src/widgets/kernel/qwidget.cpp @ 8037] 00401890 00000001 00000000 00050900 untitled5.exe! ?? [E:/qt/untitled5/test.cpp @ 6] 4: test::test() 5: { > 6: test3 *p = new test3; 7: } 8: 004017BF 00000000 184CED38 00050900 untitled5.exe! ?? [E:/qt/untitled5/mainwindow.cpp @ 10] 8: { 9: ui->setupUi(this); > 10: test *t = new test; 11: } 12: 004016D2 00000001 184CED38 00673108 untitled5.exe!qMain [E:/qt/untitled5/main.cpp @ 29] 27: 28: QApplication a(argc, argv); > 29: MainWindow w; 30: w.show(); 31: 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM