libelfutil(5)
libelfutil - library for xlate sections and leb128 numbers.
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME libelfutil - library for xlate sections and leb128 numbers. SYNOPSIS #include <libXlate.h> #include <cmplrs/leb128.h> DESCRIPTION This library is a collection of functions which are perhaps best thought of as three groups: the xlate functions used to create and access the .MIPS.xlate and related sections, the leb128 functions, and a disassembly function (undocumented). The following is a description of the xlate routines. The xlate routines are used to create and access addresses translation data as described in xlate(4). Calls used to create address translation data are called "producer" calls. Calls used to create applications that read the address translation data are called "consumer" calls. Use -lelfutil -lelf on the link command line to link in libelfutil. All call interfaces described here pass and return values sufficient for both 32 and 64 bit executables and DSOs. On disk the data format is slightly different for 32 and 64 bit executables and DSOs but there is only one library interface. xlate Consumer Interface The xlate consumer interface is used by debuggers and other tools that wish to know, for a transformed executable or DSO, what given execution time addresses were in the original program text (executable instructions). Or that wish to know, for a given address taken from the debugging information, what address this represents in the transformed text (the debugging information is not changed by transformations, so the debugging information give addresses which are not identical to the executing transformed text). All code here ignores return values to keep the examples small. This example gets the untransformed address for a range of transformed addresses. int result; xlate_table_con contable = 0; xlate_block range; result = xlate_init_fd(myopenfd, XLATE_OPEN_STD_TABLE,&contable); for(pc = startpc; pc <endpc; pc += 4) { Elf64_Addr oldaddress; xlate_Block range; result = xlate_address(contable, XLATE_ADDRESS_INPUT_NEW_ADDRESS, pc,&oldaddress,&range); ...do something useful here... } result = xlate_finish(contable); xlate Producer Interface The xlate producer interface is used by transforming applications (like cord(1) and pixie(1)) to register the transformations so other tools (like dbx(1)) can, at execution time, use the Consumer Interface to help the tool user understand the transformed text. This example records a trivial transformation and gets back the transformed bytes. int result; xlate_table_con contable = 0; xlate_table_pro protable = 0; result = xlate_pro_init(&protable,xlate_tk_general,contable, /*is64bit= */0); /* the single transformation */ result = xlate_pro_add_range(protable,newpc,newrange, oldpc, oldrange); result = xlate_pro_disk_header(protable, XLATE_PRO_STANDARD_SETUP, &totalmemory, &numblocks); for(i = 0; i < numblocks; ++i) { result = xlate_pro_disk_next_block(protable, &data,&datasize); /* do something with datasize bytes at address data */ free(data); } result = xlate_pro_finish(protable); You must install the compiler_eoe.hdr.internal subsystem to get the headers necessary to work with the xlate functions and leb128 functions they call. FILES /usr/include/libXlate.h /usr/include/cmplrs/xlate.h /usr/include/elf.h /usr/include/dwarf.h /usr/include/libdwarf.h /usr/lib/libelfutil.a SEE ALSO xlate(4), xlate_init_fd(3e), xlate_pro_init(3e)