Re: Code Alignment Problem

From: cristalink (cristalink_at_nospam.nospam)
Date: 02/04/05


Date: Sat, 5 Feb 2005 09:16:05 +1300

The environment does not really matter. The code generated by the compiler
is substantially different in debug and release modes. Most likely you have
a bug in your code, such as an uninitialized variable etc. There's a chance
you encountered a bug in the compiler or a timing problem.

Review your code. Run Prefast from the latest DDK on your sources. Try
Driver Verifier. Usually, you need to understand the assembly code to track
down such a bug. If you cannot read assembly code, you better hire an
expert.

-- 
http://www.firestreamer.com - NTBackup to DVD and DV
"Ken Allen" <kendrhyd@sympatico.ca> wrote in message
news:O2JV6PvCFHA.1296@TK2MSFTNGP10.phx.gbl...
> We have an odd problem with one of our device drivers, and it seems to
> be associated with the placement and size of the code, but we cannot
> determine the exact cause or the correct resolution.
>
> First, I need to be clear that this is an older set of code, and it is
> being compiled with the VS 6 C++ compiler. The driver environment was
> hacked to permit the use of C++ code in the kernel, and so the
> environment is even more strange.
>
> There is one aspect of the driver that attempts to access the contents
> of a mountable file system during the boot process. Normally this works
> fine, as the attempt to open a file in that file system causes an
> auto-mount, and the file is accessed. We did notice that in debug mode
> the code was failing, and it turned out that the call to open the file
> was returning a "device not ready" error, which normally indicates that
> the file system could not be mounted.
>
> As we started to debug the cause of the problem, by adding extra debug
> information, the problem 'disappeared'! After several hours of
> experimenting with the code, we found that if we added or removed some
> code, we could cause the problem to occur or disappear! The actual code
> being added or removed does not seem to matter, as it is typically debug
> statements anyway, and in no way affects the algorithm.
>
> Does anyone have any suggestions on how we could go about isolating the
> cause for this problem and avoiding it in the future -- aside from
> rewriting the driver in the standard and latest DDK environment?
>
> -Ken


Relevant Pages

  • Re: LNK4078: multiple .rdata and .data
    ... DDK and the kind of target environment that you want to build for, ... a command prompt from that part of the start menu. ... That is what you need in order to build a device driver or to get debug ... output from the DDK's compiler. ...
    (microsoft.public.development.device.drivers)
  • Re: debugging in release mode
    ... I have no doubt that it's a problem of mine and not of the compiler. ... I don't really need optimization ... for the sake of memory space or execution speed. ... shows the differences between the default debug mode and the default release ...
    (microsoft.public.vc.mfc)
  • Re: how to make sure that kernel is up
    ... difference in my debug output before the following debug statement ... FS: initializing ROM/RAM file system ... Windows CE Kernel for ARM Built on Jun 24 2004 at ... MMC INTERRUPT END ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Whats more important optimisations or debugging?
    ... aiming to make high level debugging as accurate and complete as ... oriented debug chain is appropriate. ... But in either case, barring chip and compiler bugs, the bugs ...
    (comp.arch.embedded)
  • [PATCH 1/3] CodingStyle updates
    ... +emit the message, you'll need to turn on DEBUG in your code, which can be ... +The kernel includes macros called likelyand unlikely, ... Suppose you're developing a file system ... +to have a file system with lots of block devices? ...
    (Linux-Kernel)