Find the answer to your Linux question:
Results 1 to 5 of 5
I am not sure if this is the right forum but I hoping I will get some guidance, if not answer to my question. I am looking for a method ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    0

    compiler ...

    I am not sure if this is the right forum but I hoping I will get some guidance, if not answer to my question.
    I am looking for a method to insert certain info to my source code in C and then I extract the same info later when the code gets converted to machine code.
    Is there a way that this can be done using gcc?

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by sharanbr View Post
    I am not sure if this is the right forum but I hoping I will get some guidance, if not answer to my question.
    I am looking for a method to insert certain info to my source code in C and then I extract the same info later when the code gets converted to machine code.
    Is there a way that this can be done using gcc?
    I'm not sure what you mean by that. Can you elaborate a bit? If you don't strip your executable there are plenty of things that can be pulled out of an executable using a console utility like strings.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  3. #3
    Just Joined!
    Join Date
    Jan 2010
    Posts
    0
    my requirement is simple -
    * when I code my program, I put certain information (in the form of tokens)
    * when the executable is generated, I would like to see association of final code
    with information I put
    * I would like to mainly extract the token along with the instruction address that is getting executed for some other processing ...

  4. #4
    Trusted Penguin Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,391
    Sounds like a debugger to me. Couldn't you add a simple trace or logger line to your application to write information to a file at the points you want to record it?
    Linux user #126863 - see http://linuxcounter.net/

  5. #5
    Just Joined!
    Join Date
    Jan 2010
    Posts
    0
    Quote Originally Posted by Roxoff View Post
    Sounds like a debugger to me. Couldn't you add a simple trace or logger line to your application to write information to a file at the points you want to record it?
    Debugger is probably close but not close enough for my problem.
    The issue is that I am not trying to print any info as the program runs.
    Once my code gets compiled and machine code gets generated, I would like to
    extract the original info I put in my application code along with say the actual
    target instruction.

    Maybe if it helps, this is the end use of this:
    1) when I write my program, I put unique tokens
    2) once the code gets compiled, I extract the tokens and the instruction address associated with the token
    3) an external entity (external to CPU) does the action specified by the token
    when the instruction address associated with the token is getting executed
    by the processor ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •