RE: -femit-struct-debug-reduced/baseonly debug info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, from the documentation:
"The value `base' means that the base of name of the file in which the type declaration appears must match the base of the name of the main compilation file."

I've created two files test.c and test-nonbase.h. (attached)

So, as I understand, when compiling like "gcc-4.7 test.c -O0 -g2 -femit-struct-debug-detailed=ind:ord:base" info about structs declared in test-nonbase.h shouldn't be emitted.
But I can get all debug info on structs declared in test-nonbase.h using gdb:
Starting program: ./gcc-tests/a.out 

Breakpoint 1, main () at test.c:18
18	  free(indir_ord);
(gdb) p a
$1 = 5
(gdb) p b
$2 = 98
(gdb) p dir_ord 
$3 = {a = 5, b = 97 'a'}
(gdb) p *indir_ord 
$4 = {a = 10, b = 98 'b'}

Meanwhile, compiling with "-femit-struct-debug-detailed=ord:base" gdb can't find the debug info:
Starting program: ./gcc-tests/a.out 

Breakpoint 1, main () at test.c:18
18	  free(indir_ord);
(gdb) p dir_ord
$1 = <incomplete type>
(gdb) p *inddir_ord
No symbol "inddir_ord" in current context.
(gdb) p *indir_ord
$2 = <incomplete type>


This is not clear to me why first parameter affects so much.

/*
With optimism,
Evgeny Gavrin

email : evgeny.gavrin@xxxxxxxxxxx
*/


----------------------------------------
> Date: Tue, 18 Jun 2013 09:23:01 -0700
> Subject: Re: -femit-struct-debug-reduced/baseonly debug info
> From: iant@xxxxxxxxxx
> To: evgeny.gavrin@xxxxxxxxxxx
> CC: gcc-help@xxxxxxxxxxx
>
> On Tue, Jun 18, 2013 at 7:53 AM, Evgeny Gavrin
> <evgeny.gavrin@xxxxxxxxxxx> wrote:
>> Quote from the documentations is not clear to me: "Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of file in which the type was defined, unless the struct is a template or defined in a system header. "
>>
>> As I understood, this'll store info only about static types and I'll loose info about inlining, for example, am I right?
>
> No. This only affect the debug info for "struct-like types", meaning,
> in C++, classes and structs. It doesn't affect inlining. You're
> right that it will keep info about static types. And if you are
> compiling foo.cc, it will keep info about class foo.
>
>> And to extend the question:
>> I don't understand what means direct or indirect accessed structs? Ordinary or generic ones? Where I can read about it?
>
> This is documented with the -femit-struct-debug-detailed option.
>
> Ian 		 	   		  
#include <malloc.h>
#include "test-nonbase.h"

int main()
{
  struct DIR_ORD  dir_ord;
  struct IND_ORD *indir_ord = (struct IND_ORD*)malloc(sizeof(struct IND_ORD));

  dir_ord.a = 5;
  dir_ord.b = 'a';

  indir_ord->a = 10;
  indir_ord->b = 'b';

  int a = dir_ord.a;
  int b = indir_ord->b;

  free(indir_ord);

  return 0;
}
struct DIR_ORD
{
  int a;
  char b;
};

struct IND_ORD
{
  int a;
  char b;
};


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux