refactor: db access from pdb_extraction.py

This commit is contained in:
jonschz 2024-06-08 12:51:58 +02:00
parent f306f48fc4
commit eb0d736eb8
2 changed files with 5 additions and 7 deletions

View File

@ -126,7 +126,7 @@ def handle_matched_function(
self, match_info: MatchInfo self, match_info: MatchInfo
) -> Optional[tuple[MatchInfo, FunctionSignature]]: ) -> Optional[tuple[MatchInfo, FunctionSignature]]:
assert match_info.orig_addr is not None assert match_info.orig_addr is not None
match_options = self.compare.db.get_match_options(match_info.orig_addr) match_options = self.compare.get_match_options(match_info.orig_addr)
assert match_options is not None assert match_options is not None
if match_options.get("skip", False) or match_options.get("stub", False): if match_options.get("skip", False) or match_options.get("stub", False):
return None return None

View File

@ -4,7 +4,7 @@
import struct import struct
import uuid import uuid
from dataclasses import dataclass from dataclasses import dataclass
from typing import Callable, Iterable, List, Optional from typing import Any, Callable, Iterable, List, Optional
from isledecomp.bin import Bin as IsleBin, InvalidVirtualAddressError from isledecomp.bin import Bin as IsleBin, InvalidVirtualAddressError
from isledecomp.cvdump.demangler import demangle_string_const from isledecomp.cvdump.demangler import demangle_string_const
from isledecomp.cvdump import Cvdump, CvdumpAnalysis from isledecomp.cvdump import Cvdump, CvdumpAnalysis
@ -88,11 +88,6 @@ def __init__(
self._match_thunks() self._match_thunks()
self._find_vtordisp() self._find_vtordisp()
@property
def db(self):
"""Newer code needs to access this field, legacy code uses _db"""
return self._db
def _load_cvdump(self): def _load_cvdump(self):
logger.info("Parsing %s ...", self.pdb_file) logger.info("Parsing %s ...", self.pdb_file)
self.cv = ( self.cv = (
@ -745,6 +740,9 @@ def get_vtables(self) -> List[MatchInfo]:
def get_variables(self) -> List[MatchInfo]: def get_variables(self) -> List[MatchInfo]:
return self._db.get_matches_by_type(SymbolType.DATA) return self._db.get_matches_by_type(SymbolType.DATA)
def get_match_options(self, addr: int) -> Optional[dict[str, Any]]:
return self._db.get_match_options(addr)
def compare_address(self, addr: int) -> Optional[DiffReport]: def compare_address(self, addr: int) -> Optional[DiffReport]:
match = self._db.get_one_match(addr) match = self._db.get_one_match(addr)
if match is None: if match is None: