\doxysection{Attaching a tied dbg }
\hypertarget{group__example2}{}\label{group__example2}\index{Attaching a tied dbg@{Attaching a tied dbg}}


Example attaching base dbg to a split-\/\+DWARF object.  


Example attaching base dbg to a split-\/\+DWARF object. 

See DWARF5 Appendix F on Split-\/\+DWARF.

By libdwarf convention, open the split \doxylink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug} using a dwarf\+\_\+init call. Then open the executable as the tied object. Then call \doxylink{group__initfunctions_ga4d7ccb86c49acbff43dc0fe2ad87068e}{dwarf\+\_\+set\+\_\+tied\+\_\+dbg()} so the library can look for relevant data in the tied-\/dbg (the executable).

With split dwarf your libdwarf calls after the the initial open are done against the split Dwarf\+\_\+\+Dbg and libdwarf automatically looks in the tied dbg when and as appropriate. the tied\+\_\+dbg can be detached too, see example3 link, though you must call dwarf\+\_\+finish() on the detached dw\+\_\+tied\+\_\+dbg, the library will not do that for you.


\begin{DoxyParams}{Parameters}
{\em split\+\_\+dbg} & \\
\hline
{\em tied\+\_\+dbg} & \\
\hline
{\em error} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns DW\+\_\+\+DLV\+\_\+\+OK or DW\+\_\+\+DLV\+\_\+\+ERROR or DW\+\_\+\+DLV\+\_\+\+NO\+\_\+\+ENTRY to the caller.
\end{DoxyReturn}

\begin{DoxyCode}{0}
\DoxyCodeLine{*/}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ example2(\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\_Debug}}\ split\_dbg,\ \doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\_Debug}}\ tied\_dbg,}
\DoxyCodeLine{\ \ \ \ \doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\_Error}}\ *error)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordtype}{int}\ res\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \textcolor{comment}{/*\ \ The\ caller\ should\ have\ opened\ dbg}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ on\ the\ split-\/dwarf\ object/dwp,}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ an\ object\ with\ DWARF,\ but\ no\ executable}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ code.}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ And\ it\ should\ have\ opened\ tieddbg\ on\ the}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ runnable\ shared\ object\ or\ executable.\ }}

\end{DoxyCode}
