* [PATCH] Allow osabi to be optional in target descriptors
@ 2017-11-16 8:09 Alan Hayward
2017-11-16 9:17 ` Yao Qi
0 siblings, 1 reply; 3+ messages in thread
From: Alan Hayward @ 2017-11-16 8:09 UTC (permalink / raw)
To: gdb-patches; +Cc: nd
Osabi is an option field in target descriptors, according to:
https://sourceware.org/gdb/current/onlinedocs/gdb/Target-Description-Format.html
However, removing the osabi field from the i386 and amd64 target descriptors
will cause gdbserver to assert. This is code I used to test (not for
committing!) :
diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c
index 30c73e642f..5c63a6c223 100644
--- a/gdb/arch/amd64.c
+++ b/gdb/arch/amd64.c
@@ -41,9 +41,6 @@ amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux)
#ifndef IN_PROCESS_AGENT
set_tdesc_architecture (tdesc, is_x32 ? "i386:x64-32" : "i386:x86-64");
-
- if (is_linux)
- set_tdesc_osabi (tdesc, "GNU/Linux");
#endif
long regnum = 0;
diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c
index 7d71506a7b..112c0a89e6 100644
--- a/gdb/arch/i386.c
+++ b/gdb/arch/i386.c
@@ -37,8 +37,6 @@ i386_create_target_description (uint64_t xcr0, bool is_linux)
#ifndef IN_PROCESS_AGENT
set_tdesc_architecture (tdesc, "i386");
- if (is_linux)
- set_tdesc_osabi (tdesc, "GNU/Linux");
#endif
long regnum = 0;
The following patch fixes this error.
Tested with gdbserver on x86 and also on aarch64 with my target descriptor patch.
Also ran make check on x86 with unix and native-gdbserver.
2017-11-16 Alan Hayward <alan.hayward@arm.com>
gdbserver
* tdesc.c (tdesc_get_features_xml): Allow null osabi.
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index 63d6467d56d168777f4fa39b56495dd5649c046b..72603d626f005821a8b866d60cfdfca112c1395c 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 != NULL)
+ {
+ buffer += "<osabi>";
+ buffer += tdesc->osabi;
+ buffer += "</osabi>";
+ }
char *xml;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Allow osabi to be optional in target descriptors
2017-11-16 8:09 [PATCH] Allow osabi to be optional in target descriptors Alan Hayward
@ 2017-11-16 9:17 ` Yao Qi
2017-11-16 10:07 ` Alan Hayward
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2017-11-16 9:17 UTC (permalink / raw)
To: Alan Hayward; +Cc: gdb-patches, nd
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/
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Allow osabi to be optional in target descriptors
2017-11-16 9:17 ` Yao Qi
@ 2017-11-16 10:07 ` Alan Hayward
0 siblings, 0 replies; 3+ messages in thread
From: Alan Hayward @ 2017-11-16 10:07 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches, nd
> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-16 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16 8:09 [PATCH] Allow osabi to be optional in target descriptors Alan Hayward
2017-11-16 9:17 ` Yao Qi
2017-11-16 10:07 ` Alan Hayward
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).