Re: Need Help Debugging
- From: Ben <benm5678@xxxxxxxxx>
- Date: Tue, 25 Sep 2007 15:15:57 -0000
On Sep 25, 8:42 am, "Waleri Todorov" <this...@xxxxxxxxxxxxxxxx> wrote:
Dr. Watson can create a crash minidump, that can be used for postmortem debuggin. It will take you to exact location of the crash. With debug build of your code, you will be positioned to the crash location, with debug info loaded, etc...
"Ben" <benm5...@xxxxxxxxx> wrote in messagenews:1190649816.660022.162510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a non-managed c++ service that has a crash periodically.
I analyze the DrWatson dump and every time it seems to point to a
ntdll!RtlInitializeCriticalSectionAndSpinCount. I do use
CRITICAL_SECTIONS often throughout the code to manage access to the
variables, since it's a multi-threaded app.
Is there a certain rule of thumb when using Critical Sections to avoid
this ? I saw in MSDN they say to call
InitializeCriticalSectionAndSpinCount instead of just
InitializeCriticalSection in order to avoid memory resource exceptions
on pre-windows-XP systems... but our clients are XP, so I think i'm ok
with using InitializeCriticalSection. Maybe there's something more
recommended to use ?
In my searches, i'm seen some references to stack overflows... i'm not
too familiar with how to avoid it ? can someone offer some
guidance ? I know we use some string variables that can hold a few MB
of xml data... usually they are declared as an STL "string" and passed
as references. Do I need to use 'new' to allocate these large vars ?
does that avoid using the stack ?!?
Thanks for any tips!
ben- Hide quoted text -
- Show quoted text -
I do use DrWatson and set to generate a full dump with symbols. I'm
running 'release' code on my 90 user pilot group since the debug
version has a 30-40% cpu spike every 10 seconds when we enumerate
system procs. But I do have a PDB file generated and all the source
code for each version.
Had about 5 crashes this month all from different PCs, and in all of
them, when I looked at the call stack, it seems to have started with a
call to addToLog (a custom func we have to write to the eventviewer)
in order to log some exception that happened in a try{}catch(...){}
block. The first line of that function is MyEnterCriticalSection,
which is our custom CRITICAL_SECTION class. That's the last line in
my code that call stack leads me to... and the next functions i see in
the stack are usually EnterCriticalSection or
IntializeCriticalSection... but double-clicking on them doesn't lead
me inside my custom MyEnterCriticalSection function... anyone know
why ? I did a full re-build one time, and still didn't help...
btw, the MyEnterCriticalSection is part of a custom class I built to
help track CRITICAL_SECTION usage. So in my code, when i want to
protect a section, I call
MyEnterCriticalSection("NameOfCriticalSection",
"NameOfFunctionThatIsRequesting") -- then my custom function, looks up
if "NameOfSection" appears in the <map> object it uses to store the
CRITICAL_SECTION pointers. If it does, it calls EnterCriticalSection
on it, if it doesn't, it creates a new CRITICAL_SECTION pointer and
adds to the <map> as "NameOfSection", then initializes & enters it.
Every time it messes with the <map> it protects it with
EnterCriticalSection. The beautiful thing, is I can get a report of
every critical_section and see which function 'owns' it and at what
time it aquired it and also see which functions are requesting it
currently... it helped me debug deadlocks in minutes.
.
- Follow-Ups:
- Re: Need Help Debugging
- From: Ivan Brugiolo [MSFT]
- Re: Need Help Debugging
- References:
- Need Help Debugging
- From: Ben
- Need Help Debugging
- Prev by Date: RE: When does GetCurrentDirectory fail to return a drive letter?
- Next by Date: Re: Need Help Debugging
- Previous by thread: Re: Need Help Debugging
- Next by thread: Re: Need Help Debugging
- Index(es):
Relevant Pages
|