Most of the dumps have information about real number of CPUS. Use that to instantiate GDB's target inferior threads. Signed-off-by: Alexey Makhalov <amakhalov@xxxxxxxxxx> --- diskdump.c | 13 +++++++++++-- gdb_interface.c | 9 +++++++++ netdump.c | 11 ++++++++--- sadump.c | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/diskdump.c b/diskdump.c index 4f14596..9340343 100644 --- a/diskdump.c +++ b/diskdump.c @@ -2516,13 +2516,22 @@ diskdump_kaslr_check() return FALSE; } -#ifdef X86_64 int diskdump_get_nr_cpus(void) { - return dd->num_qemu_notes; + if (dd->num_prstatus_notes) + return dd->num_prstatus_notes; + else if (dd->num_qemu_notes) + return dd->num_qemu_notes; + else if (dd->num_vmcoredd_notes) + return dd->num_vmcoredd_notes; + else if (dd->header->nr_cpus) + return dd->header->nr_cpus; + + return 1; } +#ifdef X86_64 QEMUCPUState * diskdump_get_qemucpustate(int cpu) { diff --git a/gdb_interface.c b/gdb_interface.c index 5a41992..194082f 100644 --- a/gdb_interface.c +++ b/gdb_interface.c @@ -1070,6 +1070,15 @@ int crash_get_nr_cpus(void); int crash_get_nr_cpus(void) { + if (SADUMP_DUMPFILE()) + return sadump_get_nr_cpus(); + else if (DISKDUMP_DUMPFILE()) + return diskdump_get_nr_cpus(); + else if (KDUMP_DUMPFILE()) + return kdump_get_nr_cpus(); + else if (VMSS_DUMPFILE()) + return vmware_vmss_get_nr_cpus(); + /* Just CPU #0 */ return 1; } diff --git a/netdump.c b/netdump.c index f2b3363..5374feb 100644 --- a/netdump.c +++ b/netdump.c @@ -5204,11 +5204,17 @@ kdump_kaslr_check(void) return FALSE; } -#ifdef X86_64 int kdump_get_nr_cpus(void) { - return nd->num_qemu_notes; + if (nd->num_prstatus_notes) + return nd->num_prstatus_notes; + else if (nd->num_qemu_notes) + return nd->num_qemu_notes; + else if (nd->num_vmcoredd_notes) + return nd->num_vmcoredd_notes; + + return 1; } QEMUCPUState * @@ -5230,7 +5236,6 @@ kdump_get_qemucpustate(int cpu) return (QEMUCPUState *)nd->nt_qemu_percpu[cpu]; } -#endif static void * get_kdump_device_dump_offset(void) diff --git a/sadump.c b/sadump.c index d75c66b..cb43fdb 100644 --- a/sadump.c +++ b/sadump.c @@ -1670,7 +1670,6 @@ get_sadump_data(void) return sd; } -#ifdef X86_64 int sadump_get_nr_cpus(void) { @@ -1678,6 +1677,7 @@ sadump_get_nr_cpus(void) return sd->dump_header->nr_cpus; } +#ifdef X86_64 int sadump_get_cr3_cr4_idtr(int cpu, ulong *cr3, ulong *cr4, ulong *idtr) { -- 2.11.0 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility