- User Since
- Jul 7 2015, 10:13 AM (385 w, 6 d)
Jul 8 2015
Jul 7 2015
Does it have any serious consequence if we get it wrong? (in this case there is only one entry in line table anyway)
Well, you still need to parse the line table prologue to understand DW_AT_decl_file, etc, but I get your point. If you are doing some simple processing, it nice to have the extra copy so you do not have to bother.
Thank you for the answer. If you pardon my ignorance... what is the purpose of *primary* source file? How does it differ from the other files? I do not imagine that the entries in the line table care whether the source is primary. I imagine DW_AT_decl_file and similar do not care either. I guess there is a good reason, I just can not think of it.
As a side note, what is the compilation unit filename needed for? The filenames in the line table are obviously used for PC->line mapping, and they may be referenced from the debug_info. However, it is not clear to me why compilation unit needs a filename. I believe it is perfectly valid to aggregate all debug information info to single compilation unit, and then there is no obvious primary source file.
Parse line table after creating the compilation unit.