diff options
author | Fam Zheng <famz@redhat.com> | 2013-11-20 10:01:54 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-11-29 13:40:37 +0100 |
commit | 4cc70e933731ebf4309e1f1ce90973a0de04f28f (patch) | |
tree | 254369a947f01aa34c7c5e1e766ded66919d7b4f /block | |
parent | 5b43dbb699599cdb9f75a624cb28d4f709ad2cdf (diff) |
blkdebug: add "remove_break" command
This adds "remove_break" command which is the reverse of blkdebug
command "break": it removes all breakpoints with given tag and resumes
all the requests.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blkdebug.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c index 16d2b91ac9..37cf028545 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -605,6 +605,31 @@ static int blkdebug_debug_resume(BlockDriverState *bs, const char *tag) return -ENOENT; } +static int blkdebug_debug_remove_breakpoint(BlockDriverState *bs, + const char *tag) +{ + BDRVBlkdebugState *s = bs->opaque; + BlkdebugSuspendedReq *r; + BlkdebugRule *rule, *next; + int i, ret = -ENOENT; + + for (i = 0; i < BLKDBG_EVENT_MAX; i++) { + QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) { + if (rule->action == ACTION_SUSPEND && + !strcmp(rule->options.suspend.tag, tag)) { + remove_rule(rule); + ret = 0; + } + } + } + QLIST_FOREACH(r, &s->suspended_reqs, next) { + if (!strcmp(r->tag, tag)) { + qemu_coroutine_enter(r->co, NULL); + ret = 0; + } + } + return ret; +} static bool blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag) { @@ -639,6 +664,8 @@ static BlockDriver bdrv_blkdebug = { .bdrv_debug_event = blkdebug_debug_event, .bdrv_debug_breakpoint = blkdebug_debug_breakpoint, + .bdrv_debug_remove_breakpoint + = blkdebug_debug_remove_breakpoint, .bdrv_debug_resume = blkdebug_debug_resume, .bdrv_debug_is_suspended = blkdebug_debug_is_suspended, }; |