Re: [PATCH v2 10/47] gdb, gdbserver, ze: in-memory libraries

Thiago Jung Bauermann
2025-07-16T04:09:31Z

Hello again,

I just noticed a couple of things I missed in my review:

Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> writes:

> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index ddd414659fcc554813fc2a12a79e581ad7a188b9..c84a8372c223e724e3042322a8bee07b12423050 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -48026,9 +48026,10 @@ queries the target's operating system and reports which libraries
> are loaded.
>
> The @samp{qXfer:libraries:read} packet returns an XML document which
> -lists loaded libraries and their offsets. Each library has an
> -associated name and one or more segment or section base addresses,
> -which report where the library was loaded in memory.
> +lists loaded libraries and their offsets. Each library has either an
> +associated name or begin and end addresses and one or more segment or
> +section base addresses, which report where the library was loaded in
> +memory.
>
> For the common case of libraries that are fully linked binaries, the
> library should have a list of segments. If the target supports
> @@ -48040,6 +48041,10 @@ depend on the library's link-time base addresses.
> @value{GDBN} must be linked with the Expat library to support XML
> library lists. @xref{Expat}.
>
> +@value{GDBN} indicates support for in-memory library elements by
> +supplying the @code{qXfer:libraries:read:in-memory-library+}
> +@samp{qSupported} feature (@pxref{qSupported}).

This feature should be added to the list in the qSupported documentation
entry.

> A simple memory map, with one loaded library relocated by a single
> offset, looks like this:

<snip>

> diff --git a/gdb/remote.c b/gdb/remote.c
> index f41129915683194237d1bba56d17df61ae89c063..7d074a5df322d68ded8f96c4832bc8c247435a4f 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -5956,6 +5956,9 @@ remote_target::remote_query_supported ()
> != AUTO_BOOLEAN_FALSE)
> remote_query_supported_append (&q, "memory-tagging+");
>
> + remote_query_supported_append
> + (&q, "qXfer:libraries:read:in-memory-library+");

This is the only feature in this function that isn't guarded by a "set
remote foo-packet" command state. Shouldn't it?

> /* Keep this one last to work around a gdbserver <= 7.10 bug in
> the qSupported:xmlRegisters=i386 handling. */
> if (remote_support_xml != NULL

--
Thiago