[rtems-tools commit] covoar/ObjdumpProcessor.cc: Remove jump tables from the end of symbols.
Chris Johns
chrisj at rtems.org
Tue Aug 29 08:10:13 UTC 2017
Module: rtems-tools
Branch: master
Commit: 953415779ae4c82a0da0b2cc983e6aede255d047
Changeset: http://git.rtems.org/rtems-tools/commit/?id=953415779ae4c82a0da0b2cc983e6aede255d047
Author: Cillian O'Donnell <cpodonnell8 at gmail.com>
Date: Sat Aug 26 09:15:54 2017 +0100
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.
---
tester/covoar/ObjdumpProcessor.cc | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
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.
More information about the vc
mailing list