summaryrefslogtreecommitdiffstats
path: root/tools/kvm
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2018-02-05 13:59:58 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-24 01:43:41 +0100
commit1cd8bfb1ed9962be6d80d5020508922aa93653ac (patch)
tree8ed58a2c8f4d4e65c979cdcdb6475ae7b16dad04 /tools/kvm
parenttools/kvm_stat: fix crash when filtering out all non-child trace events (diff)
downloadlinux-1cd8bfb1ed9962be6d80d5020508922aa93653ac.tar.xz
linux-1cd8bfb1ed9962be6d80d5020508922aa93653ac.zip
tools/kvm_stat: print error on invalid regex
Entering an invalid regular expression did not produce any indication of an error so far. To reproduce, press 'f' and enter 'foo(' (with an unescaped bracket). Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/kvm')
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 4e0f282c5289..08f842238c32 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1176,6 +1176,7 @@ class Tui(object):
Asks for a valid regex and sets the fields filter accordingly.
"""
+ msg = ''
while True:
self.screen.erase()
self.screen.addstr(0, 0,
@@ -1184,6 +1185,7 @@ class Tui(object):
self.screen.addstr(2, 0,
"Current regex: {0}"
.format(self.stats.fields_filter))
+ self.screen.addstr(5, 0, msg)
self.screen.addstr(3, 0, "New regex: ")
curses.echo()
regex = self.screen.getstr().decode(ENCODING)
@@ -1198,6 +1200,7 @@ class Tui(object):
self.refresh_header()
return
except re.error:
+ msg = '"' + regex + '": Not a valid regular expression'
continue
def show_vm_selection_by_pid(self):