public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Having trouble printing the subvars of structs, under certain   conditions
@ 2009-06-01  5:24 顏呈育
  0 siblings, 0 replies; 2+ messages in thread
From: 顏呈育 @ 2009-06-01  5:24 UTC (permalink / raw)
  To: gcc

I am using gcc 4.1.1 to do research involving gimple.  For this work I need to
know the sizes of all of my variables, without running the program and calling
"sizeof".

To accomplish this, I inserted a call to:
   dump_referenced_vars(dump_file_ptr);

At first, everything looked fine.  The output looks something like this:

...
Variable: ibin, UID 1428, char[16], is global, call clobbered, default
def: ibin_100
Variable: ie, UID 1429, struct great, sub-vars: { SFT.124 SFT.123 SFT.122 }
Variable: itmp, UID 1430, long unsigned int
...

From this information, I can work out the sizes of all 3 variables
(ibin, ie, and itmp).
The ie variable is a struct with 3 subbvariables (SFT.124, SFT.123,
SFT.122). To
compute the size of ie, I need to recursively find the name of each
subvar, but this
is not the problem that I want to ask about.


The problem is that the subvars of a struct do not always print. I
specifically see that
it does not print subvars if one of the subvars is an array or itself
a struct.  For
example, here is a code snippet for a struct with an array element:

typedef struct card{ int a;  char *b;  float c[10];}cardtyp;
static cardtyp c1;

And here is the dump_referenced_vars output for it:
Variable: c1, UID 1916, struct cardtyp, is global, call clobbered,
default def: c1_1

Notice that it does not list the subvars, so I cannot catch the size
of cardtype.


It also does not print subvars for arrays of struct variables:
Variable: kns, UID 1272, struct great[17], is addressable, is global,
call clobbered, default def: kns_29


So how can I get this information?  (By the way, I'm not particularly
concerned with
referenced variables. I would be even happier to have the information
for all variables,
whether referenced or not.)

Thank you for your help,
Cheng-Yu

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Having trouble printing the subvars of structs, under certain   conditions
@ 2009-06-08  3:04 顏呈育
  0 siblings, 0 replies; 2+ messages in thread
From: 顏呈育 @ 2009-06-08  3:04 UTC (permalink / raw)
  To: gcc

I am using gcc 4.1.1 to do research involving gimple.  For this work I need to
know the sizes of all of my variables, without running the program and calling
"sizeof".

To accomplish this, I inserted a call to:
  dump_referenced_vars(dump_file_ptr);

At first, everything looked fine.  The output looks something like this:

...
Variable: ibin, UID 1428, char[16], is global, call clobbered, default
def: ibin_100
Variable: ie, UID 1429, struct great, sub-vars: { SFT.124 SFT.123 SFT.122 }
Variable: itmp, UID 1430, long unsigned int
...

From this information, I can work out the sizes of all 3 variables
(ibin, ie, and itmp).
The ie variable is a struct with 3 subbvariables (SFT.124, SFT.123,SFT.122).
To compute the size of ie, I need to recursively find the name of each
subvar, but this is not the problem that I want to ask about.


The problem is that the subvars of a struct do not always print. I
specifically see that it does not print subvars if one of the subvars
is an array or itself
a struct.  For example, here is a code snippet for a struct with an
array element:

typedef struct card{ int a;  char *b;  float c[10];} cardtyp;
static cardtyp c1;

And here is the dump_referenced_vars output for it:
Variable: c1, UID 1916, struct cardtyp, is global, call clobbered,
default def: c1_1

Notice that it does not list the subvars, so I cannot catch the size
of cardtype.


It also does not print subvars for arrays of struct variables:
Variable: kns, UID 1272, struct great[17], is addressable, is global,
call clobbered, default def: kns_29


So how can I get this information?  (By the way, I'm not particularly
concerned with referenced variables. I would be even happier to have
the information
for all variables, whether referenced or not.)

Thank you for your help,
Cheng-Yu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-08  3:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-01  5:24 Having trouble printing the subvars of structs, under certain conditions 顏呈育
2009-06-08  3:04 顏呈育

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).