mirror of
https://github.com/crash-utility/crash
synced 2024-12-11 19:54:34 +00:00
crash_get_nr_cpus: get nr_cpus from the dumps
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@vmware.com>
This commit is contained in:
parent
9fab193edb
commit
163abcbbab
13
diskdump.c
13
diskdump.c
@ -2593,13 +2593,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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
11
netdump.c
11
netdump.c
@ -5206,11 +5206,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 *
|
||||
@ -5232,7 +5238,6 @@ kdump_get_qemucpustate(int cpu)
|
||||
|
||||
return (QEMUCPUState *)nd->nt_qemu_percpu[cpu];
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *
|
||||
get_kdump_device_dump_offset(void)
|
||||
|
Loading…
Reference in New Issue
Block a user