OpenRISC gdb port
v6 cover OpenRISC gdb port
Hello Again,
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:
=== gdb Summary ===
# of expected passes 19558 # of unexpected failures 395 # of expected failures 29 # of unknown successes 2 # of known failures 56 # of unresolved testcases 2 # of untested testcases 189 # of unsupported tests 290
-Stafford
--
Changes since v5
* Change from using frame_debug to or1k_debug
* Change to use TYPE_*() macros rather than direct access to arg_type fields
* Fixes to docs suggested by Eli
* Fixes suggested by Yao Qi
- Use target_read_code() vs target_read_memory()
- use bool where possible instead of int
- User error over throw_quit
- Fix line widths to 80 characters for comments
- Add some better comments on the analyse functions
- Dynamically allocate arg buffers rather than hard coding size to 4, to allow for dynamic sizes.
- Remote or1k_register_*() functions, handled all in tdesc now
- Change way to define inline or1k_frame_unwind struct
* Add test for gdb.xml/tdesc-regs.exp
Changes since v4
* Fixed issue with gdb_assert causing prologue sniffer to abort gdb on kernel debugs
* Fixed issue with step through delay slot possible SEGV
* Cleaned up a few more comments to be GNU style
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 (2):
tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
gdb: Add OpenRISC or1k and or1knd target support
Stafford Horne (3):
gdb: testsuite: Add or1k l.nop instruction
gdb: testsuite: Add or1k tdesc-regs.exp test support Add gdb for or1k build
configure | 7 - configure.ac | 7 - gdb/configure.tgt | 6 + gdb/doc/gdb.texinfo | 70 ++ gdb/features/Makefile | 2 + gdb/features/or1k-core.xml | 65 ++ gdb/features/or1k.c | 77 ++ gdb/features/or1k.xml | 12 + gdb/or1k-tdep.c | 1307 +++++++++++++++++++++++++++++++++ gdb/or1k-tdep.h | 56 ++ gdb/target-descriptions.c | 12 +- gdb/testsuite/gdb.base/bp-permanent.c | 2 + gdb/testsuite/gdb.xml/tdesc-regs.exp | 3 + 13 files changed, 1606 insertions(+), 20 deletions(-) create mode 100644 gdb/features/or1k-core.xml 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
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
From: Franck Jullien <[email protected]>
tdesc_register_in_reggroup_p in now able to handle arbitrary groups. This is useful when groups are created while the target descriptor file is received from the remote.
This can be the case of a soft core target processor where registers/groups can change.
gdb/ChangeLog:
2013-02-15 Franck Jullien <[email protected]>
* target-descriptions.c (tdesc_register_in_reggroup_p): Support arbitrary strings.
--- gdb/target-descriptions.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
gdb/target-descriptions.c +6 -6
@@ -1086,12 +1086,8 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno)return -1 if it does not know; the caller should handle registers with no specified group. -Arbitrary strings (other than "general", "float", and "vector") -from the description are not used; they cause the register to be -displayed in "info all-registers" but excluded from "info -registers" et al. The names of containing features are also not -used. This might be extended to display registers in some more -useful groupings. +The names of containing features are also not used. This might be +extended to display registers in some more useful groupings. The save-restore flag is also implemented here. */
@@ -1120,6 +1116,10 @@ tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,if (reggroup == general_reggroup)return general_p; + +if (strcmp (reg->group,reggroup_name (reggroup)) ==0 ) +return 1 ; + } if (reg != NULL
Signature · 1 line
2.9.3
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Stafford HorneFrom: 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-04-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-04-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 file.
* or1k-tdep.h: New file.
* features/Makefile: Add or1k.xml to build.
* features/or1k.xml: New file.
* features/or1k-core.xml: New file.
* features/or1k.c: Generated.
--- gdb/configure.tgt | 6 + gdb/doc/gdb.texinfo | 70 +++ gdb/features/Makefile | 2 + gdb/features/or1k-core.xml | 65 +++ gdb/features/or1k.c | 77 +++ gdb/features/or1k.xml | 12 + gdb/or1k-tdep.c | 1307 ++++++++++++++++++++++++++++++++++++++++++++ gdb/or1k-tdep.h | 56 ++ 8 files changed, 1595 insertions(+) create mode 100644 gdb/features/or1k-core.xml 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
gdb/configure.tgt +6 -0
@@ -427,6 +427,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
100 lines not on this page · raw message
gdb/features/Makefile +2 -0
@@ -93,6 +93,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
@@ -179,6 +180,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-core.xml new file +65 -0
65 lines not on this page · raw message
gdb/features/or1k.c new file +77 -0
77 lines not on this page · raw message
gdb/features/or1k.xml new file +12 -0
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 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>or1k</architecture> + <xi:include href="or1k-core.xml"/> +</target>
gdb/or1k-tdep.c new file +1307 -0
1,307 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
PATCH v6 3/5 gdb: testsuite: Add or1k l.nop instruction
In reply to Stafford HorneThe 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
@@ -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
PATCH v6 4/5 gdb: testsuite: Add or1k tdesc-regs.exp test support
In reply to Stafford Hornegdb/testsuite/ChangeLog:
2017-04-20 Stafford Horne <[email protected]>
* gdb.xml/tdesc-regs.exp: Add or1k support.
--- gdb/testsuite/gdb.xml/tdesc-regs.exp | 3 +++ 1 file changed, 3 insertions(+)
gdb/testsuite/gdb.xml/tdesc-regs.exp +3 -0
@@ -50,6 +50,9 @@ switch -glob -- [istarget] { "nios2-*-*" { set core-regs {nios2-cpu.xml} } + "or1k-*-*" { + set core-regs {or1k-core.xml} + } "powerpc*-*-*" { set regdir "rs6000/" set core-regs {power-core.xml}
Signature · 1 line
2.9.3
PATCH v6 5/5 Add gdb for or1k build
In reply to Stafford Horne* ChangeLog:
2017-02-12 Stafford Horne <[email protected]>
* configure.ac: remove logic adding gdb to noconfigsdirs for or1k
* configure: regenerate
--- configure | 7 ------- configure.ac | 7 ------- 2 files changed, 14 deletions(-)
configure +0 -7
@@ -3632,10 +3632,6 @@ case "${target}" in ;; *-*-rtems*) noconfigdirs="$noconfigdirs target-libgloss" - # this is not caught below because this stanza matches earlier - case $target in - or1k*-*-*) noconfigdirs="$noconfigdirs gdb" ;; - esac ;; # The tpf target doesn't support gdb yet. *-*-tpf*)
@@ -3841,9 +3837,6 @@ case "${target}" in nvptx*-*-*) noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" ;; - or1k*-*-*) - noconfigdirs="$noconfigdirs gdb" - ;; sh-*-*) case "${target}" in sh*-*-elf)
configure.ac +0 -7
@@ -966,10 +966,6 @@ case "${target}" in ;; *-*-rtems*) noconfigdirs="$noconfigdirs target-libgloss" - # this is not caught below because this stanza matches earlier - case $target in - or1k*-*-*) noconfigdirs="$noconfigdirs gdb" ;; - esac ;; # The tpf target doesn't support gdb yet. *-*-tpf*)
@@ -1175,9 +1171,6 @@ case "${target}" in nvptx*-*-*) noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" ;; - or1k*-*-*) - noconfigdirs="$noconfigdirs gdb" - ;; sh-*-*) case "${target}" in sh*-*-elf)
Signature · 1 line
2.9.3
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Stafford HorneReview
Quoted 6 lines
From: Stafford Horne <[email protected]>
Cc: Openrisc <[email protected]>, Franck Jullien <[email protected]>
Date: Mon, 24 Apr 2017 21:52:51 +0900(quoted diff) +2
-0+The OpenRISC 1000 provides a free and open RISC instruction set +architecture.
"Free" is a superset of "open", so I think you should leave only the former in the text. (It will also help us not to get in trouble with RMS.)
OK for the documentation part, with the above fixed.
Thanks.
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
Quoted 4 lines · Eli Zaretskii
Quoted 4 lines
From: Stafford Horne <[email protected]>
Cc: Openrisc <[email protected]>, Franck Jullien <[email protected]>
Date: Mon, 24 Apr 2017 21:52:51 +0900
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+The OpenRISC 1000 provides a free and open RISC instruction set +architecture."Free" is a superset of "open", so I think you should leave only the former in the text. (It will also help us not to get in trouble with RMS.)
OK for the documentation part, with the above fixed.
Thank you, I have fixed the above.
+The OpenRISC 1000 provides a free RISC instruction set architecture.
It is pushed to my git repo which can be browsed here, if interested:
https://github.com/stffrdhrn/binutils-gdb/commits/or1k-upstream-v6
-Stafford
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Stafford Hornegdb/doc/gdb.texinfo As usual, you can inquire about the @code{mipsfpu} variable with · line 22318
Quoted 10 lines · Stafford Horne
+ at kindex target remote
+ at item target remotegdb/doc/gdb.texinfo +8
-0+ +Connect to a remote OpenRISC 1000 target. This is supported by + at dfn{Or1ksim}, the OpenRISC 1000 architectural simulator as well as QEMU, +Verilator and Icarus Verilog simulators. @dfn{Remote serial protocol} +servers, such as OpenOCD, are also available to drive various hardware +implementations via JTAG. + +Example: @code{target remote :51000}
Do we need to document "target remote"? which is not specific to any particular configurations.
Quoted 44 lines
gdb/doc/gdb.texinfo +30
-0+ + at kindex target sim + at item target sim + +Runs the builtin CPU simulator which can run very basic +programs but does not support most hardware functions like MMU. +For more complex use cases the user is advised to run an external +target, and connect using @samp{target remote}. + +Example: @code{target sim} + + at end table + @node PowerPC Embedded @subsection PowerPC Embedded@@ -41088,6 +41131,7 @@ registers using the capitalization used in the description. * M68K Features:: * NDS32 Features:: * Nios II Features:: +* OpenRISC 1000 Features:: * PowerPC Features:: * S/390 and System z Features:: * Sparc Features::@@ -41374,6 +41418,32 @@ targets. It should contain the 32 core registers (@samp{zero}, @samp{pc}, and the 16 control registers (@samp{status} through @samp{mpuacc}). + at node OpenRISC 1000 Features + at subsection Openrisc 1000 Features + at cindex target descriptions, OpenRISC 1000 features + +The @samp{org.gnu.gdb.or1k.group0} feature is required for OpenRISC 1000 +targets. It should contain the 32 general purpose registers (@samp{r0} +through @samp{r31}), @samp{ppc}, @samp{npc} and @samp{sr}. + +Along with the default reggroups like @samp{system} and @samp{general} +provided by @value{GDBN}, OpenRISC targets can use the following reggroups +to group their many registers: + + at smallexample + Group Type + immu user + dmmu user
gdb/doc/gdb.texinfo targets. It should contain the 32 core registers (@samp{zero}, · line 41446
Quoted 10 lines
gdb/doc/gdb.texinfo +10
-0+ icache user + dcache user + pic user + timer user + power user + perf user + mac user + debug user + at end smallexample +
Why do you need to document the reggroups?
gdb/or1k-tdep.c line 1290
Quoted 3 lines
gdb/or1k-tdep.c new file +3
-0+ +extern initialize_file_ftype _initialize_or1k_tdep;/* -Wmissing-prototypes */ +
This is no longer needed, because GDB is moved to C++.
Otherwise, the code is good to me.
Signature · 1 line
Yao (齐尧)
PATCH v6 4/5 gdb: testsuite: Add or1k tdesc-regs.exp test support
In reply to Stafford HorneQuoted 5 lines · Stafford Horne
gdb/testsuite/ChangeLog:
2017-04-20 Stafford Horne <[email protected]>
* gdb.xml/tdesc-regs.exp: Add or1k support.
Patch is good to me.
Signature · 1 line
Yao (齐尧)
PATCH v6 5/5 Add gdb for or1k build
In reply to Stafford HorneQuoted 3 lines · Stafford Horne
2017-02-12 Stafford Horne <[email protected]>
* configure.ac: remove logic adding gdb to noconfigsdirs for or1k
s/remove/Remove/
ended with ".".
Quoted 1 line
* configure: regenerate
Likewise.
Patch should be sent to gcc-patches at gcc.gnu.org, where top-level configure are maintained. You can post your patch there after all the rest of patches are approved here.
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
In reply to Stafford HorneQuoted 7 lines · Stafford Horne
tdesc_register_in_reggroup_pin now able to handle arbitrary groups. This is useful when groups are created while the target descriptor file is received from the remote.This can be the case of a soft core target processor where registers/groups can change.
Quoted 6 lines
gdb/ChangeLog:
2013-02-15 Franck Jullien <[email protected]>
*
target-descriptions.c(tdesc_register_in_reggroup_p): Support arbitrary strings.
I am not sure what do you want to change and why do you need this change? I didn't see it in the previous version.
If you want to control what registers are displayed, you can follow the way nds32 used, see nds32-tdep.c:nds32_register_reggroup_p.
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
Quoted 13 lines · Yao Qi
Quoted 11 lines · Stafford Horne
tdesc_register_in_reggroup_pin now able to handle arbitrary groups. This is useful when groups are created while the target descriptor file is received from the remote.This can be the case of a soft core target processor where registers/groups can change.
gdb/ChangeLog:
2013-02-15 Franck Jullien <[email protected]>
Quoted 8 lines
Quoted 2 lines
*
target-descriptions.c(tdesc_register_in_reggroup_p): Support arbitrary strings.I am not sure what do you want to change and why do you need this change? I didn't see it in the previous version.
If you want to control what registers are displayed, you can follow the way nds32 used, see nds32-tdep.c:nds32_register_reggroup_p.
Hi Yao,
Thanks for reviewing. Sorry, this was in previous versions but dropped on accident then added back, I forgot to mention.
Currenly tdesc_register_in_reggroup_p() only returns true if the register group number is one of the hard coded reggroups: float, vector, general, save or restor.
This change is to also allow returning true in the case that the register group was registered with gdb with reggroup_add(). This seems like something that will be generally required so it was added to the target-descriptions definition. If you think not I can make it for openrisc only, but I think it makes more sense in tdesc.
This allows the command like, the below to return the registers for the named reggroup.
info reg system
-Stafford
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Yao QiQuoted 15 lines · Yao Qi
gdb/doc/gdb.texinfo As usual, you can inquire about the @code{mipsfpu} variable with · line 22318
Quoted 10 lines · Stafford Horne
+ at kindex target remote
+ at item target remotegdb/doc/gdb.texinfo +8
-0+ +Connect to a remote OpenRISC 1000 target. This is supported by + at dfn{Or1ksim}, the OpenRISC 1000 architectural simulator as well as QEMU, +Verilator and Icarus Verilog simulators. @dfn{Remote serial protocol} +servers, such as OpenOCD, are also available to drive various hardware +implementations via JTAG. + +Example: @code{target remote :51000}Do we need to document "target remote"? which is not specific to any particular configurations.
I understand this is nothing new, but this tells to the users some extra details about using target remote for OpenRISC (example which platforms support it). Also, this is consistent with some other targets like Microblaze.
Quoted 48 lines
Quoted 48 lines
gdb/doc/gdb.texinfo +34
-0+ + at kindex target sim + at item target sim + +Runs the builtin CPU simulator which can run very basic +programs but does not support most hardware functions like MMU. +For more complex use cases the user is advised to run an external +target, and connect using @samp{target remote}. + +Example: @code{target sim} + + at end table + @node PowerPC Embedded @subsection PowerPC Embedded@@ -41088,6 +41131,7 @@ registers using the capitalization used in the description. * M68K Features:: * NDS32 Features:: * Nios II Features:: +* OpenRISC 1000 Features:: * PowerPC Features:: * S/390 and System z Features:: * Sparc Features::@@ -41374,6 +41418,32 @@ targets. It should contain the 32 core registers (@samp{zero}, @samp{pc}, and the 16 control registers (@samp{status} through @samp{mpuacc}). + at node OpenRISC 1000 Features + at subsection Openrisc 1000 Features + at cindex target descriptions, OpenRISC 1000 features + +The @samp{org.gnu.gdb.or1k.group0} feature is required for OpenRISC 1000 +targets. It should contain the 32 general purpose registers (@samp{r0} +through @samp{r31}), @samp{ppc}, @samp{npc} and @samp{sr}. + +Along with the default reggroups like @samp{system} and @samp{general} +provided by @value{GDBN}, OpenRISC targets can use the following reggroups +to group their many registers: + + at smallexample + Group Type + immu user + dmmu user + icache user + dcache user + pic user + timer user
Quoted 8 lines
gdb/doc/gdb.texinfo targets. It should contain the 32 core registers (@samp{zero}, · line 41446
Quoted 6 lines
gdb/doc/gdb.texinfo +6
-0+ power user + perf user + mac user + debug user + at end smallexample +Why do you need to document the reggroups?
These register groups can be used by the target description features. If not documented one would have to look into the code. In general arbitrary groups are not allowed by features. This is also related to patch 1/5.
Quoted 10 lines
gdb/or1k-tdep.c line 1290
Quoted 3 lines
gdb/or1k-tdep.c new file +3
-0+ +extern initialize_file_ftype _initialize_or1k_tdep;/* -Wmissing-prototypes */ +This is no longer needed, because GDB is moved to C++.
Otherwise, the code is good to me.
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
In reply to Stafford HorneQuoted 5 lines · Stafford Horne
This change is to also allow returning true in the case that the register group was registered with gdb with
reggroup_add(). This seems like something that will be generally required so it was added to the target-descriptions definition. If you think not I can make it for openrisc only, but I think it makes more sense in tdesc.
Thanks for the explanation.
Quoted 5 lines
This allows the command like, the below to return the registers for the named reggroup.
info reg system
Some bits are missing,
- A test case, in which we can define some reggroups "foo" and test expected "foo" is shown in the output of "maintenance print reggroups". You can add reggroups in gdb.xml/extra-regs.xml.
- A test case with live inferior, get a list of support reggroups from the output of "maint print reggroups", pass each reggroup to "info reg $group", and test there is no error.
- Document "info registers".
https://sourceware.org/gdb/current/onlinedocs/gdb/Registers.html
doesn't document the usage "info reg GROUP". We need to add it.
- Add a news entry, because your patch adds a user visible change.
Signature · 1 line
Yao (齐尧)
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Stafford HorneQuoted 5 lines · Stafford Horne
I understand this is nothing new, but this tells to the users some extra details about using target remote for OpenRISC (example which platforms support it). Also, this is consistent with some other targets like Microblaze.
All the targets listed in "Embedded Processors" do have "target remote". We don't have to document it for every one. IMO, we need to remove "target remote" from Microblaze part too.
Quoted 59 lines
Quoted 50 lines
Quoted 50 lines
gdb/doc/gdb.texinfo +13
-0+ + at kindex target sim + at item target sim + +Runs the builtin CPU simulator which can run very basic +programs but does not support most hardware functions like MMU. +For more complex use cases the user is advised to run an external +target, and connect using @samp{target remote}. + +Example: @code{target sim} + + at end table + @node PowerPC Embedded @subsection PowerPC Embedded@@ -41088,6 +41131,7 @@ registers using the capitalization used inthe description.
* M68K Features::
* NDS32 Features::
* Nios II Features::gdb/doc/gdb.texinfo +21
-0+* OpenRISC 1000 Features:: * PowerPC Features:: * S/390 and System z Features:: * Sparc Features::@@ -41374,6 +41418,32 @@ targets. It should contain the 32 core registers (@samp{zero}, @samp{pc}, and the 16 control registers (@samp{status} through @samp{mpuacc}). + at node OpenRISC 1000 Features + at subsection Openrisc 1000 Features + at cindex target descriptions, OpenRISC 1000 features + +The @samp{org.gnu.gdb.or1k.group0} feature is required for OpenRISC 1000 +targets. It should contain the 32 general purpose registers (@samp{r0} +through @samp{r31}), @samp{ppc}, @samp{npc} and @samp{sr}. + +Along with the default reggroups like @samp{system} and @samp{general} +provided by @value{GDBN}, OpenRISC targets can use the following reggroups +to group their many registers: + + at smallexample + Group Type + immu user + dmmu user + icache user + dcache user + pic user + timer userQuoted 8 lines
gdb/doc/gdb.texinfo targets. It should contain the 32 core registers (@samp{zero}, · line 41446
Quoted 6 lines
gdb/doc/gdb.texinfo +6
-0+ power user + perf user + mac user + debug user + at end smallexample +Why do you need to document the reggroups?
Quoted 3 lines
These register groups can be used by the target description features. If not documented one would have to look into the code. In general arbitrary groups are not allowed by features. This is also related to patch 1/5.
"maintenance print reggroups" can tell the reggroups, so don't need to document them.
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
In reply to Stafford Hornegdb/target-descriptions.c tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, · line 1123
Quoted 8 lines · Stafford Horne
if (reggroup == general_reggroup)gdb/target-descriptions.c +4
-0return general_p; + +if (strcmp (reg->group,reggroup_name (reggroup)) ==0 ) +return 1 ; + }
I read the patch again, and find that we can replace the whole block in "if (reg != NULL && reg->group != NULL)" with the code this patch adds, like this,
if (reg != NULL && reg->group != NULL
&& (strcmp (reg->group, reggroup_name (reggroup)) == 0))
return 1;Signature · 1 line
Yao (齐尧)
PATCH v6 2/5 gdb: Add OpenRISC or1k and or1knd target support
In reply to Yao QiQuoted 11 lines · Yao Qi
Quoted 5 lines · Stafford Horne
I understand this is nothing new, but this tells to the users some extra details about using target remote for OpenRISC (example which platforms support it). Also, this is consistent with some other targets like Microblaze.
All the targets listed in "Embedded Processors" do have "target remote". We don't have to document it for every one. IMO, we need to remove "target remote" from Microblaze part too.
Sure I will remove. Also I am adding 'set debug or1k' and 'show debug or1k'.
Quoted 59 lines
Quoted 59 lines
Quoted 58 lines
Quoted 46 lines
gdb/doc/gdb.texinfo +13
-0+ + at kindex target sim + at item target sim + +Runs the builtin CPU simulator which can run very basic +programs but does not support most hardware functions like MMU. +For more complex use cases the user is advised to run an external +target, and connect using @samp{target remote}. + +Example: @code{target sim} + + at end table + @node PowerPC Embedded @subsection PowerPC Embedded@@ -41088,6 +41131,7 @@ registers using the capitalization used inthe description.
* M68K Features::
* NDS32 Features::
* Nios II Features::gdb/doc/gdb.texinfo +17
-0+* OpenRISC 1000 Features:: * PowerPC Features:: * S/390 and System z Features:: * Sparc Features::@@ -41374,6 +41418,32 @@ targets. It should contain the 32 core registers (@samp{zero}, @samp{pc}, and the 16 control registers (@samp{status} through @samp{mpuacc}). + at node OpenRISC 1000 Features + at subsection Openrisc 1000 Features + at cindex target descriptions, OpenRISC 1000 features + +The @samp{org.gnu.gdb.or1k.group0} feature is required for OpenRISC 1000 +targets. It should contain the 32 general purpose registers (@samp{r0} +through @samp{r31}), @samp{ppc}, @samp{npc} and @samp{sr}. + +Along with the default reggroups like @samp{system} and @samp{general} +provided by @value{GDBN}, OpenRISC targets can use the following reggroups +to group their many registers: + + at smallexample + Group Type + immu user + dmmu usergdb/doc/gdb.texinfo targets. It should contain the 32 core · line 41447
Quoted 10 lines
gdb/doc/gdb.texinfo +10
-0+ icache user + dcache user + pic user + timer user + power user + perf user + mac user + debug user + at end smallexample +Why do you need to document the reggroups?
Quoted 6 lines
Quoted 3 lines
These register groups can be used by the target description features. If not documented one would have to look into the code. In general arbitrary groups are not allowed by features. This is also related to patch 1/5.
"maintenance print reggroups" can tell the reggroups, so don't need to document them.
Sure, I will remove.
Quoted 2 lines
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
In reply to Yao QiQuoted 14 lines · Yao Qi
gdb/target-descriptions.c tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, · line 1123
Quoted 8 lines · Stafford Horne
if (reggroup == general_reggroup)gdb/target-descriptions.c +4
-0return general_p; + +if (strcmp (reg->group,reggroup_name (reggroup)) ==0 ) +return 1 ; + }I read the patch again, and find that we can replace the whole block in "if (reg != NULL &&
reg->group!= NULL)" with the code this patch adds, like this,
Quoted 3 lines
if (reg != NULL && reg->group != NULL
&& (strcmp (reg->group, reggroup_name (reggroup)) == 0))
return 1;Thanks, I was thinking to simply to this as well, but I left the patch I inheherited as is. I will also update the commit log and comment to make it more clear what is going on.
Quoted 2 lines
Signature · 1 line
Yao (齐尧)
PATCH v6 1/5 tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
In reply to Yao QiQuoted 26 lines · Yao Qi
Quoted 5 lines · Stafford Horne
This change is to also allow returning true in the case that the register group was registered with gdb with
reggroup_add(). This seems like something that will be generally required so it was added to the target-descriptions definition. If you think not I can make it for openrisc only, but I think it makes more sense in tdesc.Thanks for the explanation.
Quoted 5 lines
This allows the command like, the below to return the registers for the named reggroup.
info reg system
Some bits are missing,
- A test case, in which we can define some reggroups "foo" and test expected "foo" is shown in the output of "maintenance print reggroups". You can add reggroups in
gdb.xml/extra-regs.xml.- A test case with live inferior, get a list of support reggroups from the output of "maint print reggroups", pass each reggroup to "info reg $group", and test there is no error.
Quoted 5 lines
- Document "info registers".
https://sourceware.org/gdb/current/onlinedocs/gdb/Registers.html
doesn't document the usage "info reg GROUP". We need to add it.- Add a news entry, because your patch adds a user visible change.
Right,
I am working on this, I have most of it done. However, I am thinking to submit this separately from the OpenRISC port.
There are more changes required to get this to work as you mention in the (1st) test case above. Currently tdesc supplied reggroups are not added by default, they need to be manually supplied by calling reggroup_add(). I have made a patch to make this automatic.
As mentioned I will split this out separate from the OpenRISC patch and do all that is mentioned above.
-Stafford