Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix non-MC builds
[simgrid.git] / src / mc / mc_member.cpp
1 /* Copyright (c) 2014-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "src/mc/mc_private.h"
8 #include "src/mc/Type.hpp"
9 #include "src/mc/mc_dwarf.hpp"
10
11 namespace simgrid {
12 namespace dwarf {
13
14 /** Resolve snapshot in the process address space
15  *
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
21  */
22 void *resolve_member(
23     const void *base, simgrid::mc::Type* type, simgrid::mc::Member* member,
24     simgrid::mc::AddressSpace* address_space, int process_index)
25 {
26   ExpressionContext state;
27   state.frame_base = nullptr;
28   state.cursor = nullptr;
29   state.address_space = address_space;
30   state.process_index = process_index;
31
32   ExpressionStack stack;
33   stack.push((ExpressionStack::value_type) base);
34   simgrid::dwarf::execute(member->location_expression, state, stack);
35   return (void*) stack.top();
36 }
37
38 }
39 }