Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* solist - internals: when ldd is in libc
@ 2008-08-15 18:27 Aleksandar Ristovski
  2008-08-15 20:28 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Aleksandar Ristovski @ 2008-08-15 18:27 UTC (permalink / raw)
  To: gdb

Hello,


I have a question regarding the internals. We (qnx) have ldd in libc; qnx target is svr4, so we use solib-svr4; ldd is not listed in the process' link map. ldd lives in libc, but in .interp section it is called "ldqnx.so.2". Physically, ldqnx.so.2 is a softlink to real libc.so.2 (libc.so.3).

When GDB tries to determines current_sos before any shared object is loaded, it will call svr4_default_sos, which, in turn, will create "artificial" ldqnx entry in the gdb's so_list based on .interp name.

The problem: when the "real" libc is mapped, gdb will update_solib_list and determine that ldqnx is now missing from the inferior's linkmap and thus disable all the breakpoints set in it. I want to avoid disabling the breakpoints and let gdb "know" that newly mapped libc is, in fact, ldqnx mapped by default_sos; being one the same, all the resolved addresses for breakpoints are valid. 

And this is, finally, my question: is there a mechanism in gdb to handle such situation, or would supporting this scenario be a new feature?


Thank you,
Aleksandar Ristovski
QNX Software Systems


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: solist - internals: when ldd is in libc
  2008-08-15 18:27 solist - internals: when ldd is in libc Aleksandar Ristovski
@ 2008-08-15 20:28 ` Joel Brobecker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2008-08-15 20:28 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb

> And this is, finally, my question: is there a mechanism in gdb to handle 
> such situation, or would supporting this scenario be a new feature?

Would the same routine in the target_ops object be what you are looking
for? Specifically, it is set to the following function for svr4:

    /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent
       the same shared library.  */
    
    static int
    svr4_same_1 (const char *gdb_so_name, const char *inferior_so_name)
    {
      if (strcmp (gdb_so_name, inferior_so_name) == 0)
        return 1;
    
      /* On Solaris, when starting inferior we think that dynamic linker is
         /usr/lib/ld.so.1, but later on, the table of loaded shared libraries 
         contains /lib/ld.so.1.  Sometimes one file is a link to another, but 
         sometimes they have identical content, but are not linked to each
         other.  We don't restrict this check for Solaris, but the chances
         of running into this situation elsewhere are very low.  */
      if (strcmp (gdb_so_name, "/usr/lib/ld.so.1") == 0
          && strcmp (inferior_so_name, "/lib/ld.so.1") == 0)
        return 1;
    
      /* Similarly, we observed the same issue with sparc64, but with
         different locations.  */
      if (strcmp (gdb_so_name, "/usr/lib/sparcv9/ld.so.1") == 0
          && strcmp (inferior_so_name, "/lib/sparcv9/ld.so.1") == 0)
        return 1;
    
      return 0;
    }

-- 
Joel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-15 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15 18:27 solist - internals: when ldd is in libc Aleksandar Ristovski
2008-08-15 20:28 ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox