mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-27 20:57:49 -05:00
Merge branch 'pret:main' into main
This commit is contained in:
@@ -114,5 +114,6 @@ def read_pmdsky_debug_symbols() -> Dict[str, Dict[str, Dict[int, SymbolDetails]]
|
||||
for file in os.listdir(overlay_folder):
|
||||
if file.endswith('.yml'):
|
||||
read_yaml_symbols(os.path.join(overlay_name, file), str(i))
|
||||
read_yaml_symbols('ram.yml', 'ram')
|
||||
|
||||
return pmdsky_debug_symbols
|
||||
|
||||
@@ -39,6 +39,10 @@ replaced_symbols = set()
|
||||
for language, pmdsky_debug_language_symbols in pmdsky_debug_symbols.items():
|
||||
xmap_language_symbols = xmap_symbols[language]
|
||||
for section_name, pmdsky_debug_section in pmdsky_debug_language_symbols.items():
|
||||
if section_name == 'ram':
|
||||
# We can't distinguish between different types of RAM symbols.
|
||||
# E.g., they could be in the BSS, heap, etc.
|
||||
continue
|
||||
if section_name in xmap_language_symbols:
|
||||
xmap_section = xmap_language_symbols[section_name]
|
||||
else:
|
||||
|
||||
@@ -38,7 +38,7 @@ def find_symbol_in_header(symbol_name: str, is_data: bool, header_contents: List
|
||||
return i
|
||||
return None
|
||||
|
||||
def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, yaml_manager: YamlManager):
|
||||
def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, yaml_manager: YamlManager, pmdsky_debug_section: Dict[int, SymbolDetails]):
|
||||
if default_symbol_name.match(symbol.name):
|
||||
return
|
||||
|
||||
@@ -70,6 +70,8 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, yaml_ma
|
||||
base_symbol_path = 'arm7.yml'
|
||||
elif section_name == 'ITCM':
|
||||
base_symbol_path = os.path.join('arm9', 'itcm.yml')
|
||||
elif section_name == 'ram':
|
||||
base_symbol_path = 'ram.yml'
|
||||
else:
|
||||
base_symbol_path = f'overlay{int(section_name):02d}.yml'
|
||||
|
||||
@@ -265,4 +267,4 @@ with YamlManager() as yaml_manager:
|
||||
pmdsky_debug_section = {}
|
||||
|
||||
for address, symbol in xmap_section.items():
|
||||
sync_xmap_symbol(address, symbol, language, yaml_manager)
|
||||
sync_xmap_symbol(address, symbol, language, yaml_manager, pmdsky_debug_section)
|
||||
|
||||
@@ -56,6 +56,9 @@ def read_xmap_symbols_for_language(language: str) -> Dict[str, Dict[int, SymbolD
|
||||
for line in xmap_lines:
|
||||
if line.startswith(SECTION_START):
|
||||
section_name = line[len(SECTION_START) : -1]
|
||||
# The corresponding BSS sections can contain RAM data symbols
|
||||
is_ram = section_name.endswith('.bss')
|
||||
section_name = section_name.removesuffix('.bss')
|
||||
if section_name in overlay_names:
|
||||
current_section = str(overlay_names[section_name])
|
||||
elif section_name == 'main' or section_name == 'ITCM' or section_name == 'arm7':
|
||||
@@ -64,10 +67,12 @@ def read_xmap_symbols_for_language(language: str) -> Dict[str, Dict[int, SymbolD
|
||||
current_section = 'arm7'
|
||||
else:
|
||||
current_section = None
|
||||
if current_section is not None and is_ram:
|
||||
current_section = 'ram'
|
||||
if current_section is not None and current_section not in xmap_symbols:
|
||||
xmap_symbols[current_section]: Dict[str, int] = {}
|
||||
|
||||
elif current_section is not None and line.startswith(' ') and ('.text' in line or '.data' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS:
|
||||
elif current_section is not None and line.startswith(' ') and ('.text' in line or '.data' in line or '.bss' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS:
|
||||
symbol_split = line[28:-1].split('\t')
|
||||
symbol_name = symbol_split[0]
|
||||
symbol_address = int(line[2:10], 16)
|
||||
|
||||
Reference in New Issue
Block a user