简体   繁体   English

GCC 预处理器输出中的调试信息

[英]Debugging information in GCC preprocessor output

I was inspecting the preprocessed output generated by GCC, and I see a lot of these in the .i file that I generated using the -save-temps flag:我正在检查 GCC 生成的预处理输出,我在使用-save-temps标志生成的.i文件中看到了很多这样的输出:

# 8 "/usr/include/i386-linux-gnu/gnu/stubs.h" 2 3 4

What do the numbers before and after the absolute path of stubs.h mean? stubs.h绝对路径前后的数字是什么意思? It seems to be some kind of debugging information that is inserted by the preprocessor and allows the compiler to issue error messages referring to this information.它似乎是由预处理器插入的某种调试信息,并允许编译器发出参考此信息的错误消息。 These lines do not affect the program itself, but what specifically is each number for?这些行不会影响程序本身,但每个数字具体是什么?

Based on the documentation the number before the filename is the line number.根据文档,文件名之前的数字是行号。 The numbers after the file name are a flag and mean the following:文件名后面的数字是一个标志,含义如下:

  • 1 indicates the start of a new file. 1表示新文件的开始。
  • 2 indicates returning to a file (after having included another file). 2表示返回到一个文件(在包含另一个文件之后)。
  • 3 indicates that the following text comes from a system header file, so certain warnings should be suppressed. 3表示以下文本来自系统头文件,因此应禁止某些警告。
  • 4 indicates that the following text should be treated as being wrapped in an implicit extern "C" block. 4表示以下文本应被视为包含在隐式 extern "C" 块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM