Linux中与结构体大小相关的命令是什么

发布于 2024-12-23 06:55:35 字数 95 浏览 5 评论 0原文

你好,不久前我在Linux中遇到一个命令,它打印一个与源代码文件名相同但扩展名不同的文件,源代码中定义的结构体大小的详细用法...请让我知道任何这样的命令

谢谢

Hello sometime back I came across a command in Linux which prints in a file with the same name as that of the sourcecode filename but different extension,the detailed usage of sizes of the structures defined in the source code ...please let me know about any such commands

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

上课铃就是安魂曲 2024-12-30 06:55:35

我最好的猜测是您正在谈论 nm ,它列出了目标文件中的符号。一个简单的例子:

文件 test.c

int int_array[10];
double double_array[10];

int main()
{
   int_array[0] = 0;
   double_array[0] = 0;

   return 0;
} 

构建一个目标文件:

$ gcc -c test.c

现在列出带有大小信息的符号:

$ nm -S test.o

这会在我的 macbook 上打印类似这样的内容:

0000000000000040 n EH_frame0
0000000000000050 C _double_array
0000000000000028 C _int_array
0000000000000000 T _main
0000000000000058 N _main.eh

检查 nm 手册页以获取更多信息(http://linux.about.com/library/cmd /blcmdl1_nm.htm)

My best guess is you are talking about nm which lists symbols from object files. A quick example:

file test.c

int int_array[10];
double double_array[10];

int main()
{
   int_array[0] = 0;
   double_array[0] = 0;

   return 0;
} 

Build an object file :

$ gcc -c test.c

Now list symbols with size information:

$ nm -S test.o

This prints something like this on my macbook:

0000000000000040 n EH_frame0
0000000000000050 C _double_array
0000000000000028 C _int_array
0000000000000000 T _main
0000000000000058 N _main.eh

Check the nm manpage for further information (http://linux.about.com/library/cmd/blcmdl1_nm.htm)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文