\doxysection{Location/\+expression access }
\hypertarget{group__example__loclistcv5}{}\label{group__example__loclistcv5}\index{Location/expression access@{Location/expression access}}


Example using DWARF2-\/5 loclists and loc-\/expressions.  


Example using DWARF2-\/5 loclists and loc-\/expressions. 

Valid for DWARF2 and later DWARF.

This example simply {\itshape assumes} the attribute has a form which relates to location lists or location expressions. Use \doxylink{group__attrform_ga3b1fd6183b2cfd7e76570d6dbd65a839}{dwarf\+\_\+get\+\_\+form\+\_\+class()} to determine if this attribute fits. Use \doxylink{group__dieentry_ga72a92b9f97d75d458bd2aff0f0fbfc7a}{dwarf\+\_\+get\+\_\+version\+\_\+of\+\_\+die()} to help get the data you need. \begin{DoxySeeAlso}{See also}
\doxylink{group__attrform_ga3b1fd6183b2cfd7e76570d6dbd65a839}{dwarf\+\_\+get\+\_\+form\+\_\+class} 

\doxylink{group__dieentry_ga72a92b9f97d75d458bd2aff0f0fbfc7a}{dwarf\+\_\+get\+\_\+version\+\_\+of\+\_\+die} 

\doxylink{group__example__locexprc}{Reading a location expression}
\end{DoxySeeAlso}

\begin{DoxyCode}{0}
\DoxyCodeLine{*/}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ example\_loclistcv5(\doxymbox{\hyperlink{group__allstructs_ga3b8f8b4e43653647a2face222040a915}{Dwarf\_Attribute}}\ someattr,}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\_Error}}\ *error)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\_Unsigned}}\ lcount\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_ga77e23e9624ff0b22ed747913f294fd25}{Dwarf\_Loc\_Head\_c}}\ loclist\_head\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordtype}{int}\ lres\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ lres\ =\ \doxymbox{\hyperlink{group__locations_ga63391b01dedf669137d7b8f004d26040}{dwarf\_get\_loclist\_c}}(someattr,\&loclist\_head,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \&lcount,error);}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}\ (lres\ ==\ DW\_DLV\_OK)\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\_Unsigned}}\ i\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ \ Before\ any\ return\ remember\ to\ call}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ dwarf\_loc\_head\_c\_dealloc(loclist\_head);\ }}

\end{DoxyCode}
