|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -# Copyright (C) 2009, 2012-2013, 2015 Rocky Bernstein |
| 2 | +# Copyright (C) 2009, 2012-2013, 2015, 2020 Rocky Bernstein |
3 | 3 | # |
4 | 4 | # This program is free software: you can redistribute it and/or modify |
5 | 5 | # it under the terms of the GNU General Public License as published by |
@@ -46,38 +46,40 @@ class SetEvents(Mbase_subcmd.DebuggerSubcommand): |
46 | 46 | `set trace`, `show trace`, and `show events`. `help step` lists event names. |
47 | 47 | """ |
48 | 48 |
|
49 | | - in_list = True |
50 | | - min_abbrev = len('ev') |
| 49 | + in_list = True |
| 50 | + min_args = 0 |
| 51 | + min_abbrev = len("ev") |
51 | 52 | short_help = "Set execution-tracing event set" |
52 | 53 |
|
53 | 54 | def run(self, args): |
54 | | - valid_args = tracer.ALL_EVENT_NAMES + ('all',) |
| 55 | + valid_args = tracer.ALL_EVENT_NAMES + ("all",) |
55 | 56 | eventset = [] |
56 | 57 | for arg in args: |
57 | 58 | if arg not in valid_args: |
58 | | - self.errmsg('set events: Invalid argument %s ignored.' % arg) |
| 59 | + self.errmsg("set events: Invalid argument %s ignored." % arg) |
59 | 60 | continue |
60 | 61 | if arg in tracer.ALL_EVENTS: |
61 | 62 | eventset += [arg] |
62 | | - elif 'all' == arg: |
| 63 | + elif "all" == arg: |
63 | 64 | eventset += tracer.ALL_EVENTS |
64 | 65 | pass |
65 | 66 | if [] != eventset: |
66 | | - self.debugger.settings['printset'] = frozenset(eventset) |
| 67 | + self.debugger.settings["printset"] = frozenset(eventset) |
67 | 68 | pass |
68 | 69 | return |
69 | 70 |
|
70 | 71 | pass |
71 | 72 |
|
72 | | -if __name__ == '__main__': |
| 73 | + |
| 74 | +if __name__ == "__main__": |
73 | 75 | from trepan.processor.command import mock, set as Mset |
| 76 | + |
74 | 77 | d, cp = mock.dbg_setup() |
75 | 78 | s = Mset.SetCommand(cp) |
76 | 79 | sub = SetEvents(s) |
77 | | - sub.name = 'events' |
78 | | - for args in (['line'], ['bogus'], |
79 | | - ['call', 'return']): |
| 80 | + sub.name = "events" |
| 81 | + for args in (["line"], ["bogus"], ["call", "return"]): |
80 | 82 | sub.run(args) |
81 | | - print(d.settings['printset']) |
| 83 | + print(d.settings["printset"]) |
82 | 84 | pass |
83 | 85 | pass |
0 commit comments