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: Yao Qi <qiyaoltc at gmail dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>
- Cc: "gdb-patches\@sourceware.org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 30 Oct 2017 12:21:14 +0000
- Subject: Re: [PATCH 2/4] gdbserver use aarch64_create_target_description
- Authentication-results: sourceware.org; auth=none
- References: <48281E67-64B6-4558-9790-CB4189187124@arm.com>
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.
> 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 (齐尧)