Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Access to symbol table values (after C Preprocessor) in AS6
PostPosted: Thu Aug 09, 2012 9:57 pm 
Offline

Joined: Thu Aug 09, 2012 9:33 pm
Posts: 2
Perhaps I am missing some quick AS6 setting, but, I cannot find symbol table final values after they have been digested by the C preprocessor.

For example:
#define BUF_SIZE (63)
#define JOE (7 * BUF_SIZE)
#define ALICE (JOE + 5*BUF_SIZE)

I would like to see the final value for ALICE to verify correctness.
Since my real defines are MANY levels deep and quite complicated,
this is needed to make sure all is well.

So, where are they hiding?

thanks,
Dan


Top
 Profile  
 
 Post subject: Re: Access to symbol table values (after C Preprocessor) in
PostPosted: Thu Aug 09, 2012 10:38 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
They are text macro expansions, the compiler never sees them as the preprocessor resolves/unfolds them, before passing it into a compiler pass and consequently won't ever be symbols.

Try instead
printf("%d\n", ALICE);

GNU/GCC has a -E option that just runs the preprocessor pass, review the output.


Top
 Profile  
 
 Post subject: Re: Access to symbol table values (after C Preprocessor) in
PostPosted: Fri Aug 10, 2012 6:03 am 
Offline

Joined: Thu Aug 09, 2012 9:33 pm
Posts: 2
Thanks Cpt for the Titanic dose of reality. I completely forgot that the CPP just did text substitutions, ad nauseum, until it was just a large string of text at the end going into the compiler.

So, with your suggestion, I added assignment statements, grep'ed the assembly listing for the assembly code and awk'ed my way to get the actual final compiled values to compare with the expected values.

That was better than comparing hundreds of blindingly similar values by hand.

thanks, again, Cpt,
Dan

btw, with the -E option, I confirmed the final expansion for one of the values is over 10130 characters long of all math, parens, and numbers. Lots of fun.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: