Skip to content

Commit 2c5c202

Browse files
committed
Squelch traceback on break on unparsable file
1 parent 0e8efc2 commit 2c5c202

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

trepan/processor/cmdbreak.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright (C) 2009, 2010, 2015, 2017-2018 Rocky Bernstein
3+
# Copyright (C) 2009, 2010, 2015, 2017-2018, 2022 Rocky Bernstein
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
66
# the Free Software Foundation, either version 3 of the License, or
@@ -36,7 +36,11 @@ def set_break(cmd_obj, func, filename, lineno, condition, temporary,
3636
filename = cmd_obj.core.canonic(filename)
3737
pass
3838
if func is None:
39-
ok_linenos = pyficache.trace_line_numbers(filename)
39+
try:
40+
ok_linenos = pyficache.trace_line_numbers(filename)
41+
except:
42+
ok_linenos = None
43+
4044
if not ok_linenos or lineno not in ok_linenos:
4145
part1 = ('File %s' % cmd_obj.core.filename(filename))
4246
msg = Mmisc.wrapped_lines(part1,
@@ -95,7 +99,12 @@ def parse_break_cmd(proc, args):
9599
location = bp_expr.location
96100
condition = bp_expr.condition
97101

98-
location = resolve_location(proc, location)
102+
try:
103+
location = resolve_location(proc, location)
104+
except ValueError as e:
105+
proc.errmsg(str(e))
106+
return INVALID_PARSE_BREAK
107+
99108
if location:
100109
return location.method, location.path, location.line_number, condition
101110
else:

0 commit comments

Comments
 (0)