|
1 To build libdwarf.a, type |
|
2 ./configure |
|
3 make |
|
4 |
|
5 To use dwarf or libdwarf, you may want to install dwarf.h and |
|
6 libdwarf.h somewhere convenient, and you may need the libdwarf |
|
7 in the accompanying libdwarf directory |
|
8 |
|
9 Multi Threading, or using threads with libdwarf (Thread Safety): |
|
10 Nothing in libdwarf does any locking. Every Dwarf_Debug |
|
11 (such as returned by dwarf_init()) is fully independent |
|
12 of all other Dwarf_Debug-s. However, calls to libdwarf can |
|
13 change a Dwarf_Debug. So it is unsafe to have two different |
|
14 threads accessing a single Dwarf_Debug simultaneously. |
|
15 It is therefore sufficient to ensure than any one Dwarf_Debug |
|
16 is only accessed from a single thread. |
|
17 |
|
18 Warnings like |
|
19 "warning: cast from pointer to integer of different size" |
|
20 at compile time are to be expected in dwarf_frame.c and |
|
21 dwarf_frame2.c. Do not be alarmed. |
|
22 |
|
23 If your headers are not in the expected places, |
|
24 use the configure script to access them (and to add other ld |
|
25 or C flags). |
|
26 For example |
|
27 ./configure CPPFLAGS="-I/home/davea/inc" CFLAGS="-I/home/davea/inc" |
|
28 Set both CFLAGS and CPPFLAGS so that configure works properly. |
|
29 |
|
30 It is now possible to request shared library build with |
|
31 --enable-shared |
|
32 (--enable-nonshared is on by default). |
|
33 |
|
34 TARGET DEPENDENCIES of .debug_frame: |
|
35 dwarf.h |
|
36 These should be revised if you have more than the defined |
|
37 63 'normal' registers. It's not harmful to have these too large! |
|
38 Too small will lead to errors reading .debug_frame and .eh_frame. |
|
39 DW_FRAME_HIGHEST_NORMAL_REGISTER |
|
40 DW_FRAME_LAST_REG_NUM |
|
41 |
|
42 These you might revise, but can safely ignore if simply |
|
43 using dwarfdump. If using the producer code you will want |
|
44 to get these exactly right for your architecture. |
|
45 DW_FRAME_RA_COL |
|
46 DW_FRAME_STATIC_LINK |
|
47 DW_FRAME_CFA_COL |
|
48 |
|
49 libdwarf.h |
|
50 The DW_FRAME_REG_INITIAL_VALUE #define should be set to |
|
51 the value approprate to your archtecture. See libdwarf.h |
|
52 for details. |
|
53 |
|
54 If DW_REG_TABLE_SIZE is not set large enough attempts to |
|
55 fill in the .debug_frame tables will get an error. |
|
56 Should be at least as large as DW_FRAME_LAST_REG_NUM. |
|
57 If it's too large nothing is harmed (but some extra space taken |
|
58 at run time). |
|
59 |
|
60 |
|
61 The .debug_frame is so very architecture dependent |
|
62 and because the host (where libdwarf/dwarfdump are executed) |
|
63 and target (the objects read) could be different. |
|
64 It's currently not supported to have dwarfdump/libdwarf determine |
|
65 the architecture on-the-fly and do-the-right-thing. |
|
66 Just setting DW_FRAME_LAST_REG_NUM and DW_FRAME_HIGHEST_NORMAL_REGISTER |
|
67 and DW_REG_TABLE_SIZE high enough will likely suffice for most |
|
68 purposes and most compilers/architectures.. |
|
69 See comments in dwarf.h/libdwarf.h. |
|
70 |
|
71 It's perfectly safe to ignore the above suggestions as long |
|
72 as libdwarf does not get a DW_DLE_DF_REG_NUM_TOO_HIGH error. |
|
73 (which would only happen on reading .debug_frame or .eh_frame data). |
|
74 |
|
75 If you intend to use the libdwarf dwarf-producer code |
|
76 for .debug_frame information |
|
77 you must do a thorough analysys and revise dwarf.h |
|
78 substantially to match the output target archtecture. |
|
79 |
|
80 In general, in the producer code, numbers are copied from and |
|
81 to integers with memcpy(). In case of endianness problems, |
|
82 constants set in dwarf_producer_init() can fix the problems. |
|
83 If one wants to produce a *different-endian* output the best |
|
84 solution is to change the integer memcpy calls to call thru a |
|
85 new dbg-based function pointer and have it 'do the right thing' |
|
86 to adjust endianness. Set the function pointer correctly in |
|
87 dwarf_producer_init() and the rest of the code will just call |
|
88 thru the function pointer. Tedious work to find and change the |
|
89 memcpy calls to be dbg->de_memcpy(), but once done the code is |
|
90 no longer endian dependent (right now there is no way to ask |
|
91 for cross-endian: a new flag needed or ?). |
|
92 |
|
93 leb128 numbers are endian-independent, so nothing need be |
|
94 done with those for cross-endian support (the storage |
|
95 of leb128 on disk is always little-endian). |
|
96 |
|
97 The .ps files are postscript. So those who cannot deal with mm |
|
98 format files but do have a postscript printer (or have |
|
99 ghostscript) can print the documents. |
|
100 This form was chosen before pdf format existed... |
|
101 |
|
102 libdwarf2.1.ps documents a way for a debugger to read dwarf information. |
|
103 libdwarf2p.1.ps documents a way for a compiler to generate dwarf information. |
|
104 dwarf.v2.ps documents Dwarf Version 2. |
|
105 index.v2.ps is an index to dwarf.v2.ps. |
|
106 indexDW.v2 is a plain text index of dwarf #defines to dwarf.v2.ps |
|
107 mips_extensions.ps documents the mips/sgi extensions to dwarf. |
|
108 |
|
109 The commands used to generate the postscript were: |
|
110 pr -t -e libdwarf2.1.mm | tbl | psroff -t -mm >libdwarf2.1.ps |
|
111 pr -t -e libdwarf2p.1.mm | tbl | psroff -t -mm >libdwarf2p.1.ps |
|
112 pic dwarf.v2.mm | tbl | psroff -t -mm >dwarf.v2.ps 2> newIndex |
|
113 pic index.v2.mm | tbl | psroff -t -mm >index.v2.ps |
|
114 |
|
115 pic is a picture processing tool (ATT command). |
|
116 tbl is a table-processing tool. |
|
117 (part of Documentor's Work Bench on ATT-like systems). |
|
118 tbl and pic are available on linux. |
|
119 |
|
120 psroff is a name for a troff-like processor, part of |
|
121 Documentor's Work Bench on IRIX. Substitute a |
|
122 troff-like or nroff-like processor. |
|
123 |
|
124 The index.v2.mm was generated by the dwarf-document writer |
|
125 using some local ATT/USL tools (which SGI does not have, so |
|
126 there is no way I know of to regenerate this). |
|
127 |
|
128 To use dwarf or libdwarf, you may want to install dwarf.h and |
|
129 libdwarf.h somewhere convenient. |
|
130 |
|
131 You will also need libelf (libelf.a and/or libelf.so) and |
|
132 libelf.h installed. These are available from GNU repositories. |
|
133 |
|
134 $Source: /plroot/cmplrs.src/v7.4.5m/.RCS/PL/libdwarf/RCS/README,v $ |
|
135 $Revision: 1.10 $ |
|
136 $Date: 2006/03/30 18:04:52 $ |