diff options
-rwxr-xr-x | sbe/build/simics/simics-debug-framework.py | 154 | ||||
-rw-r--r-- | sbe/image/Makefile | 6 | ||||
-rwxr-xr-x | tools/ppetracepp/tracehash.pl | 42 |
3 files changed, 125 insertions, 77 deletions
diff --git a/sbe/build/simics/simics-debug-framework.py b/sbe/build/simics/simics-debug-framework.py index e9a903c9..f377e07d 100755 --- a/sbe/build/simics/simics-debug-framework.py +++ b/sbe/build/simics/simics-debug-framework.py @@ -1,65 +1,89 @@ -import os
-import os.path
-import subprocess
-import re
-import random
-import sys
-import imp
-testIstepAuto = imp.load_source("testIstepAuto", os.environ['SBE_TOOLS_PATH'] + "/testIstepAuto.py")
-err = False
-
-syms = {};
-
-def check_sbe_tools_path ():
- global SBE_TOOLS_PATH
- SBE_TOOLS_PATH = os.environ['SBE_TOOLS_PATH'];
-
-def register_sbe_debug_framework_tools():
- check_sbe_tools_path ()
- fillSymTable()
- # Create command hook.
- new_command("sbe-istep",testIstepAuto.sbe_istep_func,
- args = [arg(int_t, "major"), arg(int_t, "minor")],
- alias = "istep",
- type = ["sbe-commands"],
- short = "Runs the debug framework for istep ",
- doc = "")
- new_command("sbe-trace", collectTrace,
- args = [arg(int_t, "procNr")],
- alias = "strace",
- type = ["sbe-commands"],
- short = "Runs the debug framework for trace ",
- doc = "")
- print "SBE Debug Framework: Registered tool:", "sbe-istep"
- print "SBE Debug Framework: Registered tool:", "sbe-trace"
-
-
-def fillSymTable():
-# symFile = os.environ['SBE_IMG_OUT_LOC'] + "/sbe.syms"
- symFile = SBE_TOOLS_PATH + "/sbe.syms"
-# symFile = os.environ['sb'] + "/../obj/ppc/sbei/sbfw/simics/sbe.syms"
- f = open( symFile, 'r')
- for line in f:
- words = line.split()
- if( len( words ) == 4 ):
- syms[words[3]] = [words[0], words[1]]
-
-def collectTrace ( procNr ):
- fileName = "sbe_" + `procNr` + "_tracMERG"
- cmd1 = "pipe \"p9Proc" + `procNr` + ".sbe.mibo_space.x 0x" + syms['g_pk_trace_buf'][0] + " 0x2028\" \"sed 's/^p:0x........ //g' | sed 's/ ................$//g' | sed 's/ //g' | xxd -r -p> ppetrace.bin\""
- cmd2 = "shell \"" + SBE_TOOLS_PATH + "/ppe2fsp ppetrace.bin sbetrace.bin \""
- cmd3 = "shell \"" + SBE_TOOLS_PATH + "/fsp-trace -s " + SBE_TOOLS_PATH + "/trexStringFile sbetrace.bin >" + fileName + "\""
- cmd4 = "shell \"" + "cat " + fileName + "\""
-
- ( rc, out ) = quiet_run_command( cmd1, output_modes.regular )
- if ( rc ):
- print "simics ERROR running %s: %d "%( cmd1, rc )
-
- SIM_run_alone( run_command, cmd2 )
- SIM_run_alone( run_command, cmd3 )
- SIM_run_alone( run_command, cmd4 )
-
-
-# Run the registration automatically whenever this script is loaded.
-register_sbe_debug_framework_tools()
-
+# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: sbe/build/simics/simics-debug-framework.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG +import os +import os.path +import subprocess +import re +import random +import sys +import imp +testIstepAuto = imp.load_source("testIstepAuto", os.environ['SBE_TOOLS_PATH'] + "/testIstepAuto.py") +err = False + +syms = {}; + +def check_sbe_tools_path (): + global SBE_TOOLS_PATH + SBE_TOOLS_PATH = os.environ['SBE_TOOLS_PATH']; + +def register_sbe_debug_framework_tools(): + check_sbe_tools_path () + fillSymTable() + # Create command hook. + new_command("sbe-istep",testIstepAuto.sbe_istep_func, + args = [arg(int_t, "major"), arg(int_t, "minor")], + alias = "istep", + type = ["sbe-commands"], + short = "Runs the debug framework for istep ", + doc = "") + new_command("sbe-trace", collectTrace, + args = [arg(int_t, "procNr")], + alias = "strace", + type = ["sbe-commands"], + short = "Runs the debug framework for trace ", + doc = "") + print "SBE Debug Framework: Registered tool:", "sbe-istep" + print "SBE Debug Framework: Registered tool:", "sbe-trace" + + +def fillSymTable(): +# symFile = os.environ['SBE_IMG_OUT_LOC'] + "/sbe.syms" + symFile = SBE_TOOLS_PATH + "/sbe.syms" +# symFile = os.environ['sb'] + "/../obj/ppc/sbei/sbfw/simics/sbe.syms" + f = open( symFile, 'r') + for line in f: + words = line.split() + if( len( words ) == 4 ): + syms[words[3]] = [words[0], words[1]] + +def collectTrace ( procNr ): + fileName = "sbe_" + `procNr` + "_tracMERG" + cmd1 = "pipe \"p9Proc" + `procNr` + ".sbe.mibo_space.x 0x" + syms['g_pk_trace_buf'][0] + " 0x2028\" \"sed 's/^p:0x........ //g' | sed 's/ ................$//g' | sed 's/ //g' | xxd -r -p> ppetrace.bin\"" + cmd2 = "shell \"" + SBE_TOOLS_PATH + "/ppe2fsp ppetrace.bin sbetrace.bin \"" + cmd3 = "shell \"" + SBE_TOOLS_PATH + "/fsp-trace -s " + SBE_TOOLS_PATH + "/sbeStringFile sbetrace.bin >" + fileName + "\"" + cmd4 = "shell \"" + "cat " + fileName + "\"" + + ( rc, out ) = quiet_run_command( cmd1, output_modes.regular ) + if ( rc ): + print "simics ERROR running %s: %d "%( cmd1, rc ) + + SIM_run_alone( run_command, cmd2 ) + SIM_run_alone( run_command, cmd3 ) + SIM_run_alone( run_command, cmd4 ) + + +# Run the registration automatically whenever this script is loaded. +register_sbe_debug_framework_tools() + diff --git a/sbe/image/Makefile b/sbe/image/Makefile index f03bc65c..abb145ff 100644 --- a/sbe/image/Makefile +++ b/sbe/image/Makefile @@ -144,7 +144,7 @@ SIMICS_PPE_TAR_FILES += $(OBJDIR)/../test/*.xml SIMICS_PPE_TAR_FILES += $(OBJDIR)/../test/*.py SIMICS_PPE_TAR_FILES += $(OBJDIR)/../../tools/ppetracepp/fsp-trace SIMICS_PPE_TAR_FILES += $(OBJDIR)/../../tools/ppetracepp/ppe2fsp -SIMICS_PPE_TAR_FILES += $(OBJDIR)/trexStringFile +SIMICS_PPE_TAR_FILES += $(OBJDIR)/sbeStringFile SIMICS_BB_TAR_FILES += $(OBJDIR)/../build/simics/* # Common Pm libraries @@ -445,11 +445,11 @@ appendloader: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMA #/afs/bb/proj/cte/tools/ppetools/prod/powerpc-eabi/bin/objcopy -O binary --only-section=.fixed $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJDIR)/fixed.bin -# collect all of the trace hash files for this image into a single trexStringFile +# collect all of the trace hash files for this image into a single sbeStringFile .PHONY : tracehash tracehash: mkdir -p $(OBJDIR) - $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile + $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/sbeStringFile #clean the kernel directory first, then the application level clean clean: diff --git a/tools/ppetracepp/tracehash.pl b/tools/ppetracepp/tracehash.pl index f12a0f8c..629578c0 100755 --- a/tools/ppetracepp/tracehash.pl +++ b/tools/ppetracepp/tracehash.pl @@ -1,4 +1,28 @@ #!/usr/bin/perl -w +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: tools/ppetracepp/tracehash.pl $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG # File tracehash.pl created by B J Zander. use strict; @@ -28,7 +52,7 @@ my $BB_STRING_FILE = "/opt/fsp/etc/BB_StringFile"; # Global Variables my $debug = 0; my $seperator = "&&&&"; -my $file_name = "trexStringFile"; +my $file_name = "sbeStringFile"; my $in_sand; my ($backing) = $ENV{'bb'}; my $hash_prog = "trexhash"; #default to in path @@ -292,7 +316,7 @@ sub determine_args() { exit(127); } - # Make sure trexStringFile is readable/writeable + # Make sure sbeStringFile is readable/writeable system("chmod ugo+rw $string_file"); } @@ -432,7 +456,7 @@ sub read_string_file() { $line = <FH>; - print "first line in trexStringFile= $line\n" if $debug; + print "first line in sbeStringFile= $line\n" if $debug; if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) { @@ -470,7 +494,7 @@ sub read_string_file() { } else { # If there is a file then we are dealing with the first - # version of trexStringFile so don't look for file name. + # version of sbeStringFile so don't look for file name. if ($debug) { print "version 0 stringfile detected: $string_file\n"; } @@ -611,7 +635,7 @@ sub assimilate_file($) { if ($version eq "1") { if ($hash_filename_too) { print "*** ERROR: hash_filename_too (-F) isn't possible with trace version 1\n"; - print " please rebuild all .hash files and global trexStringFile\n"; + print " please rebuild all .hash files and global sbeStringFile\n"; print " version 1 file is '$l_loc'\n"; exit(127); } @@ -664,7 +688,7 @@ sub assimilate_file($) { } else { # If there is a file then we are dealing with the first - # version of trexStringFile so don't look for file name. + # version of sbeStringFile so don't look for file name. # these files shouldn't be there anymore. we don't check for collisions here if ($debug) { print "version 0 stringfile detected: $string_file\n"; @@ -774,7 +798,7 @@ sub write_string_file() { foreach $l_key (@keys) { my $l_tmp = $hash_strings_array{$l_key}; # freshly collected strings if (exists $string_file_array{$l_key}) - { # hash exists in list from trexStringFile + { # hash exists in list from sbeStringFile my $l_tmp2 = $string_file_array{$l_key}; if (!$hash_filename_too) { $l_tmp =~ s/\|\|.*$//; @@ -847,7 +871,7 @@ Collect mode: tracehash.pl -c [-vFCS] [-d <dir>] [-s <string_file>] -f - String file to read and write/add to <string_file>. -d - Start of directory tree to scan for .hash files. Default = . -s - File with trace strings (and hashes) to read from and write to - default = ./trexStringFile + default = ./sbeStringFile -F - hash is calculated over trace string and source file name, otherwise without source file name -C - report an error if a hash collisions occurs @@ -862,7 +886,7 @@ Scan mode: tracehash.pl [-vFCS] [-d <dir>] [-s <string_file>] [ccpopts] -f - Source file to scan for trace entries. -d - Source directory to scan for trace entries. -s - File with trace strings (and hashes) to read from and write to. - default = ./trexStringFile + default = ./sbeStringFile -F - hash for string was build from format string + source file name -C - report an error if hash collisions occur -S - don't read global FLD-2.2 string file ($BB_STRING_FILE) |