[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index |
Date: |
Mon, 28 Jan 2019 18:10:47 +0000 |
Now we're keeping the cluster index in the CPUState, we don't
need to jump through hoops in gdb_get_cpu_pid() to find the
associated cluster object.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Luc Michel <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Message-id: address@hidden
---
gdbstub.c | 48 +++++-------------------------------------------
1 file changed, 5 insertions(+), 43 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index d4cc6ecf99b..3129b5c2842 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -644,50 +644,12 @@ static int memtox(char *buf, const char *mem, int len)
static uint32_t gdb_get_cpu_pid(const GDBState *s, CPUState *cpu)
{
-#ifndef CONFIG_USER_ONLY
- gchar *path, *name = NULL;
- Object *obj;
- CPUClusterState *cluster;
- uint32_t ret;
-
- path = object_get_canonical_path(OBJECT(cpu));
-
- if (path == NULL) {
- /* Return the default process' PID */
- ret = s->processes[s->process_num - 1].pid;
- goto out;
- }
-
- name = object_get_canonical_path_component(OBJECT(cpu));
- assert(name != NULL);
-
- /*
- * Retrieve the CPU parent path by removing the last '/' and the CPU name
- * from the CPU canonical path.
- */
- path[strlen(path) - strlen(name) - 1] = '\0';
-
- obj = object_resolve_path_type(path, TYPE_CPU_CLUSTER, NULL);
-
- if (obj == NULL) {
- /* Return the default process' PID */
- ret = s->processes[s->process_num - 1].pid;
- goto out;
- }
-
- cluster = CPU_CLUSTER(obj);
- ret = cluster->cluster_id + 1;
-
-out:
- g_free(name);
- g_free(path);
-
- return ret;
-
-#else
/* TODO: In user mode, we should use the task state PID */
- return s->processes[s->process_num - 1].pid;
-#endif
+ if (cpu->cluster_index == UNASSIGNED_CLUSTER_INDEX) {
+ /* Return the default process' PID */
+ return s->processes[s->process_num - 1].pid;
+ }
+ return cpu->cluster_index + 1;
}
static GDBProcess *gdb_get_process(const GDBState *s, uint32_t pid)
--
2.20.1
- [Qemu-devel] [PULL 11/26] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories, (continued)
- [Qemu-devel] [PULL 11/26] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 15/26] tests/microbit-test: Check nRF51 UART functionality, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 17/26] xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_serial(), Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 18/26] aspeed/smc: fix default read value, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 21/26] aspeed/smc: snoop SPI transfers to fake dummy cycles, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 20/26] aspeed/smc: Add dummy data register, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 19/26] aspeed/smc: define registers for all possible CS, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 16/26] checkpatch: Don't emit spurious warnings about block comments, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 14/26] tests/microbit-test: Make test independent of global_qtest, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index,
Peter Maydell <=
- [Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 22/26] tests/microbit-test: Add tests for nRF51 NVMC, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 23/26] hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 24/26] qom/cpu: Add cluster_index to CPUState, Peter Maydell, 2019/01/28