From patchwork Wed Mar 6 14:40:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 778294 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:47:b0:33e:474f:8c56 with SMTP id k7csp324635wrx; Wed, 6 Mar 2024 06:41:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXGotQsuimF2FaE5CUto4Qeyt3k4OUWYEvTVZoZ9o+0y1Kxd8fy5kV2i/qejVnB+vMB/GYlGPPrZVepx4M+cd72 X-Google-Smtp-Source: AGHT+IFJLAzJ98aEK8+x50cgTV96M9fx8bOsNFuB4I7EHDPXNwEut2pI1YCWrjye2ja/5Uo5awU8 X-Received: by 2002:a05:622a:148b:b0:42e:ebc5:519c with SMTP id t11-20020a05622a148b00b0042eebc5519cmr5681563qtx.37.1709736076104; Wed, 06 Mar 2024 06:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709736076; cv=none; d=google.com; s=arc-20160816; b=Vd0o4Dq5OFs2jwUCOepyrP+URVNBMggiLjV1qTOa4C0rmTSSf9cNIMmokNSSwaK5BU ulswS3pEiAEtrqj5odjW2KaSc34Kmrz0nlveNtc21saqD5P52HqZmCEN4EJkpC/jUEi9 +/guE7wP5OmTzp8kQbuSDSJq8b2PpdRDYM4XErRAM6NySuvE2n4d1FI6p2aYTzZ64gWU /56hE0XtloqVPCUBUyqs5ggJ5jDTeJZFc2RNzvxnt8/lMtglhdRGtRjOYSe3u8Mc+gep y4r236lYNXrJmkgdrbaFIEY9YlbD4PQznozHWQRU5kg71AlM92GSAa7mei4BFih/SOt7 RYQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nviOiWVWbJ3XjGVXW4/AZHv8DEOjXGh4DiERqDJEuQ4=; fh=U8v/Dtss/m4oPeJtZ17DHKEvZGyePY/+mu3CqtBX2ks=; b=wiuXlzJ5yukO4ULBFuKvncpIL+TjOUZU0CzevS2JIDr6rermnmMtWm86gGf0CNjFW6 iVG3iz2F5Eo2tY5V46Lio97Fw4mSu0vBx2zF9ZmOdOq3j+yVC/HNyFyVPpMSYobcm6t9 1RQwdHDS5XkBLSRig/xbOzsHTfsd0R56dsxprQIkzb/5Qw5tH9URQXMZIXE8ZtS3r1Q+ /q72snTMuFgHBN8u0Zn91TYA7TsfomkECT6a4xW2RODrdUF7MI21L1g23ueRSInO1Exu m5tW13qJc7iEkL9Z1CnOvOCk5IgeGYQUZoFWciQ2Hbz0o4SBSahwjZ9OjVkzyI5EyR7S KDsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lorAkO2b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 11-20020ad45b8b000000b00690047c614esi14737458qvp.593.2024.03.06.06.41.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2024 06:41:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lorAkO2b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhsS7-0007co-Jk; Wed, 06 Mar 2024 09:41:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhsS3-0007O6-BL for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:40:59 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhsRx-0001Tt-9C for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:40:59 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso614845f8f.0 for ; Wed, 06 Mar 2024 06:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709736048; x=1710340848; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nviOiWVWbJ3XjGVXW4/AZHv8DEOjXGh4DiERqDJEuQ4=; b=lorAkO2b7j/zbXYiVsPKjOt3PZXMCY+mSZ7BULkeJkjXnr97ytVWR9k3tiv7VtUKqX sZ++j+lK/k0d9CStwhex7Ow2OPsYepXL+UaPPdMg0VVgqYf6WE/lSECTp1u4JK1XjuE9 ctVaYQOh4+W33IEODprBax72Wo+297vD4l39O2TPRW/6Jub0xx/BzBd+ifldgym39CHF P4e3L2MBs17/3FhY8Jbm8d2AKTP7fhq4DRZDOi/JUA1eOQXosmFO8ClY6QoScehRwZz4 l3lXFtVyi2dYoNAiNTZyTWXHNLULFnLkbXy68IbeZE2r6HD0qDrMVOg5+KGJp2Qq9td6 ZGqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709736048; x=1710340848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nviOiWVWbJ3XjGVXW4/AZHv8DEOjXGh4DiERqDJEuQ4=; b=mPotsysm1R9R2zs0v5zqc85wqpCJ6EV67nyZa8Bb8L6HCBnXF+zMvZoce8LiSf3lw8 i4VWdhkBGfMcxMgI+PT1Uq4c7eG3WAGj2ZQWbQL9soT1m1FIpPAE+ePPyGrMED3w+QZI aOhMeKZaTU0JPxkMDE3Ns5lX1xSTW5Kl0+xEGBfqlRGikA9o9Dw9ZG7m4f0yNi2L+PhK gSVX6hSe3hOBKRBXEf06ytLDYB7YWj425CRi14hL2iY03w4qZ+btcMyfEeRyzLCHCcI0 7k7o48RZFDVku3Mo0Y2eCxt61tZWWdNuuih9i4fqq+Ilzvfw3u/G1TbHxd8RjQvTurv2 /aUg== X-Gm-Message-State: AOJu0YxUcNEevbfsa34HnBloI9XTxi72/OFkpu5X96dH2Lnq4S+q5w9R ngMW5S9WbQzlmtHSRKaXC84Z9IxaFbISZpAig6hSPzMtWmnKj7x17kSpyaqVltKzkZ+1W9aXrpe i X-Received: by 2002:adf:8902:0:b0:33d:69c1:e7af with SMTP id s2-20020adf8902000000b0033d69c1e7afmr4427895wrs.9.1709736047766; Wed, 06 Mar 2024 06:40:47 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bj1-20020a0560001e0100b0033e48db23bdsm4998270wrb.100.2024.03.06.06.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 06:40:45 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A1D265F9CF; Wed, 6 Mar 2024 14:40:42 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PULL 11/29] gdbstub: Introduce gdb_handle_detach_user() Date: Wed, 6 Mar 2024 14:40:23 +0000 Message-Id: <20240306144041.3787188-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306144041.3787188-1-alex.bennee@linaro.org> References: <20240306144041.3787188-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich The upcoming follow-fork-mode child support needs to perform certain actions when GDB detaches from the stopped parent or the stopped child. Introduce a user-specific hook for this. Signed-off-by: Ilya Leoshkevich Message-Id: <20240219141628.246823-11-iii@linux.ibm.com> Signed-off-by: Alex Bennée Message-Id: <20240305121005.3528075-12-alex.bennee@linaro.org> diff --git a/gdbstub/internals.h b/gdbstub/internals.h index b4905c7181a..b4724598384 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -198,6 +198,7 @@ void gdb_handle_query_xfer_exec_file(GArray *params, void *user_ctx); /* user */ void gdb_handle_set_catch_syscalls(GArray *params, void *user_ctx); /* user */ void gdb_handle_query_supported_user(const char *gdb_supported); /* user */ bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid); /* user */ +bool gdb_handle_detach_user(uint32_t pid); /* user */ void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 3eb93162aa8..17efcae0d0e 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -1024,6 +1024,12 @@ static void handle_detach(GArray *params, void *user_ctx) pid = get_param(params, 0)->val_ul; } +#ifdef CONFIG_USER_ONLY + if (gdb_handle_detach_user(pid)) { + return; + } +#endif + process = gdb_get_process(pid); gdb_process_breakpoint_remove_all(process); process->attached = false; diff --git a/gdbstub/user.c b/gdbstub/user.c index b048754c4f8..1a7b582a40d 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -391,6 +391,11 @@ bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid) return false; } +bool gdb_handle_detach_user(uint32_t pid) +{ + return false; +} + /* * Execution state helpers */