From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16243 invoked by alias); 20 Jun 2006 19:45:50 -0000 Received: (qmail 16228 invoked by uid 22791); 20 Jun 2006 19:45:50 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 20 Jun 2006 19:45:48 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FsmAT-00007B-OJ; Tue, 20 Jun 2006 15:45:45 -0400 Date: Tue, 20 Jun 2006 19:45:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org, Richard Earnshaw Subject: [rfa] Use better types for ARM registers Message-ID: <20060620194545.GA32554@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org, Richard Earnshaw MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00285.txt.bz2 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 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 * 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 * 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)