X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b3b356352e87ae00a20f737c48e19b0c8413455a..8695eb4cf63ff136fb246e39305887f3c7c334a8:/src/mc/mc_dwarf_expression.cpp diff --git a/src/mc/mc_dwarf_expression.cpp b/src/mc/mc_dwarf_expression.cpp index d4926a2281..bf8003730b 100644 --- a/src/mc/mc_dwarf_expression.cpp +++ b/src/mc/mc_dwarf_expression.cpp @@ -4,13 +4,14 @@ /* 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 + #include #include #include -#include -#include "mc_object_info.h" +#include "mc_dwarf.hpp" #include "mc_private.h" #include "mc_location.h" #include "mc/AddressSpace.hpp" @@ -21,7 +22,7 @@ using simgrid::mc::remote; extern "C" { -static int mc_dwarf_push_value(mc_expression_state_t state, Dwarf_Off value) +static int mc_dwarf_push_value(mc_expression_state_t state, std::uint64_t value) { if (state->stack_size >= MC_EXPRESSION_STACK_SIZE) return MC_EXPRESSION_E_STACK_OVERFLOW; @@ -38,10 +39,10 @@ static int mc_dwarf_push_value(mc_expression_state_t state, Dwarf_Off value) */ static int mc_dwarf_register_to_libunwind(int dwarf_register) { -#if defined(UNW_TARGET_X86_64) +#if defined(__x86_64__) // It seems for this arch, DWARF and libunwind agree in the numbering: return dwarf_register; -#elif defined(UNW_TARGET_X86) +#elif defined(__i386__) // Could't find the authoritative source of information for this. // This is inspired from http://source.winehq.org/source/dlls/dbghelp/cpu_i386.c#L517. switch (dwarf_register) { @@ -101,12 +102,12 @@ static int mc_dwarf_register_to_libunwind(int dwarf_register) #endif } -int mc_dwarf_execute_expression(size_t n, const Dwarf_Op * ops, +int mc_dwarf_execute_expression(size_t n, const simgrid::mc::DwarfInstruction* ops, mc_expression_state_t state) { for (size_t i = 0; i != n; ++i) { int error = 0; - const Dwarf_Op *op = ops + i; + const simgrid::mc::DwarfInstruction *op = ops + i; uint8_t atom = op->atom; switch (atom) { @@ -170,7 +171,7 @@ int mc_dwarf_execute_expression(size_t n, const Dwarf_Op * ops, unw_step(&cursor); unw_word_t res; - unw_get_reg(&cursor, UNW_TDEP_SP, &res); + unw_get_reg(&cursor, UNW_REG_SP, &res); error = mc_dwarf_push_value(state, res); break; } @@ -233,7 +234,7 @@ int mc_dwarf_execute_expression(size_t n, const Dwarf_Op * ops, return MC_EXPRESSION_E_NO_BASE_ADDRESS; if (state->stack_size == MC_EXPRESSION_STACK_SIZE) return MC_EXPRESSION_E_STACK_OVERFLOW; - Dwarf_Off addr = (Dwarf_Off) (uintptr_t) + std::uint64_t addr = (std::uint64_t) (uintptr_t) state->object_info->base_address() + op->number; error = mc_dwarf_push_value(state, addr); break; @@ -540,36 +541,4 @@ void *mc_find_frame_base(simgrid::mc::Frame* frame, simgrid::mc::ObjectInformati } } -void mc_dwarf_location_list_init( - simgrid::mc::LocationList* list, simgrid::mc::ObjectInformation* info, - Dwarf_Die * die, Dwarf_Attribute * attr) -{ - list->clear(); - - ptrdiff_t offset = 0; - Dwarf_Addr base, start, end; - Dwarf_Op *ops; - size_t len; - - while (1) { - - offset = dwarf_getlocations(attr, offset, &base, &start, &end, &ops, &len); - if (offset == 0) - return; - else if (offset == -1) - xbt_die("Error while loading location list"); - - simgrid::mc::LocationListEntry entry; - entry.expression = simgrid::mc::DwarfExpression(ops, ops + len); - - void *base = info->base_address(); - // If start == 0, this is not a location list: - entry.lowpc = start == 0 ? NULL : (char *) base + start; - entry.highpc = start == 0 ? NULL : (char *) base + end; - - list->push_back(std::move(entry)); - } - -} - }