49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe/*
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe dwarf_addr_finder.h
07dc1947c362e187fb955d283b692f8769dd5defRichard Lowe $Source: /plroot/cmplrs.src/v7.4.5m/.RCS/PL/include/cmplrs/RCS/dwarf_addr_finder.h,v $
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe $Date: 2002/06/11 17:49:06 $
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Defines user interface.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe*/
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe/* return codes for functions
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe*/
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_DLV_NO_ENTRY -1
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_DLV_OK 0
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_DLV_ERROR 1
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe/* the following are the 'section' number passed to the called-back
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe function.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe The called-back application must translate this to the
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe appropriate elf section number/pointer.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Putting this burden on the application avoids having to store
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe the numbers in the Dwarf_Debug structure (thereby saving space
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe for most consumers).
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe*/
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_SECTION_INFO 0
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_SECTION_FRAME 1
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_SECTION_ARANGES 2
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_SECTION_LINE 3
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe#define DW_SECTION_LOC 4 /* .debug_loc */
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe/* section is one of the above codes: it specifies a section.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe secoff is the offset in the dwarf section.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe existingAddr is the value at the specified offset (so the
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe called back routine can sanity check the proceedings).
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe It's up to the caller to know the size of an address (4 or 8)
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe and update the right number of bytes.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe*/
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowetypedef int (*Dwarf_addr_callback_func) (int /*section*/,
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Dwarf_Off /*secoff*/, Dwarf_Addr /*existingAddr*/);
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe/* call this to do the work: it calls back thru cb_func
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe once per each address to be modified.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Once this returns you are done.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Returns DW_DLV_OK if finished ok.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Returns DW_DLV_ERROR if there was some kind of error, in which
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe the dwarf error number was passed back thu the dwerr ptr.
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Returns DW_DLV_NO_ENTRY if there are no relevant dwarf sections,
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe so there were no addresses to be modified (and none
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe called back).
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe*/
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Loweint _dwarf_addr_finder(dwarf_elf_handle elf_file_ptr,
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe Dwarf_addr_callback_func cb_func,
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe int *dwerr);
49d3bc91e27cd871b950d56c01398fa2f2e12ab4Richard Lowe