public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Any way to output variable names with their size (i.e. int, char and etc.)
@ 2014-01-10 14:45 shall890
  2014-01-10 14:54 ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: shall890 @ 2014-01-10 14:45 UTC (permalink / raw)
  To: gcc-help

Hello,

I am wanting to extract variable names and their size (int, char and etc.)
from a c file.  Is there any way to extract that type of information?

Thanks,
Stephen



--
View this message in context: http://gcc.1065356.n5.nabble.com/Any-way-to-output-variable-names-with-their-size-i-e-int-char-and-etc-tp1001590.html
Sent from the gcc - Help mailing list archive at Nabble.com.

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

* Re: Any way to output variable names with their size (i.e. int, char and etc.)
  2014-01-10 14:45 Any way to output variable names with their size (i.e. int, char and etc.) shall890
@ 2014-01-10 14:54 ` Jonathan Wakely
  2014-01-10 15:45   ` shall890
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2014-01-10 14:54 UTC (permalink / raw)
  To: shall890; +Cc: gcc-help

On 10 January 2014 14:45, shall890 wrote:
> Hello,
>
> I am wanting to extract variable names and their size (int, char and etc.)

Those are types, not sizes.  A variable's type is a property of the
source code, the size of that type depends on the compiler and target
platform.

> from a c file.  Is there any way to extract that type of information?

You could compile it and look at the debug info. Or write a GCC plugin
to output the info as the file is compiled.  There are probably better
ways too.

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

* Re: Any way to output variable names with their size (i.e. int, char and etc.)
  2014-01-10 14:54 ` Jonathan Wakely
@ 2014-01-10 15:45   ` shall890
  2014-01-10 16:06     ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: shall890 @ 2014-01-10 15:45 UTC (permalink / raw)
  To: gcc-help

Hello Jonathan,

I don't usually use gcc.  Is there a file that contains the debug info
output in a readable format?

Also, where can Info on writing a GCC plugin?

Thanks,
Stephen



--
View this message in context: http://gcc.1065356.n5.nabble.com/Any-way-to-output-variable-names-with-their-size-i-e-int-char-and-etc-tp1001590p1001612.html
Sent from the gcc - Help mailing list archive at Nabble.com.

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

* Re: Any way to output variable names with their size (i.e. int, char and etc.)
  2014-01-10 15:45   ` shall890
@ 2014-01-10 16:06     ` Jonathan Wakely
  2014-01-10 19:11       ` shall890
  2014-01-10 22:15       ` Ángel González
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Wakely @ 2014-01-10 16:06 UTC (permalink / raw)
  To: shall890; +Cc: gcc-help

On 10 January 2014 15:45, shall890 wrote:
> Hello Jonathan,
>
> I don't usually use gcc.  Is there a file that contains the debug info
> output in a readable format?

It's in the object file produced by the compiler, in a machine-readable format.

> Also, where can Info on writing a GCC plugin?

I found these pages by searching the web:
http://gcc.gnu.org/wiki/plugins
http://lwn.net/Articles/457543/
http://libplugin.sourceforge.net/tutorials/gcc-plugin.html

Using debug info or writing a plugin will take a reasonable amount of
work. If you're looking for something simple and quick then I think
the answer is that GCC won't easily give you the information you're
looking for.

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

* Re: Any way to output variable names with their size (i.e. int, char and etc.)
  2014-01-10 16:06     ` Jonathan Wakely
@ 2014-01-10 19:11       ` shall890
  2014-01-10 22:15       ` Ángel González
  1 sibling, 0 replies; 6+ messages in thread
From: shall890 @ 2014-01-10 19:11 UTC (permalink / raw)
  To: gcc-help

Thanks.
Stephen



--
View this message in context: http://gcc.1065356.n5.nabble.com/Any-way-to-output-variable-names-with-their-size-i-e-int-char-and-etc-tp1001590p1001693.html
Sent from the gcc - Help mailing list archive at Nabble.com.

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

* Re: Any way to output variable names with their size (i.e. int, char and etc.)
  2014-01-10 16:06     ` Jonathan Wakely
  2014-01-10 19:11       ` shall890
@ 2014-01-10 22:15       ` Ángel González
  1 sibling, 0 replies; 6+ messages in thread
From: Ángel González @ 2014-01-10 22:15 UTC (permalink / raw)
  To: shall890; +Cc: gcc-help

Why do you want the variable names and their size? I suspect that 
perhaps your goal could be with a slightly different information 
(hopefully easier to get).

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

end of thread, other threads:[~2014-01-10 22:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-10 14:45 Any way to output variable names with their size (i.e. int, char and etc.) shall890
2014-01-10 14:54 ` Jonathan Wakely
2014-01-10 15:45   ` shall890
2014-01-10 16:06     ` Jonathan Wakely
2014-01-10 19:11       ` shall890
2014-01-10 22:15       ` Ángel González

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).