OpenCores
URL https://opencores.org/ocsvn/s80186/s80186/trunk

Subversion Repositories s80186

[/] [s80186/] [trunk/] [scripts/] [disassemble-trace] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jamieiles
#!/usr/bin/env python
2
 
3
# Copyright Jamie Iles, 2017
4
#
5
# This file is part of s80x86.
6
#
7
# s80x86 is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# s80x86 is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with s80x86.  If not, see .
19
 
20
import distorm3
21
import re
22
import sys
23
 
24
LOC_RE = re.compile(r'\[(?P[0-9a-f]+):(?P[0-9a-f]+)\]')
25
 
26
with open(sys.argv[1]) as log:
27
    for line in log:
28
        m = LOC_RE.match(line)
29
        if not m:
30
            print line,
31
            continue
32
 
33
        try:
34
            loc, instr_bytes = line.split(' ', 1)
35
        except Exception:
36
            print line,
37
            continue
38
 
39
        ip = int(m.groupdict()['IP'], 16)
40
        hexbuf = instr_bytes.strip().replace(' ', '').decode('hex')
41
        _, __,instruction, ___ = distorm3.Decode(ip, hexbuf, distorm3.Decode16Bits)[0]
42
        print loc, instruction.lower()

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.