summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2017-07-09 14:38:45 +0200
committerLars-Dominik Braun <lars@6xq.net>2017-07-09 14:39:08 +0200
commit5518d226faa8bf8f624cdb7e804927d6c13453e7 (patch)
tree1ed9b15cf2af088f333d1c43c077c8416f905860
parentc108c6216eedd5ffa7b379ed1318ed47b13c687a (diff)
downloadeumel-tools-5518d226faa8bf8f624cdb7e804927d6c13453e7.zip
eumel-tools-5518d226faa8bf8f624cdb7e804927d6c13453e7.tar.gz
eumel-tools-5518d226faa8bf8f624cdb7e804927d6c13453e7.tar.bz2
convertFileDs: Catch unresolved heap references
-rwxr-xr-xconvertFileDs.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/convertFileDs.py b/convertFileDs.py
index c4037db..89e0cab 100755
--- a/convertFileDs.py
+++ b/convertFileDs.py
@@ -9,7 +9,7 @@ datastructure here. See EUMEL packet “file handling”.
import struct, copy
from collections import namedtuple
-from eumel import Dataspace, DataspaceTypeMismatch
+from eumel import Dataspace, DataspaceTypeMismatch, HeapReferenceUnresolved
Segment = namedtuple ('Segment', ['succ', 'pred', 'end'])
Sequence = namedtuple ('Sequence', ['index', 'segmentbegin', 'segmentend', 'lineno', 'lines'])
@@ -127,7 +127,11 @@ class FileDataspace (Dataspace):
visited.add (chain.pos)
r = chain.atom
- lbytes = bytes (r.line)
+ try:
+ lbytes = bytes (r.line)
+ except HeapReferenceUnresolved as e:
+ lbytes = b''
+ logging.warning ('heap reference unresolved at line {}: {}'.format (len (lines)+1, e))
lbytesStripped = lbytes.rstrip (b'\xff')
if len (lbytes) != len (lbytesStripped):
logging.warning ('Line {} length incorrect. Is {}, should be {}, fixing. {}'.format (chain.lineno, r.line.length, len (lbytesStripped), lbytes))