]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/solib: adjust info linker-namespaces/sharedlibrary format
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 23 Jul 2025 18:11:39 +0000 (14:11 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 22 Aug 2025 14:45:47 +0000 (10:45 -0400)
commit8a729432af7fe9e9f07036e2d0a5c66439de8bf9
treecc224eee8aaaf5d71179c57a6756e87cba6b1442
parentfcdc6c5aff198140e0e2c8b94eef48d340e04dbc
gdb/solib: adjust info linker-namespaces/sharedlibrary format

I would like to propose some minor changes to the format of "info linker
namespaces" and "info sharedlibrary", to make it a bit tidier and less
chatty.

Here are the current formats (I replaced empty lines with dots, so that
git doesn't collapse them):

    (gdb) info linker-namespaces
    There are 3 linker namespaces loaded
    There are 5 libraries loaded in linker namespace [[0]]
    Displaying libraries for linker namespace [[0]]:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /lib64/ld-linux-x86-64.so.2
    0x00007ffff7e94000  0x00007ffff7f8c000  Yes         /usr/lib/libm.so.6
    0x00007ffff7ca4000  0x00007ffff7e94000  Yes         /usr/lib/libc.so.6
    0x00007ffff7fad000  0x00007ffff7fb2000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fa8000  0x00007ffff7fad000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    .
    .
    There are 6 libraries loaded in linker namespace [[1]]
    Displaying libraries for linker namespace [[1]]:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fb7000  0x00007ffff7fbc000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fb2000  0x00007ffff7fb7000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7b79000  0x00007ffff7c71000  Yes         /usr/lib/libm.so.6
    0x00007ffff7989000  0x00007ffff7b79000  Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7f99000  0x00007ffff7f9e000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.2.so
    .
    .
    There are 5 libraries loaded in linker namespace [[2]]
    Displaying libraries for linker namespace [[2]]:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7fa3000  0x00007ffff7fa8000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7f9e000  0x00007ffff7fa3000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7891000  0x00007ffff7989000  Yes         /usr/lib/libm.so.6
    0x00007ffff76a1000  0x00007ffff7891000  Yes         /usr/lib/libc.so.6
    (gdb) info sharedlibrary
    From                To                  NS    Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  [[0]] Yes         /lib64/ld-linux-x86-64.so.2
    0x00007ffff7e94000  0x00007ffff7f8c000  [[0]] Yes         /usr/lib/libm.so.6
    0x00007ffff7ca4000  0x00007ffff7e94000  [[0]] Yes         /usr/lib/libc.so.6
    0x00007ffff7fb7000  0x00007ffff7fbc000  [[1]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fb2000  0x00007ffff7fb7000  [[1]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7b79000  0x00007ffff7c71000  [[1]] Yes         /usr/lib/libm.so.6
    0x00007ffff7989000  0x00007ffff7b79000  [[1]] Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  [[1]] Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7fad000  0x00007ffff7fb2000  [[0]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fa8000  0x00007ffff7fad000  [[0]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7fa3000  0x00007ffff7fa8000  [[2]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7f9e000  0x00007ffff7fa3000  [[2]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7891000  0x00007ffff7989000  [[2]] Yes         /usr/lib/libm.so.6
    0x00007ffff76a1000  0x00007ffff7891000  [[2]] Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  [[1]] Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7f99000  0x00007ffff7f9e000  [[1]] Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.2.so

Here is what I would change:

 - I find that the [[...]] notation used everywhere is heavy and noisy.
   I understand that this is the (proposed) notation for specifying a
   namespace id in an expression.  But I don't think it's useful to
   print those brackets everywhere (when it's obvious from the context
   that the number is a namespace id).  I would remove them from the
   messages and from the tables.

 - I find these lines a bit too verbose:

       There are X libraries loaded in linker namespace [[Y]]
       Displaying libraries for linker namespace [[Y]]:

   I think they can be condensed to a single line, without loss of
   information (I think that printing the number of libs in each
   namespace is not essential, but I don't really mind, so I left it
   there).

 - I would add an empty line after the "There are N linker namespaces
   loaded" message, to visually separate it from the first group.  I
   would also finish that line with a period.

 - There are two empty lines between each group I think that one empty
   line is sufficient to do a visual separation.

Here's how it looks with this patch:

    (gdb) info linker-namespaces
    There are 3 linker namespaces loaded.

    5 libraries loaded in linker namespace 0:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /lib64/ld-linux-x86-64.so.2
    0x00007ffff7e94000  0x00007ffff7f8c000  Yes         /usr/lib/libm.so.6
    0x00007ffff7ca4000  0x00007ffff7e94000  Yes         /usr/lib/libc.so.6
    0x00007ffff7fad000  0x00007ffff7fb2000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fa8000  0x00007ffff7fad000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so

    6 libraries loaded in linker namespace 1:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fb7000  0x00007ffff7fbc000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fb2000  0x00007ffff7fb7000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7b79000  0x00007ffff7c71000  Yes         /usr/lib/libm.so.6
    0x00007ffff7989000  0x00007ffff7b79000  Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7f99000  0x00007ffff7f9e000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.2.so

    5 libraries loaded in linker namespace 2:
    From                To                  Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7fa3000  0x00007ffff7fa8000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7f9e000  0x00007ffff7fa3000  Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7891000  0x00007ffff7989000  Yes         /usr/lib/libm.so.6
    0x00007ffff76a1000  0x00007ffff7891000  Yes         /usr/lib/libc.so.6
    (gdb) info shared
    From                To                  Linker NS Syms Read   Shared Object Library
    0x00007ffff7fc6000  0x00007ffff7fff000  0         Yes         /lib64/ld-linux-x86-64.so.2
    0x00007ffff7e94000  0x00007ffff7f8c000  0         Yes         /usr/lib/libm.so.6
    0x00007ffff7ca4000  0x00007ffff7e94000  0         Yes         /usr/lib/libc.so.6
    0x00007ffff7fb7000  0x00007ffff7fbc000  1         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fb2000  0x00007ffff7fb7000  1         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7b79000  0x00007ffff7c71000  1         Yes         /usr/lib/libm.so.6
    0x00007ffff7989000  0x00007ffff7b79000  1         Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  1         Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7fad000  0x00007ffff7fb2000  0         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7fa8000  0x00007ffff7fad000  0         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7fa3000  0x00007ffff7fa8000  2         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.1.so
    0x00007ffff7f9e000  0x00007ffff7fa3000  2         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib-dep.so
    0x00007ffff7891000  0x00007ffff7989000  2         Yes         /usr/lib/libm.so.6
    0x00007ffff76a1000  0x00007ffff7891000  2         Yes         /usr/lib/libc.so.6
    0x00007ffff7fc6000  0x00007ffff7fff000  1         Yes         /usr/lib/ld-linux-x86-64.so.2
    0x00007ffff7f99000  0x00007ffff7f9e000  1         Yes         /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.mi/mi-dlmopen/dlmopen-lib.2.so

Change-Id: Iefad340f7f43a15cff24fc8e1301f91d3d7f0278
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
gdb/solib.c
gdb/testsuite/gdb.base/dlmopen-ns-ids.exp
gdb/testsuite/gdb.base/dlmopen.exp
gdb/testsuite/gdb.mi/mi-dlmopen.exp