summaryrefslogtreecommitdiffstats
path: root/src/build/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/debug')
-rwxr-xr-xsrc/build/debug/Hostboot/Errl.pm5
-rwxr-xr-xsrc/build/debug/Hostboot/MemStats.pm64
-rwxr-xr-xsrc/build/debug/Hostboot/PageMgr.pm5
-rw-r--r--src/build/debug/Hostboot/PrintVMM.pm8
-rwxr-xr-xsrc/build/debug/Hostboot/Printk.pm7
-rwxr-xr-xsrc/build/debug/Hostboot/Ps.pm3
-rwxr-xr-xsrc/build/debug/Hostboot/Trace.pm10
-rwxr-xr-xsrc/build/debug/Hostboot/_DebugFramework.pm140
-rwxr-xr-xsrc/build/debug/Hostboot/_DebugFrameworkVMM.pm6
-rwxr-xr-xsrc/build/debug/ecmd-debug-framework.pl15
-rwxr-xr-xsrc/build/debug/hb-dump-debug21
-rwxr-xr-xsrc/build/debug/simics-debug-framework.pl13
12 files changed, 249 insertions, 48 deletions
diff --git a/src/build/debug/Hostboot/Errl.pm b/src/build/debug/Hostboot/Errl.pm
index e3484555c..8b248a786 100755
--- a/src/build/debug/Hostboot/Errl.pm
+++ b/src/build/debug/Hostboot/Errl.pm
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2015
+# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] International Business Machines Corp.
#
#
@@ -84,7 +84,8 @@ sub main
}
}
- my ($symAddr, $symSize) = ::findSymbolAddress("ERRORLOG::g_ErrlStorage");
+ my ($symAddr, $symSize) = ::findPointer("ERRORLOG",
+ "ERRORLOG::g_ErrlStorage");
if (not defined $symAddr)
{
::userDisplay "Couldn't find symbol ERRORLOG::g_ErrlStorage\n";
diff --git a/src/build/debug/Hostboot/MemStats.pm b/src/build/debug/Hostboot/MemStats.pm
index 68fcf15e2..9156d8267 100755
--- a/src/build/debug/Hostboot/MemStats.pm
+++ b/src/build/debug/Hostboot/MemStats.pm
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2018
+# [+] 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.
@@ -28,6 +30,8 @@ our @EXPORT_OK = ('main');
use constant HEAPMGR_INSTANCE_NAME =>
"Singleton<HeapManager>::instance()::instance";
+use constant PAGEMGR_INSTANCE_NAME =>
+ "Singleton<PageManager>::instance()::instance";
use constant HEAPMGR_CHUNK_OFFSET => 0;
#use constant HEAPMGR_BIGCHUNK_OFFSET => 0;
use constant HEAPMGR_NUMBER_OF_BUCKETS => 12;
@@ -51,11 +55,11 @@ sub main
$showchunks = 1;
}
- my ($heap_manager_addr, $symSize) =
- ::findSymbolAddress(HEAPMGR_INSTANCE_NAME);
+ my ($heap_manager_addr, $symSize) = ::findPointer("HEAPMGR ",
+ HEAPMGR_INSTANCE_NAME);
- my @page_manager_addr =
- ::findSymbolAddress("Singleton<PageManager>::instance()::instance");
+ my @page_manager_addr = ::findPointer("PAGEMGR ",
+ PAGEMGR_INSTANCE_NAME);
my $free_pages =
::read64 @page_manager_addr;
@@ -63,39 +67,49 @@ sub main
my $total_pages =
::read64 ($page_manager_addr[0] + 8, 8);
- my $free_min =
- ::read64 ::findSymbolAddress("PageManager::cv_low_page_count");
+ my $free_min = ::read64
+ ::findPointer("PAGEMLPC",
+ "PageManager::cv_low_page_count");
- my $page_coal =
- ::read64 ::findSymbolAddress("PageManager::cv_coalesce_count");
+ my $page_coal = ::read64
+ ::findPointer("PAGEMCNT",
+ "PageManager::cv_coalesce_count");
- my $big_heap_pages_used =
- ::read32 ::findSymbolAddress("HeapManager::cv_largeheap_page_count");
+ my $big_heap_pages_used = ::read32
+ ::findPointer("HEAPMLPC",
+ "HeapManager::cv_largeheap_page_count");
- my $big_heap_max =
- ::read32 ::findSymbolAddress("HeapManager::cv_largeheap_page_max");
+ my $big_heap_max = ::read32
+ ::findPointer("HEAPMLPM",
+ "HeapManager::cv_largeheap_page_max");
- my $small_heap_pages_used =
- ::read32 ::findSymbolAddress("HeapManager::cv_smallheap_page_count");
+ my $small_heap_pages_used = ::read32
+ ::findPointer("HEAPMSPC",
+ "HeapManager::cv_smallheap_page_count");
- my $heap_coal =
- ::read32 ::findSymbolAddress("HeapManager::cv_coalesce_count");
+ my $heap_coal = ::read32
+ ::findPointer("HEAPMCNT",
+ "HeapManager::cv_coalesce_count");
- my $heap_free =
- ::read32 ::findSymbolAddress("HeapManager::cv_free_bytes");
+ my $heap_free = ::read32
+ ::findPointer("HEAPBYTE",
+ "HeapManager::cv_free_bytes");
- my $heap_free_chunks =
- ::read32 ::findSymbolAddress("HeapManager::cv_free_chunks");
+ my $heap_free_chunks = ::read32
+ ::findPointer("HEAPCHNK",
+ "HeapManager::cv_free_chunks");
my $heap_total = $big_heap_pages_used + $small_heap_pages_used;
my $heap_max = $big_heap_max + $small_heap_pages_used;
- my $castout_ro =
- ::read32 ::findSymbolAddress("Block::cv_ro_evict_req");
+ my $castout_ro = ::read32
+ ::findPointer("BLOCKROE",
+ "Block::cv_ro_evict_req");
- my $castout_rw =
- ::read32 ::findSymbolAddress("Block::cv_rw_evict_req");
+ my $castout_rw = ::read32
+ ::findPointer("BLOCKRWE",
+ "Block::cv_rw_evict_req");
::userDisplay "===================================================\n";
diff --git a/src/build/debug/Hostboot/PageMgr.pm b/src/build/debug/Hostboot/PageMgr.pm
index d0d73f3d8..faa70253e 100755
--- a/src/build/debug/Hostboot/PageMgr.pm
+++ b/src/build/debug/Hostboot/PageMgr.pm
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2012,2016
+# Contributors Listed Below - COPYRIGHT 2012,2018
# [+] International Business Machines Corp.
#
#
@@ -54,7 +54,8 @@ sub main
}
# Find the PageManager
- my ($symAddr, $symSize) = ::findSymbolAddress(PAGEMGR_INSTANCE_NAME);
+ my ($symAddr, $symSize) = ::findPointer("PAGEMGR ",
+ PAGEMGR_INSTANCE_NAME);
if (not defined $symAddr)
{
::userDisplay "Couldn't find ".PAGEMGR_INSTANCE_NAME;
diff --git a/src/build/debug/Hostboot/PrintVMM.pm b/src/build/debug/Hostboot/PrintVMM.pm
index 390a9b4b6..476262d93 100644
--- a/src/build/debug/Hostboot/PrintVMM.pm
+++ b/src/build/debug/Hostboot/PrintVMM.pm
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# Contributors Listed Below - COPYRIGHT 2012,2018
+# [+] 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.
@@ -68,8 +70,8 @@ sub main
}
# Get the device segment address
- my @segment_manager_addr =
- ::findSymbolAddress("Singleton<SegmentManager>::instance()::instance");
+ my @segment_manager_addr = ::findPointer("SGMNTMGR",
+ "Singleton<SegmentManager>::instance()::instance");
if (not defined @segment_manager_addr)
{
diff --git a/src/build/debug/Hostboot/Printk.pm b/src/build/debug/Hostboot/Printk.pm
index 8f933145c..b7dd49546 100755
--- a/src/build/debug/Hostboot/Printk.pm
+++ b/src/build/debug/Hostboot/Printk.pm
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2018
+# [+] 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.
@@ -30,7 +32,8 @@ our @EXPORT_OK = ('main');
sub main
{
- my ($symAddr, $symSize) = ::findSymbolAddress("kernel_printk_buffer");
+ my ($symAddr, $symSize) = ::findPointer("PRINTK ",
+ "kernel_printk_buffer");
if (not defined $symAddr) { ::userDisplay "Cannot find symbol.\n"; die; }
my $data = ::readData($symAddr,$symSize);
$data =~ s/\0+//g; #strip off nulls
diff --git a/src/build/debug/Hostboot/Ps.pm b/src/build/debug/Hostboot/Ps.pm
index 134bc6ae8..594f124e0 100755
--- a/src/build/debug/Hostboot/Ps.pm
+++ b/src/build/debug/Hostboot/Ps.pm
@@ -67,7 +67,8 @@ sub main
# Find symbol containing kernel list of task objects.
# (Tasks who's parent is the kernel)
- my ($symAddr, $symSize) = ::findSymbolAddress(PS_TASKMGR_SYMBOLNAME);
+ my ($symAddr, $symSize) = ::findPointer("TASKLIST",
+ PS_TASKMGR_SYMBOLNAME);
if (not defined $symAddr)
{
::userDisplay "Couldn't find ".PS_TASKMGR_SYMBOLNAME;
diff --git a/src/build/debug/Hostboot/Trace.pm b/src/build/debug/Hostboot/Trace.pm
index 23286b48c..4756de305 100755
--- a/src/build/debug/Hostboot/Trace.pm
+++ b/src/build/debug/Hostboot/Trace.pm
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2016
+# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] International Business Machines Corp.
#
#
@@ -75,11 +75,11 @@ sub main
my $foundBuffer = 0;
print $fh "\2";
- my ($daemonAddr, $daemonSize) =
- ::findSymbolAddress("Singleton<TRACEDAEMON::Daemon>::instance()::instance");
+ my ($daemonAddr, $daemonSize) =::findPointer("TRACEDMN",
+ "Singleton<TRACEDAEMON::Daemon>::instance()::instance");
- my ($serviceAddr, $serviceSize) =
- ::findSymbolAddress("Singleton<TRACE::Service>::instance()::instance");
+ my ($serviceAddr, $serviceSize) = ::findPointer("TRACESVC",
+ "Singleton<TRACE::Service>::instance()::instance");
if ((not defined $daemonAddr) || (not defined $serviceAddr))
{
diff --git a/src/build/debug/Hostboot/_DebugFramework.pm b/src/build/debug/Hostboot/_DebugFramework.pm
index 8937f4f6d..4977eedeb 100755
--- a/src/build/debug/Hostboot/_DebugFramework.pm
+++ b/src/build/debug/Hostboot/_DebugFramework.pm
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2017
+# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] International Business Machines Corp.
#
#
@@ -56,6 +56,7 @@ our @EXPORT = ( 'setBootloader', 'clearBootloader', 'callToolModule',
'getIstepList',
'findSymbolWithinAddrRange',
'alignUp',
+ 'findDebugPointer', 'findPointer',
);
our ($parsedSymbolFile, %symbolAddress, %symbolTOC,
@@ -63,6 +64,11 @@ our ($parsedSymbolFile, %symbolAddress, %symbolTOC,
our ($parsedModuleFile, %moduleAddress);
our (%toolOpts);
our ($bootloaderDebug);
+our (%debugPointerAddrs, %debugPointerSizes, $parsedDebugPointers);
+
+# HOSTBOOT eyecatcher at HRMOR+8K+16
+use constant DEBUG_PTR_ADDR => 8208;
+
BEGIN
{
@@ -71,6 +77,9 @@ BEGIN
%symbolTOC = ();
%addressSymbol = ();
%addrRangeHash = ();
+ %debugPointerAddrs = ();
+ %debugPointerSizes = ();
+ $parsedDebugPointers = 0;
%symbolSize = ();
@@ -365,9 +374,103 @@ sub parseSymbolFile
$parsedSymbolFile = 1;
}
+# @sub parseDebugPointers <INTERNAL ONLY>
+#
+# Parses the debug pointers area of memory.
+# See debugpointers.H for implementation details
+#
+# @return array of (address, size) or (not-defined, not-defined).
+#
+sub parseDebugPointers
+{
+ if ($parsedDebugPointers) { return; }
+
+ # The pointer to the DebugPointers_t sits right behind the
+ #my $debugptr = translateHRMOR(DEBUG_PTR_ADDR);
+ #::userDisplay("Reading $debugptr\n");
+ my $mainptr = ::read64(DEBUG_PTR_ADDR);
+ #::userDisplay("mainptr=$mainptr\n");
+ if( $mainptr == 0 )
+ {
+ ::userDisplay("No debug pointer set at 0x2010\n");
+ }
+ elsif( $mainptr > 0x4000000 )
+ {
+ ::userDisplay("Debug pointer area appears invalid - $mainptr\n");
+ }
+ else
+ {
+ #::userDisplay("Found debug pointer at $mainptr\n");
+ #uint64_t eyecatcher;
+ #uint16_t version;
+ #uint16_t numEntries;
+ #uint32_t reserved;
+ #PointerPair_t pairs[MAX_ENTRIES];
+
+ # Pull down the metadata
+ my $eyecatcher = ::read64($mainptr);
+ #::userDisplay("eyecatcher=$eyecatcher\n");
+ my $version = ::read16($mainptr+8);
+ #::userDisplay("version=$version\n");
+ my $numentries = ::read16($mainptr+10);
+ #::userDisplay("numentries=$numentries\n");
+ if( $eyecatcher != 0x4445425547505452 ) #DEBUGPTR
+ {
+ ::userDisplay("Invalid debug pointer at $mainptr\n");
+ }
+
+ # Walk through all of the pointers
+ #char label[8];
+ #uint32_t size;
+ #uint32_t pointer;
+
+ my $curentry = $mainptr+16;
+ for(my $i = 0; $i < $numentries; $i++)
+ {
+ #::userDisplay("i=$i, curentry=$curentry\n");
+ my $cur_label = ::read64($curentry);
+ my $cur_label2 = sprintf("%X",$cur_label);
+ my $cur_size = ::read32($curentry+8);
+ my $cur_ptr = ::read32($curentry+12);
+ if( $cur_label != 0 )
+ {
+ #my $cur_ascii = pack( "A*", $cur_label2 );
+ #::userDisplay(
+ # "$cur_label2 / $cur_ascii is at $cur_ptr for $cur_size\n");
+ $debugPointerAddrs{$cur_label2} = $cur_ptr;
+ $debugPointerSizes{$cur_label2} = $cur_size;
+ }
+
+ $curentry = $curentry+16;
+ }
+ }
+
+ $parsedDebugPointers = 1;
+}
+
+# @sub findDebugPointer
+#
+# Searches a syms file for the address of a particular symbol name.
+#
+# @param string - Symbol to search for.
+# @return array of (address, size) or (not-defined, not-defined).
+#
+sub findDebugPointer
+{
+ my $name = shift;
+
+ parseDebugPointers();
+ #::userDisplay("name=$name\n");
+ # need to turn this string into hex digits
+ my $name2 = uc(unpack( "H*", $name ));
+ #::userDisplay("name2=$name2\n");
+
+ return ($debugPointerAddrs{$name2}, $debugPointerSizes{$name2} );
+}
+
# @sub findSymbolAddress
#
-# Searchs a syms file for the address of a particular symbol name.
+# Searches a syms file for the address of a particular symbol name.
#
# @param string - Symbol to search for.
# @return array of (address, size) or (not-defined, not-defined).
@@ -381,6 +484,39 @@ sub findSymbolAddress
return ($symbolAddress{$name}, $symbolSize{$name} );
}
+# @sub findPointer
+#
+# Searches for a pointer wherever it can be found.
+# Looks in the debug pointer section of memory first, then
+# tries to use the symbols
+#
+# @param string - Debug pointer to search for.
+# @param string - Symbol to search for.
+# @return array of (address, size) or (not-defined, not-defined).
+#
+sub findPointer
+{
+ my $dbgptrstr = shift; #Debug Pointer
+ my $sym = shift; #Symbol
+ my $addr;
+ my $size;
+
+ my $symsmode = ::getSymsMode();
+ if( ($symsmode =~ "") || ($symsmode =~ "usemem") )
+ {
+ ($addr, $size ) = findDebugPointer( $dbgptrstr );
+ }
+
+ if( (($symsmode =~ "") && (not defined $addr))
+ || ($symsmode =~ "usefile") )
+ {
+ #::userDisplay( "*Using Symbol File*\n" );
+ ($addr, $size ) = findSymbolAddress( $sym );
+ }
+
+ return ( $addr, $size );
+}
+
# @sub findSymbolTOCAddress
# Searches a syms file for the address of the TOC of a symbol.
#
diff --git a/src/build/debug/Hostboot/_DebugFrameworkVMM.pm b/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
index e51e195a3..128df4ec7 100755
--- a/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
+++ b/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2012,2015
+# Contributors Listed Below - COPYRIGHT 2012,2018
# [+] International Business Machines Corp.
#
#
@@ -400,8 +400,8 @@ sub getPhysicalAddr
#}
# Get the device segment address
- my @segment_manager_addr =
- ::findSymbolAddress("Singleton<SegmentManager>::instance()::instance");
+ my @segment_manager_addr = ::findPointer("SGMNTMGR",
+ "Singleton<SegmentManager>::instance()::instance");
if (not defined @segment_manager_addr)
diff --git a/src/build/debug/ecmd-debug-framework.pl b/src/build/debug/ecmd-debug-framework.pl
index 0fadd554b..cbdbbad83 100755
--- a/src/build/debug/ecmd-debug-framework.pl
+++ b/src/build/debug/ecmd-debug-framework.pl
@@ -67,6 +67,11 @@ if (not $self)
$tool = basename $0;
}
+# "" : Default - Try to use memory, fall-back to symbol files
+# "usefile" : Only use the symbol files
+# "usemem" : Only use the data from memory
+my $useSymsMode = "";
+
GetOptions("tool:s" => \$tool,
"tool-options:s" => \$toolOptions,
"test" => \$testImage,
@@ -77,6 +82,7 @@ GetOptions("tool:s" => \$tool,
"node:i" => \$node,
"proc:i" => \$proc,
"memmode:s" => \$memMode,
+ "symsmode:s" => \$useSymsMode,
"man" => \$cfgMan) || pod2usage(-verbose => 0);
pod2usage(-verbose => 1) if $cfgHelp;
pod2usage(-verbose => 2) if $cfgMan;
@@ -125,6 +131,15 @@ sub getImgPath
return $imgPath;
}
+# @sub getSymsMode
+#
+# Return whether we should use symbol files or pointers from memory.
+#
+sub getSymsMode
+{
+ return $useSymsMode;
+}
+
# @sub getIsTest
#
# Return boolean to determine if tools should look at test debug files or
diff --git a/src/build/debug/hb-dump-debug b/src/build/debug/hb-dump-debug
index 50972ff45..3aeffe02e 100755
--- a/src/build/debug/hb-dump-debug
+++ b/src/build/debug/hb-dump-debug
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2018
+# [+] 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.
@@ -50,17 +52,23 @@ if (defined ($hbDir))
}
}
+# "both" : Try to use memory, fall-back to symbol files
+# "usefile" : Only use the symbol files
+# "usemem" : Only use the data from memory
+my $useSymsMode = "both";
+
GetOptions("tool:s" => \$tool,
"tool-options:s" => \$toolOptions,
"file:s" => \$dumpfile,
"test" => \$testImage,
"img-path:s" => \$imgPath,
+ "symsmode:s" => \$useSymsMode,
"help" => \$cfgHelp,
"toolhelp" => \$toolHelp,
"man" => \$cfgMan) || pod2usage(-verbose => 0);
pod2usage(-verbose => 1) if $cfgHelp;
pod2usage(-verbose => 2) if $cfgMan;
-pod2usage(-verbose => 0) if (($tool eq "") ||
+pod2usage(-verbose => 0) if (($tool eq "") ||
(($dumpfile eq "") && (!$toolHelp)));
if ($toolHelp)
@@ -133,6 +141,15 @@ sub getImgPath
return $imgPath;
}
+# @sub getSymsMode
+#
+# Return whether we should use symbol files or pointers from memory.
+#
+sub getSymsMode
+{
+ return $useSymsMode;
+}
+
# @sub getIsTest
#
# Return boolean to determine if tools should look at test debug files or
diff --git a/src/build/debug/simics-debug-framework.pl b/src/build/debug/simics-debug-framework.pl
index 932a30f84..1a16db647 100755
--- a/src/build/debug/simics-debug-framework.pl
+++ b/src/build/debug/simics-debug-framework.pl
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2016
+# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] Google Inc.
# [+] International Business Machines Corp.
#
@@ -157,6 +157,17 @@ sub getImgPath
return $imgPath;
}
+# @sub getSymsMode
+#
+# Return whether we should use symbol files or pointers from memory.
+# "usefile" : Only use the symbol files
+#
+sub getSymsMode
+{
+ # We're always running from a build of some sort in simics
+ return "usefile";
+}
+
# Tool location override.
sub getToolOverride
{
OpenPOWER on IntegriCloud