From: John Baldwin Date: Wed, 4 Mar 2020 18:43:43 +0000 (-0800) Subject: Copy ELF header flags from executable to core file. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4f89e9870e5ed92527bb6879187c5cc28e98001;p=thirdparty%2Fbinutils-gdb.git Copy ELF header flags from executable to core file. --- diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 26e1ea5c12b..026232f05ea 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -697,12 +697,16 @@ static gdb::unique_xmalloc_ptr fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) { gdb::unique_xmalloc_ptr note_data; - Elf_Internal_Ehdr *i_ehdrp; + Elf_Internal_Ehdr *c_ehdrp, *e_ehdrp; struct thread_info *curr_thr, *signalled_thr; /* Put a "FreeBSD" label in the ELF header. */ - i_ehdrp = elf_elfheader (obfd); - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + c_ehdrp = elf_elfheader (obfd); + c_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + + bfd *exec_bfd = current_program_space->exec_bfd (); + if (exec_bfd != NULL && (e_ehdrp = elf_elfheader (exec_bfd)) != NULL) + c_ehdrp->e_flags = e_ehdrp->e_flags; gdb_assert (gdbarch_iterate_over_regset_sections_p (gdbarch));