Skip to content

Commit 42fbae4

Browse files
liutgnulian-bo
authored andcommitted
Fix a regression of "help -r" which fail to print regs
This patch fixed a regression introduced by commit aa9f724 ("Fix for "help -r" segfault in case of ramdump"), which ignored the case which nd->nt_prstatus may contain register notes. As a result, it fails to print the registers of such case. Before: crash> help -r CPU 0: help: registers not collected for cpu 0 CPU 1: [OFFLINE] After: crash> help -r CPU 0: RIP: ffffffff800c4d92 RSP: ffff810066cc7d68 RFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 650001bc7e664240 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 650001bc7e664240 R8: 0000000000000006 R9: ffff810069dd03d4 R10: ffff81007d942080 R11: ffffffff80154235 R12: 0000000000000000 R13: 0000000000000000 R14: 000000000001e5fe R15: 0000000000000001 CS: 0010 SS: 0018 CPU 1: [OFFLINE] Signed-off-by: Tao Liu <[email protected]>
1 parent 3340224 commit 42fbae4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

netdump.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,9 +2768,10 @@ display_regs_from_elf_notes(int cpu, FILE *ofp)
27682768
}
27692769
}
27702770

2771-
if (((cpu < 0 ) || (!nd->nt_prstatus_percpu[cpu]) ||
2772-
(cpu - skipped_count) >= nd->num_prstatus_notes) &&
2773-
!machine_type("MIPS")) {
2771+
if (((cpu < 0 ) ||
2772+
((!nd->nt_prstatus_percpu[cpu]) && (!nd->nt_prstatus)) ||
2773+
(cpu - skipped_count) >= nd->num_prstatus_notes)
2774+
&& !machine_type("MIPS")) {
27742775
error(INFO, "registers not collected for cpu %d\n", cpu);
27752776
return;
27762777
}

0 commit comments

Comments
 (0)