extern "C" {
-/** \brief Find the frame base of a given frame
- *
- * \param frame
- * \param unw_cursor
- */
-void *mc_find_frame_base(simgrid::mc::Frame* frame, simgrid::mc::ObjectInformation* object_info,
- unw_cursor_t * unw_cursor)
-{
- simgrid::dwarf::Location location = simgrid::dwarf::resolve(
- frame->frame_base, object_info,
- unw_cursor, NULL, NULL, -1);
- if (location.in_memory())
- return location.address();
- else if (location.in_register()) {
- // This is a special case.
- // The register if not the location of the frame base
- // (a frame base cannot be located in a register)
- // Instead, DWARF defines this to mean that the register
- // contains the address of the frame base.
- unw_word_t word;
- unw_get_reg(unw_cursor, location.register_id(), &word);
- return (void*) word;
- }
- else xbt_die("Unexpected location type");
-
-}
-
void mc_dwarf_location_list_init(
simgrid::dwarf::LocationList* list, simgrid::mc::ObjectInformation* info,
Dwarf_Die * die, Dwarf_Attribute * attr)
--- /dev/null
+/* Copyright (c) 2007-2015. The SimGrid Team.
+ * All rights reserved. */
+
+/* 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 <mc/Frame.hpp>
+
+namespace simgrid {
+namespace mc {
+
+void* Frame::frame_base(unw_cursor_t& unw_cursor) const
+{
+ simgrid::dwarf::Location location = simgrid::dwarf::resolve(
+ frame_base_location, object_info,
+ &unw_cursor, NULL, NULL, -1);
+ if (location.in_memory())
+ return location.address();
+ else if (location.in_register()) {
+ // This is a special case.
+ // The register if not the location of the frame base
+ // (a frame base cannot be located in a register)
+ // Instead, DWARF defines this to mean that the register
+ // contains the address of the frame base.
+ unw_word_t word;
+ unw_get_reg(&unw_cursor, location.register_id(), &word);
+ return (void*) word;
+ }
+ else xbt_die("Unexpected location type");
+}
+
+}
+}
\ No newline at end of file
std::string name;
void *low_pc;
void *high_pc;
- simgrid::dwarf::LocationList frame_base;
+ simgrid::dwarf::LocationList frame_base_location;
std::vector<Variable> variables;
unsigned long int id; /* DWARF offset of the subprogram */
std::vector<Frame> scopes;
unsigned long int abstract_origin_id;
simgrid::mc::ObjectInformation* object_info;
+
+ void* frame_base(unw_cursor_t& unw_cursor) const;
};
inline
simgrid::dwarf::LocationList*, simgrid::mc::ObjectInformation* info,
Dwarf_Die* die, Dwarf_Attribute* attr);
-void* mc_find_frame_base(
- simgrid::mc::Frame* frame, simgrid::mc::ObjectInformation* object_info, unw_cursor_t* unw_cursor);
-
SG_END_DECL()
#endif
if (frame) {
stack_frame.frame_name = frame->name;
stack_frame.frame_base =
- (unw_word_t) mc_find_frame_base(frame, frame->object_info, &c);
+ (unw_word_t) frame->frame_base(c);
} else {
stack_frame.frame_base = 0;
stack_frame.frame_name = std::string();
if (klass == simgrid::dwarf::TagClass::Subprogram) {
Dwarf_Attribute attr_frame_base;
if (dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base))
- mc_dwarf_location_list_init(&frame.frame_base, info, die,
+ mc_dwarf_location_list_init(&frame.frame_base_location, info, die,
&attr_frame_base);
}
simgrid::mc::Variable* var = find_local_variable(subprogram, variable);
assert(var);
- void* frame_base = mc_find_frame_base(subprogram, info, cursor);
+ void* frame_base = subprogram->frame_base(*cursor);
simgrid::dwarf::Location location = simgrid::dwarf::resolve(
var->location_list, info, cursor, frame_base, NULL, -1);
src/mc/AddressSpace.hpp
src/mc/AddressSpace.cpp
src/mc/Frame.hpp
+ src/mc/Frame.cpp
src/mc/ModelChecker.hpp
src/mc/ModelChecker.cpp
src/mc/ObjectInformation.hpp