From: Paul Floyd Date: Sun, 22 May 2022 11:05:10 +0000 (+0200) Subject: Change coredump note names for FreeBSD X-Git-Tag: VALGRIND_3_20_0~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90763ca763e129ff7484d5aabb28a0dfb9fac1b6;p=thirdparty%2Fvalgrind.git 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 --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 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 }