<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for gcc-testing (2010-05-05)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-05-05 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore, Makefile, covoar.cc: Add very basic configuration file
support.
* ConfigFile.cc, ConfigFile.h, configFile.txt, configfile_test.cc:
New files.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/.cvsignore.diff?r1=text&tr1=1.6&r2=text&tr2=1.7&diff_format=h">M</a></td><td width='1%'>1.7</td><td width='100%'>rtems-coverage/.cvsignore</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ChangeLog.diff?r1=text&tr1=1.198&r2=text&tr2=1.199&diff_format=h">M</a></td><td width='1%'>1.199</td><td width='100%'>rtems-coverage/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ConfigFile.h?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">rtems-coverage/ConfigFile.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ConfigFile.cc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">rtems-coverage/ConfigFile.cc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/Makefile.diff?r1=text&tr1=1.16&r2=text&tr2=1.17&diff_format=h">M</a></td><td width='1%'>1.17</td><td width='100%'>rtems-coverage/Makefile</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/configFile.txt?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">rtems-coverage/configFile.txt</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/configfile_test.cc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">rtems-coverage/configfile_test.cc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/covoar.cc.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>rtems-coverage/covoar.cc</td></tr>
</table>
<pre>
<font color='#006600'>diff -u gcc-testing/rtems-coverage/.cvsignore:1.6 gcc-testing/rtems-coverage/.cvsignore:1.7
--- gcc-testing/rtems-coverage/.cvsignore:1.6 Fri Apr 23 08:36:22 2010
+++ gcc-testing/rtems-coverage/.cvsignore Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -1,3 +1,4 @@
</font><font color='#000088'>+configfile-test
</font> coverage_converter
covmerge
covoar
<font color='#006600'>diff -u gcc-testing/rtems-coverage/ChangeLog:1.198 gcc-testing/rtems-coverage/ChangeLog:1.199
--- gcc-testing/rtems-coverage/ChangeLog:1.198 Fri Apr 30 07:43:14 2010
+++ gcc-testing/rtems-coverage/ChangeLog Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2010-05-05 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * .cvsignore, Makefile, covoar.cc: Add very basic configuration file
+ support.
+ * ConfigFile.cc, ConfigFile.h, configFile.txt, configfile_test.cc:
+ New files.
+
</font> 2010-04-30 Jennifer Averett
* Target_arm.cc, Target_m68k.cc, Target_powerpc.cc, Target_sparc.cc:
<font color='#006600'>diff -u /dev/null gcc-testing/rtems-coverage/ConfigFile.h:1.1
--- /dev/null Wed May 5 18:10:02 2010
+++ gcc-testing/rtems-coverage/ConfigFile.h Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -0,0 +1,85 @@
</font><font color='#000088'>+/*
+ * $Id$
+ */
+
+
+
+/*! @file FileReader.h
+ * @brief FileReader Specification
+ *
+ * This file contains the specification of the FileReader class.
+ */
+
+#ifndef __CONFIGURATION_FILE_H__
+#define __CONFIGURATION_FILE_H__
+
+namespace Configuration {
+
+ typedef struct {
+ const char *option;
+ const char *value;
+ } Options_t;
+
+
+ /*! @class FileReader
+ *
+ * This is the specification of the FileReader base class.
+ * All FileReader implementations inherit from this class.
+ */
+ class FileReader {
+
+ public:
+
+ /*!<span style="background-color: #FF0000"> </span>
+ * This method constructs a FileReader instance.
+ *
+ * @param[in] options is the set of options
+ */
+ FileReader(
+ Options_t *options
+ );
+
+ /*!<span style="background-color: #FF0000"> </span>
+ * This method destructs a FileReader instance.
+ */
+ virtual ~FileReader();
+
+ /*!
+ * This method processes the configuratino information from the input
+ * @a file.
+ *
+ * @param[in] file is the coverage file to process
+ *
+ * @return Returns TRUE if the method succeeded and FALSE if it failed.
+ */
+ virtual bool processFile(
+ const char* const file
+ );
+
+ bool setOption(
+ const char* const option,
+ const char* const value
+ );
+
+ const char *getOption(
+ const char* const option
+ );
+
+ void printOptions(void);
+
+ private:
+ /*!
+ * This method processes the configuratino information from the input
+ * @a file.
+ *
+ * @param[in] option is the name of the option
+ * @param[in] value is the associated value
+ *
+ * @return Returns TRUE if the method succeeded and FALSE if it failed.
+ */
+ Options_t *options_m;
+
+ };
+
+}
+#endif
</font>
<font color='#006600'>diff -u /dev/null gcc-testing/rtems-coverage/ConfigFile.cc:1.1
--- /dev/null Wed May 5 18:10:02 2010
+++ gcc-testing/rtems-coverage/ConfigFile.cc Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -0,0 +1,125 @@
</font><font color='#000088'>+/*
+ * $Id$
+ */
+
+
+/*! @file ConfigFile.cc
+ * @brief ConfigFile Implementation
+ *
+ * This file contains the implementation of the FileReader class.
+ */
+
+#include "ConfigFile.h"
+#include <string.h>
+#include <stdio.h>
+
+namespace Configuration {
+
+ FileReader::FileReader(
+ Options_t *options
+ )
+ {
+ options_m = options;
+ }
+
+ FileReader::~FileReader()
+ {
+ }
+
+ bool FileReader::processFile(
+ const char* const file
+ )
+ {
+ #define METHOD "FileReader::processFile - "
+ FILE *in;
+ char line[256];
+ char option[256];
+ char value[256];
+ int line_no;
+
+ if ( file == NULL ) {
+ fprintf( stderr, METHOD "NULL filename\n" );
+ return false;
+ }
+
+ in = fopen( file, "r" );
+ if ( !in ) {
+ fprintf( stderr, METHOD "unable to open %s\n", file );
+ return false;
+ }
+
+ line_no = 0;
+ while (fgets(line, sizeof(line), in) != NULL) {
+
+ line_no++;
+
+ /* Ignore empty lines and comments */
+ if (line[0] == '#' || line[0] == '\n')
+ continue;
+
+ if (sscanf(line, "%s = %[^ \r\n#]", option, value) != 2) {
+ fprintf(
+ stderr,
+ "%s: line %d is invalid: %s",
+ file,
+ line_no,
+ line
+ );
+ continue;
+ }
+
+ if ( !setOption(option, value) ) {
+ fprintf(
+ stderr,
+ "%s: line %d: option %s is unknown\n",
+ file,
+ line_no,
+ option
+ );
+ continue;
+ }
+
+ }
+
+ return false;
+ }
+
+ bool FileReader::setOption(
+ const char* const option,
+ const char* const value
+ )
+ {
+ Options_t *o;
+
+ for ( o=options_m ; o->option ; o++ ) {
+ if ( !strcmp( o->option, option ) ) {
+ o->value = strdup( value );
+ return true;
+ }
+ }
+ return false;
+ }
+
+ const char *FileReader::getOption(
+ const char* const option
+ )
+ {
+ Options_t *o;
+
+ for ( o=options_m ; o->option ; o++ ) {
+ if ( !strcmp( o->option, option ) ) {
+ return o->value;
+ }
+ }
+ return NULL;
+ }
+
+ void FileReader::printOptions(void)
+ {
+ Options_t *o;
+
+ for ( o=options_m ; o->option ; o++ ) {
+ fprintf( stderr, "(%s)=(%s)\n", o->option, o->value );
+ }
+ }
+}
</font>
<font color='#006600'>diff -u gcc-testing/rtems-coverage/Makefile:1.16 gcc-testing/rtems-coverage/Makefile:1.17
--- gcc-testing/rtems-coverage/Makefile:1.16 Thu Apr 29 14:12:31 2010
+++ gcc-testing/rtems-coverage/Makefile Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -3,10 +3,11 @@
</font> #
INSTALL_DIR=../bin
<font color='#880000'>-CXXFLAGS=-g -Wall -O0 -march=native -mtune=native
-PROGRAMS=covoar qemu-dump-trace trace-converter
</font><font color='#000088'>+CXXFLAGS=-g -Wall -O3 -march=native -mtune=native
+PROGRAMS=covoar qemu-dump-trace trace-converter configfile-test
</font>
COMMON_OBJS= app_common.o \
<font color='#000088'>+ ConfigFile.o \
</font> CoverageFactory.o \
CoverageMap.o \
CoverageMapBase.o \
<font color='#997700'>@@ -49,6 +50,10 @@
</font> $(COMMON_OBJS) \
covoar.o
<font color='#000088'>+CONFIGFILE_TEST_OBJS = \
+ $(COMMON_OBJS) \
+ configfile_test.cc
+
</font> INSTALLED= \
../bin/qemu-dump-trace \
../bin/trace-converter
<font color='#997700'>@@ -75,6 +80,9 @@
</font> trace-converter: $(TRACECONVERTER_OBJS)
$(CXX) $(CXXFLAGS) -o $(@) $(TRACECONVERTER_OBJS)
<font color='#000088'>+configfile-test: $(CONFIGFILE_TEST_OBJS)
+ $(CXX) $(CXXFLAGS) -o $(@) $(CONFIGFILE_TEST_OBJS)
+
</font> # DEPENDENCIES ON SINGLE OBJECTS
app_common.o: app_common.h app_common.cc
<font color='#006600'>diff -u /dev/null gcc-testing/rtems-coverage/configFile.txt:1.1
--- /dev/null Wed May 5 18:10:02 2010
+++ gcc-testing/rtems-coverage/configFile.txt Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -0,0 +1,13 @@
</font><font color='#000088'>+#
+# This is a comment.
+#
+# $Id$
+#
+verbose = no<span style="background-color: #FF0000"> </span>
+
+verbose
+
+verbose yes<span style="background-color: #FF0000"> </span>
+
+bad_option no
+
</font>
<font color='#006600'>diff -u /dev/null gcc-testing/rtems-coverage/configfile_test.cc:1.1
--- /dev/null Wed May 5 18:10:02 2010
+++ gcc-testing/rtems-coverage/configfile_test.cc Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -0,0 +1,26 @@
</font><font color='#000088'>+/*
+ * $Id$
+ */
+
+#include "ConfigFile.h"
+#include <stdio.h>
+
+Configuration::Options_t Options[] = {
+ { "verbose", NULL },
+ { NULL, NULL }
+};
+
+int main(
+ int argc,
+ char *argv[]
+)
+{
+ Configuration::FileReader *config;
+
+ config = new Configuration::FileReader(Options);
+<span style="background-color: #FF0000"> </span>
+ config->processFile( "configFile.txt" );
+ config->printOptions();
+
+}
+
</font>
<font color='#006600'>diff -u gcc-testing/rtems-coverage/covoar.cc:1.10 gcc-testing/rtems-coverage/covoar.cc:1.11
--- gcc-testing/rtems-coverage/covoar.cc:1.10 Thu Apr 29 14:12:31 2010
+++ gcc-testing/rtems-coverage/covoar.cc Wed May 5 18:09:36 2010
</font><font color='#997700'>@@ -39,12 +39,13 @@
</font> char* executableExtension = NULL;
int executableExtensionLength = 0;
std::list<Coverage::ExecutableInfo*> executablesToAnalyze;
<font color='#880000'>-char* explanations = NULL;
</font><font color='#000088'>+const char* explanations = NULL;
</font> char* progname;
bool singleExecutable = false;
const char* sizeReportFile = "sizes.txt";
const char* symbolsFile = NULL;
<font color='#880000'>-char* target = NULL;
</font><font color='#000088'>+const char* target = NULL;
+const char* format = NULL;
</font>
/*
<font color='#997700'>@@ -67,6 +68,7 @@
</font> " -1 EXECUTABLE - name of executable to get symbols from\n"
" -e EXE_EXTENSION - extension of the executables to analyze\n"
" -c COVERAGEFILE_EXTENSION - extension of the coverage files to analyze\n"
<font color='#000088'>+ " -C ConfigurationFileName - name of configuration file\n"
</font> "\n",
progname,
progname
<font color='#997700'>@@ -76,6 +78,62 @@
</font> #define PrintableString(_s) \
((!(_s)) ? "NOT SET" : (_s))
<font color='#000088'>+/*
+ * Configuration File Support
+ */
+#include "ConfigFile.h"
+Configuration::FileReader *CoverageConfiguration;
+
+Configuration::Options_t Options[] = {
+ { "explanations", NULL },
+ { "format", NULL },
+ { "symbolsFile ", NULL },
+ { "target", NULL },
+ { "verbose", NULL },
+ { NULL, NULL }
+};
+
+bool isTrue(const char *value)
+{
+ if ( !value ) return false;
+ if ( !strcmp(value, "true") ) return true;
+ if ( !strcmp(value, "TRUE") ) return true;
+ if ( !strcmp(value, "yes") ) return true;
+ if ( !strcmp(value, "YES") ) return true;
+ return false;
+}
+
+#define GET_BOOL(_opt, _val) \
+ if (isTrue(CoverageConfiguration->getOption(_opt))) \
+ _val = true;
+
+#define GET_STRING(_opt, _val) \
+ do { \
+ const char *_t; \
+ _t = CoverageConfiguration->getOption(_opt); \
+ if ( _t ) _val = _t; \
+ } while(0)
+<span style="background-color: #FF0000"> </span>
+
+void check_configuration(void)
+{
+ GET_BOOL( "verbose", Verbose );
+
+ GET_STRING( "format", format );
+ GET_STRING( "target", target );
+ GET_STRING( "explanations", explanations );
+ GET_STRING( "symbolsFile", symbolsFile );
+
+ // Now calculate some values
+ if ( coverageFileExtension )
+ coverageExtensionLength = strlen( coverageFileExtension );
+
+ if ( executableExtension )
+ executableExtensionLength = strlen( executableExtension );
+ if ( format )
+ coverageFormat = Coverage::CoverageFormatToEnum(optarg);
+}
+
</font> int main(
int argc,
char** argv
<font color='#997700'>@@ -85,16 +143,17 @@
</font> std::string coverageFileName;
std::list<Coverage::ExecutableInfo*>::iterator eitr;
Coverage::ExecutableInfo* executableInfo = NULL;
<font color='#880000'>- char* format = NULL;
</font> int i;
int opt;
<font color='#000088'>+ CoverageConfiguration = new Configuration::FileReader(Options);
+<span style="background-color: #FF0000"> </span>
</font> //
// Process command line options.
//
progname = argv[0];
<font color='#880000'>- while ((opt = getopt(argc, argv, "1:e:c:E:f:s:T:v")) != -1) {
</font><font color='#000088'>+ while ((opt = getopt(argc, argv, "1:e:c:E:f:s:T:vC:")) != -1) {
</font> switch (opt) {
case '1':
singleExecutable = true;
<font color='#997700'>@@ -103,26 +162,26 @@
</font> break;
case 'e':
executableExtension = optarg;
<font color='#880000'>- executableExtensionLength = strlen( executableExtension );
</font> break;
case 'c':
coverageFileExtension = optarg;
<font color='#880000'>- coverageExtensionLength = strlen( coverageFileExtension );
</font><font color='#000088'>+ break;
+ case 'C':
+ CoverageConfiguration->processFile( optarg );
</font> break;
case 'E': explanations = optarg; break;
case 's': symbolsFile = optarg; break;
case 'T': target = optarg; break;
case 'v': Verbose = true; break;
<font color='#880000'>- case 'f':
- format = optarg;
- coverageFormat = Coverage::CoverageFormatToEnum(optarg);
- break;
</font><font color='#000088'>+ case 'f': format = optarg; break;
</font> default: /* '?' */
usage();
exit( -1 );
}
}
<font color='#000088'>+ check_configuration();
+
</font> // If a single executable was specified, process the remaining
// arguments as coverage file names.
if (singleExecutable) {
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>