-/* Copyright (c) 2008-2013 Da SimGrid Team. All rights reserved. */
+/* Copyright (c) 2008-2013. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
static void MC_snapshot_stack_free(mc_snapshot_stack_t s){
if(s){
- xbt_free(s->local_variables->data);
- xbt_free(s->local_variables);
+ xbt_dynar_free(&(s->local_variables));
xbt_free(s);
}
}
local_variable_free((local_variable_t) * (void **) v);
}
+static void MC_region_destroy(mc_mem_region_t reg)
+{
+ xbt_free(reg->data);
+ xbt_free(reg);
+}
+
+void MC_free_snapshot(mc_snapshot_t snapshot){
+ unsigned int i;
+ for(i=0; i < NB_REGIONS; i++)
+ MC_region_destroy(snapshot->regions[i]);
+
+ xbt_free(snapshot->stack_sizes);
+ xbt_dynar_free(&(snapshot->stacks));
+ xbt_dynar_free(&(snapshot->to_ignore));
+ xbt_free(snapshot);
+}
+
/******************************* Snapshot regions ********************************/
/*********************************************************************************/
before copying the data */
memcpy(reg->start_addr, reg->data, reg->size);
-
return;
}
-static void MC_region_destroy(mc_mem_region_t reg)
-{
- xbt_free(reg->data);
- xbt_free(reg);
-}
-
static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, void *start_addr, size_t size)
{
mc_mem_region_t new_reg = MC_region_new(type, start_addr, size);
int frame_found = 0, region_type;
void *frame_pointer_address = NULL;
long true_ip, value;
- int stop;
+ int stop = 0;
xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
mc_snapshot_t MC_take_snapshot(){
- int raw_mem = (mmalloc_get_current_heap() == raw_heap);
-
- MC_SET_RAW_MEM;
-
mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1);
snapshot->nb_processes = xbt_swag_size(simix_global->process_list);
MC_dump_checkpoint_ignore(snapshot);
- MC_UNSET_RAW_MEM;
-
- if(raw_mem)
- MC_SET_RAW_MEM;
-
return snapshot;
}
}
-void MC_free_snapshot(mc_snapshot_t snapshot){
- unsigned int i;
- for(i=0; i < NB_REGIONS; i++)
- MC_region_destroy(snapshot->regions[i]);
-
- xbt_free(snapshot->stack_sizes);
- xbt_dynar_free(&(snapshot->stacks));
- xbt_dynar_free(&(snapshot->to_ignore));
- xbt_free(snapshot);
-}
-
mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
return MC_take_snapshot();
}