\doxysection{Using dwarf\+\_\+init\+\_\+path\+\_\+dl() }
\hypertarget{group__exampleinit__dl}{}\label{group__exampleinit__dl}\index{Using dwarf\_init\_path\_dl()@{Using dwarf\_init\_path\_dl()}}


Example focused on GNU debuglink data.  


Example focused on GNU debuglink data. 

In case GNU debuglink data is followed the true\+\_\+pathbuf content will not match path. The path actually used is copied to true\+\_\+path\+\_\+out.

In the case of Mac\+OS d\+SYM the true\+\_\+path\+\_\+out may not match path.

If debuglink data is missing from the Elf executable or shared-\/object (ie, it is a normal object!) or unusable by libdwarf or true\+\_\+path\+\_\+buffer len is zero or true\+\_\+path\+\_\+out\+\_\+buffer is zero libdwarf accepts the path given as the object to report on, no debuglink or d\+SYM processing will be used.

\begin{DoxySeeAlso}{See also}
\href{https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html}{\texttt{https:\+/\+/\+sourceware.\+org/\+gdb/\+onlinedocs/\+gdb/\+\+Separate-\/\+Debug-\/\+Files.\+html}}
\end{DoxySeeAlso}
An example calling \doxylink{group__initfunctions_ga8f0107a24ee3013be3f4853295800ff4}{dwarf\+\_\+init\+\_\+path\+\_\+dl()} and dwarf\+\_\+finish()


\begin{DoxyParams}{Parameters}
{\em path} & Path to an object we wish to open. \\
\hline
{\em groupnumber} & Desired groupnumber. Use DW\+\_\+\+DW\+\_\+\+GROUPNUMBER\+\_\+\+ANY unless you have reason to do otherwise. \\
\hline
{\em error} & A pointer we can use to record error details. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the applicable result. DW\+\_\+\+DLV\+\_\+\+OK etc.
\end{DoxyReturn}

\begin{DoxyCode}{0}
\DoxyCodeLine{*/}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ exampleinit\_dl(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keywordtype}{unsigned}\ groupnumber,}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\_Error}}\ *error)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{char}\ true\_pathbuf[FILENAME\_MAX];}
\DoxyCodeLine{\ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *glpath[3]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}/usr/local/debug"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}/usr/local/private/debug"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}/usr/local/libdwarf/debug"{}}}
\DoxyCodeLine{\ \ \ \ \};}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordtype}{unsigned}\ \ \ \ \ \ tpathlen\ =\ FILENAME\_MAX;}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_ga6de1c2929cebfae36804315f7232cb19}{Dwarf\_Handler}}\ errhand\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__basicdatatypes_ga376c1939313af42401fc67bc998fdd2c}{Dwarf\_Ptr}}\ \ \ \ \ errarg\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\_Debug}}\ \ \ dbg\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ res\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ path\_source\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ res\ =\ \doxymbox{\hyperlink{group__initfunctions_ga8f0107a24ee3013be3f4853295800ff4}{dwarf\_init\_path\_dl}}(path,true\_pathbuf,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ tpathlen,groupnumber,errhand,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ errarg,\&dbg,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ (\textcolor{keywordtype}{char}\ **)glpath,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ 3,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \&path\_source,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ error);}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}\ (res\ ==\ DW\_DLV\_ERROR)\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ \ We\ are\ not\ returning\ dbg,\ so\ we\ must\ do:}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ dwarf\_dealloc\_error(dbg,*error);}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ here\ to\ free\ the\ error\ details.\ }}

\end{DoxyCode}
