MTV/variable server crashes if checkpoint has less malfunctions then currently running sim

Did two things to stop the crash.  1.  When following an address path if we hit a NULL
address, stop processing and return the NULL.  2.  When trying to resolve addresses in
copy_sim_data, if a NULL address is returned then reset the reference to unresolved and
return a dummy value.

Need to fix MTV to handle dummy value returns.

refs #117
This commit is contained in:
Alex Lin 2015-09-14 11:33:11 -05:00
parent 94a99fb9ea
commit e58ba61d8e
2 changed files with 15 additions and 1 deletions

View File

@ -24,6 +24,10 @@ void * follow_address_path(REF2 * R) {
address = (void *)((char *)address + address_node->operand.offset) ; address = (void *)((char *)address + address_node->operand.offset) ;
break ; break ;
} }
// If we resolve a pointer to NULL this variable is now bad.
if (address == NULL) {
break ;
}
} }
return(address) ; return(address) ;

View File

@ -32,7 +32,17 @@ int Trick::VariableServerThread::copy_sim_data() {
// if there's a pointer somewhere in the address path, follow it in case pointer changed // if there's a pointer somewhere in the address path, follow it in case pointer changed
if ( curr_var->ref->pointer_present == 1 ) { if ( curr_var->ref->pointer_present == 1 ) {
curr_var->address = follow_address_path(curr_var->ref) ; curr_var->address = follow_address_path(curr_var->ref) ;
curr_var->ref->address = curr_var->address ; if ( curr_var->address == NULL ) {
std::string save_name(curr_var->ref->reference) ;
if ( curr_var->ref->attr) {
free(curr_var->ref->attr) ;
}
free(curr_var->ref) ;
curr_var->ref = make_error_ref(save_name) ;
curr_var->address = curr_var->ref->address ;
} else {
curr_var->ref->address = curr_var->address ;
}
} }
// if this variable is a string we need to get the raw character string out of it. // if this variable is a string we need to get the raw character string out of it.