#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # $Source: src/build/vpo/hb-errl $ # # IBM CONFIDENTIAL # # COPYRIGHT International Business Machines Corp. 2011 # # p1 # # Object Code Only (OCO) source materials # Licensed Internal Code Source Materials # IBM HostBoot Licensed Internal Code # # The source code for this program is not published or other- # wise divested of its trade secrets, irrespective of what has # been deposited with the U.S. Copyright Office. # # Origin: 30 # # IBM_PROLOG_END # # Purpose: This perl script works on VBU and will dump error log buffer # # Author: CamVan Nguyen # Last Updated: 09/07/2011 # #------------------------------------------------------------------------------ # Specify perl modules to use #------------------------------------------------------------------------------ use strict; use warnings; use POSIX; #------------------------------------------------------------------------------ # Forward Declaration #------------------------------------------------------------------------------ sub printUsage; #============================================================================== # MAIN #============================================================================== #------------------------------------------------------------------------------ # Parse optional input arguments #------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; #print "num args = $numArgs\n"; #print "argument list = @ARGV\n"; my $hbDir = $ENV{'HBDIR'}; if (defined ($hbDir)) { unless ($hbDir ne "") { $hbDir = '.'; #Set to current directory } } else { $hbDir = '.'; #Set to current directory } my $dumpErrlList = 0; my $dumpErrlDtl = 0; my @errlOpt; for (my $i=0; $i<$numArgs; $i++) { if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) { #Print command line help printUsage(); exit (0); } elsif ($ARGV[$i] eq "--in") { if (($i + 1) >= $numArgs) { die "No value given for --in parameter.\n"; } $i++; $hbDir = $ARGV[$i]; } elsif ($ARGV[$i] eq "--out") { if (($i + 1) >= $numArgs) { die "No value given for --out parameter.\n"; } $i++; } elsif (($ARGV[$i] eq "-d") && ($dumpErrlList == 0)) { $dumpErrlDtl = 1; #save the error log option & remove it from @ARGV push(@errlOpt, $ARGV[$i]); splice(@ARGV, $i, 1); $numArgs--; $i--; last if (($i + 1) >= $numArgs); $i++; if (substr($ARGV[$i], 0, 1) eq '-') { $i--; } else { if (($ARGV[$i] =~ /all/i) || isdigit($ARGV[$i])) { #save the error log option & remove it from @ARGV push(@errlOpt, $ARGV[$i]); splice(@ARGV, $i, 1); $numArgs--; $i--; } else { die "ERROR: Enter logid or 'all'" } } } elsif (($ARGV[$i] eq "-l") && ($dumpErrlDtl == 0)) { $dumpErrlList = 1; #save the error log option & remove it from @ARGV push(@errlOpt, $ARGV[$i]); splice(@ARGV, $i, 1); $numArgs--; $i--; } elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) { print "Invalid argument entered: $ARGV[$i]\n"; printUsage(); exit(1); } } #------------------------------------------------------------------------------ # Dump the error log(s) #------------------------------------------------------------------------------ my $command = "$hbDir/hb-virtdebug.pl --errl @errlOpt @ARGV"; system($command); #============================================================================== # SUBROUTINES #============================================================================== #------------------------------------------------------------------------------ # Print command line help #------------------------------------------------------------------------------ sub printUsage() { print ("\nUsage: hb-errl [--help] | [-l | -d [|all]]\n"); print (" [--in ]\n"); print (" [--out ]\n"); print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); print (" This program retrieves the error log(s) from L3.\n"); print (" User should copy the relevant .syms file, hb-virtdebug.pl & errlparser\n"); print (" to the current directory or set the env variable HBDIR to the path\n"); print (" of the files.\n\n"); print (" --help Prints usage information.\n"); print (" --in Overrides the automatically detected .syms file,\n"); print (" hb-virtdebug.pl & errlparser in HBDIR or the current directory.\n"); print (" This program will search for the files in the "); print ("following order:\n"); print (" 1. from the path specified by the user\n"); print (" 2. from HBDIR if it is defined\n"); print (" 3. from the current directory\n"); print (" --out Directory where the output data will be saved.\n"); print (" Default path is the current directory.\n"); print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); print (" -l Dumps a listing of all the error logs\n"); print (" -d Dumps detailed data of the specified error log.\n"); print (" -d [all] Dumps detailed data of all error logs\n"); print (" -k# Specify which cage to act on (default = 0).\n"); print (" -n# Specify which node to act on (default = 0).\n"); print (" -s# Specify which slot to act on (default = 0).\n"); print (" -p# Specify which chip position to act on (default = 0).\n"); print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); print ("\n NOTE: This program will not work if user has not stopped instructions\n"); print (" prior to running this program.\n"); }