note description: "Field record" status: "See notice at end of class." legal: "See notice at end of class." date: "$Date: 2013-03-04 22:57:52 +0000 (Mon, 04 Mar 2013) $" revision: "$Revision: 91317 $" class RT_DBG_LOCAL_RECORD [G -> detachable ANY] inherit RT_DBG_VALUE_RECORD redefine debug_output end create make feature {NONE} -- Initialization make (dep, pos, eif_t: INTEGER_32; t: like rt_type) -- Make local record with index i, type t an value v do callstack_depth := dep position := pos type := eif_t rt_type := t end feature -- RT internals frozen local_value_at (dep: INTEGER_32; pos: INTEGER_32; a_rt_type: like rt_type): detachable ANY -- Object attached at local position pos for depth dep -- (directly or through a reference) require index_large_enough: pos >= 0 local a_loc_type: INTEGER_32 do if pos = 0 then a_loc_type := {RT_DBG_INTERNAL}.rt_dlt_result else a_loc_type := {RT_DBG_INTERNAL}.rt_dlt_localvar end if a_loc_type /= {RT_DBG_INTERNAL}.rt_dlt_result then Result := stack_value_at (dep, a_loc_type, pos, a_rt_type) end end set_local_value_at (dep: INTEGER_32; pos: INTEGER_32; a_rt_type: like rt_type; val: like value) local a_loc_type: INTEGER_32 res: INTEGER_32 do if pos = 0 then a_loc_type := {RT_DBG_INTERNAL}.rt_dlt_result else a_loc_type := {RT_DBG_INTERNAL}.rt_dlt_localvar end res := set_stack_value_at (dep, a_loc_type, pos, a_rt_type, val) check res = 0 end end feature -- Properties value: detachable G -- Associated value. callstack_depth: INTEGER_32 -- Related call stack depth. rt_type: NATURAL_32 -- Field type feature -- Access current_value_record: detachable RT_DBG_VALUE_RECORD -- Record for current value do Result := object_local_record (callstack_depth, position, rt_type) end associated_object: detachable ANY -- Associated object, if any do end Is_local_record: BOOLEAN = True -- Is local record ? is_same_as (other: RT_DBG_VALUE_RECORD): BOOLEAN -- Is Current same as other ? do Result := attached {like Current} other as l_loc and then position = l_loc.position and then value = l_loc.value end debug_output: STRING_8 -- String that should be displayed in debugger to represent Current. do Result := Precursor + " (depth=" + callstack_depth.out + ")" end to_string: STRING_8 -- String representation local v: like value do v := value inspect type when {REFLECTOR_CONSTANTS}.reference_type then if v /= Void then Result := ($v).out else Result := "Void" end when {REFLECTOR_CONSTANTS}.expanded_type then check value_attached: value /= Void end if v /= Void then Result := ($v).out else create Result.make_empty end else if v /= Void then Result := out_value (v) else create Result.make_empty end end end feature -- Change properties get_value -- Get value do if attached {like value} local_value_at (callstack_depth, position, rt_type) as v then value := v else value := default_value end end feature -- Runtime restore (val: RT_DBG_VALUE_RECORD) -- Restore value , and associate val as backup do debug ("rt_dbg_replay") dtrace (generator + ".restore: depth=" + callstack_depth.out + " #" + position.out + "%N") end if is_same_as (val) then debug ("rt_dbg_replay") dtrace (" -> unchanged because same value [" + to_string + "].%N") end else set_local_from_record (Current) debug ("rt_dbg_replay") dtrace (" -> restored: from [" + val.to_string + "] to [" + to_string + "] %N") end end end revert (bak: RT_DBG_VALUE_RECORD) -- Revert previous change due to Current do debug ("rt_dbg_replay") dtrace (generator + ".revert: depth=" + callstack_depth.out + " #" + position.out + "%N") end set_local_from_record (bak) debug ("rt_dbg_replay") dtrace (" -> reverted: from [" + to_string + "] to [" + bak.to_string + "] %N") end end feature {NONE} -- Internal Implementation set_local_from_record (r: RT_DBG_VALUE_RECORD) -- Set object field defined by r on target obj require r_attached: r /= Void do if attached {RT_DBG_LOCAL_RECORD [like value]} r as ot_record then set_local_value_at (callstack_depth, position, rt_type, ot_record.value) else check should_not_occur: False end end end feature {NONE} -- Output out_value (v: attached G): STRING_8 -- Printable representation of v. require v_attached: attached v do Result := v.out ensure result_attached: attached Result end feature {NONE} -- Implementation default_value: detachable G -- Default value do end note library: "EiffelBase: Library of reusable components for Eiffel." copyright: "Copyright (c) 1984-2013, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class RT_DBG_LOCAL_RECORD
Generated by ISE EiffelStudio