Skip to content

Commit 0d60ef0

Browse files
spfennellFennell, Scott P 263712616
andauthored
iss #1219 #1223 #1224 reference ignored in name from address (#1222)
* #1219 added code to check reference mod bit in ClassicCheckPointAgent::getCompositeSubReference, use reference width instead of size. * #1219 refactor getCompositeSubReference for readability * #1219 and #1223 add reference width to mod bits in ICG * check for mod bits in TRICK_STRUCTURED section, refactor function * #1219 adding MM_ref_name_from_address tests * #1224 fix logic for offset into arrayed struct closes #1219 closes #1223 closes #1224 Co-authored-by: Fennell, Scott P 263712616 <scott.p.fennell@nasa.gov>
1 parent 017a5ae commit 0d60ef0

File tree

5 files changed

+288
-144
lines changed

5 files changed

+288
-144
lines changed

include/trick/attributes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ typedef struct ATTRIBUTES_tag {
9898
bit 0 = c++ reference var
9999
bit 1 = c++ static var
100100
bit 2 = "--" units
101+
bit 3-8:
102+
if c++ reference bit is set, width of reference attribute.
103+
else not set.
104+
Why: because `size` is the size of the type, not the reference
105+
reference is the size of a pointer because of compiler implementations, but
106+
is not enforced by C++ standard (could change).
101107
bit 31 = deprecated var */
102108

103109
long offset; /**< -- Offset in bytes of this parameter from beginning of data structure */

trick_source/codegen/Interface_Code_Gen/PrintFileContents10.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void PrintFileContents10::print_field_attr(std::ostream & ostream , FieldDescri
7676
ostream << ", sizeof(" << fdes.getTypeName() << ")" ;
7777
}
7878
ostream << ", 0, 0, Language_CPP" ; // range_min, range_max, language
79-
ostream << ", " << fdes.isReference() + (fdes.isStatic() << 1) + (fdes.isDashDashUnits() << 2) << "," << std::endl ; // mods
79+
// mods (see attributes.h for descriptions)
80+
ostream << ", " << fdes.isReference() + (fdes.isStatic() << 1) + (fdes.isDashDashUnits() << 2) + (fdes.isReference() ? (((fdes.getFieldWidth() / 8) & 0x3F) << 3) : 0) << "," << std::endl ; // mods
8081
if ( fdes.isBitField() ) {
8182
// For bitfields we need the offset to start on 4 byte boundaries because that is what our
8283
// insert and extract bitfield routines work with.

0 commit comments

Comments
 (0)