I am trying to extract information from object file with nm
command for some kind of static code analysis in which I have to count numbers of declared variables and functions in a C code. I have went through the documentation of GNU Binutils. I could find the variables declared in global scope in the symbol table returned by nm
but I couldn't find variables those are declared in local scope. Why is that? How can I access it?
Is there any way other than nm
in which I can extract my desired information. As a compiler gcc is supposed to generate a symbol table for its use. Can I access it through any gcc command?