📄 readme.dwarf
字号:
Notes on the GNU Implementation of DWARF Debugging Information--------------------------------------------------------------Last Updated: Sun Oct 4 10:04:13 PDT 1992 by rfg@netcom.com-----------------------------------------------------This file describes special and unique aspects of the GNU implementationof the DWARF debugging information language, as provided in the GNU version2.x compiler(s).For general information about the DWARF debugging information language,you should obtain the DWARF version 1 specification document (and perhapsalso the DWARF version 2 draft specification document) developed by theUNIX International Programming Languages Special Interest Group. A copyof the the DWARF version 1 specification (in PostScript form) may beobtained either from me <rfg@netcom.com> or from UNIX International. (Seebelow.) The file you are looking at now only describes known deviationsfrom the UI/PLSIG DWARF version 1 specification, together with thosethings which are allowed by the DWARF version 1 specification but whichare known to cause interoperability problems (e.g. with SVR4 SDB).To obtain a copy of the DWARF version 1 specification from UNIX International,use the following procedure:--------------------------------------------------------------------------- Send mail to archive@ui.org containing the following: path yourname@your.site send PUBLIC/dwarf.v1.mm for the troff source, or send PUBLIC/dwarf.v1.ps for the postscript. If you system supports uncompress and uudecode, you can request that the data be compressed by placing the command 'compress' in the message. If you have any questions about the archive service, please contact Shane P. McCarron, UI Project Manager, <s.mccarron@ui.org>.---------------------------------------------------------------------------The generation of DWARF debugging information by the GNU version 2.x Ccompiler has now been tested rather extensively for m88k, i386, i860, andSparc targets. The DWARF output of the GNU C compiler appears to inter-operate well with the standard SVR4 SDB debugger on these kinds of targetsystems (but of course, there are no guarantees).DWARF generation for the GNU g++ compiler is still not operable. This isdue primarily to the many remaining cases where the g++ front end does notconform to the conventions used in the GNU C front end for representingvarious kinds of declarations in the TREE data structure. It is not clearat this time how these problems will be addressed.Future plans for the dwarfout.c module of the GNU compiler(s) includes theaddition of full support for GNU FORTRAN. (This should, in theory, be alot simpler to add than adding support for g++... but we'll see.)Many features from the evolving DWARF version 2 (draft) specification havebeen adapted to, and used in the GNU implementation of DWARF (version 1).In most of these cases, a DWARF version 2 (draft) approach is used in placeof (or in addition to) DWARF version 1 stuff simply because it is apparentthat DWARF version 1 is not sufficiently expressive to provide the kinds ofinformation which may be necessary to support really robust debugging.In *all* of these cases however, the use of DWARF version 2 (draft) featuresshould not interfere in any way with the interoperability (of GNU compilers)with generally available "classic" (pre version 1) DWARF consumer tools(e.g. SVR4 SDB). Full support for DWARF version 2 should be availablesometime after the DWARF version 2 specification has been finalized.The DWARF generation enhancement for the GNU compiler(s) was initiallydonated to the Free Software Foundation by Network Computing Devices.(Thanks NCD!) Additional development and maintenance of dwarfout.c hasbeen largely supported (i.e. funded) by Intel Corporation. (Thanks Intel!)If you have questions or comments about the DWARF generation feature, pleasesend mail to me <rfg@netcom.com>. I will be happy to investigate any bugsreported and I may even provide fixes (but of course, I can make no promises).The DWARF debugging information produced by GCC may deviate in a few minor(but perhaps significant) respects from the DWARF debugging informationcurrently produced by other C compilers. A serious attempt has been madehowever to conform to the published specifications, to existing practice,and to generally accepted norms in the GNU implementation of DWARF.If you are interested in obtaining more information about DWARF or inparticipating in the continuing evolution of DWARF within the UI/PLSIGgroup, please contact either myself or the UI/PLSIG chairman, Dan Oldman<oldman@dg-rtp.dg.com>. The UI/PLSIG welcomes and encourages theparticipation of new members who might be interested in discussing debuggingissues in general, and DWARF in particular. There are no dues and youDO NOT have to be a UI member in order to join the UI/PLSIG. The UI/PLSIGoperates an E-mail mailing list and holds regular meeting in various cities.If you don't have time to participate actively, but would like to be keptabreast of recent developments, you con join the UI/PLSIG mailing list andjust listen in on our lively discussions. ** IMPORTANT NOTE ** ** IMPORTANT NOTE ** ** IMPORTANT NOTE **Under normal circumstances, the DWARF information generated by the GNUcompilers (in an assembly language file) is essentially impossible fora human being to read. This fact can make it very difficult to debugcertain DWARF-related problems. In order to overcome this difficulty,a feature has been added to dwarfout.c (enabled by the -fverbose-asmoption) which causes additional comments to be placed into the assemblylanguage output file, out to the right-hand side of most bits of DWARFmaterial. The comments indicate (far more clearly that the obscureDWARF hex codes do) what is actually being encoded in DWARF. Thus, the-fverbose-asm option can be highly useful for those who must study theDWARF output from the GNU compilers in detail.---------(Footnote: Within this file, the term `Debugging Information Entry' willbe abbreviated as `DIE'.)Release Notes (aka known bugs)-------------------------------In one very obscure case involving dynamically sized arrays, the DWARF"location information" for such an array may make it appear that thearray has been totally optimized out of existence, when in fact it*must* actually exist. (This only happens when you are using *both* -g*and* -O.) This is due to aggressive dead store elimination in thecompiler, and to the fact that the DECL_RTL expressions associated withvariables are not always updated to correctly reflect the effects ofGCC's aggressive dead store elimination.-------------------------------When attempting to set a breakpoint at the "start" of a function compiledwith -g1, the debugger currently has no way of knowing exactly where theend of the prologue code for the function is. Thus, for most targets,all the debugger can do is to set the breakpoint at the AT_low_pc addressfor the function. But if you stop there and then try to look at one ormore of the formal parameter values, they may not have been "homed" yet,so you may get inaccurate answers (or perhaps even addressing errors).Some people may consider this simply a non-feature, but I consider it abug, and I hope to provide some some GNU-specific attributes (on functionDIEs) which will specify the address of the end of the prologue and theaddress of the beginning of the epilogue in a future release.-------------------------------It is believed at this time that old bugs relating to the AT_bit_offsetvalues for bit-fields have been fixed.There may still be some very obscure bugs relating to the DWARF descriptionof type `long long' bit-fields for target machines (e.g. 80x86 machines)where the alignment of type `long long' data objects is different from(and less than) the size of a type `long long' data object.Please report any problems with the DWARF description of bit-fields as youwould any other GCC bug. (Procedures for bug reporting are given in theGNU C compiler manual.)--------------------------------At this time, GCC does not know how to handle the GNU C "nested functions"extension. (See the GCC manual for more info on this extension to ANSI C.)--------------------------------The GNU compilers now represent inline functions (and inlined instancesthereof) in exactly the manner described by the current DWARF version 2(draft) specification. The version 1 specification for handling inlinefunctions (and inlined instances) was known to be brain-damaged (by thePLSIG) when the version 1 spec was finalized, but it was simply too latein the cycle to get it removed before the version 1 spec was formallyreleased to the public (by UI).--------------------------------At this time, GCC does not generate the kind of really precise informationabout the exact declared types of entities with signed integral types whichis required by the current DWARF draft specification.Specifically, the current DWARF draft specification seems to require thatthe type of an non-unsigned integral bit-field member of a struct or uniontype be represented as either a "signed" type or as a "plain" type,depending upon the the exact set of keywords that were used in thetype specification for the given bit-field member. It was felt (by theUI/PLSIG) that this distinction between "plain" and "signed" integral typescould have some significance (in the case of bit-fields) because ANSI Cdoes not constrain the signedness of a plain bit-field, whereas it doesconstrain the signedness of an explicitly "signed" bit-field. For thisreason, the current DWARF specification calls for compilers to producetype information (for *all* integral typed entities... not just bit-fields)which explicitly indicates the signedness of the relevant type to be"signed" or "plain" or "unsigned".Unfortunately, the GNU DWARF implementation is currently incapable of makingsuch distinctions.--------------------------------Known Interoperability Problems-------------------------------Although the GNU implementation of DWARF conforms (for the most part) withthe current UI/PLSIG DWARF version 1 specification (with many compatibleversion 2 features added in as "vendor specific extensions" just for goodmeasure) there are a few known cases where GCC's DWARF output can causesome confusion for "classic" (pre version 1) DWARF consumers such as theSystem V Release 4 SDB debugger. These cases are described in this section.--------------------------------The DWARF version 1 specification includes the fundamental type codesFT_ext_prec_float, FT_complex, FT_dbl_prec_complex, and FT_ext_prec_complex.Since GNU C is only a C compiler (and since C doesn't provide any "complex"data types) the only one of these fundamental type codes which GCC evergenerates is FT_ext_prec_float. This fundamental type code is generatedby GCC for the `long double' data type. Unfortunately, due to an apparentbug in the SVR4 SDB debugger, SDB can become very confused wherever anyattempt is made to print a variable, parameter, or field whose type wasgiven in terms of FT_ext_prec_float.(Actually, SVR4 SDB fails to understand *any* of the four fundamental typecodes mentioned here. This will fact will cause additional problems whenthere is a GNU FORTRAN front-end.)--------------------------------In general, it appears that SVR4 SDB is not able to effectively ignorefundamental type codes in the "implementation defined" range. This cancause problems when a program being debugged uses the `long long' datatype (or the signed or unsigned varieties thereof) because these typesare not defined by ANSI C, and thus, GCC must use its own private fundamentaltype codes (from the implementation-defined range) to represent these types.--------------------------------General GNU DWARF extensions----------------------------In the current DWARF version 1 specification, no mechanism is specified bywhich accurate information about executable code from include files can beproperly (and fully) described. (The DWARF version 2 specification *does*specify such a mechanism, but it is about 10 times more complicated thanit needs to be so I'm not terribly anxious to try to implement it rightaway.)In the GNU implementation of DWARF version 1, a fully downward-compatibleextension has been implemented which permits the GNU compilers to specifywhich executable lines come from which files. This extension placesadditional information (about source file names) in GNU-specific sections(which should be totally ignored by all non-GNU DWARF consumers) so thatthis extended information can be provided (to GNU DWARF consumers) in a waywhich is totally transparent (and invisible) to non-GNU DWARF consumers(e.g. the SVR4 SDB debugger). The additional information is placed *only*in specialized GNU-specific sections, where it should never even be seenby non-GNU DWARF consumers.To understand this GNU DWARF extension, imagine that the sequence of entriesin the .lines section is broken up into several subsections. Each contiguoussequence of .line entries which relates to a sequence of lines (or statements)from one particular file (either a `base' file or an `include' file) couldbe called a `line entries chunk' (LEC).For each LEC there is one entry in the .debug_srcinfo section.Each normal entry in the .debug_srcinfo section consists of two 4-bytewords of data as follows: (1) The starting address (relative to the entire .line section) of the first .line entry in the relevant LEC. (2) The starting address (relative to the entire .debug_sfnames section) of a NUL terminated string representing the relevant filename. (This filename name be either a relative or an absolute filename, depending upon how the given source file was located during compilation.)Obviously, each .debug_srcinfo entry allows you to find the relevant filename,and it also points you to the first .line entry that was generated as a resultof having compiled a given source line from the given source file.Each subsequent .line entry should also be assumed to have been producedas a result of compiling yet more lines from the same file. The end ofany given LEC is easily found by looking at the first 4-byte pointer inthe *next* .debug_srcinfo entry. That next .debug_srcinfo entry pointsto a new and different LEC, so the preceding LEC (implicitly) must haveended with the last .line section entry which occurs at the 2 1/2 wordsjust before the address given in the first pointer of the new .debug_srcinfoentry.The following picture may help to clarify this feature. Let's assume that`LE' stands for `.line entry'. Also, assume that `* 'stands for a pointer. .line section .debug_srcinfo section .debug_sfnames section ---------------------------------------------------------------- LE <---------------------- *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -