summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/plugins
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-03-12 10:12:01 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-16 09:13:39 -0500
commit8a1168142bd3f273dbd4edf841c53a3ae394cd5e (patch)
tree94029d881fa5b89d186073859c7de2fd6dcdfcb8 /src/usr/errl/plugins
parentff8472f5e338d17194b5a1300b9553dd1ac3a241 (diff)
downloadtalos-hostboot-8a1168142bd3f273dbd4edf841c53a3ae394cd5e.tar.gz
talos-hostboot-8a1168142bd3f273dbd4edf841c53a3ae394cd5e.zip
ERRL: Ensure all Hostboot code uses ErrlUserDetails framework.
RTC: 36920 Change-Id: I82667c8e63e8a99b9cc7eb1dfbbbdbe1c3b2bb2a Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/730 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/errl/plugins')
-rw-r--r--src/usr/errl/plugins/errlParse.C190
-rw-r--r--src/usr/errl/plugins/symbols.H2
2 files changed, 30 insertions, 162 deletions
diff --git a/src/usr/errl/plugins/errlParse.C b/src/usr/errl/plugins/errlParse.C
index a70dc3ab3..bd859ad42 100644
--- a/src/usr/errl/plugins/errlParse.C
+++ b/src/usr/errl/plugins/errlParse.C
@@ -21,33 +21,23 @@
//
// IBM_PROLOG_END
-
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
+/**
+ * @file initsvcParse.C
+ *
+ * errl user data parser
+ */
#include <netinet/in.h>
-#include <endian.h>
-#include <vector>
-// Get these from a FipS/FSP backing build.
+// FSP includes
#include <errlplugins.H>
#include <errlusrparser.H>
#include <srcisrc.H>
-// These are from Hostboot.
+// Hostboot includes.
#include <hbotcompid.H>
#include <hostBootSrcParse.H>
-#include <errl/hberrltypes.H>
-
-// Get these from current directory.
#include "symbols.H"
-
-
//-------------------------------------------------------------
// endian switch a uint64
// TODO all plugins are probably going to want this.
@@ -74,159 +64,37 @@ static uint64_t ntohll( uint64_t i )
#error Unexpected endian context.
#endif
+#include <errl/errludparserfactoryerrl.H>
-
-
-//--------------------------------------------------------------------------
-// Use methods of i_parser such as
-// i_parser.PrintString( "label", "datastring" );
-// to format my user-defined data attached to error logs for my component.
-// Parameters i_sst (subsection type) and i_ver (version) identify
-// the nature of the user-defined data as defined by my component.
-// The file $bb/export/x86.nfp/fips/include/errlusrparser.H defines the
-// ErrlUsrParser class.
-//
-// Return true if handled, suppressing the default hex dump of the data.
-
-static bool myDataParse (
- ErrlUsrParser& i_parser,
- void* i_buffer,
- uint32_t i_buflen,
- errlver_t i_ver,
- errlsubsec_t i_sst)
+static bool myDataParse(
+ ErrlUsrParser& i_parser,
+ void* i_buffer,
+ uint32_t i_buflen,
+ errlver_t i_ver,
+ errlsubsec_t i_sst)
{
- bool rc = false;
- char szWork[ 256 ];
-
-
- switch( i_sst ) {
- case HBERRL_SST_FIRSTLADY:
- {
- memcpy( szWork, i_buffer, i_buflen );
- szWork[ i_buflen ] = 0;
- i_parser.PrintString( "First Lady", szWork );
- rc = true;
- }
- break;
- case HBERRL_SST_PRESIDENT:
- {
- memcpy( szWork, i_buffer, i_buflen );
- szWork[ i_buflen ] = 0;
- i_parser.PrintString( "President", szWork );
- rc = true;
- }
- break;
- case HBERRL_SST_STRING:
- {
- // How to label this string?
- const char * l_pLabel;
- switch( i_ver )
- {
- case HBERRL_VER_STRINGTASK:
- l_pLabel = "Task";
- break;
- case HBERRL_VER_STRINGTASKNAME:
- l_pLabel = "Task name";
- break;
- case HBERRL_VER_STRINGATTRNAME:
- l_pLabel = "Attribute name";
- break;
- case HBERRL_VER_STRINGFILENAME:
- l_pLabel = "File name";
- break;
- case HBERRL_VER_STRINGPROCNAME:
- l_pLabel = "Procedure name";
- break;
- case HBERRL_VER_STRINGNAME:
- default:
- l_pLabel = "Name";
- break;
- }
- // Expect to have a null-ended string in the data,
- // but add a null for good measure.
- int cb = i_buflen + 1;
- char * pWork = new char[cb];
- memcpy( pWork, i_buffer, i_buflen );
- pWork[i_buflen] = 0;
- i_parser.PrintString( l_pLabel, pWork );
- delete pWork;
- rc = true;
- }
- break;
-
- case HBERRL_SST_BACKTRACE:
- {
- // This buffer contains a number of 64-bit frame pointers.
- // Awkward because FipS/FSP errl provides no PrintNumber()
- // for a 64-bit number as of Jan 2012.
-
- // Initialize l_the symbol table.
- const char * l_pSymFile = "hbicore.syms";
- hbSymbolTable symTab;
- int readRC = symTab.readSymbols( l_pSymFile );
- if( readRC )
- {
- i_parser.PrintString( "Symbols not found", l_pSymFile );
- // symTab.nearestSymbol() will return NULL because of this.
- // Carry on.
- }
-
- const char * l_pErrlEntry = "ErrlEntry::ErrlEntry";
- const char * l_pLabel = "Backtrace";
-
- // loop thru the buffer which is an array of 64-bit addresses
- uint64_t * p64 = static_cast<uint64_t*>(i_buffer);
- int l_count = i_buflen / sizeof( uint64_t );
- for( int i = 0; i < l_count; i++ )
- {
- // endian convert the stack address
- uint64_t l_addr = ntohll(*p64);
-
- // get nearest symbol
- const char * l_pSymbol = symTab.nearestSymbol( l_addr );
-
- if( l_pSymbol )
- {
- if( strstr( l_pSymbol, l_pErrlEntry ))
- {
- // hackish, makes for better looking output
- // it's in every backtrace (jan2012)
- l_pSymbol = l_pErrlEntry;
- }
- sprintf( szWork,"#%2d %016llX %s", i, l_addr, l_pSymbol );
- }
- else
- {
- sprintf( szWork,"#%2d %016llX", i, l_addr );
- }
- i_parser.PrintString( l_pLabel, szWork );
-
- // next stack address in the buffer
- p64++;
-
- // don't print the label for subsequent backtraces
- l_pLabel = "";
- }
-
- rc = true;
- }
- break;
- default:
- break;
+ bool l_rc = false;
+
+ // Create a ErrlUserDetailsParserFactoryErrl object
+ ERRORLOG::ErrlUserDetailsParserFactoryErrl l_factory;
+
+ // Use the factory to create a ErrlUserDetailsParser object
+ ERRORLOG::ErrlUserDetailsParser * l_pParser = l_factory.createParser(i_sst);
+
+ if (l_pParser)
+ {
+ l_rc = true;
+ l_pParser->parse(i_ver, i_parser, i_buffer, i_buflen);
}
-
-
- return rc;
+
+ return l_rc;
}
// Map my Hostboot component ID to the function above.
// static errl::DataPlugin g_DataPlugin( HBERRL_COMP_ID, hberrl_DataParse );
static errl::DataPlugin g_DataPlugin( HBERRL_COMP_ID, myDataParse );
-
-
-
//----------------------------------------------------------------------------
// Call the code generated by scanforsrc.pl
@@ -250,5 +118,3 @@ static bool hbSrcParse( ErrlUsrParser & i_parser, const SrciSrc & i_src )
// Create an instance of SrcPlugin by type (instead of the usual component).
static errl::SrcPlugin g_SrcPlugin( errl::Plugin::HOSTBOOT_SRCPARSE, hbSrcParse );
-
-
diff --git a/src/usr/errl/plugins/symbols.H b/src/usr/errl/plugins/symbols.H
index 4be1512b4..b7f1f0d0d 100644
--- a/src/usr/errl/plugins/symbols.H
+++ b/src/usr/errl/plugins/symbols.H
@@ -28,6 +28,8 @@
#ifndef ERRL_PLUGINS_SYMS_H
#define ERRL_PLUGINS_SYMS_H
+#include <vector>
+
/**
* @file symbols.H
*
OpenPOWER on IntegriCloud