Message ID | 20230627160943.2956928-34-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3867944wrm; Tue, 27 Jun 2023 09:17:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vpAeb/imdqO+RiMVGPRbyaRncnacqs6jz52vGDDjuGBrgav+GRsU6ouJWdgKNF5ATEKxD X-Received: by 2002:a05:620a:25c8:b0:763:b475:90ef with SMTP id y8-20020a05620a25c800b00763b47590efmr23668801qko.69.1687882630129; Tue, 27 Jun 2023 09:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687882630; cv=none; d=google.com; s=arc-20160816; b=NsCKZ0byGscsuVVwN8exMyBI6g8x/KgyPeKGVO2ng/gwWfpbXn8YMh9UxZssJSIqVD CEgVIMj08jMvyz/T0RKzMfNESiQBJ8Wrxm2d7JEc9YrCM945IaFUlxV/26n3RqEAW8A4 7ku0GoZknUkJLtn7o6S+VgwJg2vJtr2ZnhDOhdwETXSQTDmqzJZ6LuX32rBv5b7ayb1N 7kgcvhL1Il8IlaQgb9AXMzKVIBW47dUmFsOazdh1PbE/EBnLcAWPz65vi8JGJyXJDyaP DROnsLmntm0XsREka7zKOekx3QcO1ALEaRwrGsZ37i3zurq7SOoOarJFZ8liOeqGz8Ap Lp9A== 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=oenQvTjQMNLdspNzkaNvCWQ+SG7wcPXLwQUq75k2j/o=; fh=B6/adVaiTRj/g/M/QPigvyXZO+x+u/FNsaNX2Qo1+tw=; b=Em4etnfoz1+lLPcCoOmBeNMwQzcv3HsaqUs4mSAxoVzpE7i3B61dLnbcbpWdqxr8Av JR3On0BYnVC/aSKFYShWQ072x+11tTtjsCOKJT7rbjdU+BP9OJ9ZEP33kgek7YUeOYhk mAIZ8P3yI/FpYFLeiqs4WT4Cb1Jho4SYLw/jlCMQoHtwNLHxmyy1ZsJRt4/Z+OeBP5v+ XDxNIRUzRSl+F1qpNAZCXbYj11+8wgbtn4lg6GkqJM/U9gmVbIWQgFgZr4CXiBYhS2Ty R5Fl+CKfOYagbQWpMAIVVp4tQmKlfyBpppywJ/IMfDNQXHbXPJLF7ychWTWxFPQsjEP7 OJPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ih2wexnc; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ra15-20020a05620a8c8f00b0076554a836e6si3139344qkn.580.2023.06.27.09.17.09 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Jun 2023 09:17:10 -0700 (PDT) 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=Ih2wexnc; 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 <qemu-devel-bounces@nongnu.org>) id 1qEBMH-00011q-Cj; Tue, 27 Jun 2023 12:16:01 -0400 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 <alex.bennee@linaro.org>) id 1qEBME-0000ya-Du for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:15:58 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1qEBMA-00088p-Fd for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:15:58 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-313e34ab99fso3936693f8f.1 for <qemu-devel@nongnu.org>; Tue, 27 Jun 2023 09:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687882552; x=1690474552; 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=oenQvTjQMNLdspNzkaNvCWQ+SG7wcPXLwQUq75k2j/o=; b=Ih2wexncfGfDwD/HAFokzszaawhjM6uXNHK7B6jp2MzfjbW9DldwHEyzIji3TXQl1E 5WBYFZznMG5OEMZd4XnACFVvna6jclk2uDjNJtmIpIY8FjrRYYZmZYTGCTcMXhl3fCg4 /sFik4pCIs4FgGanbatBlgfpTiVunY9tKbi76zC5qKzSNUAA+QPUI99LZhRqYC9IBLRY SBEXA/6agLb/T5ikQl8nzgqpCZk0r6DK8rLhLPoShxLeTpMhxm2yljngOhK/MVF+6xWT y0IZa9AgBBkVv/Gh7sWhxDa0rGhLTgC7/Wr22A8XsJzGIWC0Iohqxgr89xYZgc1Br3oF qrPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687882552; x=1690474552; 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=oenQvTjQMNLdspNzkaNvCWQ+SG7wcPXLwQUq75k2j/o=; b=DzzxDOt70iN2MBjyls0ZFPO4qQ5Dz9tT75jKAMnDvE5X2xgLLWO69LbmlSpPyKsjMG KsJQy10vKzR2TBoOpK8UOoocdEMUKTJUhsVad5eGllHcXfTa1tJ7vmDTnQ8tN1es5OSO HEAngZkepNoIhFbAJJ3dRiZpyg2seZuW1rjkpqn7+GNJRUKpOWirQuo0UaOhXv2PT9Xx KAnanQqep6v568UjFTME7ZbaP05/GQ9vOPVy4YoEfDIc4jmzK7icX/s3MPl+w3YeX33K Md1TpKt2RyOHl/uG7mBZ/+r17UhSh1ybBuVl4x0SDQF/9VEbfK78iIev1EWoVbAsdnkn rMYQ== X-Gm-Message-State: AC+VfDw9UqPe98fso0KzmppbxR40n/rx9QFurn28IybbNU4QiNEBHnGv TIAlaw4Tji/vJxPjVIhsnyLicA== X-Received: by 2002:a5d:4a0e:0:b0:30a:e6d2:3ce3 with SMTP id m14-20020a5d4a0e000000b0030ae6d23ce3mr23425908wrq.16.1687882552435; Tue, 27 Jun 2023 09:15:52 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n2-20020a5d67c2000000b003127741d7desm10713516wrw.58.2023.06.27.09.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:15:50 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C2A7D1FFDB; Tue, 27 Jun 2023 17:09:47 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta <wainersm@redhat.com>, Juan Quintela <quintela@redhat.com>, Thomas Huth <thuth@redhat.com>, Cleber Rosa <crosa@redhat.com>, Leonardo Bras <leobras@redhat.com>, Beraldo Leal <bleal@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Bin Meng <bmeng.cn@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Darren Kenny <darren.kenny@oracle.com>, Alexander Bulekov <alxndr@bu.edu>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Peter Xu <peterx@redhat.com>, Radoslaw Biernacki <rad@semihalf.com>, Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, qemu-arm@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Bandan Das <bsd@redhat.com>, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>, Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>, Leif Lindholm <quic_llindhol@quicinc.com>, Laurent Vivier <lvivier@redhat.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Mahmoud Mandour <ma.mandourr@gmail.com>, Riku Voipio <riku.voipio@iki.fi>, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com> Subject: [PATCH v3 33/36] gdbstub: Report the actual qemu-user pid Date: Tue, 27 Jun 2023 17:09:40 +0100 Message-Id: <20230627160943.2956928-34-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230627160943.2956928-1-alex.bennee@linaro.org> References: <20230627160943.2956928-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
maintainer omnibus: testing, fuzz, plugins, documentation, gdbstub (pre-PR)
|
expand
|
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index ce3e4a2671..697dd4bbad 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -202,13 +202,16 @@ void gdb_memtox(GString *buf, const char *mem, int len) static uint32_t gdb_get_cpu_pid(CPUState *cpu) { - /* TODO: In user mode, we should use the task state PID */ +#ifdef CONFIG_USER_ONLY + return getpid(); +#else if (cpu->cluster_index == UNASSIGNED_CLUSTER_INDEX) { /* Return the default process' PID */ int index = gdbserver_state.process_num - 1; return gdbserver_state.processes[index].pid; } return cpu->cluster_index + 1; +#endif } GDBProcess *gdb_get_process(uint32_t pid) @@ -2137,19 +2140,25 @@ void gdb_read_byte(uint8_t ch) void gdb_create_default_process(GDBState *s) { GDBProcess *process; - int max_pid = 0; + int pid; +#ifdef CONFIG_USER_ONLY + assert(gdbserver_state.process_num == 0); + pid = getpid(); +#else if (gdbserver_state.process_num) { - max_pid = s->processes[s->process_num - 1].pid; + pid = s->processes[s->process_num - 1].pid; + } else { + pid = 0; } + /* We need an available PID slot for this process */ + assert(pid < UINT32_MAX); + pid++; +#endif s->processes = g_renew(GDBProcess, s->processes, ++s->process_num); process = &s->processes[s->process_num - 1]; - - /* We need an available PID slot for this process */ - assert(max_pid < UINT32_MAX); - - process->pid = max_pid + 1; + process->pid = pid; process->attached = false; process->target_xml[0] = '\0'; }