source: rtems-testing/covoar/app_common.cc @ a518bc5

4.11
Last change on this file since a518bc5 was a518bc5, checked in by Jennifer Averett <Jennifer.Averett@…>, on May 24, 2010 at 8:07:09 PM

2010-05-24 Jennifer Averett <Jennifer.Averett@…>

  • covoar/05_ascending.gif, covoar/05_descending.gif, covoar/05_unsorted.gif, covoar/ConfigFile.cc, covoar/ConfigFile.h, covoar/CoverageFactory.cc, covoar/CoverageFactory.h, covoar/CoverageMap.cc, covoar/CoverageMap.h, covoar/CoverageMapBase.cc, covoar/CoverageMapBase.h, covoar/CoverageRanges.cc, covoar/CoverageRanges.h, covoar/CoverageReaderBase.cc, covoar/CoverageReaderBase.h, covoar/CoverageReaderQEMU.cc, covoar/CoverageReaderQEMU.h, covoar/CoverageReaderRTEMS.cc, covoar/CoverageReaderRTEMS.h, covoar/CoverageReaderSkyeye.cc, covoar/CoverageReaderSkyeye.h, covoar/CoverageReaderTSIM.cc, covoar/CoverageReaderTSIM.h, covoar/CoverageWriterBase.cc, covoar/CoverageWriterBase.h, covoar/CoverageWriterRTEMS.cc, covoar/CoverageWriterRTEMS.h, covoar/CoverageWriterSkyeye.cc, covoar/CoverageWriterSkyeye.h, covoar/CoverageWriterTSIM.cc, covoar/CoverageWriterTSIM.h, covoar/DesiredSymbols.cc, covoar/DesiredSymbols.h, covoar/ExecutableInfo.cc, covoar/ExecutableInfo.h, covoar/Explanations.cc, covoar/Explanations.h, covoar/Makefile, covoar/ObjdumpProcessor.cc, covoar/ObjdumpProcessor.h, covoar/ReportsBase.cc, covoar/ReportsBase.h, covoar/ReportsHtml.cc, covoar/ReportsHtml.h, covoar/ReportsText.cc, covoar/ReportsText.h, covoar/SymbolTable.cc, covoar/SymbolTable.h, covoar/TargetBase.cc, covoar/TargetBase.h, covoar/TargetFactory.cc, covoar/TargetFactory.h, covoar/Target_arm.cc, covoar/Target_arm.h, covoar/Target_i386.cc, covoar/Target_i386.h, covoar/Target_lm32.cc, covoar/Target_lm32.h, covoar/Target_m68k.cc, covoar/Target_m68k.h, covoar/Target_powerpc.cc, covoar/Target_powerpc.h, covoar/Target_sparc.cc, covoar/Target_sparc.h, covoar/TraceConverter.cc, covoar/TraceList.cc, covoar/TraceList.h, covoar/TraceReaderBase.cc, covoar/TraceReaderBase.h, covoar/TraceReaderLogQEMU.cc, covoar/TraceReaderLogQEMU.h, covoar/TraceWriterBase.cc, covoar/TraceWriterBase.h, covoar/TraceWriterQEMU.cc, covoar/TraceWriterQEMU.h, covoar/app_common.cc, covoar/app_common.h, covoar/configfile_test.cc, covoar/coverage_converter.cc, covoar/covmerge.cc, covoar/covoar.cc, covoar/covoar.css, covoar/filter.gif, covoar/qemu-dump-trace.c, covoar/qemu-log.h, covoar/qemu-traces.h, covoar/rtemscov_header.h, covoar/skyeye_header.h, covoar/table.js: New files.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <sys/stat.h>
9#include <sys/types.h>
10#include <unistd.h>
11
12#include "app_common.h"
13#include "DesiredSymbols.h"
14#include "Explanations.h"
15
16/* hack so this can compile on the RH7 RTEMS 4.5 host */
17#if (__GNUC__ <= 2)
18#define STAT stat
19#define OPEN fopen
20#else
21#define STAT stat64
22#define OPEN fopen64
23#endif
24
25/*
26 *  Global variables for the program
27 */
28Coverage::Explanations*     AllExplanations     = NULL;
29Coverage::ObjdumpProcessor* objdumpProcessor    = NULL;
30Coverage::DesiredSymbols*   SymbolsToAnalyze    = NULL;
31bool                        Verbose             = false;
32const char*                 outputDirectory     = ".";
33bool                        BranchInfoAvailable = false;
34Target::TargetBase*         TargetInfo          = NULL;
35const char*                 dynamicLibrary      = NULL;
36const char*                 projectName         = NULL;
37
38
39bool FileIsNewer(
40  const char *f1,
41  const char *f2
42)
43{
44  struct STAT buf1, buf2;
45
46   if (STAT( f2, &buf2 ) == -1)
47    return true;
48 
49  if (STAT( f1, &buf1 ) == -1)
50    exit (1);
51
52  if (buf1.st_mtime > buf2.st_mtime)
53    return true;
54
55  return false;
56}
57
58bool FileIsReadable( const char *f1 )
59{
60  struct STAT buf1;
61
62  if (STAT( f1, &buf1 ) == -1)
63    return false;
64
65  if (buf1.st_size == 0)
66    return false;
67
68  // XXX check permission ??
69  return true;
70}
71
72bool ReadUntilFound( FILE *file, const char *line )
73{
74  char discardBuff[100];
75  size_t  len = strlen( line );
76
77  do { 
78    if ( !fgets( discardBuff, 99, file ) )
79      return false;
80
81    if ( strncmp( discardBuff, line, len ) == 0 ) 
82      return true; 
83  } while (1);
84}
85
Note: See TracBrowser for help on using the repository browser.