1 /* Copyright (c) 2014-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "src/mc/mc_private.h"
8 #include "src/mc/Type.hpp"
9 #include "src/mc/mc_dwarf.hpp"
14 /** Resolve snapshot in the process address space
16 * @param object Process address of the struct/class
17 * @param type Type of the struct/class
18 * @param member Member description
19 * @param snapshot Snapshot (or nullptr)
20 * @return Process address of the given member of the 'object' struct/class
23 const void *base, simgrid::mc::Type* type, simgrid::mc::Member* member,
24 simgrid::mc::AddressSpace* address_space, int process_index)
26 // TODO, get rid of this?
27 if (!member->has_offset_location())
28 return ((char *) base) + member->offset();
30 ExpressionContext state;
31 state.frame_base = nullptr;
32 state.cursor = nullptr;
33 state.address_space = address_space;
34 state.process_index = process_index;
36 ExpressionStack stack;
37 stack.push((ExpressionStack::value_type) base);
38 simgrid::dwarf::execute(member->location_expression, state, stack);
39 return (void*) stack.top();