-void* mc_find_frame_base(dw_frame_t frame, unw_cursor_t* unw_cursor) {
- return (void*) mc_dwarf_resolve_locations(&frame->frame_base, unw_cursor, NULL, NULL);
+void *mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info,
+ unw_cursor_t * unw_cursor)
+{
+ s_mc_location_t location;
+ mc_dwarf_resolve_locations(&location,
+ &frame->frame_base, object_info,
+ unw_cursor, NULL, NULL, -1);
+ switch(mc_get_location_type(&location)) {
+ case MC_LOCATION_TYPE_ADDRESS:
+ return location.memory_location;
+
+ case MC_LOCATION_TYPE_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(location.cursor, location.register_id, &word);
+ return (void*) word;
+ }
+
+ default:
+ xbt_die("Cannot handle non-address frame base");
+ return NULL; // Unreachable
+ }