X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fc5167a345c9569b12237d14937523d733fb041f..c08295c26e7710f67045230969a3b5b84c7b6df8:/src/mc/mc_checkpoint.c diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index 56209f5571..4b8283bd34 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -4,7 +4,8 @@ /* 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. */ -#include +#define _GNU_SOURCE +#include #include "mc_private.h" #include "xbt/module.h" @@ -15,13 +16,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc, "Logging specific to mc_checkpoint"); -void *start_text_libsimgrid; -void *start_plt_libsimgrid, *end_plt_libsimgrid; -void *start_got_plt_libsimgrid, *end_got_plt_libsimgrid; -void *start_plt_binary, *end_plt_binary; -void *start_got_plt_binary, *end_got_plt_binary; char *libsimgrid_path; +static void MC_find_object_address(memory_map_t maps, mc_object_info_t result); static void MC_get_plt_section(mc_object_info_t info); /************************************ Free functions **************************************/ @@ -205,7 +202,7 @@ static void MC_get_memory_regions(mc_snapshot_t snapshot){ } -/** @brief Find the range of the different memory segments and binary paths */ +/** @brief Finds the range of the different memory segments and binary paths */ void MC_init_memory_map_info(){ unsigned int i = 0; @@ -239,15 +236,24 @@ void MC_init_memory_map_info(){ } -mc_object_info_t MC_find_object_address(memory_map_t maps, char* name) { +/** \brief Finds informations about a given shared object/executable */ +mc_object_info_t MC_find_object_info(memory_map_t maps, char* name) { mc_object_info_t result = MC_new_object_info(); result->file_name = xbt_strdup(name); result->start_data = NULL; result->start_text = NULL; + MC_find_object_address(maps, result); + MC_get_plt_section(result); + MC_dwarf_get_variables(result); + return result; +} +/** \brief Fills the position of the .bss and .data sections. */ +static void MC_find_object_address(memory_map_t maps, mc_object_info_t result) { unsigned int i = 0; s_map_region_t reg; - int len = strlen(basename(name)); + const char* name = result->file_name; + int len = strlen(basename(result->file_name)); while (i < maps->mapsize) { reg = maps->regions[i]; if (maps->regions[i].pathname == NULL || memcmp(basename(maps->regions[i].pathname), basename(name), len)){ @@ -268,9 +274,9 @@ mc_object_info_t MC_find_object_address(memory_map_t maps, char* name) { xbt_assert(result->start_text); MC_get_plt_section(result); - return result; } +/** \brief Fills the position of the .plt and .got.plt sections. */ static void MC_get_plt_section(mc_object_info_t info){ FILE *fp;