[rtems-tools commit] covoar: Fix off-by-one in Coverage::finalizeSymbol()
Joel Sherrill
joel at rtems.org
Fri Apr 2 14:32:14 UTC 2021
Module: rtems-tools
Branch: master
Commit: 26538d6edad965d45a02e3d999d5853fb3fa51c6
Changeset: http://git.rtems.org/rtems-tools/commit/?id=26538d6edad965d45a02e3d999d5853fb3fa51c6
Author: Alex White <alex.white at oarcorp.com>
Date: Wed Mar 31 11:01:06 2021 -0500
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.
---
tester/covoar/ObjdumpProcessor.cc | 9 ++++-----
1 file 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;
More information about the vc
mailing list