Skip to content

Commit 0f60578

Browse files
committed
Added 1-byte enum checkpoint support.
1 parent a8e5059 commit 0f60578

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

trick_source/sim_services/CheckPointAgent/ClassicCheckPointAgent.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ int Trick::ClassicCheckPointAgent::is_nil_valued( void* address,
409409
} else if ((size_t)attr->size == sizeof(short)) {
410410
test_addr = (char*)address + offset * sizeof(short);
411411
if (*(short*)test_addr == 0) return(1);
412+
} else if ((size_t)attr->size == sizeof(char)) {
413+
test_addr = (char*)address + offset * sizeof(char);
414+
if (*(char*)test_addr == 0) return(1);
412415
} else {
413416
return(-1);
414417
}
@@ -578,6 +581,14 @@ void Trick::ClassicCheckPointAgent::write_singleton( std::ostream& chkpnt_os, vo
578581
} else if ((size_t)attr->size == sizeof(short)) {
579582
src_addr = (char*)address + offset * sizeof(short);
580583
value = *(short*)src_addr;
584+
} else if ((size_t)attr->size == sizeof(char)) {
585+
src_addr = (char*)address + offset * sizeof(char);
586+
ENUM_ATTR* eattr = (ENUM_ATTR*)attr->attr;
587+
if (eattr != nullptr && (eattr[0].mods & 0x40000000)) {
588+
value = (int)(unsigned char)*(char*)src_addr;
589+
} else {
590+
value = (int)*(char*)src_addr;
591+
}
581592
} else {
582593
std::cerr << __FUNCTION__ << ": enumeration size error." << std::endl;
583594
std::cerr.flush();

trick_source/sim_services/CheckPointAgent/PythonPrint.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ void Trick::PythonPrint::write_singleton( std::ostream& chkpnt_os, void* address
121121
} else if ((size_t)attr->size == sizeof(short)) {
122122
src_addr = (char*)address + offset * sizeof(short);
123123
value = *(short*)src_addr;
124+
} else if ((size_t)attr->size == sizeof(char)) {
125+
src_addr = (char*)address + offset * sizeof(char);
126+
ENUM_ATTR* eattr = (ENUM_ATTR*)attr->attr;
127+
if (eattr != nullptr && (eattr[0].mods & 0x40000000)) {
128+
value = (int)(unsigned char)*(char*)src_addr;
129+
} else {
130+
value = (int)*(char*)src_addr;
131+
}
124132
} else {
125133
std::cerr << __FUNCTION__ << " enumeration size error." << std::endl;
126134
std::cerr.flush();

0 commit comments

Comments
 (0)