\doxysection{Example getting .debug\+\_\+ranges data }
\hypertarget{group__examplev}{}\label{group__examplev}\index{Example getting .debug\_ranges data@{Example getting .debug\_ranges data}}


Example accessing ranges data.  


Example accessing ranges data. 

If have\+\_\+base\+\_\+addr is false there is no die (as in reading the raw .debug\+\_\+ranges section) or there is some serious data corruption somewhere. 
\begin{DoxyCode}{0}
\DoxyCodeLine{*/}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ functionusingrange(\doxymbox{\hyperlink{group__basicdatatypes_gac91d9490d58c8d86a4d5b63ca93ba6dd}{Dwarf\_Signed}}\ i,\doxymbox{\hyperlink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\_Ranges}}\ *r,}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga32afecc94a71aae2be36aa279f1dded8}{Dwarf\_Bool}}\ *have\_base\_addr,}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\_Unsigned}}\ *baseaddr)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\_Unsigned}}\ base\ =\ *baseaddr;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}[\%4ld]\ "{}},(\textcolor{keywordtype}{signed}\ \textcolor{keywordtype}{long})i);}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{switch}(r-\/>dwr\_type)\ \{}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{case}\ DW\_RANGES\_ENTRY:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}DW\_RANGES\_ENTRY:\ raw\ \ \ \ addr1\ "{}}\ PRX}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\ addr2\ "{}}\ PRX,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ r-\/>dwr\_addr1,r-\/>dwr\_addr2);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (r-\/>dwr\_addr1\ ==\ r-\/>dwr\_addr2)\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\ (empty\ range)"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (*have\_base\_addr)\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\ \ \ \ \ \ \ "{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}DW\_RANGES\_ENTRY:\ cooked\ addr1\ 0x\%08llx"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\ addr2\ \ "{}}\ PRX\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}}\ ,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ r-\/>dwr\_addr1+base,r-\/>dwr\_addr2+base);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{case}\ DW\_RANGES\_ADDRESS\_SELECTION:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Base\ Address\ \ \ :\ "{}}\ PRX\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ r-\/>dwr\_addr2);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ have\_base\_addr\ =\ TRUE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ baseaddr\ =\ r-\/>dwr\_addr2;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{case}\ DW\_RANGES\_END:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}DW\_RANGES\_END\ \ :\ 0,0\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ have\_base\_addr\ =\ FALSE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ baseaddr\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ERROR\ \ \ \ \ \ \ \ \ \ :\ incorrect\ dwr\_type\ is\ 0x\%lx\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long})r-\/>dwr\_type);}
\DoxyCodeLine{\ \ \ \ \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ On\ call\ the\ rangesoffset\ is\ a\ default\ zero.\ }}

\end{DoxyCode}
