| 9120e874 Andy McCall |
1 |
#ifndef _DBG_INFO_H_ |
| 2 |
#define _DBG_INFO_H_ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
#include <stdbool.h> |
| 6 |
|
| 7 |
#ifdef __cplusplus |
| 8 |
extern "C" { |
| 9 |
#endif |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
typedef uint32_t dbg_addr_t; |
| 15 |
|
| 16 |
|
| 17 |
typedef enum { |
| 18 |
DBG_BANK_NO_MATCH = 0, |
| 19 |
DBG_BANK_RESOLVED, |
| 20 |
DBG_BANK_UNKNOWN, |
| 21 |
|
| 22 |
|
| 23 |
} dbg_bank_result_t; |
| 24 |
|
| 25 |
|
| 26 |
int dbg_info_load(const char *path); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
bool dbg_info_addr_to_source(dbg_addr_t addr, const char **file_path, int *line_num); |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
bool dbg_info_addr_to_source_nearest(dbg_addr_t addr, const char **file_path, int *line_num); |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
const char *dbg_info_get_dbg_dir(void); |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
bool dbg_info_has_high_level(void); |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
bool dbg_info_source_to_addr(const char *file_path, int line_num, dbg_addr_t *addr); |
| 51 |
|
| 52 |
|
| 53 |
bool dbg_info_is_loaded(void); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
bool dbg_info_is_span_start(dbg_addr_t addr); |
| 60 |
|
| 61 |
|
| 62 |
void dbg_info_unload_range(dbg_addr_t start, dbg_addr_t end); |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
bool dbg_info_peek_file_range(const char *loaded_path, dbg_addr_t *out_start, dbg_addr_t *out_end); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
int dbg_info_load_for_file(const char *loaded_path, dbg_addr_t load_addr); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
bool dbg_info_addr_to_source_banked(dbg_addr_t addr, int ram_bank, |
| 106 |
const char **file_path, int *line_num); |
| 107 |
|
| 108 |
dbg_bank_result_t dbg_info_addr_to_source_banked_ex(dbg_addr_t addr, int ram_bank, |
| 109 |
const char **file_path, int *line_num); |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
void dbg_info_note_bank_load(dbg_addr_t load_addr, uint32_t size, uint8_t ram_bank); |
| 116 |
|
| 117 |
|
| 118 |
void dbg_info_free(void); |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
bool dbg_info_addr_to_label(dbg_addr_t addr, const char **name); |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
bool dbg_info_addr_to_label_nearest(dbg_addr_t addr, const char **name, dbg_addr_t *label_addr); |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
bool dbg_info_label_to_addr(const char *name, dbg_addr_t *addr); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
bool dbg_info_equate_to_value(const char *name, dbg_addr_t *val); |
| 151 |
|
| 152 |
|
| 153 |
#define DBG_NAME_LABEL 0 |
| 154 |
#define DBG_NAME_EQUATE 1 |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
bool dbg_info_name_to_value(const char *name, dbg_addr_t *val, int *kind); |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
int dbg_info_symbol_count(void); |
| 163 |
bool dbg_info_symbol_at(int index, const char **name, dbg_addr_t *addr); |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
#define DBG_INFO_PATH_MAX 260 |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
int dbg_info_file_count(void); |
| 181 |
bool dbg_info_file_at(int index, const char **name); |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
int dbg_info_scan_dbg_files(const char *dir, char out[][DBG_INFO_PATH_MAX], int max); |
| 189 |
|
| 190 |
#ifdef __cplusplus |
| 191 |
} |
| 192 |
#endif |
| 193 |
|
| 194 |
#endif |