Skip to content
Snippets Groups Projects
Commit 517117c2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "linux-ramdump-parser-v2: Catch parsing exceptions"

parents 26b59ebe a7d3bcd8
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
import sys import sys
import traceback
from contextlib import contextmanager from contextlib import contextmanager
out_file = None out_file = None
...@@ -30,6 +31,11 @@ def print_out_str(string): ...@@ -30,6 +31,11 @@ def print_out_str(string):
else: else:
out_file.write((string + '\n').encode('ascii', 'ignore')) out_file.write((string + '\n').encode('ascii', 'ignore'))
def print_out_exception():
if out_file is None:
traceback.print_exc(file=sys.stdout)
else:
traceback.print_exc(file=out_file)
@contextmanager @contextmanager
def print_out_section(header): def print_out_section(header):
......
...@@ -25,7 +25,7 @@ from optparse import OptionParser ...@@ -25,7 +25,7 @@ from optparse import OptionParser
import parser_util import parser_util
from ramdump import RamDump from ramdump import RamDump
from print_out import print_out_str, set_outfile, print_out_section from print_out import print_out_str, set_outfile, print_out_section, print_out_exception
# Please update version when something is changed!' # Please update version when something is changed!'
VERSION = '2.0' VERSION = '2.0'
...@@ -306,7 +306,11 @@ if __name__ == '__main__': ...@@ -306,7 +306,11 @@ if __name__ == '__main__':
# p.cls.__name__ attribute. # p.cls.__name__ attribute.
if getattr(options, p.cls.__name__) or (options.everything and not p.optional): if getattr(options, p.cls.__name__) or (options.everything and not p.optional):
with print_out_section(p.cls.__name__): with print_out_section(p.cls.__name__):
p.cls(dump).parse() try:
p.cls(dump).parse()
except:
print_out_str('!!! Exception while running {0}'.format(p.cls.__name__))
print_out_exception()
if options.t32launcher or options.everything: if options.t32launcher or options.everything:
dump.create_t32_launcher() dump.create_t32_launcher()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment