2 * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013, Rene Gollent, rene@gollent.com
4 * Distributed under the terms of the MIT License.
6 #ifndef _DEBUG_SUPPORT_H
7 #define _DEBUG_SUPPORT_H
16 typedef struct debug_context
{
23 status_t
init_debug_context(debug_context
*context
, team_id team
,
25 void destroy_debug_context(debug_context
*context
);
27 status_t
send_debug_message(debug_context
*context
, int32 messageCode
,
28 const void *message
, int32 messageSize
, void *reply
,
31 ssize_t
debug_read_memory_partial(debug_context
*context
, const void *address
,
32 void *buffer
, size_t size
);
33 ssize_t
debug_read_memory(debug_context
*context
, const void *address
,
34 void *buffer
, size_t size
);
35 ssize_t
debug_read_string(debug_context
*context
, const void *_address
,
36 char *buffer
, size_t size
);
37 ssize_t
debug_write_memory_partial(debug_context
*context
, const void *address
,
38 void *buffer
, size_t size
);
39 ssize_t
debug_write_memory(debug_context
*context
, const void *address
,
40 void *buffer
, size_t size
);
42 status_t
debug_get_cpu_state(debug_context
*context
, thread_id thread
,
43 debug_debugger_message
*messageCode
, debug_cpu_state
*cpuState
);
46 // stack trace support
48 typedef struct debug_stack_frame_info
{
52 } debug_stack_frame_info
;
54 status_t
debug_get_instruction_pointer(debug_context
*context
, thread_id thread
,
55 void **ip
, void **stackFrameAddress
);
56 status_t
debug_get_stack_frame(debug_context
*context
,
57 void *stackFrameAddress
, debug_stack_frame_info
*stackFrameInfo
);
60 // symbol lookup support
62 typedef struct debug_symbol_lookup_context debug_symbol_lookup_context
;
63 typedef struct debug_symbol_iterator debug_symbol_iterator
;
65 status_t
debug_create_symbol_lookup_context(team_id team
, image_id image
,
66 debug_symbol_lookup_context
**lookupContext
);
67 // imageID can be -1 if all images in the target team are
68 // desired, otherwise a valid image id is expected.
70 void debug_delete_symbol_lookup_context(
71 debug_symbol_lookup_context
*lookupContext
);
73 status_t
debug_get_symbol(debug_symbol_lookup_context
* lookupContext
,
74 image_id image
, const char* name
, int32 symbolType
,
75 void** _symbolLocation
, size_t* _symbolSize
, int32
* _symbolType
);
76 status_t
debug_lookup_symbol_address(debug_symbol_lookup_context
*lookupContext
,
77 const void *address
, void **baseAddress
, char *symbolName
,
78 int32 symbolNameSize
, char *imageName
, int32 imageNameSize
,
81 status_t
debug_create_image_symbol_iterator(
82 debug_symbol_lookup_context
* lookupContext
, image_id imageID
,
83 debug_symbol_iterator
** _iterator
);
85 status_t
debug_create_file_symbol_iterator(const char* path
,
86 debug_symbol_iterator
** _iterator
);
87 void debug_delete_symbol_iterator(debug_symbol_iterator
* iterator
);
89 status_t
debug_next_image_symbol(debug_symbol_iterator
* iterator
,
90 char* nameBuffer
, size_t nameBufferLength
, int32
* _symbolType
,
91 void** _symbolLocation
, size_t* _symbolSize
);
92 status_t
debug_get_symbol_iterator_image_info(debug_symbol_iterator
* iterator
,
100 #endif // _DEBUG_SUPPORT_H