From: Pedro Alves <pedro@palves.net>
To: Markus Metzger <markus.t.metzger@intel.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v4] gdb, gdbserver: support dlmopen()
Date: Thu, 3 Mar 2022 18:32:23 +0000 [thread overview]
Message-ID: <a2c55703-a5fb-3d85-cf34-797b47a92fd4@palves.net> (raw)
In-Reply-To: <20211117142812.3685162-1-markus.t.metzger@intel.com>
On 2021-11-17 14:28, Markus Metzger via Gdb-patches wrote:
> This patch was originally developed by H.J. Last version:
> https://sourceware.org/pipermail/gdb-patches/2021-October/182353.html
>
Should the commit have a Co-Authored-By: tag for H.J.?
> Changes in v4:
>
> 1. add gdb.base/dlmopen.exp
> 2. extend svr4_same() to compare the load offset in addition to the name
> 3. supply l_addr_inferior for default DSO to make it work with #2
> 4. fix bugs in gdbserver/linux-low.cc
>
> Changes in v3:
>
> 1. Fix gdbserver support.
>
> Changes in v2:
>
> 1. Don't check shared libraries in other namespaces when updating shared
> libraries in a new namespace.
>
> Regression-tested on x86-64 linux.
>
> ---
>
> In glibc, the r_debug structure contains (amongst others) the following
> fields:
>
> int r_version:
> Version number for this protocol. It should be greater than 0.
>
> If r_version is 2, struct r_debug is extended to struct r_debug_extended
> with one additional field:
>
> struct r_debug_extended *r_next;
> Link to the next r_debug_extended structure. Each r_debug_extended
> structure represents a different namespace. The first r_debug_extended
> structure is for the default namespace.
>
> 1. Change solib_svr4_r_map argument to take the debug base.
> 2. Add solib_svr4_r_next to find the link map in the next namespace from
> the r_next field.
> 3. Update svr4_current_sos_direct to get the link map in the next namespace
> from the r_next field.
> 4. Don't check shared libraries in other namespaces when updating shared
> libraries in a new namespace.
> 5. Update svr4_same to check the load offset in addition to the name
> 6. Update svr4_default_sos to also set l_addr_inferior
>
> Add gdb.base/dlmopen.exp to test this.
I'm wondering whether ideally symbol lookup would be updated to handle
different namespaces. I'm thinking of for example
svr4_iterate_over_objfiles_in_search_order.
Can you describe what xml changes were necessary? Do we need to update
the manual where the xml/packet are described?
> +++ b/gdb/testsuite/gdb.base/dlmopen.exp
> @@ -0,0 +1,141 @@
> +# This testcase is part of GDB, the GNU debugger.
> +#
> +# Copyright 2021 Free Software Foundation, Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
Please a short description of what is being tested, here.
> +clean_restart $binfile
> +
> +# Start the test program.
> +set test_spawn_id [spawn_wait_for_attach $binfile]
> +set testpid [spawn_id_get_pid $test_spawn_id]
> +
> +# Attach.
> +gdb_test "attach $testpid" "Attaching to program.*, process $testpid.*"
Seems like a can_spawn_for_attach check is missing.
> +
> +with_test_prefix "attach" {
> + # Remove the pause. We no longer need it.
> + gdb_test "print pause = 0" "\\\$1 = 0"
> +
> + # Set the same breakpoints again. This time, however, we do not allow the
> + # breakpoint to be pending since the library has already been loaded.
> + gdb_breakpoint $srcfile_lib:$bp_inc
> + gdb_breakpoint $srcfile:$bp_main
> +
> + test_dlmopen
> +}
next prev parent reply other threads:[~2022-03-03 18:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 14:28 Markus Metzger
2022-01-21 11:42 ` Metzger, Markus T
2022-03-01 19:10 ` Tom Tromey
2022-03-09 12:23 ` Metzger, Markus T
2022-03-03 18:32 ` Pedro Alves [this message]
2022-03-09 12:24 ` Metzger, Markus T
2022-03-09 14:15 ` Pedro Alves
2022-03-29 16:13 ` Metzger, Markus T
2022-04-08 12:40 ` Metzger, Markus T
2022-05-25 17:12 ` Kevin Buettner
2022-05-31 9:29 ` Metzger, Markus T
2022-05-31 18:44 ` Ben Woodard
2022-05-24 18:40 Ben Woodard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2c55703-a5fb-3d85-cf34-797b47a92fd4@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).