Files
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

39 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""Export fixed crash metadata only; never stack/register/heap contents.
The report's <unknown> frames can still be assigned by its module ranges.
"""
import argparse,json,re
from pathlib import Path
def analyze(path):
path=Path(path)
if path.stat().st_size>2*1024*1024:raise RuntimeError('Crash text exceeds bounded diagnostic input')
data=path.read_text(errors='replace')
block=re.search(r'<Exception\.Summary:>(.*?)(?:</Exception\.Summary>|\n<)',data,re.S)
summary=block.group(1) if block else ''
modules=[]
for base,size,name,pdb in re.findall(r'DBG-MODULE<([0-9a-fA-F]{16})\s+([0-9a-fA-F]+)\s+"([^"\r\n]+)"\s+"([^"\r\n]*)"',data):
modules.append((int(base,16),int(size,16),Path(name.replace('\\','/')).name,Path(pdb.replace('\\','/')).name))
frames=[]
for address in re.findall(r'DBG-ADDR<([0-9a-fA-F]{16})>',summary)[:12]:
value=int(address,16);row={'address':hex(value),'module':'unresolved'}
for base,size,name,pdb in modules:
if base<=value<base+size:row.update(module=name,rva=hex(value-base),pdb_reference=pdb);break
frames.append(row)
code='0xC0000005' if 'ACCESS_VIOLATION' in summary else None
if not code:
match=re.search(r'0x([0-9a-fA-F]{8})\s+\(',summary)
if match:code='0x'+match.group(1).upper()
instruction=re.search(r'(?:instruction at\s+"|\bat\s+)(?:0x)?([0-9a-fA-F]{16})',summary)
fault_location=None
if instruction:
value=int(instruction.group(1),16)
for base,size,name,pdb in modules:
if base<=value<base+size:
fault_location={'module':name,'rva':hex(value-base),'pdb_reference':pdb};break
return {'report':path.name,'exception_code':code,'instruction':hex(int(instruction.group(1),16)) if instruction else None,
'fault_location':fault_location,
'frames':frames,'raw_summary_exported':False,'memory_or_register_data_exported':False}
if __name__=='__main__':
parser=argparse.ArgumentParser();parser.add_argument('reports',type=Path,nargs='+');args=parser.parse_args()
print(json.dumps([analyze(p) for p in args.reports],indent=2))