Find which registered region of code contains the given program counter, and what offset that PC is within that module's code.
(pc: usize)
| 381 | /// Find which registered region of code contains the given program counter, and |
| 382 | /// what offset that PC is within that module's code. |
| 383 | pub fn lookup_code(pc: usize) -> Option<(Arc<CodeMemory>, usize)> { |
| 384 | let all_modules = global_code().read(); |
| 385 | let (_end, (start, module)) = all_modules.range(pc..).next()?; |
| 386 | let text_offset = pc.checked_sub(*start)?; |
| 387 | Some((module.clone(), text_offset)) |
| 388 | } |
| 389 | |
| 390 | /// Registers a new region of code. |
| 391 | /// |