2 * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
7 #include <debug_support.h>
9 #include "arch_debug_support.h"
13 struct stack_frame
*previous
;
19 arch_debug_get_instruction_pointer(debug_context
*context
, thread_id thread
,
20 void **ip
, void **stackFrameAddress
)
23 debug_cpu_state cpuState
;
24 status_t error
= debug_get_cpu_state(context
, thread
, NULL
, &cpuState
);
28 *ip
= (void*)cpuState
.eip
;
29 *stackFrameAddress
= (void*)cpuState
.ebp
;
36 arch_debug_get_stack_frame(debug_context
*context
, void *stackFrameAddress
,
37 debug_stack_frame_info
*stackFrameInfo
)
39 stack_frame stackFrame
;
40 ssize_t bytesRead
= debug_read_memory(context
, stackFrameAddress
, &stackFrame
,
44 if (bytesRead
!= sizeof(stackFrame
))
47 stackFrameInfo
->frame
= stackFrameAddress
;
48 stackFrameInfo
->parent_frame
= stackFrame
.previous
;
49 stackFrameInfo
->return_address
= stackFrame
.return_address
;