Though I don’t know of a documented way, and you may have considered this,
but perhaps a decent hack of a work around would be:
#ifdef DBG
__asm nop
#endif
Just to differ the functions ever so slightly. Ugly, sure, and I hope
there’s a ‘supported’ way to do it…but if not, this should work.
Matt
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Monday, September 22, 2003 10:18 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: C++ (not a flame war) FYI and a question
Oh I agree that if done correctly the optimization does not alter functional
behavior. However, as I said, I expect code mangling in the free build, I do
not expect it in the checked build. I expect that when I step into the
dispatch function that is supposed to handle IOCTLs, that the debugger will
indicate that this function is named something like ‘DispatchDeviceControl’,
not ‘DispatchSystemControl’. I also expect that /Od, set in the checked
build, disables ALL OF THIS CRAP, as it states that it does.
Offline another person has indicated that this behavior is associated with
the (what appears to be undocumented) linker’s ‘duplicate template function
removal’ optimizations. That is fine again, but the checked build ought to
turn this off, or there ought to be a documented way to turn this off.
=====================
Mark Roddy
-----Original Message-----
From: Arlie Davis [mailto:xxxxx@sublinear.org]
Sent: Monday, September 22, 2003 11:04 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: C++ (not a flame war) FYI and a question
I don’t understand. Is this causing a problem? If the
compiler is collapsing redundant, identical functions, then
your functional behavior is still identical, right?
Is it just that this behavior is unsettling? Or is it
causing confusion during debugging because you’re suddenly in
an unfamiliar method, albeit one that works identically to
the one you expected?
And can I write any more sentences that end in question marks?
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Monday, September 22, 2003 9:22 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] C++ (not a flame war) FYI and a question
We recently ran into a rats nest of compiler madness here
regarding virtual function tables (vtables) and c++ class
hierarchies. Specifically an engineer testing a modification
to a complex C++ based driver discovered to his horror that
sending an IOCTL to a specific device object in this driver
ended up in the DispatchSystemControl method rather than the
DispatchDeviceControl method. An examination, using windbg,
of the vtable for this device extension object revealed that
indeed where the address for DispatchDeviceControl ought to
be was instead the address of DispatchSystemControl. Further
examination unraveled the confusion: the compiler knows
better than a mere programmer. The compiler examines code
segments associated with virtual functions and only emits one
version of any identical segment. (It may do this for
non-virtual functions, and it may only do this for virtual
functions only within a class hierarchy, I don’t know the
details nor can I find any documentation regarding this
behavior.) So if you run into this horror show, don’t worry,
be happy, the compiler knows better.
Now to the question. I wouldn’t mind this compiler behavior
in the free build, where I expect all sorts of code-mangling
obfuscations from the compiler, but I really hate it in the
checked build, where I expect A to be A and not B. So does
anyone know how to turn this particular optimization off?
=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@sublinear.org To unsubscribe
send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@positivenetworks.net
To unsubscribe send a blank email to xxxxx@lists.osr.com