SGI Techpubs Library

IRIX 6.5  »  Man Pages
find in page



     libelfutil - Library for xlate sections and leb128 numbers


     #include <libXlate.h>
     #include <cmplrs/leb128.h>


     This library is a collection of functions that can be divided into
     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 address 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 on this man page 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
     want to know, for a transformed executable or DSO, what given
     execution time addresses were in the original program text (executable
     instructions).  Or that want 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).

     The following code ignores return values to keep the examples small.

     The following 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,
          for(pc = startpc; pc <endpc; pc += 4)
               Elf64_Addr oldaddress;
               xlate_Block range;
                  result = xlate_address(contable,
      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.

     The following 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,
               &totalmemory, &numblocks);
          for(i = 0; i < numblocks; ++i)
               result = xlate_pro_disk_next_block(protable,
               /* do something with datasize bytes at address 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.




     xlate_init_fd(3E), xlate_pro_init(3E)


home/search | what's new | help