.githooks/
riscv/
test/
.clang-format
570 B
.gitignore
5 B
.gitsigners
112 B
AGENTS.md
227 B
LICENSE
1.1 KiB
Makefile
3.5 KiB
README
12.5 KiB
STYLE
781 B
abi_host.c
12.2 KiB
abi_linux.c
3.7 KiB
bitmanip.h
5.8 KiB
color.h
567 B
debug_map.c
5.1 KiB
debug_map.h
1.3 KiB
emulator.c
87.3 KiB
host.h
5.5 KiB
host_posix.c
11.2 KiB
hosted.h
5.7 KiB
image_native.c
4.6 KiB
image_rad0.c
2.7 KiB
image_raw.c
2.6 KiB
io.c
1.1 KiB
io.h
444 B
jit.c
99.2 KiB
jit.h
7.8 KiB
machine.c
4.4 KiB
machine.h
2.1 KiB
machine_cpu.c
13.6 KiB
machine_csr.c
4.6 KiB
machine_devices.c
10.8 KiB
machine_fdt.c
8.7 KiB
machine_internal.h
7.4 KiB
muldiv.h
1.0 KiB
profile.c
17.5 KiB
profile.h
1.4 KiB
riscv.c
755 B
riscv.h
4.3 KiB
types.h
1019 B
vector.c
54.0 KiB
vector.h
1.3 KiB
debug_map.h
raw
| 1 | #ifndef DEBUG_MAP_H |
| 2 | #define DEBUG_MAP_H |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | |
| 6 | #include "types.h" |
| 7 | |
| 8 | /* Native PC mapped to one source location. */ |
| 9 | struct debug_entry { |
| 10 | u32 pc; /* Byte offset from the first instruction. */ |
| 11 | u32 offset; /* Byte offset from the start of the source file. */ |
| 12 | const char *file; /* Source path. */ |
| 13 | }; |
| 14 | |
| 15 | /* Storage for a native source map. */ |
| 16 | struct debug_map { |
| 17 | struct debug_entry *entries; /* Entries in PC order. */ |
| 18 | size_t count; /* Number of entries. */ |
| 19 | char **paths; /* Owned paths from the path table. */ |
| 20 | size_t path_count; /* Number of owned paths. */ |
| 21 | u8 *data; /* Sidecar bytes, including legacy paths. */ |
| 22 | }; |
| 23 | |
| 24 | /* Read a whole sidecar. Return NULL for an absent or unreadable file. */ |
| 25 | u8 *debug_read_sidecar(const char *program, const char *suffix, size_t *size); |
| 26 | |
| 27 | /* Load <program>.debug if present. Return false for an invalid map. */ |
| 28 | bool debug_map_load(struct debug_map *map, const char *program, u32 code_bytes); |
| 29 | |
| 30 | /* Return the source entry at or before the given code offset, or NULL. */ |
| 31 | const struct debug_entry *debug_map_lookup(const struct debug_map *map, u32 pc); |
| 32 | |
| 33 | /* Free all memory held by the map. */ |
| 34 | void debug_map_free(struct debug_map *map); |
| 35 | |
| 36 | #endif |