\doxysection{Ranges:\+ code addresses in DWARF3-\/4 }
\hypertarget{group__ranges}{}\label{group__ranges}\index{Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
DW\+\_\+\+API int \doxymbox{\hyperlink{group__ranges_ga8d1463e2701e8b224335a144c5740b88}{dwarf\+\_\+get\+\_\+ranges\+\_\+b}} (\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}} dw\+\_\+dbg, \doxymbox{\hyperlink{group__basicdatatypes_ga08c706887ae8c6e09e8f0fb5dd9a539e}{Dwarf\+\_\+\+Off}} dw\+\_\+rangesoffset, \doxymbox{\hyperlink{group__allstructs_ga3a3759c3047d78dba9f590d5e5893be5}{Dwarf\+\_\+\+Die}} dw\+\_\+die, \doxymbox{\hyperlink{group__basicdatatypes_ga08c706887ae8c6e09e8f0fb5dd9a539e}{Dwarf\+\_\+\+Off}} \texorpdfstring{$\ast$}{*}dw\+\_\+return\+\_\+realoffset, \doxymbox{\hyperlink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\+\_\+\+Ranges}} \texorpdfstring{$\ast$}{*}\texorpdfstring{$\ast$}{*}dw\+\_\+rangesbuf, \doxymbox{\hyperlink{group__basicdatatypes_gac91d9490d58c8d86a4d5b63ca93ba6dd}{Dwarf\+\_\+\+Signed}} \texorpdfstring{$\ast$}{*}dw\+\_\+rangecount, \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}dw\+\_\+bytecount, \doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\+\_\+\+Error}} \texorpdfstring{$\ast$}{*}dw\+\_\+error)
\begin{DoxyCompactList}\small\item\em Access to code ranges from a CU or just reading through the raw .debug\+\_\+ranges section. \end{DoxyCompactList}\item 
DW\+\_\+\+API void \doxymbox{\hyperlink{group__ranges_ga16a5e78cb8b8f7dadd9be6b3f921e298}{dwarf\+\_\+dealloc\+\_\+ranges}} (\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}} dw\+\_\+dbg, \doxymbox{\hyperlink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\+\_\+\+Ranges}} \texorpdfstring{$\ast$}{*}dw\+\_\+rangesbuf, \doxymbox{\hyperlink{group__basicdatatypes_gac91d9490d58c8d86a4d5b63ca93ba6dd}{Dwarf\+\_\+\+Signed}} dw\+\_\+rangecount)
\begin{DoxyCompactList}\small\item\em Dealloc the array dw\+\_\+rangesbuf. \end{DoxyCompactList}\item 
DW\+\_\+\+API int \doxymbox{\hyperlink{group__ranges_ga59888eaf32d05ee39556fe7e271a3baf}{dwarf\+\_\+get\+\_\+ranges\+\_\+baseaddress}} (\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}} dw\+\_\+dbg, \doxymbox{\hyperlink{group__allstructs_ga3a3759c3047d78dba9f590d5e5893be5}{Dwarf\+\_\+\+Die}} dw\+\_\+die, \doxymbox{\hyperlink{group__basicdatatypes_ga32afecc94a71aae2be36aa279f1dded8}{Dwarf\+\_\+\+Bool}} \texorpdfstring{$\ast$}{*}dw\+\_\+known\+\_\+base, \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}dw\+\_\+baseaddress, \doxymbox{\hyperlink{group__basicdatatypes_ga32afecc94a71aae2be36aa279f1dded8}{Dwarf\+\_\+\+Bool}} \texorpdfstring{$\ast$}{*}dw\+\_\+at\+\_\+ranges\+\_\+offset\+\_\+present, \doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}dw\+\_\+at\+\_\+ranges\+\_\+offset, \doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\+\_\+\+Error}} \texorpdfstring{$\ast$}{*}dw\+\_\+error)
\begin{DoxyCompactList}\small\item\em Find ranges base address. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
In DWARF3 and DWARF4 the DW\+\_\+\+AT\+\_\+ranges attribute provides an offset into the .debug\+\_\+ranges section, which contains code address ranges.

\begin{DoxySeeAlso}{See also}
\doxylink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\+\_\+\+Ranges}
\end{DoxySeeAlso}
DWARF3 and DWARF4. DW\+\_\+\+AT\+\_\+ranges with an unsigned constant FORM (DWARF3) or DW\+\_\+\+FORM\+\_\+sec\+\_\+offset(\+DWARF4). 

\label{doc-func-members}
\Hypertarget{group__ranges_doc-func-members}
\doxysubsection{Function Documentation}
\Hypertarget{group__ranges_ga16a5e78cb8b8f7dadd9be6b3f921e298}\index{Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}!dwarf\_dealloc\_ranges@{dwarf\_dealloc\_ranges}}
\index{dwarf\_dealloc\_ranges@{dwarf\_dealloc\_ranges}!Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}}
\doxysubsubsection{\texorpdfstring{dwarf\_dealloc\_ranges()}{dwarf\_dealloc\_ranges()}}
{\footnotesize\ttfamily \label{group__ranges_ga16a5e78cb8b8f7dadd9be6b3f921e298} 
DW\+\_\+\+API void dwarf\+\_\+dealloc\+\_\+ranges (\begin{DoxyParamCaption}\item[{\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}}}]{dw\+\_\+dbg}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\+\_\+\+Ranges}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+rangesbuf}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_gac91d9490d58c8d86a4d5b63ca93ba6dd}{Dwarf\+\_\+\+Signed}}}]{dw\+\_\+rangecount}{}\end{DoxyParamCaption})}



Dealloc the array dw\+\_\+rangesbuf. 


\begin{DoxyParams}{Parameters}
{\em dw\+\_\+dbg} & The \doxylink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug} of interest. \\
\hline
{\em dw\+\_\+rangesbuf} & The dw\+\_\+rangesbuf pointer returned by dwarf\+\_\+get\+\_\+ranges\+\_\+b \\
\hline
{\em dw\+\_\+rangecount} & The dw\+\_\+rangecount returned by dwarf\+\_\+get\+\_\+ranges\+\_\+b \\
\hline
\end{DoxyParams}
\Hypertarget{group__ranges_ga8d1463e2701e8b224335a144c5740b88}\index{Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}!dwarf\_get\_ranges\_b@{dwarf\_get\_ranges\_b}}
\index{dwarf\_get\_ranges\_b@{dwarf\_get\_ranges\_b}!Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}}
\doxysubsubsection{\texorpdfstring{dwarf\_get\_ranges\_b()}{dwarf\_get\_ranges\_b()}}
{\footnotesize\ttfamily \label{group__ranges_ga8d1463e2701e8b224335a144c5740b88} 
DW\+\_\+\+API int dwarf\+\_\+get\+\_\+ranges\+\_\+b (\begin{DoxyParamCaption}\item[{\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}}}]{dw\+\_\+dbg}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga08c706887ae8c6e09e8f0fb5dd9a539e}{Dwarf\+\_\+\+Off}}}]{dw\+\_\+rangesoffset}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga3a3759c3047d78dba9f590d5e5893be5}{Dwarf\+\_\+\+Die}}}]{dw\+\_\+die}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga08c706887ae8c6e09e8f0fb5dd9a539e}{Dwarf\+\_\+\+Off}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+return\+\_\+realoffset}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga8795eafc9a070029c4d121decf6f8b82}{Dwarf\+\_\+\+Ranges}} \texorpdfstring{$\ast$}{*}\texorpdfstring{$\ast$}{*}}]{dw\+\_\+rangesbuf}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_gac91d9490d58c8d86a4d5b63ca93ba6dd}{Dwarf\+\_\+\+Signed}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+rangecount}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+bytecount}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\+\_\+\+Error}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+error}{}\end{DoxyParamCaption})}



Access to code ranges from a CU or just reading through the raw .debug\+\_\+ranges section. 

Adds return of the dw\+\_\+realoffset to accommodate DWARF4 GNU split-\/dwarf, where the ranges could be in the tieddbg (meaning the real executable, a.\+out, not in a dwp). DWARF4 split-\/dwarf is an extension, not standard DWARF4.

If printing all entries in the section pass in an initial dw\+\_\+rangesoffset of zero and dw\+\_\+die of NULL. Then increment dw\+\_\+rangesoffset by dw\+\_\+bytecount and call again to get the next batch of ranges. With a specific option dwarfdump can do this. This not a normal thing to do!

\begin{DoxySeeAlso}{See also}
\doxylink{group__examplev}{Example getting .\+debug\+\_\+ranges data}
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
{\em dw\+\_\+dbg} & The \doxylink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug} of interest \\
\hline
{\em dw\+\_\+rangesoffset} & The offset to read from in the section. \\
\hline
{\em dw\+\_\+die} & Pass in the DIE whose DW\+\_\+\+AT\+\_\+ranges brought us to ranges. \\
\hline
{\em dw\+\_\+return\+\_\+realoffset} & The actual offset in the section actually read. In a tieddbg dwp DWARF4 extension object the base offset is added to dw\+\_\+rangesoffset and returned here. \\
\hline
{\em dw\+\_\+rangesbuf} & A pointer to an array of structs is returned here. The struct contents are the raw values in the section. \\
\hline
{\em dw\+\_\+rangecount} & The count of structs in the array is returned here. \\
\hline
{\em dw\+\_\+bytecount} & The number of bytes in the .debug\+\_\+ranges section applying to the returned array. This makes possible just marching through the section by offset. \\
\hline
{\em dw\+\_\+error} & The usual error detail return pointer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns DW\+\_\+\+DLV\+\_\+\+OK etc. 
\end{DoxyReturn}
\Hypertarget{group__ranges_ga59888eaf32d05ee39556fe7e271a3baf}\index{Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}!dwarf\_get\_ranges\_baseaddress@{dwarf\_get\_ranges\_baseaddress}}
\index{dwarf\_get\_ranges\_baseaddress@{dwarf\_get\_ranges\_baseaddress}!Ranges: code addresses in DWARF3-\/4@{Ranges: code addresses in DWARF3-\/4}}
\doxysubsubsection{\texorpdfstring{dwarf\_get\_ranges\_baseaddress()}{dwarf\_get\_ranges\_baseaddress()}}
{\footnotesize\ttfamily \label{group__ranges_ga59888eaf32d05ee39556fe7e271a3baf} 
DW\+\_\+\+API int dwarf\+\_\+get\+\_\+ranges\+\_\+baseaddress (\begin{DoxyParamCaption}\item[{\doxymbox{\hyperlink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug}}}]{dw\+\_\+dbg}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga3a3759c3047d78dba9f590d5e5893be5}{Dwarf\+\_\+\+Die}}}]{dw\+\_\+die}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga32afecc94a71aae2be36aa279f1dded8}{Dwarf\+\_\+\+Bool}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+known\+\_\+base}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+baseaddress}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga32afecc94a71aae2be36aa279f1dded8}{Dwarf\+\_\+\+Bool}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+at\+\_\+ranges\+\_\+offset\+\_\+present}{, }\item[{\doxymbox{\hyperlink{group__basicdatatypes_ga5de64bb9627534a24dcbccc327916265}{Dwarf\+\_\+\+Unsigned}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+at\+\_\+ranges\+\_\+offset}{, }\item[{\doxymbox{\hyperlink{group__allstructs_ga8d4fac0e48040b6ca91e06ffda09766a}{Dwarf\+\_\+\+Error}} \texorpdfstring{$\ast$}{*}}]{dw\+\_\+error}{}\end{DoxyParamCaption})}



Find ranges base address. 

The function allows callers to calculate actual address from .debug\+\_\+ranges data in a simple and efficient way by returning the CU DIE ranges baseaddress.


\begin{DoxyParams}{Parameters}
{\em dw\+\_\+dbg} & The \doxylink{group__allstructs_gac2ba1e1c1b70a3191506b414195ca807}{Dwarf\+\_\+\+Debug} of interest. \\
\hline
{\em dw\+\_\+die} & Pass in any non-\/null valid \doxylink{group__allstructs_ga3a3759c3047d78dba9f590d5e5893be5}{Dwarf\+\_\+\+Die} to find the applicable .debug\+\_\+ranges base address. The dw\+\_\+die need not be a CU-\/\+DIE. A null dw\+\_\+die is allowed. \\
\hline
{\em dw\+\_\+known\+\_\+base} & if dw\+\_\+die is non-\/null and there is a known base address for the CU DIE that (a DW\+\_\+at\+\_\+low\+\_\+pc in the CU DIE) dw\+\_\+known\+\_\+base will be set TRUE, Otherwise the value FALSE will be returned through dw\+\_\+known\+\_\+base. \\
\hline
{\em dw\+\_\+baseaddress} & if dw\+\_\+known\+\_\+base is returned as TRUE then dw\+\_\+baseaddress will be set with the correct pc value. Otherwise zero will be set through dw\+\_\+baseaddress. \\
\hline
{\em dw\+\_\+at\+\_\+ranges\+\_\+offset\+\_\+present} & Set to 1 (TRUE) if dw\+\_\+die has the attribute DW\+\_\+\+AT\+\_\+ranges. \\
\hline
{\em dw\+\_\+at\+\_\+ranges\+\_\+offset} & Set to the value of DW\+\_\+\+AT\+\_\+ranges attribute of dw\+\_\+die if dw\+\_\+at\+\_\+ranges\+\_\+offset\+\_\+present was set to TRUE. The offset is of the beginning of the .debug\+\_\+ranges section range lists applying to this DIE. \\
\hline
{\em dw\+\_\+error} & The usual error detail return pointer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns DW\+\_\+\+DLV\+\_\+\+OK or DW\+\_\+\+DLV\+\_\+\+ERROR. Never returns DW\+\_\+\+DLV\+\_\+\+NO\+\_\+\+ENTRY. 
\end{DoxyReturn}
