ID Number: Q71833
3.00 3.10 3.11 3.14 | 3.00 3.10 3.11 3.12 3.50
MS-DOS | OS/2
buglist3.10 buglist3.11 buglist3.12 buglist3.14 buglist3.50
Summary:
When using CodeView to watch or display the value of a parameter to a
function declared with the register calling convention (_fastcall), an
incorrect value may be displayed.
More Information:
In the sample code below, viewing or watching the value of the
variable "b" in CodeView may give the incorrect value. The correct
value is displayed in the Local window in the [BP-000X] reference.
When stepping through the program in CodeView, after the line "b += a"
is executed, CodeView still interprets the value of "b" as 20, which
is the value in DX. The correct value, 30, is stored in the location
"BP-2".
The _fastcall function fastfn() does return the correct value of "b"
to the calling function.
To work around this problem, and watch the correct value in the Watch
window, follow these steps in CodeView:
1. Step into the _fastcall function.
2. Open the Local window if it isn't already open.
3. Note the value in the [BP-x] reference to the variable in question.
4. Use the following notation to watch that variable:
Variable type Command
------------- -------
char w?by(bp-x)
int w?wo(bp-x)
long w?dw(bp-x)
It is important to leave off the leading zeros in the value of x.
For example, if x is 0002, just use 2.
Microsoft has confirmed this to be a problem in CodeView versions 3.0,
3.1, 3.11, 3.12, 3.14, and 3.5. We are researching this problem and
will post new information here as it becomes available.
Sample Code
-----------
/* Compile options needed: /Zi /Od /Gs
*/
#include <stdio.h>
int _fastcall fastfn(int, int);
void main()
{
printf("10 + 20 = %d\n", fastfn(10,20));
}
int _fastcall fastfn(int a, int b)
{
b += a;
return b;
}
Additional keywords: fastcall buglist3.00 3.00 3.10 3.50
#o42a