public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Output files with memry information?
@ 2011-02-25 23:22 Schnapphase
  2011-02-26  7:49 ` Nicholas Sherlock
  0 siblings, 1 reply; 3+ messages in thread
From: Schnapphase @ 2011-02-25 23:22 UTC (permalink / raw)
  To: gcc-help


Hi,

I have a weird problem. I have to check some C code for read accesses on
certain variables. For example, if I analyze the variable abc, I have to
know if abc is being read somewhere in the code. This also includes access
to the memory address where the variable is held. I don't care about write
operations. 

So, my only option now is writing a C code parser, which will be very
complicated I suppose. Well, I know that there are problems with arrays,
structs, direct memory accesses etc. and that there are cases where a memory
address which is accessed is determined in runtime. But I have no option to
run or even debug the code.

Then I figured that gcc also checks, if variables are not used in the code,
which means that gcc has to parse the code as well to look for variable or
even memory accesses.

Is there an option to make gcc tell me, which variables are accessed with
read operations? Like an output file or something?

Thank You!


-- 
View this message in context: http://old.nabble.com/Output-files-with-memry-information--tp31010975p31010975.html
Sent from the gcc - Help mailing list archive at Nabble.com.

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

* Re: Output files with memry information?
  2011-02-25 23:22 Output files with memry information? Schnapphase
@ 2011-02-26  7:49 ` Nicholas Sherlock
  2011-02-26 20:14   ` Schnapphase
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Sherlock @ 2011-02-26  7:49 UTC (permalink / raw)
  To: gcc-help

On 25/02/2011 9:05 p.m., Schnapphase wrote:
> I have a weird problem. I have to check some C code for read accesses on
> certain variables. For example, if I analyze the variable abc, I have to
> know if abc is being read somewhere in the code. This also includes access
> to the memory address where the variable is held. I don't care about write
> operations.

That is, in general, impossible, as it could decide the halting problem. 
Now, if you only want to know if the variable is read from directly, or 
the address of the variable is ever taken, that would be possible.

Cheers,
Nicholas Sherlock

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

* Re: Output files with memry information?
  2011-02-26  7:49 ` Nicholas Sherlock
@ 2011-02-26 20:14   ` Schnapphase
  0 siblings, 0 replies; 3+ messages in thread
From: Schnapphase @ 2011-02-26 20:14 UTC (permalink / raw)
  To: gcc-help


Hi!

At first, thank you for your answer.


Nicholas Sherlock wrote:
> 
> That is, in general, impossible, as it could decide the halting problem. 
> 

Well, that's a problem, I suppose.


Nicholas Sherlock wrote:
> 
> Now, if you only want to know if the variable is read from directly, or 
> the address of the variable is ever taken, that would be possible.
> 

Okay, that would definitely help me. How can I do that? Can gcc help me here
or do I have to try something different?

Thank You!

-- 
View this message in context: http://old.nabble.com/Output-files-with-memry-information--tp31010975p31021690.html
Sent from the gcc - Help mailing list archive at Nabble.com.

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

end of thread, other threads:[~2011-02-26 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25 23:22 Output files with memry information? Schnapphase
2011-02-26  7:49 ` Nicholas Sherlock
2011-02-26 20:14   ` Schnapphase

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