Message ID | 20230630180423.558337-36-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp597090wrs; Fri, 30 Jun 2023 11:14:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPTxlDGMOuUR+zMKlL/e2g0KOmNTo4QVW72CFnHgqt1aIQbaEzfRtyx5Cm8lUH+IExMZIX X-Received: by 2002:a05:6359:67a3:b0:134:e301:2c21 with SMTP id sq35-20020a05635967a300b00134e3012c21mr3747068rwb.15.1688148895863; Fri, 30 Jun 2023 11:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688148895; cv=none; d=google.com; s=arc-20160816; b=amranCgFeMqocq6JZBu2h036dUz1fxjv0iiPhW/o5yi36lDbHyu24rDMiMykWsNysR ZGkW06aA5OVmkk3ABSsDT3p1KZhu4gyv3jb3b0FXo5CKgZtDWNpPyya/5MkG+VIqeLMz QksTWVmWdiNZfgTYzhlslRnrliz2Pt634Yg+PvVV0dE9rxY0nDt4L/sDPBGrOKRbXsrO GID09X0GRx/fDtLYXsOvpk3YSSTHIJzRE915bjjgYg0chj5wXTNDkIVCe5UXq1v+z1C3 lofKVH5SS9xLkc5D9w7eyCQzOKspf5jICDC4j+4vvGKCP35TZWuw64t79D+tcKso1VGP 8tVA== 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=WuTBZDcfojtFbKfkJjfEwZ/JCpHxFhyq5cXQ7fdJG7M=; b=GcnTHlaIRGEqQQwAB9asaMwjzCRrh43OKQKwAs66i1s2oj0f0zVdxzNHDzafmP897B 34QjekjSR/j3NtpC+7eTAPRzaSAkJa0oUQv/O/+5Ig4Cud3FkSqRSLHNREOBwPD7ouOU vEYZvInXlbj9c7zheI+ZaJDEb/mV7pR3nKJ9EQ9KJGFjOoqIdF9fIXjD8OO3gTNkVA+/ NwEgbiyPKWuUIupUP0rAe/WinJ6QGGgcEtZNM8i8PzPXGijgCQ0NLVB87AVMHa855waH Y0O5lmYxd61pL9vR+ezAhgLokRBjXGfPaI7sXZfd2UZ6X3ErgtK6m6m8Bamt5fuJ3M9P c1Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qddmp1xb; 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 qz10-20020a05620a8c0a00b00765b3212b78si6483010qkn.564.2023.06.30.11.14.55 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 11:14:55 -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=qddmp1xb; 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 1qFId9-0005oV-In; Fri, 30 Jun 2023 14:14:03 -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 1qFIcm-0005at-Pd for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:13:43 -0400 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 <alex.bennee@linaro.org>) id 1qFIci-0003Yk-H3 for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:13:40 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbca8935bfso4388015e9.3 for <qemu-devel@nongnu.org>; Fri, 30 Jun 2023 11:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688148815; x=1690740815; 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=qddmp1xbc6xCFtXNg6HPx+/yEITPjZ7FmfWXcpyu8GOdwqfQNX1wWjNHkzEYyjP/0Y CjRzjpMRFhVYkpjQC4AGC1BC6m1HV3L0DJ203NqRhb99xEjFXuK8RfYwU/dYGFuK5IST KkS6uKM4Mc3LmTXfYojoVozWN7qV1wQXRzWN2K5ABJ42Q6XRtirMKIvA1tE9ktvo7wZF o0z5QbC95CYpGFnbj3+CJ4q6bViIsbNeepfWv6929CaajyhXij0uOIHrkhCwZaAwsReu 72EVM5leGW/32wFikyQcf4mE+hPX6bNL2oAnzzKbFc9JS/V8YWL+eZ5b4Tqg5WedhS0B Zk8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688148815; x=1690740815; 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=Bvfuyp/doTdC/E1sPmtKF6duEPa6T6dP8XY5b909+kUAyVhwD63+JAKvmVOR9ypApu /q4nF6jJ4DcD1EJ5L7igLjblo8qvnKG9QTT61wdVc8P3i+LQW9QJkwvDt5kJgr5JFAaq W/fKLk3Kuex3+o69gQdq8nSzn8MBqFsaDDnWbiW8Epl7BhYvVKS3hLn+MlhoaM4PA+4J 0H70u2IgooE8a/IhTdwWsTS7NydvrewyGYQRcc9KoxY61ajVxb6J/x5euKdst86SA22R xyrf8hu1h4Y2aPN2HFreBRNz7PXwShtSEKP3ZmwqZMWdFugTWDaHu7lxIRNEBHLTLP2m hwnA== X-Gm-Message-State: AC+VfDw7CMm49vBXQXcmiJrGOQqk7AD/vkJP56Hu6JVTAG8AJAFIijJM SvUnjVfdQ78sf1nF0NtMrfhiug== X-Received: by 2002:a05:600c:2253:b0:3fb:a5b3:4f02 with SMTP id a19-20020a05600c225300b003fba5b34f02mr2623714wmm.36.1688148814971; Fri, 30 Jun 2023 11:13:34 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id c13-20020a7bc00d000000b003f735ba7736sm19916239wmb.46.2023.06.30.11.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:13:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EE3751FFDC; Fri, 30 Jun 2023 19:04:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Leonardo Bras <leobras@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Peter Xu <peterx@redhat.com>, Juan Quintela <quintela@redhat.com>, Beraldo Leal <bleal@redhat.com>, Radoslaw Biernacki <rad@semihalf.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Peter Maydell <peter.maydell@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Riku Voipio <riku.voipio@iki.fi>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Mahmoud Mandour <ma.mandourr@gmail.com>, Alexandre Iooss <erdnaxe@crans.org>, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= <philmd@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Bin Meng <bmeng.cn@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Bandan Das <bsd@redhat.com>, Cleber Rosa <crosa@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Leif Lindholm <quic_llindhol@quicinc.com>, Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>, qemu-arm@nongnu.org, Darren Kenny <darren.kenny@oracle.com>, Alexander Bulekov <alxndr@bu.edu>, Ilya Leoshkevich <iii@linux.ibm.com> Subject: [PATCH v4 35/38] gdbstub: Report the actual qemu-user pid Date: Fri, 30 Jun 2023 19:04:20 +0100 Message-Id: <20230630180423.558337-36-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230630180423.558337-1-alex.bennee@linaro.org> References: <20230630180423.558337-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::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: <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'; }