[v2,4/4] arc: Add arc-*-linux regformats

Message ID 20200428160437.1585-5-shahab.vahedi@gmail.com
State New
Headers show
Series
  • arc: Add GNU/Linux support
Related show

Commit Message

Hannes Domani via Gdb-patches April 28, 2020, 4:04 p.m.
From: Anton Kolesov <Anton.Kolesov@synopsys.com>


gdb/ChangeLog:
2020-04-28  Anton Kolesov <anton.kolesov@synopsys.com>

	* features/Makefile: Add new files and expedite registers.
	* regformats/arc-arcompact-Linux.dat: New file.
	* regformats/arc-v2-Linux.dat: Likewise.
---
 gdb/features/Makefile                  |  4 ++-
 gdb/regformats/arc-arcompact-linux.dat | 42 ++++++++++++++++++++++++
 gdb/regformats/arc-v2-linux.dat        | 45 ++++++++++++++++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 gdb/regformats/arc-arcompact-linux.dat
 create mode 100644 gdb/regformats/arc-v2-linux.dat

-- 
2.26.2

Comments

Simon Marchi May 14, 2020, 3:12 p.m. | #1
On 2020-04-28 12:04 p.m., Shahab Vahedi via Gdb-patches wrote:
> From: Anton Kolesov <Anton.Kolesov@synopsys.com>

> 

> gdb/ChangeLog:

> 2020-04-28  Anton Kolesov <anton.kolesov@synopsys.com>

> 

> 	* features/Makefile: Add new files and expedite registers.

> 	* regformats/arc-arcompact-Linux.dat: New file.

> 	* regformats/arc-v2-Linux.dat: Likewise.


Can you explain why this is useful?  I always forget, but I have the feeling
that regformats are something we are going away from, and that if you support
target descriptions, you don't need that... but I would need to refresh my
memory.

Simon
Hannes Domani via Gdb-patches June 15, 2020, 11:37 p.m. | #2
On Thu, May 14, 2020 at 11:12:55AM -0400, Simon Marchi wrote:
> On 2020-04-28 12:04 p.m., Shahab Vahedi via Gdb-patches wrote:

> > From: Anton Kolesov <Anton.Kolesov@synopsys.com>

> > 

> > gdb/ChangeLog:

> > 2020-04-28  Anton Kolesov <anton.kolesov@synopsys.com>

> > 

> > 	* features/Makefile: Add new files and expedite registers.

> > 	* regformats/arc-arcompact-Linux.dat: New file.

> > 	* regformats/arc-v2-Linux.dat: Likewise.

> 

> Can you explain why this is useful?  I always forget, but I have the feeling

> that regformats are something we are going away from, and that if you support

> target descriptions, you don't need that... but I would need to refresh my

> memory.


To my understanding, the values of "expedite" registers are always transferred
from the "server" to GDB client. With every step you take, or any stop you do,
GDB client will know about the value of "expedite" registers. In case of ARC,
those are the "program counter" and "stack pointer" registers.
I _think_ the "dat" files are the mechanism holding information about that.
After all it is generated from the XML and we also followed other targets
in doing so.


Shahab
Simon Marchi June 16, 2020, 2:08 a.m. | #3
On 2020-06-15 7:37 p.m., Shahab Vahedi wrote:
> On Thu, May 14, 2020 at 11:12:55AM -0400, Simon Marchi wrote:

>> On 2020-04-28 12:04 p.m., Shahab Vahedi via Gdb-patches wrote:

>>> From: Anton Kolesov <Anton.Kolesov@synopsys.com>

>>>

>>> gdb/ChangeLog:

>>> 2020-04-28  Anton Kolesov <anton.kolesov@synopsys.com>

>>>

>>> 	* features/Makefile: Add new files and expedite registers.

>>> 	* regformats/arc-arcompact-Linux.dat: New file.

>>> 	* regformats/arc-v2-Linux.dat: Likewise.

>>

>> Can you explain why this is useful?  I always forget, but I have the feeling

>> that regformats are something we are going away from, and that if you support

>> target descriptions, you don't need that... but I would need to refresh my

>> memory.

> 

> To my understanding, the values of "expedite" registers are always transferred

> from the "server" to GDB client. With every step you take, or any stop you do,

> GDB client will know about the value of "expedite" registers. In case of ARC,

> those are the "program counter" and "stack pointer" registers.

> I _think_ the "dat" files are the mechanism holding information about that.

> After all it is generated from the XML and we also followed other targets

> in doing so.


It's true that these .dat files do that, but it's not the only way.  They
don't offer any flexibility for architectures that have optional set of
registers, as it requires you to generate one format for each possible
combination of these options.  So the trend has been to move away from that,
towards target descriptions assembled at runtime.

I would encourage you to look at how aarch64 handles it, as it's one of the
latest that was introduced.  You'll notice that there is one xml file for
each "feature".  They are then assembled at runtime based on the features
detected on the current hardware.  The expedite registers are also taken
care of, it's all in gdbserver/linux-aarch64-tdesc.cc.

I'd prefer if we didn't add a new architecture that uses the old method.

Simon

Patch

diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index a95be667dc1..312c4f53185 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -44,7 +44,8 @@ 
 #   make GDB=/path/to/gdb XMLTOC="xml files" FEATURE_XMLFILES="xml files" cfiles
 
 # List of .dat files to create in ../regformats/
-WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
+WHICH = arc-v2-linux arc-arcompact-linux \
+	arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
 	arm/arm-with-neon \
 	mips-linux mips-dsp-linux \
 	microblaze-with-stack-protect \
@@ -72,6 +73,7 @@  WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
 
 # Record which registers should be sent to GDB by default after stop.
 aarch64-expedite = x29,sp,pc
+arc-expedite = sp,pc
 arm-expedite = r11,sp,pc
 i386-expedite = ebp,esp,eip
 amd64-expedite = rbp,rsp,rip
diff --git a/gdb/regformats/arc-arcompact-linux.dat b/gdb/regformats/arc-arcompact-linux.dat
new file mode 100644
index 00000000000..1d35860af3d
--- /dev/null
+++ b/gdb/regformats/arc-arcompact-linux.dat
@@ -0,0 +1,42 @@ 
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
+# Generated from: arc-arcompact-linux.xml
+name:arc_arcompact_linux
+xmltarget:arc-arcompact-linux.xml
+expedite:sp,pc
+32:r0
+32:r1
+32:r2
+32:r3
+32:r4
+32:r5
+32:r6
+32:r7
+32:r8
+32:r9
+32:r10
+32:r11
+32:r12
+32:r13
+32:r14
+32:r15
+32:r16
+32:r17
+32:r18
+32:r19
+32:r20
+32:r21
+32:r22
+32:r23
+32:r24
+32:r25
+32:gp
+32:fp
+32:sp
+32:blink
+32:lp_count
+32:pcl
+32:pc
+32:status32
+32:lp_start
+32:lp_end
+32:bta
diff --git a/gdb/regformats/arc-v2-linux.dat b/gdb/regformats/arc-v2-linux.dat
new file mode 100644
index 00000000000..7e5d1904664
--- /dev/null
+++ b/gdb/regformats/arc-v2-linux.dat
@@ -0,0 +1,45 @@ 
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
+# Generated from: arc-v2-linux.xml
+name:arc_v2_linux
+xmltarget:arc-v2-linux.xml
+expedite:sp,pc
+32:r0
+32:r1
+32:r2
+32:r3
+32:r4
+32:r5
+32:r6
+32:r7
+32:r8
+32:r9
+32:r10
+32:r11
+32:r12
+32:r13
+32:r14
+32:r15
+32:r16
+32:r17
+32:r18
+32:r19
+32:r20
+32:r21
+32:r22
+32:r23
+32:r24
+32:r25
+32:gp
+32:fp
+32:sp
+32:r30
+32:blink
+32:r58
+32:r59
+32:lp_count
+32:pcl
+32:pc
+32:status32
+32:lp_start
+32:lp_end
+32:bta