Add README.md
[dwarf-doc.git] / dwarf5 / tools / testrefer.tex
1 \% Definitions for each of the DWARF names
2 % These eliminate the need to use escapes for the underscores or
3 % add entries for indexing
4 %
5
6 \newcommand{\addtoindex}[1]{#1\index{#1}}
7 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
8 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
9 \newcommand{\referfol}[1]{\ref{#1} following}
10
11 % Generate a live link in the document
12 % use like \livelink{chap:DWOPdup}{DW\_OP\_dup}
13 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
14 % use when the index is different from the text and target.
15 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
16 % livetarg is the declaration this is the target of livelinks.
17 % FIXME: we might want livetarg and livetargi  #2 to be \textbf{#2}
18 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
19 % When we want the index entry to look different from the name.
20 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
21
22 \newcommand{\thirtytwobitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{32-bit DWARF format}}
23 \newcommand{\sixtyfourbitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{64-bit DWARF format}}
24
25 % For index entries. The tt-variant of each pair is designed to
26 % allow a word to appear in tt font in the main test and the index
27 % but to collate in the index in its non-tt order. (LaTex normally
28 % sorts all tt words before all non-tt words.)
29 \newcommand{\addtoindex}[1]{#1\index{#1}}
30 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
31 \newcommand{\addtoindexi}[2]{#1\index{#2}}
32 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
33 \newcommand{\addtoindexx}[1]{\index{#1}}
34 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
35
36
37
38
39
40 % A command to define multiple helpful DWARF name commands
41 % In a test this causes errors, but in the real run
42 % we do not see this in transfunc2
43 \newcommand{\newdwfnamecommands}[2]{
44         \expandafter\def\csname #1LINK\endcsname{\index{#2}\hyperlink{chap:#1}{#2}}
45         \expandafter\def\csname #1TARG\endcsname{\index{#2}\hypertarget{chap:#1}{#2}}
46         \expandafter\def\csname #1INDX\endcsname{\index{#2}#2}
47         \expandafter\def\csname #1MARK\endcsname{\hypertarget{chap:#1}{}\index{#2}}     
48         \expandafter\def\csname #1NAME\endcsname{#2}
49         % The normal, most common use in running text...
50         \expandafter\def\csname #1\endcsname{\csname #1LINK\endcsname}
51         }
52
53
54 % DW_ACCESS
55 %
56 \newdwfnamecommands{DWACCESSprivate}{DW\_ACCESS\_private}
57 \newdwfnamecommands{DWACCESSprotected}{DW\_ACCESS\_protected}
58 \newdwfnamecommands{DWACCESSpublic}{DW\_ACCESS\_public}
59 %
60 % DW_ADDR
61 %
62 \newdwfnamecommands{DWADDRnone}{DW\_ADDR\_none}
63 %
64 % DW_AT
65 %
66 \newdwfnamecommands{DWATabstractorigin}{DW\_AT\_abstract\_origin}
67 \newdwfnamecommands{DWATaccessibility}{DW\_AT\_accessibility}
68 \newdwfnamecommands{DWATaddrbase}{DW\_AT\_addr\_base}
69 \newdwfnamecommands{DWATaddressclass}{DW\_AT\_address\_class}
70 \newdwfnamecommands{DWATallocated}{DW\_AT\_allocated}
71 \newdwfnamecommands{DWATartificial}{DW\_AT\_artificial}
72 \newdwfnamecommands{DWATassociated}{DW\_AT\_associated}
73 %
74 \newdwfnamecommands{DWATbasetypes}{DW\_AT\_base\_types}
75 \newdwfnamecommands{DWATbinaryscale}{DW\_AT\_binary\_scale}
76 \newdwfnamecommands{DWATbitoffset}{DW\_AT\_bit\_offset}
77 \newdwfnamecommands{DWATbitsize}{DW\_AT\_bit\_size}
78 \newdwfnamecommands{DWATbitstride}{DW\_AT\_bit\_stride}
79 \newdwfnamecommands{DWATbyteoffset}{DW\_AT\_byte\_offset}
80 \newdwfnamecommands{DWATbytesize}{DW\_AT\_byte\_size}
81 \newdwfnamecommands{DWATbytestride}{DW\_AT\_byte\_stride}
82 %
83 \newdwfnamecommands{DWATcallcolumn}{DW\_AT\_call\_column}
84 \newdwfnamecommands{DWATcallfile}{DW\_AT\_call\_file}
85 \newdwfnamecommands{DWATcallline}{DW\_AT\_call\_line}
86 \newdwfnamecommands{DWATcallingconvention}{DW\_AT\_calling\_convention}
87 \newdwfnamecommands{DWATcommonreference}{DW\_AT\_common\_reference}
88 \newdwfnamecommands{DWATcompdir}{DW\_AT\_comp\_dir}
89 \newdwfnamecommands{DWATconstexpr}{DW\_AT\_const\_expr}
90 \newdwfnamecommands{DWATconstvalue}{DW\_AT\_const\_value}
91 \newdwfnamecommands{DWATcontainingtype}{DW\_AT\_containing\_type}
92 \newdwfnamecommands{DWATcount}{DW\_AT\_count}
93 %
94 \newdwfnamecommands{DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
95 \newdwfnamecommands{DWATdatalocation}{DW\_AT\_data\_location}
96 \newdwfnamecommands{DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
97 \newdwfnamecommands{DWATdecimalscale}{DW\_AT\_decimal\_scale}
98         \newcommand{\DWOPbregtwo}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg2}}            % Link, don't index...
99         \newcommand{\DWOPbregthree}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg3}}          %
100         \newcommand{\DWOPbregfour}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg4}}           %
101         \newcommand{\DWOPbregfive}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg5}}           %
102         \newcommand{\DWOPbregeleven}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg11}}        %
103 \newdwfnamecommands{DWOPbregx}{DW\_OP\_bregx}
104 \newdwfnamecommands{DWOPcalltwo}{DW\_OP\_call2}
105 \newdwfnamecommands{DWOPcallfour}{DW\_OP\_call4}
106 %
107 %%%%%%%%%%%%%%%
108 %
109 % .debug_*, .debug_*.dwo, et al
110 %
111 \newcommand{\dotdebugabbrev}{\addtoindex{\texttt{.debug\_abbrev}}}
112 \newcommand{\dotdebugaddr}{\addtoindex{\texttt{.debug\_addr}}}
113 \newcommand{\dotdebugaranges}{\addtoindex{\texttt{.debug\_aranges}}}
114 \newcommand{\dotdebugframe}{\addtoindex{\texttt{.debug\_frame}}}
115 %
116 \newcommand{\dotdata}{\addtoindex{\texttt{.data}}}
117 \newcommand{\dottext}{\addtoindex{\texttt{.text}}}
118 %
119 % Current section version numbers
120 %
121 \newcommand{\versiondotdebugabbrev}  {5}
122 \newcommand{\versiondotdebugaddr}    {5}
123 \newcommand{\versiondotdebugstr}     {5}
124 \newcommand{\versiondotdebugstroffsets}{5}
125 \newcommand{\versiondotdebugtypes}   {\versiondotdebuginfo}
126 %
127 % DWARF Standard Versions
128 %
129 \newcommand{\DWARFVersionI}   {\addtoindex{DWARF Version 1}}
130 \newcommand{\DWARFVersionII}  {\addtoindex{DWARF Version 2}}
131 %
132 \newcommand{\MDfive}{\livelink{def:MDfive}{MD5}}
133
134
135 \DWACCESSpublic&0x01  \\
136 \DWACCESSpublicTARG{}     
137 # Following is duplicate def
138 \DWACCESSpublicTARG{}     
139
140 \DWATcountLINK
141 % Following should generate error
142 \DWATcountnodwnamecommand + 3
143
144 % just shows the name. Not a target or even indexed.
145 % Actually an error because we never defined this above.
146 A \DWATnonameNAME{} attribute whose value is a
147
148 \livelinki{datarep:classreference}{reference}{reference class}
149 \livelinki{datarep:classstring}{string}{string class}
150 describe the static \livelink{chap:lexicalblock}{block} structure 
151 \livelink{chap:lexicalblock}{lexical block} that owns it, 
152 class \livelink{chap:classexprloc}{exprloc}  
153 using class \livelink{chap:classloclistptr}{loclistptr}
154 which is a \livelink{chap:classflag}{flag}.
155 \livelink{chap:classflag}{flag}.
156 attribute whose value is a \livelink{chap:classreference}{reference} to
157
158 \livetargi{chap:declarationcoordinates}{}{declaration coordinates}
159 oops \livetarg{chap:classreference}{}
160 buy \livetarg{chap:classexprloc}{}
161 something \livetarg{chap:classflag}{}
162 nice \livetarg{chap:DWATdwoidforunit}{}
163 today \livetarg{chap:DWATdwoidforunit}{}
164
165 \label{mylabone}
166 \label{mylabtwo}
167 \label{mylabdup}
168 \label{mylabdup}
169 \refersec{mylabone}
170 \refersec{danglingref}
171
172 % defines label
173 \begin{simplenametable}[1.9in]{Accessibility codes}{tab:goodlabel}
174 % No label
175 \begin{simplenametable}[1.9in]
176 % no label here, not reported
177 \begin{foo}[1.9in]{Accessibility codes}{badlabel}
178 \begin{simplenametable}[1.9in]{Accessibility codes}{chap:unusedlabel}
179 \refersec{tab:goodlabel}