diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2012-01-06 15:28:35 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-01-25 08:53:50 -0600 |
commit | cad6f41c5ceb5affe968a32618e4cf5d53cb7554 (patch) | |
tree | 93ba18d835402cb175e41f412eb67cc0d8d52d7c /src/build/debug/Hostboot/_DebugFramework.pm | |
parent | 52b60aea13ffc9a8d67a6714e1416402fd203139 (diff) | |
download | talos-hostboot-cad6f41c5ceb5affe968a32618e4cf5d53cb7554.tar.gz talos-hostboot-cad6f41c5ceb5affe968a32618e4cf5d53cb7554.zip |
VPO implementation of debug framework.
Change-Id: Ic4efd38fb189efa7c42a7b3089c82c7f6d408c14
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/596
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/debug/Hostboot/_DebugFramework.pm')
-rwxr-xr-x | src/build/debug/Hostboot/_DebugFramework.pm | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/src/build/debug/Hostboot/_DebugFramework.pm b/src/build/debug/Hostboot/_DebugFramework.pm index fd62127bf..071174021 100755 --- a/src/build/debug/Hostboot/_DebugFramework.pm +++ b/src/build/debug/Hostboot/_DebugFramework.pm @@ -42,7 +42,7 @@ use strict; package Hostboot::_DebugFramework; use Exporter 'import'; -our @EXPORT = ( 'callToolModule', 'callToolModuleHelp', +our @EXPORT = ( 'callToolModule', 'callToolModuleHelp', 'callToolModuleHelpInfo', 'parseToolOpts', 'determineImagePath', 'findSymbolAddress', 'findSymbolTOCAddress', 'findSymbolByAddress', @@ -93,20 +93,64 @@ sub callToolModule # @sub callToolModuleHelp # -# Executes the 'help' function of the requested tool module to display -# tool usage. +# Display the tool usage. # # @param string - Tool to call. # sub callToolModuleHelp { my $tool = shift; + my %info = callToolModuleHelpInfo($tool); + + ::userDisplay("\nTool: $tool\n"); + + for my $i ( 0 .. $#{ $info{intro} } ) + { + ::userDisplay("\t$info{intro}[$i]\n"); + } + + if (defined $info{options}) + { + ::userDisplay("\nOptions:\n"); + + for my $key ( keys %{$info{options}} ) + { + ::userDisplay("\t$key\n"); + + for my $i (0 .. $#{ $info{options}{$key} } ) + { + ::userDisplay("\t\t$info{options}{$key}[$i]\n"); + } + } + } + + if (defined $info{notes}) + { + ::userDisplay("\n"); + for my $i (0 .. $#{ $info{notes} } ) + { + ::userDisplay("$info{notes}[$i]\n"); + } + } +} + +# @sub callToolModuleHelpInfo +# +# Executes the 'helpInfo' function of the requested tool module to get +# the tool usage info. +# +# @param string - Tool to call. +# +sub callToolModuleHelpInfo +{ + my $tool = shift; my $package = "Hostboot::$tool"; eval("use lib '.'; use $package; return 1;") or die "Couldn't load tool \"$tool\":\n\t$@"; - eval("$package->help(\\%toolOpts);"); + my %info = eval("$package->helpInfo(\\%toolOpts);"); die $@ if $@; + return %info; } # @sub parseToolOpts |