diff options
-rwxr-xr-x | gdb-bt-reformat | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gdb-bt-reformat b/gdb-bt-reformat index 28461f5..2935ada 100755 --- a/gdb-bt-reformat +++ b/gdb-bt-reformat @@ -54,7 +54,7 @@ class BtLine(object): self._found = RE_BT.search(self._line) if self._found: for k, v in self._found.groupdict().iteritems(): - #print "\t{0}: {1}".format(k, v) + #print >>stderr, "\t{0}: {1}".format(k, v) setattr(self, k, v if v is not None else '') else: raise BtLineError(fill(line.strip(), initial_indent=self._space * 2, @@ -75,14 +75,20 @@ class BtLine(object): def main(**kwargs): line = '__dummy__' firstline = True - while line: + cnt = 1 + while line != '': + cnt += 1 line = stdin.readline() + if not line.strip(): + # unfortunately, textwrap.fill would alias, e.g., '\n' and '' cases + print line + continue try: btline = BtLine(line, **kwargs) print ('' if firstline else '\n') + str(btline) except BtLineError as ble: line = str(ble) - #print >>stderr, "bad line:", line + print >>stderr, ">> bad line:%i" % cnt print line finally: firstline = False |