This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/4] gdbserver use aarch64_create_target_description
- 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: Tue, 31 Oct 2017 15:29:27 +0000
- Subject: Re: [PATCH 2/4] gdbserver use aarch64_create_target_description
- 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: <48281E67-64B6-4558-9790-CB4189187124@arm.com> <86po94ygg5.fsf@gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> On 30 Oct 2017, at 12:21, Yao Qi <qiyaoltc@gmail.com> wrote:
>
> Alan Hayward <Alan.Hayward@arm.com> writes:
>
>> Had to add a new makefile rule to catch the arch/ file, otherwise the
>> make system gets confused between arch64/aarch64.c and features/aarch64.c
>>
>
> I don't understand the reason. We don't compile features/aarch64.c in
> GDBserver.
Sorry, I meant “aarch64-generated.c”, not "features/aarch64.c"
In the existing code, configure.srv has the following:
ipa_obj="linux-aarch64-ipa.o aarch64-ipa.o”
This creates aarch64-ipa.o by compiling aarch64-generated.c using the rule
in Makefile.in:
%-ipa.o: %-generated.c
With the new code we no longer need aarch64-generated.c in IPA.
But, we do need to compile arch64/aarch64.c into IPA.
Using the existing logic, adding it to ipa_obj using the existing rules gives the same
ipa_obj="linux-aarch64-ipa.o aarch64-ipa.o”
Which is wrong because it will just try to compile aarch64-generated.c.
I could have just changed the order of the search in Makefile.in, but this might break
something else. Instead, I added the new rule for "-arch-ipa.c"
Ok with other comments.
>
>> diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdb/gdbserver/linux-aarch64-tdesc.h
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..48314e934e0c1163fce400b368a3717a27239be8
>> --- /dev/null
>> +++ b/gdb/gdbserver/linux-aarch64-tdesc.h
>> @@ -0,0 +1,20 @@
>> +/* Low level support for aarch64, shared between gdbserver and IPA.
>> +
>> + Copyright (C) 2016-2017 Free Software Foundation, Inc.
>> +
>> + This file is part of GDB.
>> +
>> + 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/>. */
>> +
>> +const struct target_desc * aarch64_linux_read_description ();
>> diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdb/gdbserver/linux-aarch64-tdesc.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..4148ed70c4ca973652e860492cd7cc1a249991d8
>> --- /dev/null
>> +++ b/gdb/gdbserver/linux-aarch64-tdesc.c
>> @@ -0,0 +1,41 @@
>> +/* GNU/Linux/aarch64 specific target description, for the remote server
>> + for GDB.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> +
>> + This file is part of GDB.
>> +
>> + 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/>. */
>> +
>> +#include "server.h"
>> +#include "tdesc.h"
>> +#include "arch/aarch64.h"
>> +#include "linux-aarch32-low.h"
>> +
>> +/* The Aarch64 target descriptor. */
>
> s/descriptor/description/
>
>> +static const struct target_desc *aarch64_tdesc = NULL;
>> +
>
> Move it into aarch64_linux_read_description.
>
>> +/* Create the aarch64 target description. */
>> +
>> +const struct target_desc *
>
> Remove struct.
>
>> +aarch64_linux_read_description ()
>> +{
>> + struct target_desc **tdesc = (struct target_desc **) &aarch64_tdesc;
>> +
>> + if (*tdesc == NULL)
>> + {
>> + *tdesc = aarch64_create_target_description ();
>> + }
>
> "{" and "}" are not needed.
>
>> +
>> + return *tdesc;
>> +}
>
> --
> Yao (齐尧)