Skip to contentSkip to conversation

OpenRISC gdb port

PATCH Superseded Stafford Horne 1 participant 4 messages Jan 21, 2017

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover OpenRISC gdb port

Hello,

This is the openrisc port of GDB that has been in openrisc repositories for a very long time. The main original author was Jeremy Bennett as can be seen in file copyrights. Others should also have copyright assignment in place.

This along with the sim patches are the last of what has not made its way upstream. The patches are based on current gdb git master branch.

I have run the testsuite and results are as follows:

# of expected passes            19283
# of unexpected failures        406
# of expected failures          29
# of known failures             57
# of unresolved testcases       2
# of untested testcases         181
# of unsupported tests          264
#/build-gdb/gdb/gdb version  7.12.50.20170120-git -nw -nx -data-directory #/build-gdb/gdb/testsuite

-Stafford

--
Changes since v3
* Updates as per Luis's comments
- comment formatting issues (period then 2 spaces)
- remove spurious newlines
- merged configure.tgt clasues to single
- Fixed typos and grammar in gdb.texinfo
- Removed copyright names from source files (in docs)
- Remove curly braces around single statement if's
- (fyi) I left the casts as I think it keeps code readable
- used XCNEW for tdep init
- Added an example XML target descriptor
* Removed newlines

Changes from v2
* Updates as per Yao's comments
- Fix copyrights, jullien embecosm, remove embecosm
- indentation to use gnu style (i.e. && and || on left)
- Fix comments to use gnu style
- Move some includes around
- Remove constant variables, replace with constants
- Remove doxygen on a few calls
- Have only 1 space between type and var name
- remove todo about 4 const
- do fix *buf checks (use buf != NULL)
- BP_MANIPULATION
- Use the builtin types for reg register functions
- or1k_iterate_over_regset_sections - remove no linux, no cores yet
* Remove unimplements pseudo register functions
* Remove spr commands as we can now get those via info reg

Changes from v1
* Merged or1k-tdep.[ch] changes into a single commit
* Futher fixes to change log bringing in history back to 2008
* Fix doc issue on sw_breakpoint_from_kind

Franck Jullien (1):
gdb: Add OpenRISC or1k and or1knd target support

Stafford Horne (2):
or1k: gdb: Add xml tdesc
gdb: testsuite: Add or1k l.nop inscruction

 gdb/configure.tgt                     |    6 +
 gdb/doc/gdb.texinfo                   |   70 +
 gdb/features/Makefile                 |    2 +
 gdb/features/or1k.c                   | 2280 +++++++++++++++++++++++++++++++++
 gdb/features/or1k.xml                 | 2274 ++++++++++++++++++++++++++++++++
 gdb/or1k-tdep.c                       | 1324 +++++++++++++++++++
 gdb/or1k-tdep.h                       |   56 +
 gdb/testsuite/gdb.base/bp-permanent.c |    2 +
 8 files changed, 6014 insertions(+)
 create mode 100644 gdb/features/or1k.c
 create mode 100644 gdb/features/or1k.xml
 create mode 100644 gdb/or1k-tdep.c
 create mode 100644 gdb/or1k-tdep.h
Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 1/3 gdb: Add OpenRISC or1k and or1knd target support

From: Franck Jullien <[email protected]>

This patch prepates the current GDB port of the openrisc processor from
https://github.com/openrisc/binutils-gdb for upstream merging.

Testing has been done with a cgen sim provided in a separate patch. This has been tested with 2 toolchains. GCC [1] 5.4.0 from the openrisc project with Newlib [2] and GCC 5.4.0 with Musl [3] 1.1.4.

It supports or1knd (no delay slot target).
The default target is or1k (with delay slot).

You can change the target arch with:

(gdb) set architecture or1knd
The target architecture is assumed to be or1knd

[1] https://github.com/openrisc/or1k-gcc
[2] https://github.com/openrisc/newlib
[3] https://github.com/openrisc/musl-cross

gdb/doc/ChangeLog:

2017-01-20 Stafford Horne <[email protected]>
Stefan Wallentowitz <[email protected]> Franck Jullien <[email protected]> Jeremy Bennett <[email protected]>

* gdb.texinfo: Add OpenRISC documentation.

gdb/ChangeLog:

2017-01-20 Stafford Horne <[email protected]>
Stefan Wallentowitz <[email protected]> Stefan Kristiansson <[email protected]> Franck Jullien <[email protected]> Jeremy Bennett <[email protected]>

* configure.tgt: Add targets for or1k and or1knd.
* or1k-tdep.c: New.
* or1k-tdep.h: New.

---
 gdb/configure.tgt   |    6 +
 gdb/doc/gdb.texinfo |   70 +++
 gdb/or1k-tdep.c     | 1324 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/or1k-tdep.h     |   56 +++
 4 files changed, 1456 insertions(+)
 create mode 100644 gdb/or1k-tdep.c
 create mode 100644 gdb/or1k-tdep.h
gdb/configure.tgt +6 -0
index cb909e7..5a722f2 100644
@@ -426,6 +426,12 @@ nios2*-*-*)
 	gdb_target_obs="nios2-tdep.o"
 	;;
 
+or1k-*-* | or1knd-*-*)
+	# Target: OpenCores OpenRISC 1000 32-bit implementation bare metal
+	gdb_target_obs="or1k-tdep.o"
+	gdb_sim=../sim/or1k/libsim.a
+	;;
+
 powerpc*-*-freebsd*)
 	# Target: FreeBSD/powerpc
 	gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
gdb/doc/gdb.texinfo +70 -0

88 lines not on this page · raw message

gdb/or1k-tdep.c new file +1324 -0

1,324 lines not on this page · raw message

gdb/or1k-tdep.h new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/3 or1k: gdb: Add xml tdesc

In reply to Stafford Horne

Generated from OpenOCD

gdb/ChangeLog:

2017-01-20 Stafford Horne <[email protected]>

* features/Makefile: Add or1k.xml to build.
* features/or1k.xml: New file.
* features/or1k.c: Generated.

---
 gdb/features/Makefile |    2 +
 gdb/features/or1k.c   | 2280 +++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/features/or1k.xml | 2274 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 4556 insertions(+)
 create mode 100644 gdb/features/or1k.c
 create mode 100644 gdb/features/or1k.xml
gdb/features/Makefile +2 -0
index 63f8248..ff57894 100644
@@ -91,6 +91,7 @@ mips64-expedite = r29,pc
 mips64-dsp-expedite = r29,pc
 microblaze-expedite = r1,rpc
 nios2-linux-expedite = sp,pc
+or1k-expedite = r1,npc
 powerpc-expedite = r1,pc
 rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4
 rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4
@@ -173,6 +174,7 @@ XMLTOC = \
 	nds32.xml \
 	nios2-linux.xml \
 	nios2.xml \
+	or1k.xml \
 	rs6000/powerpc-32.xml \
 	rs6000/powerpc-32l.xml \
 	rs6000/powerpc-403.xml \
gdb/features/or1k.c new file +2280 -0

2,280 lines not on this page · raw message

gdb/features/or1k.xml new file +2274 -0

706 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.9.3

Part of the diff is not shown here. View the raw message.

#3 lore raw

PATCH v4 3/3 gdb: testsuite: Add or1k l.nop inscruction

In reply to Stafford Horne

The test case requires adding a nop instruction. For or1k the instruction is l.nop. This change uses the correct operation.

gdb/testsuite/ChangeLog:

2016-05-11 Stafford Horne <[email protected]>

* gdb.base/bp-permanent.c: Define nop of or1k.

---
 gdb/testsuite/gdb.base/bp-permanent.c | 2 ++
 1 file changed, 2 insertions(+)
gdb/testsuite/gdb.base/bp-permanent.c +2 -0
index acd5be7..d42aafa 100644
@@ -26,6 +26,8 @@
 
 #if defined(__s390__) || defined(__s390x__)
 #define NOP asm("nopr 0")
+#elif defined(__or1k__)
+#define NOP asm("l.nop")
 #else
 #define NOP asm("nop")
 #endif
Signature · 1 line
2.9.3