From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24311 invoked by alias); 14 Sep 2008 01:01:21 -0000 Received: (qmail 24116 invoked by uid 22791); 14 Sep 2008 01:01:18 -0000 X-Spam-Check-By: sourceware.org Received: from rn-out-0910.google.com (HELO rn-out-0910.google.com) (64.233.170.186) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 14 Sep 2008 01:00:44 +0000 Received: by rn-out-0910.google.com with SMTP id k40so1065598rnd.0 for ; Sat, 13 Sep 2008 18:00:41 -0700 (PDT) Received: by 10.150.143.5 with SMTP id q5mr1539958ybd.7.1221354041234; Sat, 13 Sep 2008 18:00:41 -0700 (PDT) Received: by 10.151.50.6 with HTTP; Sat, 13 Sep 2008 18:00:41 -0700 (PDT) Message-ID: <1e3eba760809131800y3dcbcc33u8c8c4ccb4e06eb11@mail.gmail.com> Date: Sun, 14 Sep 2008 01:01:00 -0000 From: "Randolph Chung" To: "John David Anglin" Subject: Re: [PATCH] Fix dwarf register column to gdb register mapping Cc: gdb-patches@sourceware.org In-Reply-To: <20080913233216.E87714E6A@hiauly1.hia.nrc.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080913233216.E87714E6A@hiauly1.hia.nrc.ca> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00308.txt.bz2 When I enabled the dwarf debugging support in gdb before i caused various errors and warnings about incorrect cfi. Do you still see that with this enabled? Is it compiler dependent? Because of those warnings and errors I had disabled the dwarf stuff on hppa before. Looks good to me otherwise. Thanks for fixing it. randolph On Sat, Sep 13, 2008 at 4:32 PM, John David Anglin wrote: > The following revises hppa_dwarf_reg_to_regnum and hppa64_dwarf_reg_to_regnum > to implement my understanding of the mapping needed on hppa. The dwarf > columns essentially correspond one-to-one to the GCC internal register > numbering. I think someone must have been looking at the dbx numbering > when these routines were first implemented. The numbering used by gdb > for hppa is in hppa-tdep.h. > > The sniffer stuff is obsolete. > > Tested on hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu. > > Ok? > > Dave > -- > J. David Anglin dave.anglin@nrc-cnrc.gc.ca > National Research Council of Canada (613) 990-0752 (FAX: 952-6602) > > 2008-09-13 John David Anglin > > * hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum): Remove "#if 0" "#endif". > Fix mapping of dwarf columns to gdb registers. > (hppa_linux_init_abi): Call set_gdbarch_dwarf2_reg_to_regnum. Delete > disabled code. > * hppa-tdep.c (hppa64_dwarf_reg_to_regnum): Fix mapping of dwarf columns > to gdb registers. > > Index: hppa-linux-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v > retrieving revision 1.31 > diff -u -3 -p -r1.31 hppa-linux-tdep.c > --- hppa-linux-tdep.c 21 Aug 2008 13:19:18 -0000 1.31 > +++ hppa-linux-tdep.c 13 Sep 2008 22:51:35 -0000 > @@ -34,24 +34,26 @@ > > #include "elf/common.h" > > -#if 0 > /* Convert DWARF register number REG to the appropriate register > number used by GDB. */ > static int > -hppa_dwarf_reg_to_regnum (int reg) > +hppa_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) > { > - /* registers 0 - 31 are the same in both sets */ > - if (reg < 32) > + /* r1-r31 are the same in both sets (column for r0 is not used) */ > + if (reg >= 1 && reg < 32) > return reg; > > - /* dwarf regs 32 to 85 are fpregs 4 - 31 */ > - if (reg >= 32 && reg <= 85) > + /* Dwarf registers 32 to 87 are the floating point registers fr4 to fr31. */ > + if (reg >= 32 && reg < 88) > return HPPA_FP4_REGNUM + (reg - 32); > > + /* Dwarf register 88 is the sar register. */ > + if (reg == 88) > + return HPPA_SAR_REGNUM; > + > warning (_("Unmapped DWARF Register #%d encountered."), reg); > return -1; > } > -#endif > > static void > hppa_linux_target_write_pc (struct regcache *regcache, CORE_ADDR v) > @@ -545,12 +548,7 @@ hppa_linux_init_abi (struct gdbarch_info > set_gdbarch_regset_from_core_section > (gdbarch, hppa_linux_regset_from_core_section); > > -#if 0 > - /* Dwarf-2 unwinding support. Not yet working. */ > set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa_dwarf_reg_to_regnum); > - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); > - frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); > -#endif > > /* Enable TLS support. */ > set_gdbarch_fetch_tls_load_module_address (gdbarch, > Index: hppa-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/hppa-tdep.c,v > retrieving revision 1.260 > diff -u -3 -p -r1.260 hppa-tdep.c > --- hppa-tdep.c 11 Sep 2008 14:23:15 -0000 1.260 > +++ hppa-tdep.c 13 Sep 2008 22:51:35 -0000 > @@ -661,13 +661,17 @@ hppa64_register_name (struct gdbarch *gd > static int > hppa64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) > { > - /* r0-r31 and sar map one-to-one. */ > - if (reg <= 32) > + /* r1-r31 are the same in both sets (column for r0 is not used). */ > + if (reg >= 1 && reg < 32) > return reg; > > - /* fr4-fr31 are mapped from 72 in steps of 2. */ > - if (reg >= 72 || reg < 72 + 28 * 2) > - return HPPA64_FP4_REGNUM + (reg - 72) / 2; > + /* fr4-fr31 are mapped to 72, 74, 76 ... */ > + if (reg >= 32 && reg < 60) > + return HPPA64_FP4_REGNUM + 2 * (reg - 32); > + > + /* Dwarf register 60 is the sar register. */ > + if (reg == 60) > + return HPPA_SAR_REGNUM; > > error ("Invalid DWARF register num %d.", reg); > return -1; >