From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org, Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: [rfa] Use better types for ARM registers
Date: Tue, 20 Jun 2006 19:45:00 -0000 [thread overview]
Message-ID: <20060620194545.GA32554@nevyn.them.org> (raw)
This patch switches pc and sp to pointer types, and other registers
from int32 to uint32. The pc switch follows in the footsteps of a
clever idea that I last remember seeing from Mark Kettenis:
(gdb) i reg pc
pc 0x83a4 0x83a4 <handler+20>
The uint32 change is both cosmetic (I think it's less messy) and
necessary. I recently committed this, after a bug report from Michael
and some discussion:
2006-05-17 Daniel Jacobowitz <dan@codesourcery.com>
* dwarf2-frame.c: Include "value.h".
(read_reg): Use unpack_long and register_type.
* Makefile.in (dwarf2-frame.o): Update.
An unexpected consequence is that if the CFA comes from a register with
a signed type, and the host is 64-bit (like my amd64 desktop), the CFA
will be extended in the dwarf2 frame ID. This causes "stack
corruption" messages because we think it's way outside of the previous
frame. So, fix and prettify, at the same time.
OK?
Independent of this patch, if you have ideas on avoiding the sign
extension without discarding that reasonable and otherwise correct
patch, I am interested; more targets than ARM are affected. Should we
manually construct a pointer type of the correct size in read_reg?
--
Daniel Jacobowitz
CodeSourcery
2006-06-20 Daniel Jacobowitz <dan@codesourcery.com>
* arm-tdep.c (arm_register_type): Use unsigned types for registers.
Add special types for sp and pc.
* Makefile.in (arm-tdep.o): Update.
Index: src/gdb/arm-tdep.c
===================================================================
--- src.orig/gdb/arm-tdep.c 2006-06-20 15:30:24.000000000 -0400
+++ src/gdb/arm-tdep.c 2006-06-20 15:35:12.000000000 -0400
@@ -40,6 +40,7 @@
#include "trad-frame.h"
#include "objfiles.h"
#include "dwarf2-frame.h"
+#include "gdbtypes.h"
#include "arm-tdep.h"
#include "gdb/sim-arm.h"
@@ -1356,8 +1357,12 @@ arm_register_type (struct gdbarch *gdbar
else
return builtin_type_arm_ext_littlebyte_bigword;
}
+ else if (regnum == ARM_SP_REGNUM)
+ return builtin_type_void_data_ptr;
+ else if (regnum == ARM_PC_REGNUM)
+ return builtin_type_void_func_ptr;
else
- return builtin_type_int32;
+ return builtin_type_uint32;
}
/* Index within `registers' of the first byte of the space for
Index: src/gdb/Makefile.in
===================================================================
--- src.orig/gdb/Makefile.in 2006-06-20 15:32:01.000000000 -0400
+++ src/gdb/Makefile.in 2006-06-20 15:32:20.000000000 -0400
@@ -1786,7 +1786,7 @@ arm-tdep.o: arm-tdep.c $(defs_h) $(frame
$(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(arm_tdep_h) \
$(gdb_sim_arm_h) $(elf_bfd_h) $(coff_internal_h) $(elf_arm_h) \
$(gdb_assert_h) $(bfd_in2_h) $(libcoff_h) $(objfiles_h) \
- $(dwarf2_frame_h)
+ $(dwarf2_frame_h) $(gdbtypes_h)
auxv.o: auxv.c $(defs_h) $(target_h) $(gdbtypes_h) $(command_h) \
$(inferior_h) $(valprint_h) $(gdb_assert_h) $(auxv_h) \
$(elf_common_h)
next reply other threads:[~2006-06-20 19:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-20 19:45 Daniel Jacobowitz [this message]
2006-06-21 10:59 ` Richard Earnshaw
2006-06-23 13:01 ` Daniel Jacobowitz
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=20060620194545.GA32554@nevyn.them.org \
--to=drow@false.org \
--cc=Richard.Earnshaw@arm.com \
--cc=gdb-patches@sourceware.org \
/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