summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCillian O'Donnell <cpodonnell8@gmail.com>2017-08-26 09:15:54 +0100
committerChris Johns <chrisj@rtems.org>2017-08-29 18:06:00 +1000
commit953415779ae4c82a0da0b2cc983e6aede255d047 (patch)
tree93c5706bfa82e0a238d3f7045494fc01d9a35332
parentcovoar: Add information to improve diagnostics. (diff)
downloadrtems-tools-953415779ae4c82a0da0b2cc983e6aede255d047.tar.bz2
covoar/ObjdumpProcessor.cc: Remove jump tables from the end of symbols.
Some tests objdumps have jump tables added to the end of them causing the same symbols to have different sizes when processed. This removes them and their associated errors.
-rw-r--r--tester/covoar/ObjdumpProcessor.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc
index 262c0a5..01692b8 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -345,6 +345,7 @@ namespace Coverage {
uint32_t endAddress;
uint32_t instructionOffset;
int items;
+ int found;
objdumpLine_t lineInfo;
FILE* objdumpFile;
uint32_t offset;
@@ -352,8 +353,13 @@ namespace Coverage {
uint32_t startAddress = 0;
char symbol[ MAX_LINE_LENGTH ];
char terminator1;
+ char terminatorOne;
char terminator2;
objdumpLines_t theInstructions;
+ char instruction[ MAX_LINE_LENGTH ];
+ char ID[ MAX_LINE_LENGTH ];
+ std::string call = "";
+ std::string jumpTableID = "";
// Obtain the objdump file.
if (!executableInformation->hasDynamicLibrary())
@@ -407,6 +413,15 @@ namespace Coverage {
&offset, symbol, &terminator1
);
+ // See if it is a jump table.
+ found = sscanf(
+ inputBuffer,
+ "%x%c\t%*[^\t]%c%s %*x %*[^+]%s",
+ &instructionOffset, &terminatorOne, &terminator2, instruction, ID
+ );
+ call = instruction;
+ jumpTableID = ID;
+
// If all items found, we are at the beginning of a symbol's objdump.
if ((items == 3) && (terminator1 == ':')) {
@@ -437,7 +452,27 @@ namespace Coverage {
theInstructions.push_back( lineInfo );
}
}
-
+ // If it looks like a jump table, finalize the symbol.
+ else if ( (found == 5) && (terminatorOne == ':') && (terminator2 == '\t')
+ && (call.find( "call" ) != std::string::npos)
+ && (jumpTableID.find( "+0x" ) != std::string::npos)
+ && processSymbol )
+ {
+
+ endAddress = executableInformation->getLoadAddress() + offset - 1;
+
+ // If we are currently processing a symbol, finalize it.
+ if ( processSymbol ) {
+ finalizeSymbol(
+ executableInformation,
+ currentSymbol,
+ startAddress,
+ endAddress,
+ theInstructions
+ );
+ }
+ processSymbol = false;
+ }
else if (processSymbol) {
// See if it is the dump of an instruction.