Re: [commit] reimplement AIX shared-lib support (v3)

Joel Brobecker
2013-05-07T10:10:06Z

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

> > Yes, you are right. Upon trying to document it, and looking at
> > how the other XML formats are described in the manual, I realized
> > that maybe it would be better if the XML used library-list-aix
> > instead of just library-list. It would be more consistent, I think,
> > with what is done for instance with SVR4, but also avoid any
> > confusion with the library-list. WDYT?
>
> I agree.

Thanks! Attached are the two patches I will commit momentarily.
The first one implements the suggestion you sent on IRC. The second
is about renaming the name of the XML element.

gdb/ChangeLog:

* target.h (enum target_object) [TARGET_OBJECT_LIBRARIES_AIX]:
Renames TARGET_OBJECT_AIX_LIBRARIES.
* rs6000-nat.c: Replace TARGET_OBJECT_AIX_LIBRARIES with
TARGET_OBJECT_LIBRARIES_AIX throughout.
* solib-aix.c: Likwise.

gdb/ChangeLog:

* features/library-list-aix.dtd: Replace library-list by
library-list-aix.
* rs6000-nat.c: Replace library-list by library-list-aix
throughout.
* solib-aix.c: Likewise.

Tested on ppc-aix.

--
Joel

[-- Attachment #2: 0001-Rename-TARGET_OBJECT_AIX_LIBRARIES-to-TARGET_OBJECT_.patch --]
[-- Type: text/x-diff, Size: 3433 bytes --]

From f2dca001de528ac413c864e8dd9b74f999ace043 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 7 May 2013 05:10:51 -0400
Subject: [PATCH 1/2] Rename TARGET_OBJECT_AIX_LIBRARIES to TARGET_OBJECT_LIBRARIES_AIX

More consistent with the name of other similar object names.

gdb/ChangeLog:

* target.h (enum target_object) [TARGET_OBJECT_LIBRARIES_AIX]:
Renames TARGET_OBJECT_AIX_LIBRARIES.
* rs6000-nat.c: Replace TARGET_OBJECT_AIX_LIBRARIES with
TARGET_OBJECT_LIBRARIES_AIX throughout.
* solib-aix.c: Likwise.
---
gdb/rs6000-nat.c | 6 +++---
gdb/solib-aix.c | 6 +++---
gdb/target.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index a16ccf2..2ac8b43 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -424,7 +424,7 @@ rs6000_xfer_partial (struct target_ops *ops, enum target_object object,

switch (object)
{
- case TARGET_OBJECT_AIX_LIBRARIES:
+ case TARGET_OBJECT_LIBRARIES_AIX:
return rs6000_xfer_shared_libraries (ops, object, annex,
readbuf, writebuf,
offset, len);
@@ -745,7 +745,7 @@ rs6000_core_ldinfo (bfd *abfd)
}

/* Append to OBJSTACK an XML string description of the shared library
- corresponding to LDI, following the TARGET_OBJECT_AIX_LIBRARIES
+ corresponding to LDI, following the TARGET_OBJECT_LIBRARIES_AIX
format. */

static void
@@ -811,7 +811,7 @@ rs6000_xfer_shared_library (LdInfo *ldi, struct obstack *obstack)
}

/* Implement the to_xfer_partial target_ops method for
- TARGET_OBJECT_AIX_LIBRARIES objects. */
+ TARGET_OBJECT_LIBRARIES_AIX objects. */

static LONGEST
rs6000_xfer_shared_libraries
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 8c17a6f..f891af0 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -296,11 +296,11 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
return data->library_list;

library_document = target_read_stralloc (&current_target,
- TARGET_OBJECT_AIX_LIBRARIES,
+ TARGET_OBJECT_LIBRARIES_AIX,
NULL);
if (library_document == NULL && warning_msg != NULL)
{
- warning (_("%s (failed to read TARGET_OBJECT_AIX_LIBRARIES)"),
+ warning (_("%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
warning_msg);
return NULL;
}
@@ -308,7 +308,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)

if (solib_aix_debug)
fprintf_unfiltered (gdb_stdlog,
- "DEBUG: TARGET_OBJECT_AIX_LIBRARIES = \n%s\n",
+ "DEBUG: TARGET_OBJECT_LIBRARIES_AIX = \n%s\n",
library_document);

data->library_list = solib_aix_parse_libraries (library_document);
diff --git a/gdb/target.h b/gdb/target.h
index d77bcf2..8e650cf 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -262,7 +262,7 @@ enum target_object
/* Currently loaded libraries specific for SVR4 systems, in XML format. */
TARGET_OBJECT_LIBRARIES_SVR4,
/* Currently loaded libraries specific to AIX systems, in XML format. */
- TARGET_OBJECT_AIX_LIBRARIES,
+ TARGET_OBJECT_LIBRARIES_AIX,
/* Get OS specific data. The ANNEX specifies the type (running
processes, etc.). The data being transfered is expected to follow
the DTD specified in features/osdata.dtd. */
--
1.7.0.4

[-- Attachment #3: 0002-AIX-Change-XML-to-use-library-list-aix-instead-of-li.patch --]
[-- Type: text/x-diff, Size: 3323 bytes --]

From c34759e0aad060edfa7db5d6cd3075543a48dad0 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 7 May 2013 05:40:37 -0400
Subject: [PATCH 2/2] AIX: Change XML to use library-list-aix instead of library-list.

This is more consistent with what we do with other similar XML lists,
and avoids a potential confusion with the library-list XML list.

gdb/ChangeLog:

* features/library-list-aix.dtd: Replace library-list by
library-list-aix.
* rs6000-nat.c: Replace library-list by library-list-aix
throughout.
* solib-aix.c: Likewise.
---
gdb/features/library-list-aix.dtd | 4 ++--
gdb/rs6000-nat.c | 4 ++--
gdb/solib-aix.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/features/library-list-aix.dtd b/gdb/features/library-list-aix.dtd
index 5a24ce5..8bf0cc8 100644
--- a/gdb/features/library-list-aix.dtd
+++ b/gdb/features/library-list-aix.dtd
@@ -5,8 +5,8 @@
notice and this notice are preserved. -->


-<!ELEMENT library-list (library)*>
-<!ATTLIST library-list version CDATA #FIXED "1.0">
+<!ELEMENT library-list-aix (library)*>
+<!ATTLIST library-list-aix version CDATA #FIXED "1.0">

<!ELEMENT library (name, member, text_addr, text_size, data_addr, data_size)>
<!ATTLIST library name CDATA #REQUIRED>
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 2ac8b43..afaac5d 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -841,7 +841,7 @@ rs6000_xfer_shared_libraries
/* Convert the raw data into an XML representation. */

obstack_init (&obstack);
- obstack_grow_str (&obstack, "<library-list version=\"1.0\">\n");
+ obstack_grow_str (&obstack, "<library-list-aix version=\"1.0\">\n");

ldi = ldi_data;
while (1)
@@ -860,7 +860,7 @@ rs6000_xfer_shared_libraries

xfree (ldi_data);

- obstack_grow_str0 (&obstack, "</library-list>\n");
+ obstack_grow_str0 (&obstack, "</library-list-aix>\n");

buf = obstack_finish (&obstack);
len_avail = strlen (buf);
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index f891af0..d930769 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -179,7 +179,7 @@ library_list_start_library (struct gdb_xml_parser *parser,
VEC_safe_push (lm_info_p, *list, item);
}

-/* Handle the start of a <library-list> element. */
+/* Handle the start of a <library-list-aix> element. */

static void
library_list_start_list (struct gdb_xml_parser *parser,
@@ -213,7 +213,7 @@ solib_aix_free_library_list (void *p)
}

/* The allowed elements and attributes for an AIX library list
- described in XML format. The root element is a <library-list>. */
+ described in XML format. The root element is a <library-list-aix>. */

static const struct gdb_xml_attribute library_attributes[] =
{
@@ -242,7 +242,7 @@ static const struct gdb_xml_attribute library_list_attributes[] =

static const struct gdb_xml_element library_list_elements[] =
{
- { "library-list", library_list_attributes, library_list_children,
+ { "library-list-aix", library_list_attributes, library_list_children,
GDB_XML_EF_NONE, library_list_start_list, NULL },
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
--
1.7.0.4