|
From: Paul F. <pa...@so...> - 2022-05-22 11:07:07
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=90763ca763e129ff7484d5aabb28a0dfb9fac1b6 commit 90763ca763e129ff7484d5aabb28a0dfb9fac1b6 Author: Paul Floyd <pj...@wa...> Date: Sun May 22 13:05:10 2022 +0200 Change coredump note names for FreeBSD Was not able to load vgcore files with lldb on FreeBSD. I think that there is a way to go for lldb / FreeBSD to be able to fully read vgcore files. See https://www.moritz.systems/blog/lldb-core-dump-support-improvements/ Diff: --- coregrind/m_coredump/coredump-elf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index 0d22d01cbb..4a8c29c529 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -699,6 +699,15 @@ void dump_one_thread(struct note **notelist, const vki_siginfo_t *si, ThreadId t { vki_elf_fpregset_t fpu; struct vki_elf_prstatus prstatus; + const HChar* name; +# if !defined(VGO_freebsd) + name = "CORE"; +# else + /* lldb on FreeBSD expects a prstatus with name "FreeBSD" + * see llvm::Error ProcessElfCore::parseFreeBSDNotes(llvm::ArrayRef<CoreNote> notes) in ProcessElfCore.cpp + * Otherwise it exits with "Could not find NT_PRSTATUS note in core file." */ + name = "FreeBSD"; +# endif VG_(memset)(&fpu, 0, sizeof(fpu)); VG_(memset)(&prstatus, 0, sizeof(prstatus)); # if defined(VGP_x86_linux) && !defined(VGPV_x86_linux_android) @@ -716,7 +725,7 @@ void dump_one_thread(struct note **notelist, const vki_siginfo_t *si, ThreadId t && !defined(VGPV_mips32_linux_android) \ && !defined(VGPV_arm64_linux_android) \ && !defined(VGP_nanomips_linux) - add_note(notelist, "CORE", NT_FPREGSET, &fpu, sizeof(fpu)); + add_note(notelist, name, NT_FPREGSET, &fpu, sizeof(fpu)); # endif fill_prstatus(&VG_(threads)[tid], &prstatus, si); @@ -724,7 +733,7 @@ void dump_one_thread(struct note **notelist, const vki_siginfo_t *si, ThreadId t && !defined(VGPV_x86_linux_android) \ && !defined(VGPV_mips32_linux_android) \ && !defined(VGPV_arm64_linux_android) - add_note(notelist, "CORE", NT_PRSTATUS, &prstatus, sizeof(prstatus)); + add_note(notelist, name, NT_PRSTATUS, &prstatus, sizeof(prstatus)); # endif } |