This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Allow osabi to be optional in target descriptors
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Thu, 16 Nov 2017 10:07:42 +0000
- Subject: Re: [PATCH] Allow osabi to be optional in target descriptors
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan dot Hayward at arm dot com;
- Nodisclaimer: True
- References: <D2781F20-8E87-4D21-8898-395B44496C51@arm.com> <864lputwf1.fsf@gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> On 16 Nov 2017, at 09:17, Yao Qi <qiyaoltc@gmail.com> wrote:
>
> Alan Hayward <Alan.Hayward@arm.com> writes:
>
> Patch is good to me, some nits on commit log and code,
>
>> Osabi is an option field in target descriptors, according to:
>
> s/target descriptors/target descriptions/
>
>> https://sourceware.org/gdb/current/onlinedocs/gdb/Target-Description-Format.html
>>
>> However, removing the osabi field from the i386 and amd64 target descriptors
>
> Likewise.
>
>>
>> The following patch fixes this error.
>>
>> Tested with gdbserver on x86 and also on aarch64 with my target descriptor patch.
>
> Likewise.
>
>> @@ -105,9 +104,12 @@ tdesc_get_features_xml (target_desc *tdesc)
>> buffer += tdesc->arch;
>> buffer += "</architecture>";
>>
>> - buffer += "<osabi>";
>> - buffer += tdesc->osabi;
>> - buffer += "</osabi>";
>> + if (tdesc->osabi != NULL)
>
> As we are in C++, I prefer nullptr.
>
> s/NULL/nullptr/
>
Thanks.
Pushed with changes as above.
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index 63d6467d56d168777f4fa39b56495dd5649c046b..e2c4288efba1546247a3b376da3c573c223b6eef 100644
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -92,8 +92,7 @@ tdesc_get_features_xml (target_desc *tdesc)
/* Either .xmltarget or .features is not NULL. */
gdb_assert (tdesc->xmltarget != NULL
|| (tdesc->features != NULL
- && tdesc->arch != NULL
- && tdesc->osabi != NULL));
+ && tdesc->arch != NULL));
if (tdesc->xmltarget == NULL)
{
@@ -105,9 +104,12 @@ tdesc_get_features_xml (target_desc *tdesc)
buffer += tdesc->arch;
buffer += "</architecture>";
- buffer += "<osabi>";
- buffer += tdesc->osabi;
- buffer += "</osabi>";
+ if (tdesc->osabi != nullptr)
+ {
+ buffer += "<osabi>";
+ buffer += tdesc->osabi;
+ buffer += "</osabi>";
+ }
char *xml;