列出全局变量在C程序 [英] List global variables in a C program

查看:155
本文介绍了列出全局变量在C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有解决的一个工具,将列出一个C程序中的所有全局变量?更具体地讲,有一个简单的命令行工具,将做到这一点,即不是一个重量级的IDE,CASE,图形工具包系统等,但只是一些可以像富的* .c

Is there a tool around that will list all the global variables in a C program? More specifically, is there a simple commandline tool that will do this, i.e. not a heavyweight IDE, CASE, graphical toolkit system etc., but just something that can be run like foo *.c?

推荐答案

如果你碰巧编译您所拥有的大多数的Unix文件纳米,只是列出了所有的链接器符号。这些符号分为不同的群体(有点依赖于平台的),所以你应该很容易找出其中的变量。

If you happen to compile the file on most unixes you have nm that just lists you all linker symbols. These symbols are classified in different groups (a bit platform dependent) so you should easily find out which the variables are.

这篇关于列出全局变量在C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆