libdwarf
Using dwarf_srclines_b() and linecontext

Example two using dwarf_srclines_b()

See also
dwarf_srclines_b
dwarf_srclines_from_linecontext
dwarf_srclines_dealloc_b
*/
int exampled(Dwarf_Die somedie,Dwarf_Error *error)
{
Dwarf_Signed count = 0;
Dwarf_Line_Context context = 0;
Dwarf_Line *linebuf = 0;
Dwarf_Signed i = 0;
Dwarf_Line *line;
Dwarf_Small table_count =0;
Dwarf_Unsigned version = 0;
int sres = 0;
sres = dwarf_srclines_b(somedie,
&version, &table_count,&context,error);
if (sres != DW_DLV_OK) {
return sres;
}
&linebuf,&count,error);
if (sres != DW_DLV_OK) {
return sres;
}
line = linebuf;
for (i = 0; i < count; ++line,++i) {
/* use line */
}
return DW_DLV_OK;
}
struct Dwarf_Die_s * Dwarf_Die
Definition: libdwarf.h:608
struct Dwarf_Line_s * Dwarf_Line
Definition: libdwarf.h:619
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:597
struct Dwarf_Line_Context_s * Dwarf_Line_Context
Definition: libdwarf.h:697
unsigned char Dwarf_Small
Definition: libdwarf.h:204
signed long long Dwarf_Signed
Definition: libdwarf.h:197
unsigned long long Dwarf_Unsigned
Definition: libdwarf.h:196
void dwarf_srclines_dealloc_b(Dwarf_Line_Context dw_context)
Dealloc the memory allocated by dwarf_srclines_b.
int dwarf_srclines_b(Dwarf_Die dw_cudie, Dwarf_Unsigned *dw_version_out, Dwarf_Small *dw_table_count, Dwarf_Line_Context *dw_linecontext, Dwarf_Error *dw_error)
Initialize Dwarf_Line_Context for line table access.
int dwarf_srclines_from_linecontext(Dwarf_Line_Context dw_linecontext, Dwarf_Line **dw_linebuf, Dwarf_Signed *dw_linecount, Dwarf_Error *dw_error)
Access source lines from line context.