From patchwork Wed Apr 24 14:27:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Doron X-Patchwork-Id: 1090182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KlXdNMYf"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44q3861T4fz9sDn for ; Thu, 25 Apr 2019 00:47:50 +1000 (AEST) Received: from localhost ([127.0.0.1]:42839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJJBc-0007ch-2o for incoming@patchwork.ozlabs.org; Wed, 24 Apr 2019 10:47:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIzL-0004gM-CJ for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:35:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJIs7-0000XR-Mk for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:27:40 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:36893) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJIs7-0000Ve-G9 for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:27:39 -0400 Received: by mail-wr1-x442.google.com with SMTP id t17so13737680wrr.4 for ; Wed, 24 Apr 2019 07:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4wej51JV8dBZGzGZkifd8KMFqFKiLMpf+q218fNFW6A=; b=KlXdNMYfWBwU7pBg6wIbsnwBfS/5b+VqDP5ceLuI74mX+vb85YiQid8C379vRv9JQ9 cfENSiHBz7/M/Jd/Eiv+ZZPkflq7cIfktNkMDT9+a34h/h6iZfIwposCx280JkwRDIQD tqcQAxgaTMHaTASErQp6siHkLmGHD3BKtz9mpbzkX6gsmZ9DJX2EFXBY/yMeE1L8tKBc 5GpD93losnD8aIR5WcbZzddIGSebqGzniOm6PofXd+xcB9ngZhbSv8esfZ30p8ABIzcU eF9ve36vNganMCgmeBIxQwbrWHXONtSaA91QTBoGYp+u6x4qXCO30x4Yy8t6t/ndTZIp KDRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4wej51JV8dBZGzGZkifd8KMFqFKiLMpf+q218fNFW6A=; b=HdsJzse9kP1ylB2HDGf/lOiSUFPR8Poi4oShHc2jNVXupxRzarv+0d3MIhYZo5yfSu 9zhYxN/8WcSU+tAVyap10LI1kjez9mHHX0hly45tZ2LOz2aZz7Ov0aJA6NT+WPhqvSjT CANz8MBkt26a4QxKm1rdWlAbIrXN3GHdvGW+yxJDY6h+4C/nD5SWLqT4tnuVXSODNyIl REEN0nsWJJnbcGUOJWG5V/cZbf6quM4K7AHr6WFn93oHdVbyUH5lsAUipuXZuwjnKN/L uEEfK7in2CpWlUzh73ImJ8xKp9fQO9uOESvk5K8ma49po2oS0AXzgUonFo+GOkR6A9VE 39Bg== X-Gm-Message-State: APjAAAV1kmGXULsZlHsM1qHWBW0dQxzfvCMgItbe+Z/ztXF7ybOc3jAU LZEJ8v+zxXf+5mIhENj1NJ6AGn4Q X-Google-Smtp-Source: APXvYqyqe8R3mQrkopp+9RqaMAEvsbdk7ERAI6r0kobolSrZDGfynXI8d9AFSihpw1zKqvf7OePmsQ== X-Received: by 2002:adf:db0c:: with SMTP id s12mr22773849wri.184.1556116057889; Wed, 24 Apr 2019 07:27:37 -0700 (PDT) Received: from linux.local ([31.154.166.148]) by smtp.gmail.com with ESMTPSA id q7sm5518041wmc.11.2019.04.24.07.27.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 07:27:36 -0700 (PDT) From: arilou@gmail.com To: qemu-devel@nongnu.org Date: Wed, 24 Apr 2019 17:27:02 +0300 Message-Id: <20190424142714.28460-8-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190424142714.28460-1-arilou@gmail.com> References: <20190424142714.28460-1-arilou@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v3 08/20] gdbstub: Implement remove breakpoint (z pkt) with new infra 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: Jon Doron Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron --- gdbstub.c | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 67cb140031..d0b27da518 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1627,6 +1627,29 @@ static void handle_insert_bp(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "E22"); } +static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int res; + + if (gdb_ctx->num_params < 3) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + res = gdb_breakpoint_remove(gdb_ctx->params[1].val_ull, + gdb_ctx->params[2].val_ull, + gdb_ctx->params[0].val_ul); + if (res >= 0) { + put_packet(gdb_ctx->s, "OK"); + return; + } else if (res == -ENOSYS) { + put_packet(gdb_ctx->s, ""); + return; + } + + put_packet(gdb_ctx->s, "E22"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1892,23 +1915,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'z': - type = strtoul(p, (char **)&p, 16); - if (*p == ',') - p++; - addr = strtoull(p, (char **)&p, 16); - if (*p == ',') - p++; - len = strtoull(p, (char **)&p, 16); - if (ch == 'Z') - res = gdb_breakpoint_insert(addr, len, type); - else - res = gdb_breakpoint_remove(addr, len, type); - if (res >= 0) - put_packet(s, "OK"); - else if (res == -ENOSYS) - put_packet(s, ""); - else - put_packet(s, "E22"); + { + static GdbCmdParseEntry remove_bp_cmd_desc = { + .handler = handle_remove_bp, + .cmd = "z", + .cmd_startswith = 1, + .schema = "l?L?L0" + }; + process_string_cmd(s, NULL, line_buf, &remove_bp_cmd_desc, 1); + } break; case 'H': {