This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] gdbserver use aarch64_create_target_description


> 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 (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]