fix(traceback): 通过 .vpi 内容定位 traceback 模块 SHA1
sig_files/source_module_sig_files 的值是 .vpi 路径,basename 不含 traceback;改为读取前 512 字节匹配 'Module: traceback'。
This commit is contained in:
1 parent
3da522a549
commit
1f03fc1977
1 file changed
+12
-4
@@ -2358,13 +2358,21 @@ class Phase2Translator:
|
||||
# 直接调用它(不依赖 .ctors/.init_array,避免 MinGW 下 .ctors.65534 不执行)。
|
||||
if self.traceback_enabled:
|
||||
_tb_sha1: str | None = None
|
||||
for _src_map in (getattr(self, '_shared_source_module_sig_files', {}), self.sig_files):
|
||||
for _k, _p in _src_map.items():
|
||||
for _k, _p in self.sig_files.items():
|
||||
try:
|
||||
if 'traceback' in os.path.basename(_p):
|
||||
_tb_sha1 = _k
|
||||
break
|
||||
if _tb_sha1:
|
||||
break
|
||||
if 'Module: traceback' in _ReadTextCached(_p)[:512]:
|
||||
_tb_sha1 = _k
|
||||
break
|
||||
except Exception:
|
||||
continue
|
||||
if _tb_sha1 is None:
|
||||
for _k, _p in getattr(self, '_shared_source_module_sig_files', {}).items():
|
||||
if 'traceback' in str(_p):
|
||||
_tb_sha1 = _k
|
||||
break
|
||||
if _tb_sha1 is not None:
|
||||
trans.translator.TracebackInstallSymbol = f'{_tb_sha1}.Install'
|
||||
trans.SliceLevel = self.slice_level
|
||||
|
||||
Reference in new issue
Block a user