public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug shlibs/28236] New: Don't assume r_ldsomap if r_version > 1 in debugger interface
@ 2021-08-16 22:08 hjl.tools at gmail dot com
  2021-08-17  3:31 ` [Bug shlibs/28236] " carlos at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-16 22:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28236

            Bug ID: 28236
           Summary: Don't assume r_ldsomap if r_version > 1 in debugger
                    interface
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: shlibs
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

There are

static CORE_ADDR
solib_svr4_r_ldsomap (struct svr4_info *info)
{
  struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
  enum bfd_endian byte_order = type_byte_order (ptr_type);
  ULONGEST version = 0;

  try
    {
      /* Check version, and return zero if `struct r_debug' doesn't have
         the r_ldsomap member.  */
      version
        = read_memory_unsigned_integer (info->debug_base +
lmo->r_version_offset,
                                        lmo->r_version_size, byte_order);
    }
  catch (const gdb_exception_error &ex)
    {
      exception_print (gdb_stderr, ex);
    }

  if (version < 2 || lmo->r_ldsomap_offset == -1)
    return 0;

  return read_memory_typed_address (info->debug_base + lmo->r_ldsomap_offset,
                                    ptr_type);
}

glibc is planning to bump r_version to support multiple namespaces.  But
there is no r_ldsomap when r_version is bumped to 2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug shlibs/28236] Don't assume r_ldsomap if r_version > 1 in debugger interface
  2021-08-16 22:08 [Bug shlibs/28236] New: Don't assume r_ldsomap if r_version > 1 in debugger interface hjl.tools at gmail dot com
@ 2021-08-17  3:31 ` carlos at redhat dot com
  2021-08-17 14:14 ` hjl.tools at gmail dot com
  2021-08-17 14:15 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: carlos at redhat dot com @ 2021-08-17  3:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28236

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to H.J. Lu from comment #0)
> glibc is planning to bump r_version to support multiple namespaces.  But
> there is no r_ldsomap when r_version is bumped to 2.

Agreed. The r_ldsomap is only present in Solaris (part of librtld_db), and
should never be accessed for Linux. The entire layout of r_debug is
OS-specific.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug shlibs/28236] Don't assume r_ldsomap if r_version > 1 in debugger interface
  2021-08-16 22:08 [Bug shlibs/28236] New: Don't assume r_ldsomap if r_version > 1 in debugger interface hjl.tools at gmail dot com
  2021-08-17  3:31 ` [Bug shlibs/28236] " carlos at redhat dot com
@ 2021-08-17 14:14 ` hjl.tools at gmail dot com
  2021-08-17 14:15 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-17 14:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28236

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.1

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GDB 12 by

commit c0154a4a21a3aed01ef53877af05cf0109a0b124
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 16 16:17:25 2021 -0700

    gdb: Don't assume r_ldsomap when r_version > 1 on Linux

    The r_ldsomap field is specific to Solaris (part of librtld_db), and
    should never be accessed for Linux.  glibc is planning to add a field
    to support multiple namespaces.  But there will be no r_ldsomap when
    r_version is bumped to 2.  Add linux_[ilp32|lp64]_fetch_link_map_offsets
    to set r_ldsomap_offset to -1 and use them for Linux targets.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28236

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug shlibs/28236] Don't assume r_ldsomap if r_version > 1 in debugger interface
  2021-08-16 22:08 [Bug shlibs/28236] New: Don't assume r_ldsomap if r_version > 1 in debugger interface hjl.tools at gmail dot com
  2021-08-17  3:31 ` [Bug shlibs/28236] " carlos at redhat dot com
  2021-08-17 14:14 ` hjl.tools at gmail dot com
@ 2021-08-17 14:15 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-17 14:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28236

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-08-17 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 22:08 [Bug shlibs/28236] New: Don't assume r_ldsomap if r_version > 1 in debugger interface hjl.tools at gmail dot com
2021-08-17  3:31 ` [Bug shlibs/28236] " carlos at redhat dot com
2021-08-17 14:14 ` hjl.tools at gmail dot com
2021-08-17 14:15 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).