RE: [GD-Windows] Finding routine that's crashing
Brought to you by:
vexxed72
From: Brian S. <bs...@mi...> - 2002-08-02 17:30:20
|
Yes, I had those names flip-flopped, sorry for the confusion. Too much time on Xbox :) Are you tearing apart the mini-dump files yourself or just loading them into the VS.NET debugger? I haven't looked at the file format. --brian > -----Original Message----- > From: Grills, Jeff [mailto:jg...@so...]=20 > Sent: Friday, August 02, 2002 9:53 AM > To: Brian Sharon; Colin Fahey;=20 > Gam...@li... > Subject: RE: [GD-Windows] Finding routine that's crashing >=20 >=20 >=20 > Actually, I think the old name was ImageHlp, and the new name=20 > is DbgHelp. > I'm pretty sure DbgHelp is redistributable, so you can=20 > include it with your > app to make sure it's always there, no matter what OS you're=20 > on. We use a > newer version of the DLL that has a working MiniDumpWriteDump=20 > function. > That's another awesome function you guys should become familiar with. >=20 > j >=20 > -----Original Message----- > From: Brian Sharon [mailto:bs...@mi...] > Sent: Friday, August 02, 2002 11:41 AM > To: Colin Fahey; Gam...@li... > Subject: RE: [GD-Windows] Finding routine that's crashing >=20 >=20 > dbghelp was the old name of the dll, i think it became imagehlp around > the win2000 timeframe. your best bet if you want this to work on all > platforms is to bind dynamically to one dll or the other=20 > (whichever one > you can find) and load the entry points you want manually. i remember > that at least one useful entry point doesn't exist in dbghelp...sorry > can't remember the specifics. >=20 > i do remember this being a pain in the ass to get working on=20 > 9x. i know > i have a version of this at home somewhere. i will try to dig it up > tonight and send it out. >=20 > --brian >=20 > > -----Original Message----- > > From: Colin Fahey [mailto:cp...@ea...]=20 > > Sent: Friday, August 02, 2002 2:03 AM > > To: Gam...@li... > > Subject: Re: [GD-Windows] Finding routine that's crashing > >=20 > >=20 > > 2002 August 2nd > > Friday > >=20 > > Help! > >=20 > > First, I'm going to reply to my own post, contradicting and > > criticizing myself. > >=20 > > >>> [1] Under Windows 98, the DLL with the symbol handler and > > >>> StackWalk() functions is called: "imagehlp.dll". > > >>> (i.e., different from the "dbghelp.dll" references > > >>> scattered around the source and project settings) > >=20 > > Okay, the first part is true, but the posted code doesn't > > mention "dbghelp.dll" anywhere! I was just confused. > > After I couldn't get the posted code to work, I downloaded > > a completely different project (Bugslayer1000), and *THAT* > > project had "dbghelp.dll" all over the place! > >=20 > >=20 > > >>> [2] Under Windows 98, we need the process **ID** for > > >>> SymInitialize(), NOT the process handle. > > >>> (See MSDN Library documentation for SymInitialize().) > >=20 > > This really was in the documentation, but I'm getting > > mixed signals from the code... > >=20 > > (a) If I use the process ID (following MSDN > > documentation on SymInitialize()), the StackWalk() > > stops walking after a single iteration! The symbol > > lookup returns an empty symbol string, but doesn't > > complain about accessing an invalid address. > >=20 > > (b) If I use hProcess handle (contradicting MSDN > > documentation on SymInitialize()), the StackWalk() > > walks up the stack just fine (apparently)! The symbol > > lookup fails (complain about accessing an invalid address). > >=20 > >=20 > > I'd really like to get the code working, just as an educational > > example. > >=20 > > Here's a kind of trace of what happened: > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >=20 > > (NOTE: The following trace assumes that we can get away with > > using hProcess for the symbol handler (contradicting the > > documentation). The trace with the process ID as symbol > > handler and StackWalk parameter is similar, but ends > > with a whimper: StackWalk() ends its walk immediately, > > and SymGetSymFromAddr() returns nothing!) > >=20 > > When my test application starts executing: > > ------------------------------------------ > >=20 > > ENTER ExceptionHandler::ExceptionHandler() > >=20 > > ENTER ExceptionHandler::InitClass() > > LEAVE ExceptionHandler::InitClass() > >=20 > > ENTER ExceptionHandler::InitDLL() > > global_hProcess =3D 0x7fffffff > > global_ProcessId =3D 0xfffcfd73 > > global_SymProcess =3D 0x7fffffff > > mHImageHlpDll =3D LoadLibrary("imagehlp.dll"); =3D 0x7d750000 > > LEAVE ExceptionHandler::InitDLL() > >=20 > > Dir with executable: > > 'C:\WINDOWS\DESKTOP\ASSERT_CODE\TEST_ASSERT\DEBUG\TEST_ASSERT.EXE' > >=20 > > LEAVE ExceptionHandler::ExceptionHandler() > >=20 > >=20 > >=20 > > When my test application calls ASSERTx(...): > > -------------------------------------------- > >=20 > > ENTER ExceptionHandler::DumpCrash(HANDLE hThread =3D 0xfffffffe, = void* > > pExceptionInfo =3D 0x0065f8c0) > >=20 > > About to do > > SymInitialize > >=20 > >=20 > > 0x7fffffff, > >=20 > > "C:\WINDOWS\Desktop\assert_code\test_assert\Debug;C:\WINDOWS\D > > ESKTOP\ASSERT_ > > CODE\TEST_ASSERT\DEBUG;", > > FALSE > > ); > >=20 > > About to do > > SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME | > > SYMOPT_CASE_INSENSITIVE); > >=20 > > About to do > > enumAndLoadModuleSymbols( global_hProcess, global_ProcessId ); > >=20 > >=20 > > ENTER void enumAndLoadModuleSymbols( HANDLE hProcess =3D=20 > > 0x7fffffff, DWORD > > pid =3D 0xfffcfd73 ); > >=20 > > . . . > > . . . > > . . . > > sSymLoadModule > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > 0, > > =20 > >=20 > = img=3D'C:\WINDOWS\DESKTOP\ASSERT_CODE\TEST_ASSERT\DEBUG\STDASSERT.DLL', > > mod=3D'STDASSERT.DLL', > > base=3D0x10000000, > > size=3D311296 > > ); =3D=3D> Result =3D 0x10000000 > >=20 > > sSymLoadModule > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > 0, > >=20 > > img=3D'C:\WINDOWS\DESKTOP\ASSERT_CODE\TEST_ASSERT\DEBUG\TEST_ASS > > ERT.EXE', > > mod=3D'TEST_ASSERT.EXE', > > base=3D0x00400000, > > size=3D180224 > > ); =3D=3D> Result =3D 0x00400000 > >=20 > > sSymLoadModule > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > 0, > > img=3D'C:\WINDOWS\SYSTEM\KERNEL32.DLL', > > mod=3D'KERNEL32.DLL', > > base=3D0xbff70000, > > size=3D471040 > > ); =3D=3D> Result =3D 0xbff70000 > > . . . > >=20 > > LEAVE void enumAndLoadModuleSymbols( HANDLE hProcess =3D=20 > > 0x7fffffff, DWORD pid > > =3D 0xfffcfd73 ); > >=20 > >=20 > > (Back in ExceptionHandler::DumpCrash()...) > >=20 > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x100042b3}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x100042b3, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x004012c0}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x004012c0, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x0040139e}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x0040139e, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x004013fd}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x004013fd, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x0040144a}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x0040144a, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0x004020c9}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0x004020c9, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > > StackWalk > > ( ..., > > global_SymProcess =3D 0x7fffffff, > > hThread =3D 0xfffffffe, > > {sfStackFrame.AddrPC.Offset =3D 0xbff8b537}, > > ...); =3D=3D> Result =3D 1 > >=20 > > SymGetSymFromAddr > >=20 > >=20 > > global_SymProcess =3D 0x7fffffff, > > ui32_Address =3D 0xbff8b537, > > &(dwSymOffset =3D 0x00000000), > > (pSymbol->Name =3D '') > > ); =3D=3D> Result =3D 0x00000001 > >=20 > > ERROR: "Attempt to access invalid address" > >=20 > >=20 > >=20 > > Closing Comments: > > ----------------- > >=20 > > The stack walking looks fine! The addresses fall within the=20 > > various *.DLL > > files. > > I'm sure I could convert the addresses to functions by hand; =20 > > i.e., I am > > confident that the addresses are valid. > >=20 > > I initiatialized the structure size field in the symbol structure > > (which wasn't done in the original version of the code) > > for SymGetSymFromAddr(). > >=20 > > The process handle is the same as that used to initialize the > > symbol handler -- and if I try using a different handle, > > the function reports (via GetLastError()) "invalid handle". > >=20 > > What could this be?! What is the "Attempt to access=20 > invalid address" > > reported by SymGetSymFromAddr() (via GetLastError())? > >=20 > > I also tried using the exact address of an existing symbol > > in the SymGetSymFromAddr(), just as a sanity check... > > But there was no sanity! It also resulted in the > > "Attempt to access invalid address" error. > >=20 > > All of this is under Windows 98, using Visual C++ 6.0 Professional, > > with Service Pack 5. I never explicitly installed a different > > version of "imagehlp.{dll,lib,h}" -- although VC++ 6.0 SP5 may > > have overwritten the version that shipped with VC++ 6.0. > >=20 > > I'd step in to SymGetSymFromAddr()...IF I KNEW HOW!!! ;-) > >=20 > > --- Colin > >=20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 |