read what the binary says about itself: names, signatures, prototypes; gen v2
This commit is contained in:
parent
54ef572202
commit
c458b4cb50
34 changed files with 58363 additions and 192 deletions
|
|
@ -10,7 +10,6 @@
|
|||
//! `find_vtable` shape (COL at vftable-8, TypeDescriptor `.?AV<name>@@`).
|
||||
|
||||
use crate::elf::{CodeImage, KindTag};
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub struct VTable {
|
||||
pub slot0: u64, // vaddr of virtual slot index 0
|
||||
|
|
@ -236,7 +235,6 @@ fn typeinfo_bases(img: &CodeImage, ti: u64, kinds: &RttiKinds) -> Vec<BaseClass>
|
|||
pub fn enumerate_vtables(img: &CodeImage, max_slots: usize) -> Vec<ClassVtable> {
|
||||
let kinds = RttiKinds::detect(img);
|
||||
let mut out = Vec::new();
|
||||
let mut seen = HashSet::new();
|
||||
for (slot, val) in img.reloc_slots() {
|
||||
if slot < 8 {
|
||||
continue;
|
||||
|
|
@ -244,10 +242,9 @@ pub fn enumerate_vtables(img: &CodeImage, max_slots: usize) -> Vec<ClassVtable>
|
|||
let Some((mangled, name)) = typeinfo_name(img, val, &kinds) else {
|
||||
continue;
|
||||
};
|
||||
// No de-dup guard: `reloc_slots` iterates a map KEYED by slot vaddr, so every slot — and hence
|
||||
// every `slot + 8` — is already unique. A `seen` set here can never reject a candidate.
|
||||
let vtable_va = slot.wrapping_add(8);
|
||||
if !seen.insert(vtable_va) {
|
||||
continue;
|
||||
}
|
||||
// offset-to-top sits at vtable-16 (just below the typeinfo field): a plain, non-relocated,
|
||||
// pointer-aligned int, 0 for a primary table and a small negative for sub-object tables.
|
||||
let Some(ott) = img.read_i64(slot.wrapping_sub(8)) else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue