Skip to content

Commit

Permalink
Modify debug framework to be build-independent
Browse files Browse the repository at this point in the history
During boot, Hostboot will push key pointers into memory.  This
allows the debug tools to find the pointers (using a known static
memory address) to base memory accesses on.  This replaces the
existing symbol lookup that we use now.  That means we don't
need to have the exact symbol file for the build we're debugging
against.

Change-Id: I4618e15a3dc90acc3a89520a502eb818c1b4258c
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56097
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
dcrowell77 committed Jun 26, 2018
1 parent d2482ab commit 0e138b0
Show file tree
Hide file tree
Showing 28 changed files with 578 additions and 63 deletions.
5 changes: 3 additions & 2 deletions src/build/debug/Hostboot/Errl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2011,2015
# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -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";
Expand Down
64 changes: 39 additions & 25 deletions src/build/debug/Hostboot/MemStats.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -51,51 +55,61 @@ 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;

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";
Expand Down
5 changes: 3 additions & 2 deletions src/build/debug/Hostboot/PageMgr.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2012,2016
# Contributors Listed Below - COPYRIGHT 2012,2018
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions src/build/debug/Hostboot/PrintVMM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down
7 changes: 5 additions & 2 deletions src/build/debug/Hostboot/Printk.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/build/debug/Hostboot/Ps.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/build/debug/Hostboot/Trace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2011,2016
# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit 0e138b0

Please sign in to comment.