aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-section-script.py
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-14 11:06:26 +0200
committerTom de Vries <tdevries@suse.de>2022-06-14 11:06:26 +0200
commita7e29f797cecd5a2f73c27838b09eae1f1b6c657 (patch)
treeb059688ca8208257681154112357d2e417826274 /gdb/testsuite/gdb.python/py-section-script.py
parent6df97c56ea0f3086c96743ec47148ee69fd8cf71 (diff)
downloadbinutils-a7e29f797cecd5a2f73c27838b09eae1f1b6c657.zip
binutils-a7e29f797cecd5a2f73c27838b09eae1f1b6c657.tar.gz
binutils-a7e29f797cecd5a2f73c27838b09eae1f1b6c657.tar.bz2
Fix fbsd core matching
On Thu, Jun 09, 2022 at 08:59:37AM -0700, John Baldwin wrote: > On 6/9/22 1:58 AM, Tom de Vries via Gdb-patches wrote: > > Hi, > > > > With an --enable-targets=all build and target board unix/-m32 I run into a > > FAIL in test-case gdb.base/corefile.exp: > > ... > > (gdb) file outputs/gdb.base/corefile/corefile^M > > Reading symbols from outputs/gdb.base/corefile/corefile...^M > > (gdb) core-file outputs/gdb.base/corefile/corefile.core^M > > warning: core file may not match specified executable file.^M > > [New LWP 12011]^M > > Core was generated by `outputs/gdb.base/corefile/co'.^M > > Program terminated with signal SIGABRT, Aborted.^M > > (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free > > ... > > > > The warning is there because of this mismatch between core and exec: > > ... > > (gdb) p core_bfd->xvec > > $3 = (const struct bfd_target *) 0x20112a0 <i386_elf32_fbsd_vec> > > (gdb) p exec_bfd->xvec > > $4 = (const struct bfd_target *) 0x2010b00 <i386_elf32_vec> > > ... > > > > In the exec case, the detected architecture is i386_elf32_vec because this bit > > of code in elfcode.h:elf_object_p(): > > ... > > if (ebd->elf_machine_code != EM_NONE > > && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi > > && ebd->elf_osabi != ELFOSABI_NONE) > > goto got_wrong_format_error; > > ... > > prevents i386_elf32_fbsd from matching. > > > > Fix the core matching by copying that code to elfcore.h:elf_core_file_p(). > > > > Tested on x86_64-linux. > > > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29227 > > > > Any comments? Looks good. > Looking at elfcore.h, it seems to have not gotten changes made to elfcode.h over > time and is a bit rotted. I suspect that all of changes made in commit 0aabe54e6222 > that added these lines in elfcode.h (along with several other changes) need to > be applied to this function in elfcore.h, not just adding these lines. Yes, the commit 0aabe54e6222 changes likely should go in too. I'm a little wary of adding all the sanity checks to elf_core_file_p since that might result in some core files not being recognised at all. For example, despite the FIXME I'd guess leaving out the EI_VERSION check was deliberate. The following seems reasonable to me. Please test.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-section-script.py')
0 files changed, 0 insertions, 0 deletions