From nobody Tue Feb 10 17:34:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506425733871217.6448815454778; Tue, 26 Sep 2017 04:35:33 -0700 (PDT) Received: from localhost ([::1]:46837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwo9B-0004zw-4z for importer@patchew.org; Tue, 26 Sep 2017 07:35:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnhv-0005ce-Ou for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwnhp-0001Xh-Sq for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:19 -0400 Received: from mail.ispras.ru ([83.149.199.45]:52292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnhp-0001XR-LX for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:13 -0400 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 039685400F1; Tue, 26 Sep 2017 14:07:13 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 14:07:11 +0300 Message-ID: <150642403148.3900.7920017116044093005.stgit@Misha-PC.lan02.inno> In-Reply-To: <150642384156.3900.3326424823772221077.stgit@Misha-PC.lan02.inno> References: <150642384156.3900.3326424823772221077.stgit@Misha-PC.lan02.inno> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH 33/43] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sw@weilnetz.de, lprosek@redhat.com, dovgaluk@ispras.ru, rkagan@virtuozzo.com, pbonzini@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- windbgstub-utils.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 60 insertions(+) diff --git a/windbgstub-utils.c b/windbgstub-utils.c index e33789725e..05caf98c0c 100755 --- a/windbgstub-utils.c +++ b/windbgstub-utils.c @@ -294,11 +294,71 @@ static KDData *kd; =20 static int windbg_hw_breakpoint_insert(CPUState *cpu, int index) { + CPUArchState *env =3D cpu->env_ptr; + + if (!IS_BP_ENABLED(env->dr[7], index)) { + return 0; + } + + target_ulong addr =3D env->dr[index]; + int type =3D BP_TYPE(env->dr[7], index); + int len =3D BP_LEN(env->dr[7], index); + int err =3D 0; + + switch (type) { + case DR7_TYPE_DATA_WR: + err =3D cpu_watchpoint_insert(cpu, addr, len, BP_MEM_WRITE | BP_GD= B, + &env->cpu_watchpoint[index]); + break; + case DR7_TYPE_DATA_RW: + err =3D cpu_watchpoint_insert(cpu, addr, len, BP_MEM_ACCESS | BP_G= DB, + &env->cpu_watchpoint[index]); + break; + case DR7_TYPE_BP_INST: + err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, + &env->cpu_breakpoint[index]); + break; + case DR7_TYPE_IO_RW: + return HF_IOBPT_MASK; + default: + return 0; + } + + if (!err) { + WINDBG_DEBUG("hw_breakpoint_insert: index(%d), " FMT_ADDR, + index, addr); + } else { + env->cpu_breakpoint[index] =3D NULL; + WINDBG_ERROR("hw_breakpoint_insert: index(%d), " FMT_ADDR ", " FMT= _ERR, + index, addr, err); + } return 0; } =20 static int windbg_hw_breakpoint_remove(CPUState *cpu, int index) { + CPUArchState *env =3D cpu->env_ptr; + int type =3D BP_TYPE(env->dr[7], index); + + switch (type) { + case DR7_TYPE_BP_INST: + if (env->cpu_breakpoint[index]) { + cpu_breakpoint_remove_by_ref(cpu, env->cpu_breakpoint[index]); + } + break; + case DR7_TYPE_DATA_WR: + case DR7_TYPE_DATA_RW: + if (env->cpu_watchpoint[index]) { + cpu_watchpoint_remove_by_ref(cpu, env->cpu_watchpoint[index]); + } + break; + default: + return 0; + } + + env->cpu_breakpoint[index] =3D NULL; + WINDBG_DEBUG("hw_breakpoint_remove: index(%d), " FMT_ADDR, + index, env->dr[index]); return 0; } =20