diff options
Diffstat (limited to 'src/build/debug')
| -rwxr-xr-x | src/build/debug/Hostboot/ContTrace.pm | 53 | ||||
| -rwxr-xr-x | src/build/debug/Hostboot/Istep.pm | 51 | ||||
| -rwxr-xr-x | src/build/debug/ecmd-debug-framework.pl | 10 | ||||
| -rwxr-xr-x | src/build/debug/simics-debug-framework.pl | 7 | ||||
| -rwxr-xr-x | src/build/debug/vpo-debug-framework.pl | 26 |
5 files changed, 63 insertions, 84 deletions
diff --git a/src/build/debug/Hostboot/ContTrace.pm b/src/build/debug/Hostboot/ContTrace.pm index 05c53d75b..18c64dbb3 100755 --- a/src/build/debug/Hostboot/ContTrace.pm +++ b/src/build/debug/Hostboot/ContTrace.pm @@ -6,7 +6,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,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. @@ -27,10 +29,6 @@ package Hostboot::ContTrace; use Exporter; our @EXPORT_OK = ('main'); -use constant CONT_TRACE_ENABLE_FLAG_OFFSET => 0; -use constant CONT_TRACE_BUFFER_SIZE => CONT_TRACE_ENABLE_FLAG_OFFSET + 2; -use constant CONT_TRACE_BUFFER_ADDR => CONT_TRACE_BUFFER_SIZE + 6; - use File::Temp ('tempfile'); sub main @@ -56,42 +54,19 @@ sub main $fsptrace_options = $fsptrace_options."-f "; } - my $symAddr = 0; - my $symSize = 0; - - ($symAddr, $symSize) = ::findSymbolAddress("TRACE::g_debugSettings"); - if (not defined $symAddr) - { - ::userDisplay "Cannot find symbol: TRACE::g_debugSettings.\n"; die; - } if (defined $args->{"enable-cont-trace"}) { - my $new_enable = $args->{"enable-cont-trace"}; - $new_enable = $new_enable ? 2 : 1; - - my $enable = ::read8($symAddr + CONT_TRACE_ENABLE_FLAG_OFFSET); - if ($dbgMsg) - { - ::userDisplay("current Cont Trace Enable Flag = $enable\n"); - } - if (($enable < 2) && ($new_enable == 2)) - { - # truncate tracMERG to 0 - system( "cp /dev/null tracMERG" ); - } - - ::write8($symAddr + CONT_TRACE_ENABLE_FLAG_OFFSET, $new_enable); - if ($dbgMsg) - { - $new_enable = ::read8($symAddr+CONT_TRACE_ENABLE_FLAG_OFFSET); - ::userDisplay("new Cont Trace Enable Flag = $new_enable\n"); - } + ::userDisplay("enable-cont-trace not supported anymore\n") + ::userDisplay("Use istep control with istep 255.0 to disable\n" + ::userDisplay("Use istep control with istep 255.1 to enable\n" return; } - my $trigger = ::readScom(0x00050038); + #HB will place the trace buffer address in MBOX_SCRATCH1 (0x50038) when + #there is a buf to be extracted. Trigger off of this + my $trigger = ::readScom(0x00050038, 8); if ($dbgMsg) { ::userDisplay("$trigger...\n"); @@ -116,8 +91,9 @@ sub main ($fh,$fname) = tempfile(); binmode($fh); - my $buffAddr = ::read64($symAddr + CONT_TRACE_BUFFER_ADDR); - my $buffSize = ::read16($symAddr + CONT_TRACE_BUFFER_SIZE); + #Trigger has the buffer, address MBOX_SCRATCH2 has size + my $buffAddr = $trigger >> 32; + my $buffSize = ::readScom(0x00050039, 8) >> 32; print $fh (::readData($buffAddr, $buffSize)); @@ -129,7 +105,9 @@ sub main ::userDisplay("$cycles\n"); } - ::writeScom(0x00050038, 0x0); + #Write MBOX_SCRATCH1 to zero to indicate to HB that we have + #extracted the buffer and it can continue on its way + ::writeScom(0x00050038, 8, 0x0); open TRACE, ($args->{"fsp-trace"}." -s ".::getImgPath(). "hbotStringFile $fsptrace_options $fname |") || die; @@ -156,7 +134,6 @@ sub helpInfo "fsp-trace=<path>" => ["Path to non-default fsp-trace utility."], "with-file-names" => ["Trace statements will include file name of place the", "trace was defined."], - "enable-cont-trace=<1|0>" => ["Turn on|off continuous trace"], "debug" => ["Turn on debug messages"], } ); diff --git a/src/build/debug/Hostboot/Istep.pm b/src/build/debug/Hostboot/Istep.pm index ebbcfc63c..8d1896932 100755 --- a/src/build/debug/Hostboot/Istep.pm +++ b/src/build/debug/Hostboot/Istep.pm @@ -64,6 +64,7 @@ no warnings 'portable'; package Hostboot::Istep; use Exporter; our @EXPORT_OK = ('main'); +use File::Temp ('tempfile'); #------------------------------------------------------------------------------ # Constants @@ -74,7 +75,7 @@ use constant SPLESS_SINGLE_ISTEP_CMD => 0x00; use constant SPLESS_RESUME_ISTEP_CMD => 0x01; use constant SPLESS_CLEAR_TRACE_CMD => 0x02; -use constant MAX_ISTEPS => 25; +use constant MAX_ISTEPS => 256; use constant MAX_SUBSTEPS => 25; ## Mailbox Scratchpad regs @@ -361,6 +362,48 @@ sub showHelp exit 0; } +## --------------------------------------------------------------------------- +## Check to see if there are trace buffers avail +## if so, extract and write them out +## --------------------------------------------------------------------------- +sub checkContTrace +{ + my $SCRATCH_MBOX1 = 0x00050038; + my $SCRATCH_MBOX2 = 0x00050039; + my $contTrace = ""; + my $ctName = "tracMERG.cont"; + + $contTrace = ::readScom( $SCRATCH_MBOX1, 8 ); + if ( $contTrace != 0 ) + { + my $fh; + my $fname; + my $contFile; + ($fh,$fname) = tempfile(); + open ($contFile, '>>', $ctName) or die "Can't open '$ctName' $!"; + binmode($fh); + + #contTrace has the buffer, address MBOX_SCRATCH2 has size + #MBOX Scratch regs are only valid from 0:31, shift to give a num + my $buffAddr = $contTrace >> 32; + my $buffSize = ::readScom($SCRATCH_MBOX2, 8) >> 32; + + print $fh (::readData($buffAddr, $buffSize)); + + #Write 0 to let HB know we extracted buf and it can continue + ::writeScom($SCRATCH_MBOX1, 8, 0x0); + + open TRACE, ("fsp-trace -s ".::getImgPath(). + "hbotStringFile $fname |") || die; + while (my $line = <TRACE>) + { + ::userDisplay $line; + print $contFile $line; + } + + unlink $fname; + } +} ## --------------------------------------------------------------------------- ## Dump environment variable specified. @@ -634,7 +677,7 @@ sub getSyncStatus( ) ## check to see if we need to dump trace - no-op in simics - ##::checkContTrace(); + checkContTrace(); $result = getStatus(); $running = ( ( $result & 0x2000000000000000 ) >> 61 ); @@ -682,13 +725,13 @@ sub runIStep( $$ ) sendCommand( $cmd ); - $result = getSyncStatus(); ## if result is -1 we have a timeout if ( $result == -1 ) { ::userDisplay "-----------------------------------------------------------------\n"; + exit; } else { @@ -899,7 +942,7 @@ sub setMode( $ ) if ( $opt_debug ) { ::userDisplay "=== checkContTrace\n"; } ## check to see if it's time to dump trace - no-op in simics - ::checkContTrace(); + checkContTrace(); if ( $opt_debug ) { ::userDisplay "=== isShutDown\n"; } ## check for system crash diff --git a/src/build/debug/ecmd-debug-framework.pl b/src/build/debug/ecmd-debug-framework.pl index 99e9a2857..19370dcc0 100755 --- a/src/build/debug/ecmd-debug-framework.pl +++ b/src/build/debug/ecmd-debug-framework.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2014 +# Contributors Listed Below - COPYRIGHT 2013,2016 # [+] International Business Machines Corp. # # @@ -360,14 +360,6 @@ sub extImageFile return $extImage; } -## -## Dummy function to match continuous trace call in VPO -## -sub checkContTrace -{ - -} - # @sub determinMemMode # # Determine the appropriate method to access memory diff --git a/src/build/debug/simics-debug-framework.pl b/src/build/debug/simics-debug-framework.pl index ec46eccd0..932a30f84 100755 --- a/src/build/debug/simics-debug-framework.pl +++ b/src/build/debug/simics-debug-framework.pl @@ -367,11 +367,4 @@ parseToolOpts($toolOpts); callToolModule($tool); -## -## Dummy function to match continuous trace call in VPO -## -sub checkContTrace -{ - -} diff --git a/src/build/debug/vpo-debug-framework.pl b/src/build/debug/vpo-debug-framework.pl index 4ba62b01c..24aa306e3 100755 --- a/src/build/debug/vpo-debug-framework.pl +++ b/src/build/debug/vpo-debug-framework.pl @@ -881,32 +881,6 @@ sub writeScom return; } -## -## Special case: only used in VPO -## Check the continuous trace Scom reg to see if we need to dump -## trace. -## This has to be executed as an external procedure so that it goes to the -## proper output file. -## -sub checkContTrace() -{ - my $SCRATCH_MBOX1 = 0x00050038; - my $contTrace = ""; - - $contTrace = ::readScom( $SCRATCH_MBOX1 ); - if ( $contTrace != 0 ) - { - ## activate continuous trace - system ("$hbToolsDir/hb-ContTrace --mute > /dev/null" ); - system ("cat hb-ContTrace.output >> tracMERG"); - - ## ContTrace might leave instructions stopped, turn them - ## back on here to make sure. - ::startInstructions("0"); - } - -} - # @sub getHRMOR # # Returns the HRMOR (0 for VPO). |

