From: Jiong Wang <jiwang@tilera.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>, Walter Lee <walt@tilera.com>
Subject: Re: [RFC/TileGX 2/2] fix gdbserver bug for 32bit elf
Date: Wed, 27 Feb 2013 04:27:00 -0000 [thread overview]
Message-ID: <512D8B11.7080904@tilera.com> (raw)
In-Reply-To: <512CFA08.6060507@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]
at 2013/2/27 2:08, Pedro Alves written:
> You mention the 'pc' as a pseudo register. At the
> hardware/kernel level, on tilegx32, is 'pc' 32-bit or 64-bit?
> I thought Tile-GX was always 64-bit, and tilegx32 was just an ABI.
thanks for review these.
yes, exactly, TileGX is always 64bit. On tilegx32, at
hardware/kernel level, 'pc' is 64bit.
> Is the kernel already trimming the PC?
No trimming, the kernel always return 64bit.
below is the updated ChangeLog, and patch.
please review. thanks.
gdb/
* regformats/reg-tilegx.dat (name): Change abi name to "tilegx".
* regformats/reg-tilegx32.dat: New.
gdb/gdbserver/
* Makefile.in (clean): Remove reg-tilegx.c, reg-tilegx32.c.
(reg-tilegx32.c): New rule.
* configure.srv (tilegx-*-linux*): Add reg-tilegx32.o to
srv_regobj.
* linux-tile-low.c (tile_arch_steup): New function. Invoke
different register info initializer according to elf class.
(init_registers_tilgx32): New function. The tilegx32 register info
initializer.
(tile_fill_gregset): Use "uint_reg_t" to represent register size.
(tile_store_gregset): Likewise.
[-- Attachment #2: fix-gdbserver.patch --]
[-- Type: text/x-patch, Size: 4801 bytes --]
---
gdb/gdbserver/Makefile.in | 3 +++
gdb/gdbserver/configure.srv | 1 +
gdb/gdbserver/linux-tile-low.c | 31 ++++++++++++++++++++++++++-----
gdb/regformats/reg-tilegx.dat | 2 +-
gdb/regformats/reg-tilegx32.dat | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 98 insertions(+), 6 deletions(-)
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index dffe8ae..ee2c400 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -320,6 +320,7 @@ clean:
rm -f reg-arm.c reg-bfin.c i386.c reg-ia64.c reg-m32r.c reg-m68k.c
rm -f reg-sh.c reg-sparc.c reg-spu.c amd64.c i386-linux.c
rm -f reg-cris.c reg-crisv32.c amd64-linux.c reg-xtensa.c
+ rm -f reg-tilegx.c reg-tilegx32.c
rm -f arm-with-iwmmxt.c
rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c
rm -f mips-linux.c mips64-linux.c
@@ -694,6 +695,8 @@ reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c
reg-tilegx.c : $(srcdir)/../regformats/reg-tilegx.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-tilegx.dat reg-tilegx.c
+reg-tilegx32.c : $(srcdir)/../regformats/reg-tilegx32.dat $(regdat_sh)
+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-tilegx32.dat reg-tilegx32.c
#
# Dependency tracking. Most of this is conditional on GNU Make being
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 93c499c..b9a99d0 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -333,6 +333,7 @@ case "${target}" in
srv_linux_regsets=yes
;;
tilegx-*-linux*) srv_regobj=reg-tilegx.o
+ srv_regobj="${srv_regobj} reg-tilegx32.o"
srv_tgtobj="linux-low.o linux-tile-low.o linux-osdata.o linux-procfs.o"
srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_regsets=yes
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index c73bdf2..f242675 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -20,10 +20,13 @@
#include "server.h"
#include "linux-low.h"
+#include <arch/abi.h>
#include <sys/ptrace.h>
-/* Defined in auto-generated file reg-tile.c. */
-void init_registers_tile (void);
+/* Defined in auto-generated file reg-tilegx.c. */
+void init_registers_tilegx (void);
+/* Defined in auto-generated file reg-tilegx32.c. */
+void init_registers_tilegx32 (void);
#define tile_num_regs 65
@@ -103,7 +106,7 @@ tile_fill_gregset (struct regcache *regcache, void *buf)
for (i = 0; i < tile_num_regs; i++)
if (tile_regmap[i] != -1)
- collect_register (regcache, i, ((unsigned int *) buf) + tile_regmap[i]);
+ collect_register (regcache, i, ((uint_reg_t *) buf) + tile_regmap[i]);
}
static void
@@ -113,7 +116,7 @@ tile_store_gregset (struct regcache *regcache, const void *buf)
for (i = 0; i < tile_num_regs; i++)
if (tile_regmap[i] != -1)
- supply_register (regcache, i, ((unsigned long *) buf) + tile_regmap[i]);
+ supply_register (regcache, i, ((uint_reg_t *) buf) + tile_regmap[i]);
}
struct regset_info target_regsets[] =
@@ -123,9 +126,27 @@ struct regset_info target_regsets[] =
{ 0, 0, 0, -1, -1, NULL, NULL }
};
+static void
+tile_arch_setup (void)
+{
+ int pid = pid_of (get_thread_lwp (current_inferior));
+ unsigned int machine;
+ int is_elf64 = linux_pid_exe_is_elf_64_file (pid, &machine);
+
+ if (sizeof (void *) == 4)
+ if (is_elf64 > 0)
+ error (_("Can't debug 64-bit process with 32-bit GDBserver"));
+
+ if (!is_elf64)
+ init_registers_tilegx32();
+ else
+ init_registers_tilegx();
+}
+
+
struct linux_target_ops the_low_target =
{
- init_registers_tile,
+ tile_arch_setup,
tile_num_regs,
tile_regmap,
NULL,
diff --git a/gdb/regformats/reg-tilegx.dat b/gdb/regformats/reg-tilegx.dat
index fc971f9..588252f 100644
--- a/gdb/regformats/reg-tilegx.dat
+++ b/gdb/regformats/reg-tilegx.dat
@@ -1,4 +1,4 @@
-name:tile
+name:tilegx
expedite:sp,lr,pc
64:r0
64:r1
diff --git a/gdb/regformats/reg-tilegx32.dat b/gdb/regformats/reg-tilegx32.dat
new file mode 100644
index 0000000..d8bfe2a
--- /dev/null
+++ b/gdb/regformats/reg-tilegx32.dat
@@ -0,0 +1,67 @@
+name:tilegx32
+expedite:sp,lr,pc
+64:r0
+64:r1
+64:r2
+64:r3
+64:r4
+64:r5
+64:r6
+64:r7
+64:r8
+64:r9
+64:r10
+64:r11
+64:r12
+64:r13
+64:r14
+64:r15
+64:r16
+64:r17
+64:r18
+64:r19
+64:r20
+64:r21
+64:r22
+64:r23
+64:r24
+64:r25
+64:r26
+64:r27
+64:r28
+64:r29
+64:r30
+64:r31
+64:r32
+64:r33
+64:r34
+64:r35
+64:r36
+64:r37
+64:r38
+64:r39
+64:r40
+64:r41
+64:r42
+64:r43
+64:r44
+64:r45
+64:r46
+64:r47
+64:r48
+64:r49
+64:r50
+64:r51
+64:r52
+64:tp
+64:sp
+64:lr
+64:sn
+64:io0
+64:io1
+64:us0
+64:us1
+64:us2
+64:us3
+64:zero
+32:pc
next prev parent reply other threads:[~2013-02-27 4:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 10:42 Jiong Wang
2013-02-26 18:08 ` Pedro Alves
2013-02-27 4:27 ` Jiong Wang [this message]
2013-02-27 14:06 ` Pedro Alves
2013-02-27 14:10 ` Jiong Wang
2013-02-26 18:24 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=512D8B11.7080904@tilera.com \
--to=jiwang@tilera.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=walt@tilera.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox