Codeview Uses .h File for Source Rather Than .c File

ID Number: Q32903

5.10 | 5.10

MS-DOS | OS/2

buglist5.10

Summary:

In some rare but reproducible situations, the CodeView debugger uses a

file other than the actual source file (in this case, a header file)

as the source listing. Source debugging is impossible because the

source does not correspond to the program counter.

Very slight changes to the source program correct this problem, for

example, in one case, moving the final } (close brace) of a null

function to the line after the function declaration; in another case,

deleting an unused function prototype declaration corrected the

problem.

Microsoft has confirmed this to be a problem in Version 5.10 of the C

compiler and in CodeView Version 2.20. We are researching this problem

and will post new information here as it becomes available.

More information:

Compile the example below with the following command line, then start

CodeView:

cl /AM /Zi file.c

When CodeView appears, the source on the screen is cvbug.h rather than

cvbug.c.

If you change the stuff() function to put the closing } on the next

line, it works correctly. If you remove the prototype of makeitem()

from the bottom of cvbug.h, the process works correctly.

The program below will fail as described above:

#include "cvbug.h"

void printf(byte*, ...);

void stuff(void);

void main(void);

/* If you put the closing } on the next line in the following function,

everything will work correctly.

*/

void stuff() { }

void main() {

printf("\nHi there!\n");

}

The following is the cvbug.h header file:

typedef unsigned char byte;

typedef unsigned int uint;

typedef uint SW;

typedef byte * POINTER;

typedef short int DATA;

typedef int OFFSET;

typedef unsigned char tiny;

#define NULL 0

#define NULLFUNC 0l

typedef union {

int i;

uint ui;

long l;

byte *cp;

tiny ti;

byte buf[80]; } UNIVERSAL;

typedef struct {

int row, col;

byte *prompt;

SW (*convertin)(UNIVERSAL*, byte*);

void (*convertout)(byte*, UNIVERSAL*);

POINTER data;

int maxwidth;

int datawidth;

SW (*include)(int);

int helpnumber;

int returncode;

} LISTITEM;

void makeitem(LISTITEM *, int, int, byte*, SW(*)(UNIVERSAL*, byte*),

void(*)(byte*, UNIVERSAL*), POINTER, int, int, SW(*)(int), int, int);