return (void *) state.stack[state.stack_size - 1];
}
-/** Resolve snapshot in the snapshot address space
- *
- * @param object Snapshot address of the struct/class
- * @param type Type of the struct/class
- * @param member Member description
- * @param snapshot Snapshot (or NULL)
- * @return Snapshot address of the given member of the 'object' struct/class
- */
-void *mc_member_snapshot_resolve(const void *object, dw_type_t type,
- dw_type_t member, mc_snapshot_t snapshot)
-{
- if (!member->location.size) {
- return (char *) object + member->offset;
- } else {
- // Translate the problem in the process address space:
- void *real_area =
- (void *) mc_untranslate_address((void *) object, snapshot);
- // Resolve the member in the process address space:
- void *real_member = mc_member_resolve(real_area, type, member, snapshot);
- // Translate back in the snapshot address space:
- return mc_translate_address((uintptr_t) real_member, snapshot);
- }
-}
* */
void* mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot);
-/** \brief Translate a pointer from the snapshot address space to the application address space
- *
- * This is the inverse of mc_translate_address.
- *
- * Does not work for per-page snapshot, we change the logic to handle this.
- *
- * \param addr Address in the snapshot address space
- * \param snapsot Snapshot of interest (if NULL no translation is done)
- * \return Translated address in the application address space
- */
-uintptr_t mc_untranslate_address(void* addr, mc_snapshot_t snapshot);
-
extern xbt_dynar_t mc_checkpoint_ignore;
/********************************* MC Global **********************************/
};
void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot);
-void* mc_member_snapshot_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot);
typedef struct s_dw_variable{
Dwarf_Off dwarf_offset; /* Global offset of the field. */
}
-uintptr_t mc_untranslate_address(void *addr, mc_snapshot_t snapshot)
-{
- if (!snapshot) {
- return (uintptr_t) addr;
- }
-
- for (size_t i = 0; i != NB_REGIONS; ++i) {
- mc_mem_region_t region = snapshot->regions[i];
- if (region->page_numbers) {
- xbt_die("Does not work for per-page snapshot.");
- }
- if (addr >= region->data
- && addr <= (void *) (((char *) region->data) + region->size)) {
- size_t offset = (size_t) ((char *) addr - (char *) region->data);
- return ((uintptr_t) region->start_addr) + offset;
- }
- }
-
- return (uintptr_t) addr;
-}
-
/** @brief Read memory from a snapshot region broken across fragmented pages
*
* @param addr Process (non-snapshot) address of the data