gdb: new AndesTech NDS32 port

gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Add nds32-tdep.o.
	(HFILES_NO_SRCDIR): Add nds32-tdep.h.
	(ALLDEPFILES): Add nds32-tdep.c.
	* NEWS: Mention new NDS32 port.
	* configure.tgt: Add NDS32.
	* nds32-tdep.c: New file.
	* nds32-tdep.h: New file.
	* features/Makefile (XMLTOC): Add nds32.xml.
	* features/nds32-core.xml: New file.
	* features/nds32-fpu.xml: New file.
	* features/nds32-system.xml: New file.
	* features/nds32.c: New file (generated).
	* features/nds32.xml: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Standard Target Features): Document NDS32 features.
	(NDS32 Features): New Section.

gdb/testsuite/ChangeLog:

	* gdb.base/float.exp: Add target check for nds32*-*-*.
	* gdb.xml/tdesc-regs.exp: Set core-regs for nds32*-*-*.
This commit is contained in:
Yan-Ting Lin 2016-06-17 15:25:08 +08:00 committed by patrick
parent 96074adc6a
commit a28d8e5037
17 changed files with 2518 additions and 1 deletions

View File

@ -1,3 +1,19 @@
2016-06-17 Yan-Ting Lin <currygt52@gmail.com>
* Makefile.in (ALL_TARGET_OBS): Add nds32-tdep.o.
(HFILES_NO_SRCDIR): Add nds32-tdep.h.
(ALLDEPFILES): Add nds32-tdep.c.
* NEWS: Mention new NDS32 port.
* configure.tgt: Add NDS32.
* nds32-tdep.c: New file.
* nds32-tdep.h: New file.
* features/Makefile (XMLTOC): Add nds32.xml.
* features/nds32-core.xml: New file.
* features/nds32-fpu.xml: New file.
* features/nds32-system.xml: New file.
* features/nds32.c: New file (generated).
* features/nds32.xml: New file.
2016-06-14 John Baldwin <jhb@FreeBSD.org>
* v850-tdep.c (v850_use_struct_convention): Trim type length checks.

View File

@ -691,6 +691,7 @@ ALL_TARGET_OBS = \
moxie-tdep.o \
msp430-tdep.o \
mt-tdep.o \
nds32-tdep.o \
nios2-tdep.o nios2-linux-tdep.o \
nto-tdep.o \
ppc-linux-tdep.o ppcfbsd-tdep.o ppcnbsd-tdep.o ppcobsd-tdep.o \
@ -967,7 +968,7 @@ amd64-darwin-tdep.h charset-list.h \
config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h \
dicos-tdep.h filesystem.h gcore.h gdb_wchar.h hppabsd-tdep.h \
i386-darwin-tdep.h x86-nat.h linux-record.h moxie-tdep.h nios2-tdep.h \
ft32-tdep.h \
ft32-tdep.h nds32-tdep.h \
osdata.h procfs.h python/py-event.h python/py-events.h python/py-stopevent.h \
python/python-internal.h python/python.h ravenscar-thread.h record.h \
record-full.h solib-aix.h \
@ -1726,6 +1727,7 @@ ALLDEPFILES = \
mipsnbsd-nat.c mipsnbsd-tdep.c \
mips64obsd-nat.c mips64obsd-tdep.c \
msp430-tdep.c \
nds32-tdep.c \
nios2-tdep.c nios2-linux-tdep.c \
nbsd-nat.c nbsd-tdep.c obsd-nat.c obsd-tdep.c \
posix-hdep.c common/posix-strerror.c \

View File

@ -86,6 +86,10 @@ maint selftest
=record-started,thread-group="i1",method="btrace",format="bts"
* New targets
Andes NDS32 nds32*-*-elf
*** Changes in GDB 7.11
* GDB now supports debugging kernel-based threads on FreeBSD.

View File

@ -394,6 +394,11 @@ mt-*-*)
gdb_target_obs="mt-tdep.o"
;;
nds32*-*-elf)
# Target: AndesTech NDS32 core
gdb_target_obs="nds32-tdep.o"
;;
nios2*-*-linux*)
# Target: Altera Nios II running Linux
gdb_target_obs="nios2-tdep.o nios2-linux-tdep.o solib-svr4.o \

View File

@ -1,3 +1,8 @@
2016-06-17 Yan-Ting Lin <currygt52@gmail.com>
* gdb.texinfo (Standard Target Features): Document NDS32 features.
(NDS32 Features): New Section.
2016-06-09 Toshihito Kikuchi <k.toshihito@yahoo.de>
* gdb.texinfo (Examining Memory): Document negative repeat

View File

@ -40817,6 +40817,7 @@ registers using the capitalization used in the description.
* MicroBlaze Features::
* MIPS Features::
* M68K Features::
* NDS32 Features::
* Nios II Features::
* PowerPC Features::
* S/390 and System z Features::
@ -41025,6 +41026,28 @@ This feature is optional. If present, it should contain registers
@samp{fpiaddr}.
@end table
@node NDS32 Features
@subsection NDS32 Features
@cindex target descriptions, NDS32 features
The @samp{org.gnu.gdb.nds32.core} feature is required for NDS32
targets. It should contain at least registers @samp{r0} through
@samp{r10}, @samp{r15}, @samp{fp}, @samp{gp}, @samp{lp}, @samp{sp},
and @samp{pc}.
The @samp{org.gnu.gdb.nds32.fpu} feature is optional. If present,
it should contain 64-bit double-precision floating-point registers
@samp{fd0} through @emph{fdN}, which should be @samp{fd3}, @samp{fd7},
@samp{fd15}, or @samp{fd31} based on the FPU configuration implemented.
@emph{Note:} The first sixteen 64-bit double-precision floating-point
registers are overlapped with the thirty-two 32-bit single-precision
floating-point registers. The 32-bit single-precision registers, if
not being listed explicitly, will be synthesized from halves of the
overlapping 64-bit double-precision registers. Listing 32-bit
single-precision registers explicitly is deprecated, and the
support to it could be totally removed some day.
@node Nios II Features
@subsection Nios II Features
@cindex target descriptions, Nios II features

View File

@ -189,6 +189,7 @@ XMLTOC = \
mips-linux.xml \
mips64-dsp-linux.xml \
mips64-linux.xml \
nds32.xml \
nios2-linux.xml \
nios2.xml \
rs6000/powerpc-32.xml \

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2013-2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.nds32.core">
<reg name="r0" bitsize="32" regnum="0"/>
<reg name="r1" bitsize="32"/>
<reg name="r2" bitsize="32"/>
<reg name="r3" bitsize="32"/>
<reg name="r4" bitsize="32"/>
<reg name="r5" bitsize="32"/>
<reg name="r6" bitsize="32"/>
<reg name="r7" bitsize="32"/>
<reg name="r8" bitsize="32"/>
<reg name="r9" bitsize="32"/>
<reg name="r10" bitsize="32"/>
<reg name="r11" bitsize="32"/>
<reg name="r12" bitsize="32"/>
<reg name="r13" bitsize="32"/>
<reg name="r14" bitsize="32"/>
<reg name="r15" bitsize="32"/>
<reg name="r16" bitsize="32"/>
<reg name="r17" bitsize="32"/>
<reg name="r18" bitsize="32"/>
<reg name="r19" bitsize="32"/>
<reg name="r20" bitsize="32"/>
<reg name="r21" bitsize="32"/>
<reg name="r22" bitsize="32"/>
<reg name="r23" bitsize="32"/>
<reg name="r24" bitsize="32"/>
<reg name="r25" bitsize="32"/>
<reg name="r26" bitsize="32"/>
<reg name="r27" bitsize="32"/>
<reg name="fp" bitsize="32" type="data_ptr"/>
<reg name="gp" bitsize="32" type="data_ptr"/>
<reg name="lp" bitsize="32" type="code_ptr"/>
<reg name="sp" bitsize="32" type="data_ptr"/>
<reg name="pc" bitsize="32" type="code_ptr"/>
</feature>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2013-2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.nds32.fpu">
<reg name="fd0" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd1" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd2" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd3" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd4" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd5" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd6" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd7" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd8" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd9" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd10" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd11" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd12" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd13" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd14" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd15" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd16" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd17" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd18" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd19" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd20" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd21" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd22" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd23" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd24" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd25" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd26" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd27" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd28" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd29" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd30" bitsize="64" type="ieee_double" group="float"/>
<reg name="fd31" bitsize="64" type="ieee_double" group="float"/>
</feature>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2013-2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.nds32.system">
<reg name="ir0" bitsize="32"/>
<reg name="itb" bitsize="32"/>
<reg name="ifc_lp" bitsize="32"/>
</feature>

92
gdb/features/nds32.c Normal file
View File

@ -0,0 +1,92 @@
/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
Original: nds32.xml */
#include "defs.h"
#include "osabi.h"
#include "target-descriptions.h"
struct target_desc *tdesc_nds32;
static void
initialize_tdesc_nds32 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
set_tdesc_architecture (result, bfd_scan_arch ("n1h"));
feature = tdesc_create_feature (result, "org.gnu.gdb.nds32.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "int");
tdesc_create_reg (feature, "fp", 28, 1, NULL, 32, "data_ptr");
tdesc_create_reg (feature, "gp", 29, 1, NULL, 32, "data_ptr");
tdesc_create_reg (feature, "lp", 30, 1, NULL, 32, "code_ptr");
tdesc_create_reg (feature, "sp", 31, 1, NULL, 32, "data_ptr");
tdesc_create_reg (feature, "pc", 32, 1, NULL, 32, "code_ptr");
feature = tdesc_create_feature (result, "org.gnu.gdb.nds32.fpu");
tdesc_create_reg (feature, "fd0", 33, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd1", 34, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd2", 35, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd3", 36, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd4", 37, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd5", 38, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd6", 39, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd7", 40, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd8", 41, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd9", 42, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd10", 43, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd11", 44, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd12", 45, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd13", 46, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd14", 47, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd15", 48, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd16", 49, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd17", 50, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd18", 51, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd19", 52, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd20", 53, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd21", 54, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd22", 55, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd23", 56, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd24", 57, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd25", 58, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd26", 59, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd27", 60, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd28", 61, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd29", 62, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd30", 63, 1, "float", 64, "ieee_double");
tdesc_create_reg (feature, "fd31", 64, 1, "float", 64, "ieee_double");
feature = tdesc_create_feature (result, "org.gnu.gdb.nds32.system");
tdesc_create_reg (feature, "ir0", 65, 1, NULL, 32, "int");
tdesc_create_reg (feature, "itb", 66, 1, NULL, 32, "int");
tdesc_create_reg (feature, "ifc_lp", 67, 1, NULL, 32, "int");
tdesc_nds32 = result;
}

14
gdb/features/nds32.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2013-2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target>
<architecture>nds32</architecture>
<xi:include href="nds32-core.xml"/>
<xi:include href="nds32-fpu.xml"/>
<xi:include href="nds32-system.xml"/>
</target>

2184
gdb/nds32-tdep.c Normal file

File diff suppressed because it is too large Load Diff

54
gdb/nds32-tdep.h Normal file
View File

@ -0,0 +1,54 @@
/* Target-dependent code for the NDS32 architecture, for GDB.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
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/>. */
#ifndef NDS32_TDEP_H
#define NDS32_TDEP_H
enum nds32_regnum
{
/* General purpose registers. */
NDS32_R0_REGNUM = 0,
NDS32_R5_REGNUM = 5,
NDS32_TA_REGNUM = 15, /* Temporary register. */
NDS32_FP_REGNUM = 28, /* Frame pointer. */
NDS32_GP_REGNUM = 29, /* Global pointer. */
NDS32_LP_REGNUM = 30, /* Link pointer. */
NDS32_SP_REGNUM = 31, /* Stack pointer. */
NDS32_PC_REGNUM = 32, /* Program counter. */
NDS32_NUM_REGS,
/* The first double precision floating-point register. */
NDS32_FD0_REGNUM = NDS32_NUM_REGS,
};
struct gdbarch_tdep
{
/* The guessed FPU configuration. */
int fpu_freg;
/* FSRs are defined as pseudo registers. */
int use_pseudo_fsrs;
/* Cached regnum of the first FSR (FS0). */
int fs0_regnum;
/* ELF ABI info. */
int elf_abi;
};
#endif /* NDS32_TDEP_H */

View File

@ -1,3 +1,8 @@
2016-06-17 Yan-Ting Lin <currygt52@gmail.com>
* gdb.base/float.exp: Add target check for nds32*-*-*.
* gdb.xml/tdesc-regs.exp: Set core-regs for nds32*-*-*.
2016-06-13 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.base/call-ar-st.exp: Report unsupported rather than xfail

View File

@ -76,6 +76,15 @@ if { [is_aarch64_target] } then {
pass "info float (with FPU)"
}
}
} elseif [istarget "nds32*-*-*"] then {
gdb_test_multiple "info float" "info_float" {
-re "fd0.*fd3.*$gdb_prompt $" {
pass "info float (with FPU)"
}
-re "No floating.point info available for this processor.*" {
pass "info float (without FPU)"
}
}
} elseif [istarget "powerpc*-*-*"] then {
gdb_test_multiple "info float" "info_float" {
-re "f0.*f1.*f31.*fpscr.*$gdb_prompt $" {

View File

@ -39,6 +39,9 @@ switch -glob -- [istarget] {
"mips*-*-*" {
set core-regs {mips-cpu.xml mips-cp0.xml mips-fpu.xml mips-dsp.xml}
}
"nds32*-*-*" {
set core-regs {nds32-core.xml}
}
"nios2-*-*" {
set core-regs {nios2-cpu.xml}
}