Changeset 2e97351 in rtems-tools


Ignore:
Timestamp:
Apr 3, 2016, 5:38:14 AM (3 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, master
Children:
8dc2772
Parents:
0c0b2d4
Message:

rtemstoolkit: Add an address table of symbols key by the symbol address.

This is useful if you need to look up a symbol based on its address.

Location:
rtemstoolkit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/rld-symbols.cpp

    r0c0b2d4 r2e97351  
    363363
    364364    void
     365    table::globals (addrtab& addresses)
     366    {
     367      for (symtab::iterator gi = globals_.begin ();
     368           gi != globals_.end ();
     369           ++gi)
     370      {
     371        symbol& sym = *((*gi).second);
     372        addresses[sym.value ()] = (*gi).second;
     373      }
     374    }
     375
     376    void
     377    table::weaks (addrtab& addresses)
     378    {
     379      for (symtab::iterator wi = weaks_.begin ();
     380           wi != weaks_.end ();
     381           ++wi)
     382      {
     383        symbol& sym = *((*wi).second);
     384        addresses[sym.value ()] = (*wi).second;
     385      }
     386    }
     387
     388    void
     389    table::locals (addrtab& addresses)
     390    {
     391      for (symtab::iterator li = locals_.begin ();
     392           li != locals_.end ();
     393           ++li)
     394      {
     395        symbol& sym = *((*li).second);
     396        addresses[sym.value ()] = (*li).second;
     397      }
     398    }
     399
     400    void
    365401    load (bucket& bucket_, table& table_)
    366402    {
  • rtemstoolkit/rld-symbols.h

    r0c0b2d4 r2e97351  
    4646  {
    4747    /**
     48     * Use a local type for the address.
     49     */
     50    typedef elf::elf_addr address;
     51
     52    /**
    4853     * A symbol.
    4954     */
     
    206211
    207212    /**
     213     * An address table is a map container of symbols based on address. Should
     214     * always point to symbols held in a bucket.
     215     */
     216    typedef std::map < address, symbol* > addrtab;
     217
     218    /**
    208219     * A symbols contains a symbol table of global, weak and local symbols.
    209220     */
     
    270281       */
    271282      const symtab& locals () const;
     283
     284      /**
     285       * Return the globals symbol table keyed by address.
     286       */
     287      void globals (addrtab& addresses);
     288
     289      /**
     290       * Return the weak symbol table keyed by address.
     291       */
     292      void weaks (addrtab& addresses);
     293
     294      /**
     295       * Return the local symbol table keyed by address.
     296       */
     297      void locals (addrtab& addresses);
    272298
    273299    private:
Note: See TracChangeset for help on using the changeset viewer.