diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-01-29 11:46:06 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-01-29 11:46:06 +0000 |
commit | 46f5abc0a2566ac3dc954eeb62fd625f0eaca120 (patch) | |
tree | 2565dfb0a8d719063e9682b7887747748eba230a | |
parent | f7b78602fdc6c6e4befc90159da8e93900b4bcb1 (diff) | |
download | qemu-46f5abc0a2566ac3dc954eeb62fd625f0eaca120.zip qemu-46f5abc0a2566ac3dc954eeb62fd625f0eaca120.tar.gz qemu-46f5abc0a2566ac3dc954eeb62fd625f0eaca120.tar.bz2 |
gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
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 <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20190121152218.9592-5-peter.maydell@linaro.org
-rw-r--r-- | gdbstub.c | 46 |
1 files changed, 4 insertions, 42 deletions
@@ -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) { + /* TODO: In user mode, we should use the task state PID */ + if (cpu->cluster_index == UNASSIGNED_CLUSTER_INDEX) { /* Return the default process' PID */ - ret = s->processes[s->process_num - 1].pid; - goto out; + return s->processes[s->process_num - 1].pid; } - - 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 + return cpu->cluster_index + 1; } static GDBProcess *gdb_get_process(const GDBState *s, uint32_t pid) |