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. */
9 #include "src/mc/mc_private.h"
10 #include "src/mc/Type.hpp"
11 #include "src/mc/mc_dwarf.hpp"
17 /** Resolve snapshot in the process address space
19 * @param object Process address of the struct/class
20 * @param type Type of the struct/class
21 * @param member Member description
22 * @param snapshot Snapshot (or NULL)
23 * @return Process address of the given member of the 'object' struct/class
26 const void *base, simgrid::mc::Type* type, simgrid::mc::Member* member,
27 simgrid::mc::AddressSpace* address_space, int process_index)
29 // TODO, get rid of this?
30 if (!member->has_offset_location())
31 return ((char *) base) + member->offset();
33 ExpressionContext state;
34 state.frame_base = NULL;
36 state.address_space = address_space;
37 state.process_index = process_index;
39 ExpressionStack stack;
40 stack.push((ExpressionStack::value_type) base);
41 simgrid::dwarf::execute(member->location_expression, state, stack);
42 return (void*) stack.top();