From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14195 invoked by alias); 14 Dec 2007 13:55:39 -0000 Received: (qmail 14135 invoked by uid 9707); 14 Dec 2007 13:55:32 -0000 Date: Fri, 14 Dec 2007 13:55:00 -0000 Message-ID: <20071214135532.14119.qmail@sourceware.org> From: jflavio@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fixing the Libunwind registers mapping for PowerPC32/64. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: b75c309191bc0edf60db7b51ddf9c056f720fc86 X-Git-Newrev: 59372184fa6dc225a01068158bd3cc02ee22cca9 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2007-q4/txt/msg00588.txt.bz2 The branch, master has been updated via 59372184fa6dc225a01068158bd3cc02ee22cca9 (commit) from b75c309191bc0edf60db7b51ddf9c056f720fc86 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 59372184fa6dc225a01068158bd3cc02ee22cca9 Author: Jose Flavio Aguilar Paulino Date: Fri Dec 14 11:55:29 2007 -0200 Fixing the Libunwind registers mapping for PowerPC32/64. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/stack/ChangeLog | 5 + .../frysk/stack/LibunwindRegisterMapFactory.java | 75 +++++++++++- frysk-sys/lib/unwind/ChangeLog | 9 ++ frysk-sys/lib/unwind/GenRegEnum.awk | 134 ++++++++++++++++++++ frysk-sys/lib/unwind/UnwindRegistersPPC32.shenum | 10 +-- frysk-sys/lib/unwind/UnwindRegistersPPC64.shenum | 8 +- 6 files changed, 223 insertions(+), 18 deletions(-) create mode 100644 frysk-sys/lib/unwind/GenRegEnum.awk First 500 lines of diff: diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog index 83886b7..639321e 100644 --- a/frysk-core/frysk/stack/ChangeLog +++ b/frysk-core/frysk/stack/ChangeLog @@ -1,3 +1,8 @@ +2007-12-14 Jose Flavio Aguilar Paulino + + * LibunwindRegisterMapFactory.java: Add PPC32/64 LR, NIP and Floating + Pointer Registers. + 2007-12-11 Andrew Cagney * TestRegs.java (testFloatRegisters()): Delete. diff --git a/frysk-core/frysk/stack/LibunwindRegisterMapFactory.java b/frysk-core/frysk/stack/LibunwindRegisterMapFactory.java index 0ba51b4..72c34f6 100644 --- a/frysk-core/frysk/stack/LibunwindRegisterMapFactory.java +++ b/frysk-core/frysk/stack/LibunwindRegisterMapFactory.java @@ -125,7 +125,6 @@ public class LibunwindRegisterMapFactory { .add(X8664Registers.R15, UnwindRegistersX8664.R15) .add(X8664Registers.RIP, UnwindRegistersX8664.RIP) ; - private static final RegisterMap PPC64 = new RegisterMap("PPC64 libunwind") .add(PPC64Registers.GPR0, UnwindRegistersPPC64.R0) @@ -159,7 +158,43 @@ public class LibunwindRegisterMapFactory { .add(PPC64Registers.GPR28, UnwindRegistersPPC64.R28) .add(PPC64Registers.GPR29, UnwindRegistersPPC64.R29) .add(PPC64Registers.GPR30, UnwindRegistersPPC64.R30) - .add(PPC64Registers.GPR29, UnwindRegistersPPC64.R31) + .add(PPC64Registers.GPR31, UnwindRegistersPPC64.R31) + //Special Registers + .add(PPC64Registers.LR , UnwindRegistersPPC64.LR ) + .add(PPC64Registers.NIP , UnwindRegistersPPC64.NIP) + //Floating Point Registers + .add(PPC64Registers.FPR0, UnwindRegistersPPC64.F0) + .add(PPC64Registers.FPR1, UnwindRegistersPPC64.F1) + .add(PPC64Registers.FPR2, UnwindRegistersPPC64.F2) + .add(PPC64Registers.FPR3, UnwindRegistersPPC64.F3) + .add(PPC64Registers.FPR4, UnwindRegistersPPC64.F4) + .add(PPC64Registers.FPR5, UnwindRegistersPPC64.F5) + .add(PPC64Registers.FPR6, UnwindRegistersPPC64.F6) + .add(PPC64Registers.FPR7, UnwindRegistersPPC64.F7) + .add(PPC64Registers.FPR8, UnwindRegistersPPC64.F8) + .add(PPC64Registers.FPR9, UnwindRegistersPPC64.F9) + .add(PPC64Registers.FPR10, UnwindRegistersPPC64.F10) + .add(PPC64Registers.FPR11, UnwindRegistersPPC64.F11) + .add(PPC64Registers.FPR12, UnwindRegistersPPC64.F12) + .add(PPC64Registers.FPR13, UnwindRegistersPPC64.F13) + .add(PPC64Registers.FPR14, UnwindRegistersPPC64.F14) + .add(PPC64Registers.FPR15, UnwindRegistersPPC64.F15) + .add(PPC64Registers.FPR16, UnwindRegistersPPC64.F16) + .add(PPC64Registers.FPR17, UnwindRegistersPPC64.F17) + .add(PPC64Registers.FPR18, UnwindRegistersPPC64.F18) + .add(PPC64Registers.FPR19, UnwindRegistersPPC64.F19) + .add(PPC64Registers.FPR20, UnwindRegistersPPC64.F20) + .add(PPC64Registers.FPR21, UnwindRegistersPPC64.F21) + .add(PPC64Registers.FPR22, UnwindRegistersPPC64.F22) + .add(PPC64Registers.FPR23, UnwindRegistersPPC64.F23) + .add(PPC64Registers.FPR24, UnwindRegistersPPC64.F24) + .add(PPC64Registers.FPR25, UnwindRegistersPPC64.F25) + .add(PPC64Registers.FPR26, UnwindRegistersPPC64.F26) + .add(PPC64Registers.FPR27, UnwindRegistersPPC64.F27) + .add(PPC64Registers.FPR28, UnwindRegistersPPC64.F28) + .add(PPC64Registers.FPR29, UnwindRegistersPPC64.F29) + .add(PPC64Registers.FPR30, UnwindRegistersPPC64.F30) + .add(PPC64Registers.FPR31, UnwindRegistersPPC64.F31) ; private static final RegisterMap PPC32 @@ -195,7 +230,41 @@ public class LibunwindRegisterMapFactory { .add(PPC32Registers.GPR28, UnwindRegistersPPC32.R28) .add(PPC32Registers.GPR29, UnwindRegistersPPC32.R29) .add(PPC32Registers.GPR30, UnwindRegistersPPC32.R30) - .add(PPC32Registers.GPR29, UnwindRegistersPPC32.R31) + .add(PPC32Registers.GPR31, UnwindRegistersPPC32.R31) + .add(PPC32Registers.LR , UnwindRegistersPPC32.LR ) + //Floating Point Registers + .add(PPC32Registers.FPR0, UnwindRegistersPPC32.F0) + .add(PPC32Registers.FPR1, UnwindRegistersPPC32.F1) + .add(PPC32Registers.FPR2, UnwindRegistersPPC32.F2) + .add(PPC32Registers.FPR3, UnwindRegistersPPC32.F3) + .add(PPC32Registers.FPR4, UnwindRegistersPPC32.F4) + .add(PPC32Registers.FPR5, UnwindRegistersPPC32.F5) + .add(PPC32Registers.FPR6, UnwindRegistersPPC32.F6) + .add(PPC32Registers.FPR7, UnwindRegistersPPC32.F7) + .add(PPC32Registers.FPR8, UnwindRegistersPPC32.F8) + .add(PPC32Registers.FPR9, UnwindRegistersPPC32.F9) + .add(PPC32Registers.FPR10, UnwindRegistersPPC32.F10) + .add(PPC32Registers.FPR11, UnwindRegistersPPC32.F11) + .add(PPC32Registers.FPR12, UnwindRegistersPPC32.F12) + .add(PPC32Registers.FPR13, UnwindRegistersPPC32.F13) + .add(PPC32Registers.FPR14, UnwindRegistersPPC32.F14) + .add(PPC32Registers.FPR15, UnwindRegistersPPC32.F15) + .add(PPC32Registers.FPR16, UnwindRegistersPPC32.F16) + .add(PPC32Registers.FPR17, UnwindRegistersPPC32.F17) + .add(PPC32Registers.FPR18, UnwindRegistersPPC32.F18) + .add(PPC32Registers.FPR19, UnwindRegistersPPC32.F19) + .add(PPC32Registers.FPR20, UnwindRegistersPPC32.F20) + .add(PPC32Registers.FPR21, UnwindRegistersPPC32.F21) + .add(PPC32Registers.FPR22, UnwindRegistersPPC32.F22) + .add(PPC32Registers.FPR23, UnwindRegistersPPC32.F23) + .add(PPC32Registers.FPR24, UnwindRegistersPPC32.F24) + .add(PPC32Registers.FPR25, UnwindRegistersPPC32.F25) + .add(PPC32Registers.FPR26, UnwindRegistersPPC32.F26) + .add(PPC32Registers.FPR27, UnwindRegistersPPC32.F27) + .add(PPC32Registers.FPR28, UnwindRegistersPPC32.F28) + .add(PPC32Registers.FPR29, UnwindRegistersPPC32.F29) + .add(PPC32Registers.FPR30, UnwindRegistersPPC32.F30) + .add(PPC32Registers.FPR31, UnwindRegistersPPC32.F31) ; private static final ISAMap isaToMap diff --git a/frysk-sys/lib/unwind/ChangeLog b/frysk-sys/lib/unwind/ChangeLog index bf3bbed..f93b188 100644 --- a/frysk-sys/lib/unwind/ChangeLog +++ b/frysk-sys/lib/unwind/ChangeLog @@ -1,3 +1,12 @@ +2007-12-14 Jose Flavio Aguilar Paulino + + * GenRegEnum.awk: Add new Awk script to generate the registers + enum to be used for all archs. + + * UnwindRegistersPPC32.shenum: Using the GenRegEnum.awk script. + + * UnwindRegistersPPC64.shenum: Same as above. + 2007-12-11 Andrew Cagney * cni/UnwindH.hxx (getRegister): Delete stray printf. diff --git a/frysk-sys/lib/unwind/GenRegEnum.awk b/frysk-sys/lib/unwind/GenRegEnum.awk new file mode 100644 index 0000000..fa6fcb6 --- /dev/null +++ b/frysk-sys/lib/unwind/GenRegEnum.awk @@ -0,0 +1,134 @@ +# This file is part of the program FRYSK. +# +# Copyright (C) 2006-2007 IBM +# +# Contributed by +# Jose Flavio Aguilar Paulino +# +# FRYSK is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# FRYSK is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FRYSK; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# In addition, as a special exception, Red Hat, Inc. gives You the +# additional right to link the code of FRYSK with code not covered +# under the GNU General Public License ("Non-GPL Code") and to +# distribute linked combinations including the two, subject to the +# limitations in this paragraph. Non-GPL Code permitted under this +# exception must only link to the code of FRYSK through those well +# defined interfaces identified in the file named EXCEPTION found in +# the source code files (the "Approved Interfaces"). The files of +# Non-GPL Code may instantiate templates or use macros or inline +# functions from the Approved Interfaces without causing the +# resulting work to be covered by the GNU General Public +# License. Only Red Hat, Inc. may make changes or additions to the +# list of Approved Interfaces. You must obey the GNU General Public +# License in all respects for all of the FRYSK code and other code +# used in conjunction with FRYSK except the Non-GPL Code covered by +# this exception. If you modify this file, you may extend this +# exception to your version of the file, but you are not obligated to +# do so. If you do not wish to provide this exception without +# modification, you must delete this exception statement from your +# version and license this file solely under the GPL without +# exception. + +BEGIN { + if ( ARGC != 3 ) { + print "This script ('gen_reg_list.awk') requires 2 command line args, not " (ARGC-1); + print "The first the arch prefix, ex: PPC64 or X86;"; + print "The second the registers unwind prefix, ex: UNW."; + print "To be used to compose the registers DEFINE such as: PPC32_UNW_XXXXX"; + exit 1; + } + arch_prefix = ARGV[1]; + unwind_reg_prefix = ARGV[2]; + #cleaning the argv (to avoid it to be read as files by awk) + ARGV[1] = ""; + ARGV[2] = ""; + reg_prefix = unwind_reg_prefix "_" arch_prefix "_"; + reg_num = 0; + error_parsing = 0; + all_reg_num_list = ""; +} + +#Main program block +#for each line input +{ + #Only lines started with UNW_PPC64 will be processed + line_begin_regexp = "^[ \\t]*" reg_prefix; + if($0 ~ line_begin_regexp) { + + valid_line = 0; + second_field_start = ""; + + if(NF > 1) { + second_field_start = substr($2, 1); + if(second_field_start == "=") { + if($3 != "") { + reg_equals_start = substr($3, 4); + if(reg_equals_start != "UNW_") { + valid_line = 1; + gsub(",","",$3); + reg_num = $3; + } + else { + #for this kind of line: + #UNW_TDEP_LAST_REG = UNW_PPC64_NIP, + #thats not a real valid line for creating a Java Reg + valid_line = 0; + } + } + else { + error_parsing = 1; + } + } + else + if( (second_field_start == "//") || + (second_field_start == "/*") ) { + valid_line = 1; + } + else { + error_parsing = 1; + } + } + else { + valid_line = 1; + } + + if(error_parsing == 0) { + if(valid_line == 1) { + + #Check if the current register number + #has been assigned to other registers + regnum_exp = "reg" reg_num; + if(all_reg_num_list ~ regnum_exp) { + print "ERROR, THERE ARE TWO REGISTERS WITH THE SAME NUMBER: " reg_num " (" $1 ")"; + error_parsing = 1; + } + else { + gsub(",","",$1) + gsub(reg_prefix, "", $1) + printf "%s %s\n", $1, reg_num; + #Put the printed REG number in a string (a list) + all_reg_num_list = all_reg_num_list " reg" reg_num; + reg_num++; + } + } + } + } #UNW_PPC64 lines + } + + END { + if(error_parsing == 1) { + print "ERROR, COULD NOT CONVERT libunwind HEADER to java\n"; + exit 1; + } + } diff --git a/frysk-sys/lib/unwind/UnwindRegistersPPC32.shenum b/frysk-sys/lib/unwind/UnwindRegistersPPC32.shenum index 2f9997b..785bd65 100644 --- a/frysk-sys/lib/unwind/UnwindRegistersPPC32.shenum +++ b/frysk-sys/lib/unwind/UnwindRegistersPPC32.shenum @@ -41,11 +41,5 @@ # version and license this file solely under the GPL without # exception. -# Generate a mkenum.sh table for the UNW_PPC32 encodings we are interested in. -cat $(dirname $0)/../../../frysk-imports/libunwind/include/libunwind-ppc32.h | awk ' - /UNW_PPC32/ { - gsub(",","",$1) - gsub("UNW_PPC32_", "", $1) - printf "%s\n", $1 - }' | awk '{printf "%s %s\n", $1, NR -1 } -' 2>&1 +# Generate a mkenum.sh table for the UNW_PPC64 encodings we are interested in. +cat $(dirname $0)/../../../frysk-imports/libunwind/include/libunwind-ppc32.h | awk -f $(dirname $0)/../../../frysk-sys/lib/unwind/GenRegEnum.awk PPC32 UNW 2>&1 diff --git a/frysk-sys/lib/unwind/UnwindRegistersPPC64.shenum b/frysk-sys/lib/unwind/UnwindRegistersPPC64.shenum index 51c515f..b370bb7 100644 --- a/frysk-sys/lib/unwind/UnwindRegistersPPC64.shenum +++ b/frysk-sys/lib/unwind/UnwindRegistersPPC64.shenum @@ -42,10 +42,4 @@ # exception. # Generate a mkenum.sh table for the UNW_PPC64 encodings we are interested in. -cat $(dirname $0)/../../../frysk-imports/libunwind/include/libunwind-ppc64.h | awk ' - /UNW_PPC64/ { - gsub(",","",$1) - gsub("UNW_PPC64_", "", $1) - printf "%s\n", $1 - }' | awk '{printf "%s %s\n", $1, NR -1 } -' 2>&1 +cat $(dirname $0)/../../../frysk-imports/libunwind/include/libunwind-ppc64.h | awk -f $(dirname $0)/../../../frysk-sys/lib/unwind/GenRegEnum.awk PPC64 UNW 2>&1 hooks/post-receive -- frysk system monitor/debugger