Skip to content

Handle Debugging:Debugger provided Callbacks

Joachim edited this page May 28, 2020 · 3 revisions

Alloc / free / print

alloc

typedef mpid_rc_t (*mpid_callback_memory_alloc_fn_t) (
  mpid_size_t nbytes,
  void **ptr
);

free

typedef mpid_rc_t (*mpid_callback_memory_free_fn_t) (
  void *ptr
);

print

typedef mpid_rc_t (*mpid_callback_print_string_fn_t) (
  const char *string,
  int category
);

Lookup symbols

get sizes of base types on the target

typedef mpid_rc_t (*mpid_callback_sizeof_fn_t) (
  mpid_address_space_context_t *address_space_context,
  mpid_device_type_sizes_t *sizes
);

thread context lookup

typedef mpid_rc_t
(*mpid_callback_get_thread_context_for_thread_id_fn_t) (
  mpid_address_space_context_t *address_space_context,
  mpid_thread_id_t kind,
  mpid_size_t sizeof_thread_id,
  const void *thread_id,
  mpid_thread_context_t **thread_context
);

symbol address

typedef mpid_rc_t (*mpid_callback_symbol_addr_fn_t) (
  mpid_address_space_context_t *address_space_context,
  mpid_thread_context_t *thread_context, // ?
  const char *symbol_name,
  mpid_address_t *symbol_addr,
  const char *file_name // Necessary to distinguish ambiguous symbols from different object files
);

Access target memory

read (memory / string)

typedef mpid_rc_t (*mpid_callback_memory_read_fn_t) (
  mpid_address_space_context_t *address_space_context,
  mpid_thread_context_t *thread_context,
  const mpid_address_t *addr,
  mpid_size_t nbytes,
  void *buffer
);

Write

typedef mpid_rc_t (*mpid_callback_memory_write_fn_t) (
  mpid_address_space_context_t *address_space_context,
  mpid_thread_context_t *thread_context,
  const mpid_address_t *addr,
  mpid_size_t nbytes,
  const void *buffer
);

Endianess conversion

typedef mpid_rc_t (*mpid_callback_target_host_fn_t) (
  mpid_address_space_context_t *address_space_context,
  const void *input,
  mpid_size_t unit_size,
  mpid_size_t count,
  void *output
);

Types

typedef uint64_t mpid_size_t;
typedef uint64_t mpid_addr_t;
typedef int64_t mpid_word_t;
typedef uint64_t mpid_seg_t;

typedef struct mpid_address_t {
  mpid_seg_t segment;
  mpid_addr_t address;
} mpid_address_t;

typedef uint64_t mpid_thread_id_t;
typedef struct _mpid_aspace_cont mpid_address_space_context_t;
typedef struct _mpid_thread_cont mpid_thread_context_t;

struct to hold the sizes of all base types

typedef struct mpid_device_type_sizes_t {
  uint8_t sizeof_char;
  uint8_t sizeof_short;
  uint8_t sizeof_int;
  uint8_t sizeof_long;
  uint8_t sizeof_long_long;
  uint8_t sizeof_pointer;
} mpid_device_type_sizes_t;
Clone this wiki locally