2 * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
3 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
4 * Distributed under the terms of the MIT License.
8 #include <debug_support.h>
10 #include "arch_debug_support.h"
14 struct stack_frame
*previous
;
20 arch_debug_get_instruction_pointer(debug_context
*context
, thread_id thread
,
21 void **ip
, void **stackFrameAddress
)
24 debug_cpu_state cpuState
;
25 status_t error
= debug_get_cpu_state(context
, thread
, NULL
, &cpuState
);
29 *ip
= (void*)cpuState
.rip
;
30 *stackFrameAddress
= (void*)cpuState
.rbp
;
37 arch_debug_get_stack_frame(debug_context
*context
, void *stackFrameAddress
,
38 debug_stack_frame_info
*stackFrameInfo
)
40 stack_frame stackFrame
;
41 ssize_t bytesRead
= debug_read_memory(context
, stackFrameAddress
,
42 &stackFrame
, sizeof(stackFrame
));
45 if (bytesRead
!= sizeof(stackFrame
))
48 stackFrameInfo
->frame
= stackFrameAddress
;
49 stackFrameInfo
->parent_frame
= stackFrame
.previous
;
50 stackFrameInfo
->return_address
= stackFrame
.return_address
;