From patchwork Tue Mar 5 12:09:41 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: 777979 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c8:0:b0:33e:474f:8c56 with SMTP id p8csp396734wrs; Tue, 5 Mar 2024 04:11:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW16jne3Y63IzNxdxpo9tXqcUbT0pINiZelNXAHIAqoBPFkQ31DRLNw8B9f9qPteZ7GhJijXu7XEzRpsKcASPpz X-Google-Smtp-Source: AGHT+IFBYGcTBHGGdn87hnsz4VsAT9OoSSr3wl5yMRmbabmPR3BsPgndExWz5+udw5THoX9UT+JX X-Received: by 2002:a05:6358:430e:b0:17a:ec6c:4234 with SMTP id r14-20020a056358430e00b0017aec6c4234mr1738612rwc.10.1709640667426; Tue, 05 Mar 2024 04:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709640667; cv=none; d=google.com; s=arc-20160816; b=dpDIOyfxsxh03aU4UBf+2psFmZL7FD2EMdx1a1z8NZ21V1AQ5yG/icXsBlB3WjOkKA sf7DiViWlOtP9ohJVJToS2U5w9QIXqUtRZtnopaMbB0tme/PynrAu3GTnJQ2bqyuOUMM dOAP3DpuoFRZ2ZuRdbZLf0PCcm2BLfpeZPiHq6vHb1GlUFictH7dWQ9+Vrya6oCXooHh IdCE3KOm9ZsE4lPOvv9y+p0XBMfW2KsKR5Tuqh9f+Wu0wUMeikRqFQkfkwBp4yXTkIhF DNylYGS7wGYnagdlvz3syV4rX8QhLJ8mMzGNudetaroJcgUtrP0h2fvrz1E65LZ56KFl I4xw== 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=eXVZ712kv8O0GudxyxBx9w6g4YMMrljfTMdLsClf+YA=; fh=f6avZL29XgA8xpJjruaeiY/t2FUw83MgiNvVXs1rDYg=; b=jO3ULtrSA+zVVmBC3DFTHk4GcV5QVCy7fghc3/QOMulJZOOZkE7R9hdKs3PTH11JGr x7JGjRDD20/j2Xjf3LQACbXbcuedjNbZBw90Av/VCUy1nltKwsGdV2PPJU83TqS05GE1 +1EgXcH+UMqKc5H+CFe0S5QldVuVBiyKT+AxcLZjqkW4CFmKIar2BYFcWR2YM4R9+/Vf 2DdGV0jIqQYCgtayhqkSEGu4vXOiLPq4eiKJxDoFEg4sg0GIk/n6GJd7ng+A6wr+i2FB hqC4btlQdRzsiUhOLBRyKVvz+WbaFMcpAaYvBWdZyBqFZn9wQRsk9WNiY4LyKfyoW5QM sjTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RcINmoG+; 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 bs19-20020a05620a471300b007882ec7aa9esi3655574qkb.280.2024.03.05.04.11.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Mar 2024 04:11:07 -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=RcINmoG+; 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 1rhTck-0001Yl-FP; Tue, 05 Mar 2024 07:10:24 -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 1rhTce-0001Uo-TM for qemu-devel@nongnu.org; Tue, 05 Mar 2024 07:10:17 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhTcZ-0001CO-24 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 07:10:15 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-412eb6e15ceso5331625e9.0 for ; Tue, 05 Mar 2024 04:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709640609; x=1710245409; 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=eXVZ712kv8O0GudxyxBx9w6g4YMMrljfTMdLsClf+YA=; b=RcINmoG+xMHt9q/k+fAZ8LS0fjeBljWIr4vE7yejfzIcLiy4EDXIQWu4wgzso6JaAh uAzoj1QkErBlHgWww87wPtYbRcDPeD1MRqv4rpEpB5RoK7ZnzdpM+gXDlgOakkDE1cRT rx1bADQs0UgF1g7X/gwT2rMNpLqJiOqRA/ZTIjBiLqmJnXabyacRneeGw3CW3EE40dLi 71GsG4u5izvSbkCcKiRCm7hRcYPf7Ha0CYnTBtWjqB0WTXM9iCmdaUUGLoo0kyjzPsQI si8Q+9oRIi+awF2dS1CZ82ueE9d0nCNLSTyHUXUP3zR/o3Egj0LwkAMzegaV0p4c4kRQ JfvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709640609; x=1710245409; 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=eXVZ712kv8O0GudxyxBx9w6g4YMMrljfTMdLsClf+YA=; b=itms4X9ZxrfW+S+rD4LDp1HI2ECcGnU5v9TG3jMU/sAAunjkmoB3hLOPzqW4V2cy4t H8Dj0AWcsmr7N06fRsKgW5lLYvQ+MIRuwa/MZp/Qih9z3NqKoj8+NF7US41b6Gq4gGmI EVDATVn/pbhwFx6IZBCGmvsvvp4TApuL/TKwoY2TIxHIi+VrFLp8sJVf+pTaemG8dY/G Cmmt5NfIB65JAJX9tYak+6juITTVtOlAokSMHIuiqiRnrQZOq9ut3ZeiU/hM/GKBa45e ZMzUeGGFDx5doSwC90FeLHiXUO66icgHLF/6vDkgn6Z83eFDxUko9sOQwXFUdBEozsAg M+TA== X-Gm-Message-State: AOJu0Ywx/Bad/IhSWGxKgzQtOZnSQqkm0EbQEhEnmQzzE7rh4XIgL65T CX9dTr2zHsN68EsvLwvhE8cx0numrH2dveuONrV8msFM3BqBTVa6N1PmP/gPD0M= X-Received: by 2002:a05:600c:1da6:b0:412:e95f:51bb with SMTP id p38-20020a05600c1da600b00412e95f51bbmr1999744wms.32.1709640608816; Tue, 05 Mar 2024 04:10:08 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a12-20020a05600c348c00b00412ef5a0c78sm758146wmq.43.2024.03.05.04.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 04:10:08 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 009A65F956; Tue, 5 Mar 2024 12:10:06 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Alistair Francis , Nicholas Piggin , Liu Zhiwei , Richard Henderson , Yanan Wang , qemu-s390x@nongnu.org, "Edgar E. Iglesias" , Eduardo Habkost , Daniel Henrique Barboza , Michael Rolnik , Daniel Henrique Barboza , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , Yoshinori Sato , Laurent Vivier , Thomas Huth , Peter Maydell , Mahmoud Mandour , Brad Smith , Alistair Francis , Brian Cain , Cleber Rosa , John Snow , Marcel Apfelbaum , Pierrick Bouvier , Palmer Dabbelt , Riku Voipio , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Weiwei Li , Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Beraldo Leal , Kyle Evans , David Hildenbrand , Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Alexandre Iooss , Warner Losh , qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH 05/29] gdbstub: Introduce gdbserver_fork_start() Date: Tue, 5 Mar 2024 12:09:41 +0000 Message-Id: <20240305121005.3528075-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305121005.3528075-1-alex.bennee@linaro.org> References: <20240305121005.3528075-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.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=unavailable 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 requires knowing when fork() is about to happen in order to initialize its state. Add a hook for that. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich Message-Id: <20240219141628.246823-5-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- include/gdbstub/user.h | 5 +++++ bsd-user/main.c | 1 + gdbstub/user.c | 4 ++++ linux-user/main.c | 1 + 4 files changed, 11 insertions(+) diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index 68b6534130c..e33f8d9a9a6 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -45,6 +45,11 @@ static inline int gdb_handlesig(CPUState *cpu, int sig) */ void gdb_signalled(CPUArchState *as, int sig); +/** + * gdbserver_fork_start() - inform gdb of the upcoming fork() + */ +void gdbserver_fork_start(void); + /** * gdbserver_fork() - disable gdb stub for child processes. * @cs: CPU diff --git a/bsd-user/main.c b/bsd-user/main.c index e39eef3040f..517c6b3ec2f 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -113,6 +113,7 @@ void fork_start(void) start_exclusive(); cpu_list_lock(); mmap_fork_start(); + gdbserver_fork_start(); } void fork_end(int child) diff --git a/gdbstub/user.c b/gdbstub/user.c index 3ce20b7bbfc..536fb43b03e 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -356,6 +356,10 @@ int gdbserver_start(const char *port_or_path) return -1; } +void gdbserver_fork_start(void) +{ +} + static void disable_gdbstub(CPUState *thread_cpu) { CPUState *cpu; diff --git a/linux-user/main.c b/linux-user/main.c index 699da773714..755c566d6d2 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -145,6 +145,7 @@ void fork_start(void) mmap_fork_start(); cpu_list_lock(); qemu_plugin_user_prefork_lock(); + gdbserver_fork_start(); } void fork_end(int child)