NO

Author Topic: Can not see global structure during debug  (Read 4098 times)

PhilG57

  • Guest
Can not see global structure during debug
« on: December 22, 2015, 09:44:30 PM »
Hello,
   I have a project with two source modules.  A structure is defined in a header file and that header file is included in both source code files.  While under debug, I cannot see that structure in either the local or global list of variables. 
   I discovered and reported this problem earlier this year (Jan 02, 2015) while using a global structure with GetOpenFileName.  I did receive some helpful responses but eventually just went on to work around the problem.
   I've recreated the problem and included a sample program built from the wizards.  Any help understanding this problem would be appreciated.  Plus, I really do suspect there is a compiler bug hiding in there somewhere.
   Pelles 8.00.60 on Win10. 
   Many thanks.
« Last Edit: December 22, 2015, 09:48:01 PM by PhilG57 »

Snowman

  • Guest
Re: Can not see global structure during debug
« Reply #1 on: December 22, 2015, 10:52:51 PM »
The bigdb structure appears in the Globals list if you actually use it in your code, like so:

Code: [Select]
void nothing(void)
{
int a;
int b;
a = 0;
b = 69;
a = b;
    bigdb.dwDBHdrLength = 0;
}

PhilG57

  • Guest
Re: Can not see global structure during debug
« Reply #2 on: December 23, 2015, 12:27:47 AM »
Hi.  Thanks - I did as you suggested and added that line of code to my "nothing" routine in the second (database.c) file.  The global structure DID show up, both in the 'auto' and 'global' windows of the debugger.  I received a similar suggestion on my earlier post, saying in effect you have to use the global to force it to be shown.

What is puzzling, is that I already DID reference the global structure in my original code, from the first (winmain.c) file at line #145.  My thinking was to put in a small trivial reference to the global structure just to make it show up during debug but clearly that did not work.

I still don't understand what is happening.  There must be some requirement to reference the global structure in the same source file as it is defined, as referencing the global in a source file which contains an extern reference to the global does not cut the mustard.  Is this normal?

Thanks.




Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Can not see global structure during debug
« Reply #3 on: December 23, 2015, 03:26:33 PM »
Unused variables aren't in debug info even without optimizations. PellesC feature. This makes debug info compact ;)
Those who want all that s..., except Monica Belucci's knickers color, use msvc and PDB-format :D
May the source be with you

PhilG57

  • Guest
Re: Can not see global structure during debug
« Reply #4 on: December 23, 2015, 09:02:12 PM »
Thanks, but the variable IS used at line #145 in winmain.c.  And I realize you can't see my project options, but optimization IS turned off.  So I'm still confused... 

All of this stemed from my desire to check the globals before and after I used them to ensure they were first initialized correctly and then later filled in with data correctly.  I was reading parts of a file into various globals and wanted to ensure what I believed to be happening was really happening.

Thanks again.

PhilG57

  • Guest
Re: Can not see global structure during debug
« Reply #5 on: December 27, 2015, 03:12:07 PM »
Just played around with MS Visual C++ 2010 Express and the global shows up in the "auto" window.  I don't want to think this might be a problem with Pelles's compiler, but have not yet heard any other explanation or recommendation.  I rezipped the code and the Visual C++ files just for completeness.