Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert S4U to my current coding convention
[simgrid.git] / src / mc / Frame.cpp
1 /* Copyright (c) 2007-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/Frame.hpp"
8
9 namespace simgrid {
10 namespace mc {
11
12 void* Frame::frame_base(unw_cursor_t& unw_cursor) const
13 {
14   simgrid::dwarf::Location location = simgrid::dwarf::resolve(
15                              frame_base_location, object_info,
16                              &unw_cursor, NULL, NULL, -1);
17   if (location.in_memory())
18     return location.address();
19   else if (location.in_register()) {
20     // This is a special case.
21     // The register if not the location of the frame base
22     // (a frame base cannot be located in a register)
23     // Instead, DWARF defines this to mean that the register
24     // contains the address of the frame base.
25     unw_word_t word;
26     unw_get_reg(&unw_cursor, location.register_id(), &word);
27     return (void*) word;
28   }
29   else xbt_die("Unexpected location type");
30 }
31
32 }
33 }