}
-static xbt_dict_t MC_dwarf_get_location_list(const char *elf_file){
-
- char *command = bprintf("objdump -Wo %s", elf_file);
-
- FILE *fp = popen(command, "r");
-
- if(fp == NULL){
- perror("popen for objdump failed");
- xbt_abort();
- }
-
- int debug = 0; /*Detect if the program has been compiled with -g */
-
- xbt_dict_t location_list = xbt_dict_new_homogeneous(NULL);
- char *line = NULL, *loc_expr = NULL;
- ssize_t read;
- size_t n = 0;
- int cursor_remove;
- xbt_dynar_t split = NULL;
-
- while ((read = xbt_getline(&line, &n, fp)) != -1) {
-
- /* Wipeout the new line character */
- line[read - 1] = '\0';
-
- xbt_str_trim(line, NULL);
-
- if(n == 0)
- continue;
-
- if(strlen(line) == 0)
- continue;
-
- if(debug == 0){
-
- if(strncmp(line, elf_file, strlen(elf_file)) == 0)
- continue;
-
- if(strncmp(line, "Contents", 8) == 0)
- continue;
-
- if(strncmp(line, "Offset", 6) == 0){
- debug = 1;
- continue;
- }
- }
-
- if(debug == 0){
- XBT_INFO("Your program must be compiled with -g");
- xbt_abort();
- }
-
- xbt_dynar_t loclist = xbt_dynar_new(sizeof(dw_location_entry_t), NULL);
-
- xbt_str_strip_spaces(line);
- split = xbt_str_split(line, " ");
-
- while(read != -1 && strcmp("<End", (char *)xbt_dynar_get_as(split, 1, char *)) != 0){
-
- dw_location_entry_t new_entry = xbt_new0(s_dw_location_entry_t, 1);
- new_entry->lowpc = strtoul((char *)xbt_dynar_get_as(split, 1, char *), NULL, 16);
- new_entry->highpc = strtoul((char *)xbt_dynar_get_as(split, 2, char *), NULL, 16);
-
- cursor_remove =0;
- while(cursor_remove < 3){
- xbt_dynar_remove_at(split, 0, NULL);
- cursor_remove++;
- }
-
- loc_expr = xbt_str_join(split, " ");
- xbt_str_ltrim(loc_expr, "(");
- xbt_str_rtrim(loc_expr, ")");
- new_entry->location = MC_dwarf_get_location(NULL, loc_expr);
-
- xbt_dynar_push(loclist, &new_entry);
-
- xbt_dynar_free(&split);
- free(loc_expr);
-
- read = xbt_getline(&line, &n, fp);
- if(read != -1){
- line[read - 1] = '\0';
- xbt_str_strip_spaces(line);
- split = xbt_str_split(line, " ");
- }
-
- }
-
-
- char *key = bprintf("%lu", strtoul((char *)xbt_dynar_get_as(split, 0, char *), NULL, 16));
- xbt_dict_set(location_list, key, loclist, NULL);
- xbt_free(key);
-
- xbt_dynar_free(&split);
-
- }
-
- xbt_free(line);
- xbt_free(command);
- pclose(fp);
-
- return location_list;
-}
--
+/** \brief Finds a frame (DW_TAG_subprogram) from an DWARF offset in the rangd of this subprogram
+ *
+ * The offset can be an offset of a child DW_TAG_variable.
+ */
static dw_frame_t MC_dwarf_get_frame_by_offset(xbt_dict_t all_variables, unsigned long int offset){
xbt_dict_cursor_t cursor = NULL;