Debugger uses wrong typedef for local structure

  • Thread starter Thread starter Hugh Sparks
  • Start date Start date
H

Hugh Sparks

In an application that has multiple files that each define a
typedef with the same name, the debugger does not correctly
use the local typedef when stepping in local functions.

The following example has two source files that each
define the type "ivars". If you place a breakpoint in
the "local2" function in File2.c, the debugger will
display *self using the typedef from File1.c

The generated code functions correctly, the problem
is only with the debugger's display of the data structure.

File1.c

extern void *malloc(size_t) ;

typedef struct
{ int a ;
int b ;
} ivars ;

void local1(ivars *self)
{ self->a = 1 ;
self->b = 2 ;
}

ivars *new1()
{ return malloc(sizeof(ivars)) ;
}

File2.c

extern void *malloc(size_t) ;

typedef struct
{ int p ;
int q ;
} ivars ;

void local2(ivars *self)
{ self->p = 3 ;
self->q = 4 ;
}

ivars *new2()
{ return malloc(sizeof(ivars)) ;
}

Main.c

void *local2(void*) ;

main()
{ void *x = new2() ;
local2(x) ;
}
 
The following example has two source files that each
define the type "ivars". If you place a breakpoint in
the "local2" function in File2.c, the debugger will
display *self using the typedef from File1.c

Hugh,

It displays p & q OK for me.

Which version of VC++ are you using?

I've tried with VC7.1 (VS2003).

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top