This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dwarf info missing variable if -O3 --gen_func_subsections

Other Parts Discussed in Thread: CONTROLSUITE

Hello,

Im using CCS5.5 with CGT 6.2.1 for Delfino 28335.

I do observe that with -O3 and --gen_func_subsections=on the dwarf info (output of ofd2000) does not contain a existing variable which is static in a function. The variable does exist (was not eliminated by optimizer).

  • If a look into the nm2000 output the variable is there at a "normal" RAM address.
  • If I connect with debugger, the variable is known because in Memory View the location is named with the variable name.
  • The ofd output does not contain a DW_TAG_variable for my variable.

My question is:

Is this a planned behavior or a bug?

I want to parse the ofd output to get address and type of variables. I thought that the ofd output would contain all needed information, but at least this one is lost...

Thank you for an answer to this!

Best Regards,

Roger

Here some detailed information for reproducing this:

  • Use the CpuTimer example (controlSUITE).
  • Add a global variable
  • Add a variable in main
  • Add one function with the static variable which will be lost in ofd outpout

Add declaration before main():

void dwarf_test_function(void);
int DwarfTestGlobal = 0;

Add variable declaration in main()

static int DwarfTestMain=0;

Modify endless loop in main()

   for(;;)
   {
     dwarf_test_function();
     if(DwarfTestGlobal >= 100)
     {
       DwarfTestMain++;
     }
   }

add the test function in same c file:

void dwarf_test_function(void)
{
  static int DwarfTestLost = 0;
  DwarfTestLost++;
  if(DwarfTestLost >= 100)
  {
    DwarfTestGlobal++;
  }
}

Build using -O3 --gen_func_subsections=on (I removed the include paths for better overview):

-v28 -ml -mt --float_support=fpu32 -O3 --include_path="all removed" -g --define="_DEBUG" --define="LARGE_MODEL" --diag_warning=225 --issue_remarks --gen_func_subsections=on --output_all_syms --cdebug_asm_data

Use ofd2000.exe to display dwarf info:

ofd2000.exe -g --dwarf_display=none,dinfo,types --obj_display=none -o ofd_output.ofd Example_2833xCpuTimer.out

No DW_TAG_variable entry for DwarfTestLost

Use nm2000.exe to display symbol names and addresses:

You will see somethin glike this:

0000c021 b _DwarfTestLost$2