1
int findme()
{

    int input[120];
    int make00;
}

I want to find make00 in the program and after finding i want to print the function name which contain this variable. How do I do that PS:I am noob in c.(linux)

6
  • @AntoJurković I need function name in which variable is declared -_- Commented Mar 7, 2015 at 5:50
  • 3
    This is a really complicated task. It depends entirely on your environment, and requires that debugging information be enabled in your build: Windows (PE + PDB), Linux (ELF + DWARF), embedded (screwed). Commented Mar 7, 2015 at 6:28
  • 1
    Find in source code or in resulting binary? If first, use C parser (e.g. clang) to parse full code and find there whatever you need. If latter, it is not possible/unreliable unless full debugging symbols enabled. Commented Mar 7, 2015 at 6:45
  • 1
    Note that in general, the same variable name may appear in many functions and source files that are part of the same program. Why do you think you need to do this? Are you writing a debugger? Commented Mar 7, 2015 at 6:47
  • 3
    What makefile have to do with variable names? Commented Mar 7, 2015 at 7:52

1 Answer 1

0

Have you considered good old bison + flex? The C/C++ grammar could be very simplified for your needs... I think this is your best option here.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.