Mercurial > lcfOS
diff python/outstream.py @ 249:e41e4109addd
Added current position arrow
author | Windel Bouwman |
---|---|
date | Fri, 26 Jul 2013 20:26:05 +0200 |
parents | 81752b0f85a5 |
children | f5fba5b554d7 |
line wrap: on
line diff
--- a/python/outstream.py Fri Jul 26 16:46:02 2013 +0200 +++ b/python/outstream.py Fri Jul 26 20:26:05 2013 +0200 @@ -1,5 +1,5 @@ import binascii -from target import Instruction, Label +from target import Instruction, Label, DebugInfo """ The output stream is a stream of instructions that can be output @@ -24,6 +24,10 @@ d.extend(insword) return bytes(d) + def debugInfos(self): + di = [i for i in self.instructions if isinstance(i, DebugInfo)] + return di + class OutputStream: def __init__(self): self.sections = {} @@ -35,8 +39,7 @@ def selectSection(self, s): self.currentSection = s - if not s in self.sections: - self.sections[s] = Section() + self.getSection(s) def getLabelAddress(self, lname): assert isinstance(lname, str) @@ -47,6 +50,11 @@ return i.address return 0 + def getSection(self, name): + if not name in self.sections: + self.sections[name] = Section() + return self.sections[name] + def backpatch(self): """ Fixup references to other parts in the assembler """ for s in self.sections: