2005-03-21 01:04:04 +03:00
|
|
|
/*
|
2013-05-01 02:44:44 +04:00
|
|
|
* Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Copyright 2013, Rene Gollent, rene@gollent.com
|
2005-03-21 01:04:04 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _DEBUG_SUPPORT_H
|
|
|
|
#define _DEBUG_SUPPORT_H
|
|
|
|
|
|
|
|
#include <debugger.h>
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct debug_context {
|
2005-07-17 01:12:32 +04:00
|
|
|
team_id team;
|
2005-03-21 01:04:04 +03:00
|
|
|
port_id nub_port;
|
|
|
|
port_id reply_port;
|
|
|
|
} debug_context;
|
|
|
|
|
|
|
|
|
2005-07-17 01:12:32 +04:00
|
|
|
status_t init_debug_context(debug_context *context, team_id team,
|
|
|
|
port_id nubPort);
|
2005-03-21 01:04:04 +03:00
|
|
|
void destroy_debug_context(debug_context *context);
|
|
|
|
|
|
|
|
status_t send_debug_message(debug_context *context, int32 messageCode,
|
|
|
|
const void *message, int32 messageSize, void *reply,
|
|
|
|
int32 replySize);
|
|
|
|
|
|
|
|
ssize_t debug_read_memory_partial(debug_context *context, const void *address,
|
|
|
|
void *buffer, size_t size);
|
|
|
|
ssize_t debug_read_memory(debug_context *context, const void *address,
|
|
|
|
void *buffer, size_t size);
|
|
|
|
ssize_t debug_read_string(debug_context *context, const void *_address,
|
|
|
|
char *buffer, size_t size);
|
2010-12-14 02:27:59 +03:00
|
|
|
ssize_t debug_write_memory_partial(debug_context *context, const void *address,
|
|
|
|
void *buffer, size_t size);
|
|
|
|
ssize_t debug_write_memory(debug_context *context, const void *address,
|
|
|
|
void *buffer, size_t size);
|
2005-03-21 01:04:04 +03:00
|
|
|
|
2005-05-29 04:44:51 +04:00
|
|
|
status_t debug_get_cpu_state(debug_context *context, thread_id thread,
|
|
|
|
debug_debugger_message *messageCode, debug_cpu_state *cpuState);
|
|
|
|
|
|
|
|
|
|
|
|
// stack trace support
|
|
|
|
|
|
|
|
typedef struct debug_stack_frame_info {
|
|
|
|
void *frame;
|
|
|
|
void *parent_frame;
|
|
|
|
void *return_address;
|
|
|
|
} debug_stack_frame_info;
|
|
|
|
|
|
|
|
status_t debug_get_instruction_pointer(debug_context *context, thread_id thread,
|
|
|
|
void **ip, void **stackFrameAddress);
|
|
|
|
status_t debug_get_stack_frame(debug_context *context,
|
|
|
|
void *stackFrameAddress, debug_stack_frame_info *stackFrameInfo);
|
|
|
|
|
2005-03-21 01:04:04 +03:00
|
|
|
|
2005-07-17 01:12:32 +04:00
|
|
|
// symbol lookup support
|
|
|
|
|
|
|
|
typedef struct debug_symbol_lookup_context debug_symbol_lookup_context;
|
2008-09-15 16:47:59 +04:00
|
|
|
typedef struct debug_symbol_iterator debug_symbol_iterator;
|
2005-07-17 01:12:32 +04:00
|
|
|
|
2013-05-01 02:44:44 +04:00
|
|
|
status_t debug_create_symbol_lookup_context(team_id team, image_id image,
|
2005-07-17 01:12:32 +04:00
|
|
|
debug_symbol_lookup_context **lookupContext);
|
2013-05-02 03:52:00 +04:00
|
|
|
// imageID can be -1 if all images in the target team are
|
|
|
|
// desired, otherwise a valid image id is expected.
|
|
|
|
|
2005-07-17 01:12:32 +04:00
|
|
|
void debug_delete_symbol_lookup_context(
|
|
|
|
debug_symbol_lookup_context *lookupContext);
|
|
|
|
|
2009-07-03 18:20:27 +04:00
|
|
|
status_t debug_get_symbol(debug_symbol_lookup_context* lookupContext,
|
|
|
|
image_id image, const char* name, int32 symbolType,
|
|
|
|
void** _symbolLocation, size_t* _symbolSize, int32* _symbolType);
|
2005-07-17 01:12:32 +04:00
|
|
|
status_t debug_lookup_symbol_address(debug_symbol_lookup_context *lookupContext,
|
|
|
|
const void *address, void **baseAddress, char *symbolName,
|
|
|
|
int32 symbolNameSize, char *imageName, int32 imageNameSize,
|
|
|
|
bool *exactMatch);
|
|
|
|
|
2008-09-15 16:47:59 +04:00
|
|
|
status_t debug_create_image_symbol_iterator(
|
|
|
|
debug_symbol_lookup_context* lookupContext, image_id imageID,
|
|
|
|
debug_symbol_iterator** _iterator);
|
2013-05-01 02:44:44 +04:00
|
|
|
|
2009-04-14 22:03:24 +04:00
|
|
|
status_t debug_create_file_symbol_iterator(const char* path,
|
|
|
|
debug_symbol_iterator** _iterator);
|
|
|
|
void debug_delete_symbol_iterator(debug_symbol_iterator* iterator);
|
2008-09-15 16:47:59 +04:00
|
|
|
|
|
|
|
status_t debug_next_image_symbol(debug_symbol_iterator* iterator,
|
|
|
|
char* nameBuffer, size_t nameBufferLength, int32* _symbolType,
|
|
|
|
void** _symbolLocation, size_t* _symbolSize);
|
2009-04-15 17:30:58 +04:00
|
|
|
status_t debug_get_symbol_iterator_image_info(debug_symbol_iterator* iterator,
|
|
|
|
image_info* info);
|
2005-07-17 01:12:32 +04:00
|
|
|
|
2005-03-21 01:04:04 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _DEBUG_SUPPORT_H
|