Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7631579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:23:25+00:00 2026-05-31T06:23:25+00:00

I’ve opened a shread library with lt_dlopen and would like to search the list

  • 0

I’ve opened a shread library with lt_dlopen and would like to search the list of exported symbols for those matching a specific pattern (the name of the function matches the pattern).

Is there any simple way to do this? Either search by pattern, or just get a list of all exported named. By simple I mean without a special library just for loading symbols.

The main program and library is C++ but all symbols will be extern "C".

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:23:27+00:00Added an answer on May 31, 2026 at 6:23 am

    You can follow the recipe outlined in this article just that, if you’re accessing symbols within our own address space / from a library you loaded via dlopen() is much simpler:

    1. The “struct link_map*” you obtain by reinterpret_cast<struct link_map*>(dlopen(...)); – so no need to parse “your own ELF”. See the sourcecode for __dlopen().
    2. You don’t need to use ptrace() to read from your own address space – just cast the pointers directly.

    I’ll illustrate the 2nd for finding the symbol table address:

    struct link_map *map = reinterpret_cast<struct link_map*>(dlopen(...));
    int nchains = 0;
    Elf32_Dyn *dyn = static_cast<Elf32_Dyn*>(map->l_ld);
    Elf32_Sym *symtab = NULL;
    char *strtab = NULL;
    
    while (dyn->d_tag) {
        switch (dyn->d_tag) {
        case DT_HASH:
            nchains = *static_cast<int*>(dyn->d_un.d_ptr + map->l_addr + 4);
            break;
        case DT_SYM:
            symtab = static_cast<Elf32_Sym*>(dyn->d_un.d_ptr);
            break;
        case DT_STR:
            strtab = static_cast<char*>(dyn->d_un.d_ptr);
            break;
        default:
            break;
        }
        dyn++;
    }
    

    This is an in-memory equivalent of the resolv_tables() function in the article I linked to. Converting the find_sym_in_tables() to a pattern-search through your own address space is left as an exercise to the reader.

    Note that this is Linux-specific (dlopen() returning a struct link_map*). For other systems, the technique should work as long as this condition is met (and they’re using ELF).

    Edit: This is for 32bit ELF; if you’re using 64bit, data types change (Elf64_Sym / Elf64_Dyn and 64bit integers for the table size I think). I’m sure this can be abstracted (the glibc sources do so …), it just doesn’t make the code easy to read anymore. Again, I leave it as exercise to the reader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to write an AS3 program to search for a certain keyword in
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.