bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with dladdr()?


From: Bryce McKinlay
Subject: Problem with dladdr()?
Date: Thu, 05 Oct 2000 14:07:16 +1300

libgcj uses dladdr() in conjunction with addr2line in its implementation
of Throwable.printStackTrace():

if (dladdr (p, &dl_info))
  {
    strncpy (file_name, dl_info.dli_fname, sizeof file_name);
    strncpy (method_name, dl_info.dli_sname, sizeof method_name);
    return true;
  }
else
  {
     ... lookup p using addr2line ...
  }

Previously dladdr() would return 0 if the address argument came from
within the executable (rather than any .so), and the comment in dlfcn.h
appears to support this behaviour:

/* Fill in *INFO with the following information about ADDRESS.
   Returns 0 iff no shared object's segments contain that address.  */
                    ^^^^^^

however in Red Hat 7.0 (glibc-2.1.92-14), this seems to have changed
such that the dl_info struct is filled out with some incorrect values,
and 0 is not returned:

(gdb) p p
$2 = (void *) 0x804b90b
(gdb) p dl_info
$1 = {dli_fname = 0xbffffb6d "/home/bryce/projects/tests/./st",
  dli_fbase = 0x8048000, dli_sname = 0x80488b7 "__frame_state_for",
  dli_saddr = 0x804b6d0}

dli_sname and dli_saddr are wrong here, and shouldn't dli_fbase be 0?

  [ bryce ]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]