diff options
author | Alex White <alex.white@oarcorp.com> | 2021-03-31 11:01:06 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-04-02 09:31:15 -0500 |
commit | 26538d6edad965d45a02e3d999d5853fb3fa51c6 (patch) | |
tree | dac9aa9bcfe1ccd82f1a54ae1542b4fcf0167082 | |
parent | trace/wscript: Specify C language version (diff) | |
download | rtems-tools-26538d6edad965d45a02e3d999d5853fb3fa51c6.tar.bz2 |
covoar: Fix off-by-one in Coverage::finalizeSymbol()
The `rangeIndex` variable is 1 higher than the index at which the first
instruction address was found. This fixes the loop to set `rangeIndex`
correctly.
-rw-r--r-- | tester/covoar/ObjdumpProcessor.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc index 62a06c5..c2ed3d5 100644 --- a/tester/covoar/ObjdumpProcessor.cc +++ b/tester/covoar/ObjdumpProcessor.cc @@ -52,13 +52,12 @@ namespace Coverage { throw rld::error( what, "Coverage::finalizeSymbol" ); } - int rangeIndex; + int rangeIndex = -1; uint32_t lowAddress = UINT32_MAX; - for (rangeIndex = 0; - firstInstructionAddress != lowAddress; - rangeIndex++) { + do { + rangeIndex++; lowAddress = coverageMap.getLowAddressOfRange(rangeIndex); - } + } while (firstInstructionAddress != lowAddress); uint32_t sizeWithoutNops = coverageMap.getSizeOfRange(rangeIndex); uint32_t size = sizeWithoutNops; |