summaryrefslogtreecommitdiff
path: root/rtems-coverage
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-05-12 14:04:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-05-12 14:04:48 +0000
commit87fc2e46b29c71ad0a93ff4891d089fa3b8834c4 (patch)
treeefe1ef77de046a07c4e5aa71af0e467607caec85 /rtems-coverage
parentfb545f3ae8654053888c1926d831e229ef7ab2db (diff)
2010-05-12 Joel Sherrill <joel.sherrilL@OARcorp.com>
* ReportsHtml.cc, ReportsHtml.h: Add separate html file for each explanation and link to it from the tables.
Diffstat (limited to 'rtems-coverage')
-rw-r--r--rtems-coverage/ChangeLog5
-rw-r--r--rtems-coverage/ReportsHtml.cc986
-rw-r--r--rtems-coverage/ReportsHtml.h7
3 files changed, 513 insertions, 485 deletions
diff --git a/rtems-coverage/ChangeLog b/rtems-coverage/ChangeLog
index 1bd316c..56d1f8e 100644
--- a/rtems-coverage/ChangeLog
+++ b/rtems-coverage/ChangeLog
@@ -1,5 +1,10 @@
2010-05-12 Joel Sherrill <joel.sherrilL@OARcorp.com>
+ * ReportsHtml.cc, ReportsHtml.h: Add separate html file for each
+ explanation and link to it from the tables.
+
+2010-05-12 Joel Sherrill <joel.sherrilL@OARcorp.com>
+
* covoar.cc: Fix off by one bug.
2010-05-12 Joel Sherrill <joel.sherrilL@OARcorp.com>
diff --git a/rtems-coverage/ReportsHtml.cc b/rtems-coverage/ReportsHtml.cc
index 255eef5..baa1e88 100644
--- a/rtems-coverage/ReportsHtml.cc
+++ b/rtems-coverage/ReportsHtml.cc
@@ -10,560 +10,578 @@
#include "app_common.h"
#include "CoverageRanges.h"
#include "DesiredSymbols.h"
-#include "Explanations.h"
#include "ObjdumpProcessor.h"
-
namespace Coverage {
-ReportsHtml::ReportsHtml():
- ReportsBase()
-{
- reportExtension_m = ".html";
-}
+ ReportsHtml::ReportsHtml():
+ ReportsBase()
+ {
+ reportExtension_m = ".html";
+ }
-ReportsHtml::~ReportsHtml()
-{
-}
+ ReportsHtml::~ReportsHtml()
+ {
+ }
-FILE* ReportsHtml::OpenFile(
- const char* const fileName
-)
-{
- FILE* aFile;
-
- // Open the file
- aFile = ReportsBase::OpenFile( fileName );
-
- // Put Header information on the file
- fprintf( aFile, "<html>\n");
- fprintf( aFile, "<meta http-equiv=\"Content-Language\" content=\"English\" >\n");
- fprintf(
- aFile,
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
- );
- fprintf(
- aFile,
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"covoar.css\" media=\"screen\" >\n"
- );
- fprintf( aFile, "<body>\n");
-
- lastState_m = A_SOURCE;
- fprintf( aFile, "<pre class=\"code\">\n" );
-
- return aFile;
-}
+ FILE* ReportsHtml::OpenFile(
+ const char* const fileName
+ )
+ {
+ FILE* aFile;
+
+ // Open the file
+ aFile = ReportsBase::OpenFile( fileName );
+
+ // Put Header information on the file
+ fprintf(
+ aFile,
+ "<html>\n"
+ "<meta http-equiv=\"Content-Language\" content=\"English\" >\n"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"covoar.css\" media=\"screen\" >\n"
+ "<body>\n"
+ "<pre class=\"code\">\n"
+ );
-FILE* ReportsHtml::OpenBranchFile(
- const char* const fileName,
- bool hasBranches
-)
-{
- FILE *aFile;
- // Open the file
- aFile = OpenFile(fileName);
+ return aFile;
+ }
+
+ FILE* ReportsHtml::OpenBranchFile(
+ const char* const fileName,
+ bool hasBranches
+ )
+ {
+ FILE *aFile;
+
+ // Open the file
+ aFile = OpenFile(fileName);
+
+ if ( hasBranches ) {
+ // Put header information into the file
+ fprintf(
+ aFile,
+ "<table class=\"covoar-table\">\n"
+ "<tbody class=\"covoar-tbody\">\n"
+ "<tr class=\"covoar-tr covoar-tr-first\">\n"
+ "<th class=\"covoar-th\">Index</th>\n"
+ "<th class=\"covoar-th\">Symbol</th>\n"
+ "<th class=\"covoar-th\">Line</th>\n"
+ "<th class=\"covoar-th\">Size</th>\n"
+ "<th class=\"covoar-th\">Size</th>\n"
+ "<th class=\"covoar-th\">Reason</th>\n"
+ "<th class=\"covoar-th\">Classification</th>\n"
+ "<th class=\"covoar-th\">Explanation</th>\n"
+ "</tr>\n"
+
+ "<tr class=\"covoar-tr covoar-tr-first\">\n"
+ "<th class=\"covoar-th\"></th>\n"
+ "<th class=\"covoar-th\"></th>\n"
+ "<th class=\"covoar-th\">Bytes</th>\n"
+ "<th class=\"covoar-th\">Instructions</th>\n"
+ "<th class=\"covoar-th\"></th>\n"
+ "<th class=\"covoar-th\"></th>\n"
+ "<th class=\"covoar-th\"></th>\n"
+ "</tr>\n"
+ );
+ }
+
+ return aFile;
+ }
+
+ FILE* ReportsHtml::OpenCoverageFile(
+ const char* const fileName
+ )
+ {
+ FILE *aFile;
+
+ // Open the file
+ aFile = OpenFile(fileName);
- if ( hasBranches ) {
// Put header information into the file
- fprintf( aFile, "<table class=\"covoar-table\">\n");
- fprintf( aFile, "<tbody class=\"covoar-tbody\">\n");
- fprintf( aFile, "<tr class=\"covoar-tr covoar-tr-first\">\n");
- fprintf( aFile, "<th class=\"covoar-th\">Index</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Symbol</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Line</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Size</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Size</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Reason</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Classification</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Explanation</th>\n");
- fprintf( aFile, "</tr>\n");
-
- fprintf( aFile, "<tr class=\"covoar-tr covoar-tr-first\">\n");
- fprintf( aFile, "<th class=\"covoar-th\"></th>\n");
- fprintf( aFile, "<th class=\"covoar-th\"></th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Bytes</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Instructions</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\"></th>\n");
- fprintf( aFile, "<th class=\"covoar-th\"></th>\n");
- fprintf( aFile, "<th class=\"covoar-th\"></th>\n");
- fprintf( aFile, "</tr>\n");
+ fprintf(
+ aFile,
+ "<table class=\"covoar-table\">\n"
+ "<tbody class=\"covoar-tbody\">\n"
+ "<tr class=\"covoar-tr covoar-tr-first\">\n"
+ "<th class=\"covoar-th\">Index</th>\n"
+ "<th class=\"covoar-th\">Symbol</th>\n"
+ "<th class=\"covoar-th\">Range</th>\n"
+ "<th class=\"covoar-th\">Size</br>Bytes</th>\n"
+ "<th class=\"covoar-th\">Size</br>Instructions</th>\n"
+ "<th class=\"covoar-th\">Classification</th>\n"
+ "<th class=\"covoar-th\">Explanation</th>\n"
+ "</tr>\n"
+ );
+
+ return aFile;
}
-
- return aFile;
-}
-FILE* ReportsHtml::OpenCoverageFile(
- const char* const fileName
-)
-{
- FILE *aFile;
-
- // Open the file
- aFile = OpenFile(fileName);
-
- // Put header information into the file
- fprintf( aFile, "<table class=\"covoar-table\">\n");
- fprintf( aFile, "<tbody class=\"covoar-tbody\">\n");
- fprintf( aFile, "<tr class=\"covoar-tr covoar-tr-first\">\n");
- fprintf( aFile, "<th class=\"covoar-th\">Index</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Symbol</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Range</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Size</br>Bytes</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Size</br>Instructions</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Classification</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Explanation</th>\n");
- fprintf( aFile, "</tr>\n");
-
- return aFile;
-}
+ FILE* ReportsHtml::OpenSizeFile(
+ const char* const fileName
+ )
+ {
+ FILE *aFile;
-FILE* ReportsHtml::OpenSizeFile(
- const char* const fileName
-)
-{
- FILE *aFile;
-
- // Open the file
- aFile = OpenFile(fileName);
-
- // Put header information into the file
- fprintf( aFile, "<table class=\"covoar-table\">\n");
- fprintf( aFile, "<tbody class=\"covoar-tbody\">\n");
- fprintf( aFile, "<tr class=\"covoar-tr covoar-tr-first\">\n");
- fprintf( aFile, "<th class=\"covoar-th\">Size</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">Symbol</th>\n");
- fprintf( aFile, "<th class=\"covoar-th\">File</th>\n");
- fprintf( aFile, "</tr>\n");
-
- return aFile;
-}
+ // Open the file
+ aFile = OpenFile(fileName);
-void ReportsHtml::PutAnnotatedLine(
- FILE* aFile,
- AnnotatedLineState_t state,
- std::string line,
- uint32_t id
-)
-{
- std::string stateText;
- char number[10];
-
-
- sprintf(number,"%d", id);
-
- // Set the stateText based upon the current state.
- switch (state) {
- case A_SOURCE:
- stateText = "</pre>\n<pre class=\"code\">\n";
- break;
- case A_EXECUTED:
- stateText = "</pre>\n<pre class=\"codeExecuted\">\n";
- break;
- case A_NEVER_EXECUTED:
- stateText = "</pre>\n";
- stateText += "<a name=\"range";
- stateText += number;
- stateText += "\"></a><pre class=\"codeNotExecuted\">\n";
- break;
- case A_BRANCH_TAKEN:
- stateText = "</pre>\n";
- stateText += "<a name=\"range";
- stateText += number;
- stateText += "\"></a><pre class=\"codeAlwaysTaken\">\n";
- break;
- case A_BRANCH_NOT_TAKEN:
- stateText = "</pre>\n";
- stateText += "<a name=\"range";
- stateText += number;
- stateText += "\"></a><pre class=\"codeNeverTaken\">\n";
- break;
- default:
- fprintf(stderr, "ERROR: ReportsHtml::PutAnnotatedLine Unknown state\n");
- exit( -1 );
- break;
+ // Put header information into the file
+ fprintf(
+ aFile,
+ "<table class=\"covoar-table\">\n"
+ "<tbody class=\"covoar-tbody\">\n"
+ "<tr class=\"covoar-tr covoar-tr-first\">\n"
+ "<th class=\"covoar-th\">Size</th>\n"
+ "<th class=\"covoar-th\">Symbol</th>\n"
+ "<th class=\"covoar-th\">File</th>\n"
+ "</tr>\n"
+ );
+ return aFile;
}
- // If the state has not changed there is no need to change the text block
- // format. If it has changed close out the old format and open up the
- // new format.
- if ( state != lastState_m ) {
- fprintf( aFile, stateText.c_str() );
- lastState_m = state;
+ void ReportsHtml::PutAnnotatedLine(
+ FILE* aFile,
+ AnnotatedLineState_t state,
+ std::string line,
+ uint32_t id
+ )
+ {
+ std::string stateText;
+ char number[10];
+
+
+ sprintf(number,"%d", id);
+
+ // Set the stateText based upon the current state.
+ switch (state) {
+ case A_SOURCE:
+ stateText = "</pre>\n<pre class=\"code\">\n";
+ break;
+ case A_EXECUTED:
+ stateText = "</pre>\n<pre class=\"codeExecuted\">\n";
+ break;
+ case A_NEVER_EXECUTED:
+ stateText = "</pre>\n";
+ stateText += "<a name=\"range";
+ stateText += number;
+ stateText += "\"></a><pre class=\"codeNotExecuted\">\n";
+ break;
+ case A_BRANCH_TAKEN:
+ stateText = "</pre>\n";
+ stateText += "<a name=\"range";
+ stateText += number;
+ stateText += "\"></a><pre class=\"codeAlwaysTaken\">\n";
+ break;
+ case A_BRANCH_NOT_TAKEN:
+ stateText = "</pre>\n";
+ stateText += "<a name=\"range";
+ stateText += number;
+ stateText += "\"></a><pre class=\"codeNeverTaken\">\n";
+ break;
+ default:
+ fprintf(stderr, "ERROR: ReportsHtml::PutAnnotatedLine Unknown state\n");
+ exit( -1 );
+ break;
+ }
+
+ // If the state has not changed there is no need to change the text block
+ // format. If it has changed close out the old format and open up the
+ // new format.
+ if ( state != lastState_m ) {
+ fprintf( aFile, stateText.c_str() );
+ lastState_m = state;
+ }
+
+ // For all the characters in the line replace html reserved special
+ // characters and output the line. Note that for a /pre block this
+ // is only a '<' symbol.
+ for (unsigned int i=0; i<line.size(); i++ ) {
+ if ( line[i] == '<' )
+ fprintf( aFile, "&lt;" );
+ else
+ fprintf( aFile, "%c", line[i] );
+ }
+ fprintf( aFile, "\n");
}
- // For all the characters in the line replace html reserved special characters
- // and output the line. Note that for a /pre block this is only a '<' symbol.
- for (unsigned int i=0; i<line.size(); i++ )
+ bool ReportsHtml::PutNoBranchInfo(
+ FILE* report
+ )
{
- if ( line[i] == '<' )
- fprintf( aFile, "&lt;" );
+ if ( BranchInfoAvailable )
+ fprintf( report, "All branch paths taken.\n" );
else
- fprintf( aFile, "%c", line[i] );
+ fprintf( report, "No branch information found.\n" );
+ return true;
}
- fprintf( aFile, "\n");
-}
-bool ReportsHtml::PutNoBranchInfo(
- FILE* report
-)
-{
- if ( BranchInfoAvailable )
- fprintf( report, "All branch paths taken.\n" );
- else
- fprintf( report, "No branch information found.\n" );
- return true;
-}
+ bool ReportsHtml::PutBranchEntry(
+ FILE* report,
+ unsigned int count,
+ Coverage::DesiredSymbols::symbolSet_t::iterator symbolPtr,
+ Coverage::CoverageRanges::ranges_t::iterator rangePtr
+ )
+ {
+ const Coverage::Explanation* explanation;
-bool ReportsHtml::PutBranchEntry(
- FILE* report,
- unsigned int count,
- Coverage::DesiredSymbols::symbolSet_t::iterator symbolPtr,
- Coverage::CoverageRanges::ranges_t::iterator rangePtr
-)
-{
- const Coverage::Explanation* explanation;
-
-
- // Mark the background color different for odd and even lines.
- fprintf( report, "</tr>\n");
- if ( ( count%2 ) == 0 )
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
- else
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
-
- // index
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%d</td>\n",
- rangePtr->id,
- rangePtr->id
- );
-
- // symbol
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- symbolPtr->first.c_str()
- );
-
- // line
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- rangePtr->lowSourceLine.c_str()
- );
-
- // Size in bytes
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
- rangePtr->highAddress - rangePtr->lowAddress + 1
- );
-
- // Size in instructions
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">XXX</td>\n"
- );
-
- // Reason Branch was uncovered
- if (rangePtr->reason ==
- Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">Always Taken</td>\n"
- );
- else if (rangePtr->reason ==
- Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
+ // Mark the background color different for odd and even lines.
+ fprintf( report, "</tr>\n");
+ if ( ( count%2 ) == 0 )
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
+ else
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
+
+ // index
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">Never Taken</td>\n"
- );
+ "<td class=\"covoar-td\" align=\"center\">"
+ "<a href =\"annotated.html#range%d\">%d</td>\n",
+ rangePtr->id,
+ rangePtr->id
+ );
- // See if an explanation is available
- explanation = AllExplanations->lookupExplanation( rangePtr->lowSourceLine );
- if ( !explanation ) {
+ // symbol
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ symbolPtr->first.c_str()
);
+
+ // line
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ rangePtr->lowSourceLine.c_str()
);
- } else {
+
+ // Size in bytes
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- explanation->classification.c_str()
+ "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
+ rangePtr->highAddress - rangePtr->lowAddress + 1
);
+
+ // Size in instructions
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">FILL ME IN</td>\n"
- );
-#if 0
- for ( unsigned int i=0 ;
- i < explanation->explanation.size();
- i++) {
- fprintf(
+ "<td class=\"covoar-td\" align=\"center\">XXX</td>\n"
+ );
+
+ // Reason Branch was uncovered
+ if (rangePtr->reason ==
+ Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
+ fprintf(
report,
- "%s\n",
- explanation->explanation[i].c_str()
+ "<td class=\"covoar-td\" align=\"center\">Always Taken</td>\n"
+ );
+ else if (rangePtr->reason ==
+ Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">Never Taken</td>\n"
+ );
+
+ // See if an explanation is available
+ explanation = AllExplanations->lookupExplanation( rangePtr->lowSourceLine );
+ if ( !explanation ) {
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
+ );
+ } else {
+ char explanationFile[48];
+
+ sprintf( explanationFile, "explanation%d.html", rangePtr->id );
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
+ "<td class=\"covoar-td\" align=\"center\">"
+ "<a href=\"%s\">Explanation</a></td>\n",
+ explanation->classification.c_str(),
+ explanationFile
+ );
+ WriteExplationFile( explanationFile, explanation );
+ }
+
+ fprintf( report, "</tr>\n");
+
+ return true;
+ }
+
+ bool ReportsHtml::WriteExplationFile(
+ const char* fileName,
+ const Coverage::Explanation* explanation
+ )
+ {
+ FILE* report;
+
+ report = OpenFile( fileName );
+
+ for ( unsigned int i=0 ; i < explanation->explanation.size(); i++) {
+ fprintf(
+ report,
+ "%s\n",
+ explanation->explanation[i].c_str()
);
}
-#endif
+ CloseFile( report );
+ return true;
}
- fprintf( report, "</tr>\n");
+ void ReportsHtml::putCoverageNoRange(
+ FILE* report,
+ unsigned int count,
+ std::string symbol
+ )
+ {
- return true;
-}
+ // Mark the background color different for odd and even lines.
+ fprintf( report, "</tr>\n");
+ if ( ( count%2 ) == 0 )
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
+ else
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
-void ReportsHtml::putCoverageNoRange(
- FILE* report,
- unsigned int count,
- std::string symbol
-)
-{
-
- // Mark the background color different for odd and even lines.
- fprintf( report, "</tr>\n");
- if ( ( count%2 ) == 0 )
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
- else
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
-
- // index
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"></td>\n"
- );
-
- // symbol
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- symbol.c_str()
- );
-
- // starting line
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"></td>\n"
- );
-
- // Size in bytes
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"></td>\n"
- );
-
- // Size in instructions
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"></td>\n"
- );
-
- // See if an explanation is available
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"></td>\n"
- );
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">"
- "This symbol was never referenced by an analyzed executable. "
- "Therefore there is no size or disassembly for this symbol. "
- "This could be due to symbol misspelling or lack of a test for"
- "this symbol.</td>\n"
- );
-
- fprintf( report, "</tr>\n");
-}
+ // index
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\"></td>\n"
+ );
-bool ReportsHtml::PutCoverageLine(
- FILE* report,
- unsigned int count,
- Coverage::DesiredSymbols::symbolSet_t::iterator symbolPtr,
- Coverage::CoverageRanges::ranges_t::iterator rangePtr
-)
-{
- const Coverage::Explanation* explanation;
-
-
- // Mark the background color different for odd and even lines.
- fprintf( report, "</tr>\n");
- if ( ( count%2 ) == 0 )
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
- else
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
-
- // index
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%d</td>\n",
- rangePtr->id,
- rangePtr->id
- );
-
- // symbol
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- symbolPtr->first.c_str()
- );
-
- // starting line
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s(0x%x)</br>%s(0x%x)</td>\n",
- rangePtr->lowSourceLine.c_str(),
- rangePtr->lowAddress,
- rangePtr->highSourceLine.c_str(),
- rangePtr->highAddress
- );
-
- // Size in bytes
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
- rangePtr->highAddress - rangePtr->lowAddress + 1
- );
-
- // Size in instructions
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">XXX</td>\n"
- );
-
- // See if an explanation is available
- explanation = AllExplanations->lookupExplanation( rangePtr->lowSourceLine );
- if ( !explanation ) {
+ // symbol
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ symbol.c_str()
+ );
+
+ // starting line
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\"></td>\n"
+ );
+
+ // Size in bytes
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
+ "<td class=\"covoar-td\" align=\"center\"></td>\n"
);
+
+ // Size in instructions
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
+ "<td class=\"covoar-td\" align=\"center\"></td>\n"
+ );
+
+ // See if an explanation is available
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\"></td>\n"
);
- } else {
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- explanation->classification.c_str()
+ "<td class=\"covoar-td\" align=\"center\">"
+ "This symbol was never referenced by an analyzed executable. "
+ "Therefore there is no size or disassembly for this symbol. "
+ "This could be due to symbol misspelling or lack of a test for"
+ "this symbol.</td>\n"
);
+
+ fprintf( report, "</tr>\n");
+ }
+
+ bool ReportsHtml::PutCoverageLine(
+ FILE* report,
+ unsigned int count,
+ Coverage::DesiredSymbols::symbolSet_t::iterator symbolPtr,
+ Coverage::CoverageRanges::ranges_t::iterator rangePtr
+ )
+ {
+ const Coverage::Explanation* explanation;
+
+
+ // Mark the background color different for odd and even lines.
+ fprintf( report, "</tr>\n");
+ if ( ( count%2 ) == 0 )
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
+ else
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
+
+ // index
fprintf(
report,
- "<td class=\"covoar-td\" align=\"center\">FILL ME IN</td>\n"
+ "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%d</td>\n",
+ rangePtr->id,
+ rangePtr->id
+ );
+
+ // symbol
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ symbolPtr->first.c_str()
);
+ // starting line
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s(0x%x)</br>%s(0x%x)</td>\n",
+ rangePtr->lowSourceLine.c_str(),
+ rangePtr->lowAddress,
+ rangePtr->highSourceLine.c_str(),
+ rangePtr->highAddress
+ );
+
+ // Size in bytes
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
+ rangePtr->highAddress - rangePtr->lowAddress + 1
+ );
- #if 0
- for ( unsigned int i=0; i < explanation->explanation.size(); i++) {
- fprintf( report,"%s\n", explanation->explanation[i].c_str() );
+ // Size in instructions
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">XXX</td>\n"
+ );
+
+ // See if an explanation is available
+ explanation = AllExplanations->lookupExplanation( rangePtr->lowSourceLine );
+ if ( !explanation ) {
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
+ );
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
+ );
+ } else {
+ char explanationFile[48];
+
+ sprintf( explanationFile, "explanation%d.html", rangePtr->id );
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
+ "<td class=\"covoar-td\" align=\"center\">"
+ "<a href=\"%s\">Explanation</a></td>\n",
+ explanation->classification.c_str(),
+ explanationFile
+ );
+ WriteExplationFile( explanationFile, explanation );
}
- #endif
+
+ fprintf( report, "</tr>\n");
+
+ return true;
}
- fprintf( report, "</tr>\n");
+ bool ReportsHtml::PutSizeLine(
+ FILE* report,
+ unsigned int count,
+ Coverage::DesiredSymbols::symbolSet_t::iterator symbol,
+ Coverage::CoverageRanges::ranges_t::iterator range
+ )
+ {
+ // Mark the background color different for odd and even lines.
+ fprintf( report, "</tr>\n");
+ if ( ( count%2 ) == 0 )
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
+ else
+ fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
- return true;
-}
+ // size
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
+ range->highAddress - range->lowAddress + 1
+ );
-bool ReportsHtml::PutSizeLine(
- FILE* report,
- unsigned int count,
- Coverage::DesiredSymbols::symbolSet_t::iterator symbol,
- Coverage::CoverageRanges::ranges_t::iterator range
-)
-{
- // Mark the background color different for odd and even lines.
- fprintf( report, "</tr>\n");
- if ( ( count%2 ) == 0 )
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-even\">\n");
- else
- fprintf( report, "<tr class=\"covoar-tr covoar-tr-odd\">\n");
-
- // size
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
- range->highAddress - range->lowAddress + 1
- );
-
- // symbol
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- symbol->first.c_str()
- );
-
- // file
- fprintf(
- report,
- "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
- range->lowSourceLine.c_str()
- );
-
-
-
- return true;
-}
+ // symbol
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ symbol->first.c_str()
+ );
-void ReportsHtml::CloseAnnotatedFile(
- FILE* aFile
-)
-{
- fprintf( aFile,"</pre>\n");
- fprintf( aFile,"</body>\n");
- fprintf( aFile,"</html>");
+ // file
+ fprintf(
+ report,
+ "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
+ range->lowSourceLine.c_str()
+ );
- CloseFile(aFile);
-}
-void ReportsHtml::CloseBranchFile(
- FILE* aFile,
- bool hasBranches
-)
-{
- if ( hasBranches ) {
- fprintf( aFile, "</tbody>\n" );
- fprintf( aFile, "</table>\n" );
+
+ return true;
}
- fprintf( aFile, "</pre>\n" );
- fprintf( aFile, "</body>\n");
- fprintf( aFile, "</html>");
- CloseFile(aFile);
-}
+ void ReportsHtml::CloseAnnotatedFile(
+ FILE* aFile
+ )
+ {
+ fprintf(
+ aFile,
+ "</pre>\n"
+ "</body>\n"
+ "</html>"
+ );
-void ReportsHtml::CloseCoverageFile(
- FILE* aFile
-)
-{
- fprintf( aFile, "</tbody>\n" );
- fprintf( aFile, "</table>\n" );
- fprintf( aFile, "</pre>\n" );
- fprintf( aFile,"</body>\n");
- fprintf( aFile,"</html>");
-
- CloseFile(aFile);
-}
+ CloseFile(aFile);
+ }
-void ReportsHtml::CloseSizeFile(
- FILE* aFile
-)
-{
- fprintf( aFile, "</tbody>\n" );
- fprintf( aFile, "</table>\n" );
- fprintf( aFile, "</pre>\n" );
- fprintf( aFile, "</pre>\n" );
- fprintf( aFile,"</body>\n");
- fprintf( aFile,"</html>");
-
- CloseFile( aFile );
-}
+ void ReportsHtml::CloseBranchFile(
+ FILE* aFile,
+ bool hasBranches
+ )
+ {
+ if ( hasBranches ) {
+ fprintf(
+ aFile,
+ "</tbody>\n"
+ "</table>\n"
+ );
+ }
+ fprintf(
+ aFile,
+ "</pre>\n"
+ "</body>\n"
+ "</html>"
+ );
+
+ CloseFile(aFile);
+ }
+
+ void ReportsHtml::CloseCoverageFile(
+ FILE* aFile
+ )
+ {
+ fprintf(
+ aFile,
+ "</tbody>\n"
+ "</table>\n"
+ "</pre>\n"
+ "</body>\n"
+ "</html>"
+ );
+
+ CloseFile(aFile);
+ }
+
+ void ReportsHtml::CloseSizeFile(
+ FILE* aFile
+ )
+ {
+ fprintf( aFile, "</tbody>\n" );
+ fprintf( aFile, "</table>\n" );
+ fprintf( aFile, "</pre>\n" );
+ fprintf( aFile, "</pre>\n" );
+ fprintf( aFile,"</body>\n");
+ fprintf( aFile,"</html>");
+
+ CloseFile( aFile );
+ }
}
diff --git a/rtems-coverage/ReportsHtml.h b/rtems-coverage/ReportsHtml.h
index c2c0e44..449db3f 100644
--- a/rtems-coverage/ReportsHtml.h
+++ b/rtems-coverage/ReportsHtml.h
@@ -15,6 +15,7 @@
#include <stdint.h>
#include "ReportsBase.h"
+#include "Explanations.h"
namespace Coverage {
@@ -130,7 +131,11 @@ class ReportsHtml: public ReportsBase {
const char* const fileName
);
-};
+ virtual bool WriteExplationFile(
+ const char* fileName,
+ const Coverage::Explanation* explanation
+ );
+ };
}