diff options
author | Chris Johns <chrisj@rtems.org> | 2018-05-08 15:09:39 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-06-15 15:54:25 +1000 |
commit | fb987e82be3e3d025875b6c39c92384c3e8a1c3e (patch) | |
tree | 31fb132f74f5787f0907551eda2e891435b1593f /tester/covoar/GcovData.cc | |
parent | rtemstoolkit: Add libdwarf C++ interface. (diff) | |
download | rtems-tools-fb987e82be3e3d025875b6c39c92384c3e8a1c3e.tar.bz2 |
covoar: Use DWARF to map addresses to source files and lines.
Diffstat (limited to 'tester/covoar/GcovData.cc')
-rw-r--r-- | tester/covoar/GcovData.cc | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/tester/covoar/GcovData.cc b/tester/covoar/GcovData.cc index 6d10337..2c033e5 100644 --- a/tester/covoar/GcovData.cc +++ b/tester/covoar/GcovData.cc @@ -11,7 +11,6 @@ * reading *.gcno and writing *.gcda files for gcov support */ -#include <libgen.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -61,7 +60,7 @@ namespace Gcov { if ( (tempString == NULL) && (tempString2 == NULL) ){ fprintf(stderr, "ERROR: incorrect name of *.gcno file\n"); - } + } else { strcpy( tempString, ".gcda"); // construct gcda file name @@ -238,7 +237,7 @@ namespace Gcov { status = readFrameHeader( &header, gcovFile); if ( status <= 0 ){ - // Not printing error message because this + // Not printing error message because this // happenns at the end of each file return false; } @@ -260,11 +259,11 @@ namespace Gcov { status = fread( &intBuffer, 4, header.length, gcovFile ); if ( status != (int) header.length){ - fprintf( + fprintf( stderr, "Error while reading BLOCKS from gcov file...\n" - "Header lenght is %u instead of %u\n", - header.length, - status + "Header lenght is %u instead of %u\n", + header.length, + status ); return false; } @@ -478,15 +477,13 @@ namespace Gcov { void GcovData::writeGcovFile( ) { - char path[512]; - char command[512]; - - //fprintf (stderr, "Attempting to run gcov for: %s\n", cFileName ); - strcpy( path, cFileName ); - dirname( path ); - sprintf( command, "( cd %s && gcov %s &>> gcov.log)", path, basename( cFileName ) ); - //fprintf (stderr, "> %s\n", command ); - system( command ); + //std::cerr << "Attempting to run gcov for: " << cFileName << std::endl; + std::ostringstream command; + command << "( cd " << rld::path::dirname (cFileName) + << " && gcov " << rld::path::basename (cFileName) + << " &>> gcov.log)"; + //std::cerr << "> " << command << std::endl; + system( command.str ().c_str () ); } bool GcovData::processCounters( ) |