aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-02-20Fix make 3.81 build errorsAlan Hayward2-13/+18
gdbserver/ * Makefile.in: Switch order of make rules.
2018-02-20Automatic date update in version.inGDB Administrator1-1/+1
2018-02-19gdb/doc: Additional information about 'info line'Andrew Burgess2-6/+18
Extend the documentation of 'info line' command to: 1. Make 'info line' with no argument more obvious, and make it clearer what this does. 2. Cover what happens when a secod 'info line' with no argument is issued. 3. Extend the example output for 'info line ...' to include symbolic addresses. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Additional information about "info line" command.
2018-02-19Revert "_bfd_mips_elf_final_link: Notify user about wrong .reginfo size"Maciej W. Rozycki2-10/+9
Revert commit 58807c48a5a3 ("_bfd_mips_elf_final_link: Notify user about wrong .reginfo size") now that the size of the `.reginfo' section has been truly fixed in `_bfd_mips_elf_section_processing', meaning that the offending condition can be asserted again. bfd/ Revert 2018-01-12 Vlad Ivanov <vlad@ivanov.email> * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when .reginfo section has wrong size.
2018-02-19MIPS/BFD: Fix the size of `.reginfo' and `.MIPS.abiflags' sectionsMaciej W. Rozycki22-3/+196
Use the SEC_FIXED_SIZE flag to actually fix the size of `.reginfo' and `.MIPS.abiflags' sections in `_bfd_mips_elf_always_size_sections', as originally intended, removing link failures such as: ld: final link failed: Section has no contents or: ld: final link failed: Bad value or: ld: foo: .reginfo section size should be 24 bytes, actual size is 32 and assertion failures like: ld: BFD (GNU Binutils) 2.30.51.20180131 assertion fail .../bfd/elfxx-mips.c:14322 in link scenarios involving a linker script that either creates an output `.reginfo' or `.MIPS.abiflags' section from scratch or produces either section from different sections. If such an output section's size turns out to be incorrect according to the psABI, then the section is either truncated or padded out to the correct size, as relevant. This allows people to handle these sections in a link in an unusual way, while still addressing the issue covered by commit 58807c48a5a3 ("_bfd_mips_elf_final_link: Notify user about wrong .reginfo size"). The original arrangement, coming from an unindentified change made to what was called `mips_elf_always_size_sections' back then, between commit 02650bd0a97e ("This adds ABI flags to MIPS/ELF object files.") and commit 252b5132c753 ("19990502 sourceware import"), also missing from BFD ChangeLog files, assumed that the output section size is not going to change after return from `bfd_elf_size_dynamic_sections', the caller of that function, called in turn from `ldemul_before_allocation' via `gld${EMULATION_NAME}_before_allocation' in ld/emultempl/elf32.em, and ultimately from `lang_process'. This is because later on in `lang_process' processing `lang_size_sections' is called , happily recalculating the section size, and it has actually already been the case at the time of commit 252b5132c753 ("19990502 sourceware import"), so the assumption was clearly incorrect right from the beginning. bfd/ * elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and `.MIPS.abiflags' sections. (_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo' section's end. ld/ * testsuite/ld-mips-elf/reginfo-0.d: New test. * testsuite/ld-mips-elf/reginfo-0r.d: New test. * testsuite/ld-mips-elf/reginfo-1.d: New test. * testsuite/ld-mips-elf/reginfo-1r.d: New test. * testsuite/ld-mips-elf/reginfo-2.d: New test. * testsuite/ld-mips-elf/reginfo-2r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-0.d: New test. * testsuite/ld-mips-elf/mips-abiflags-0r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-1.d: New test. * testsuite/ld-mips-elf/mips-abiflags-1r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-2.d: New test. * testsuite/ld-mips-elf/mips-abiflags-2r.d: New test. * testsuite/ld-mips-elf/reginfo-0.ld: New test linker script. * testsuite/ld-mips-elf/reginfo-1.ld: New test linker script. * testsuite/ld-mips-elf/mips-abiflags-0.ld: New test linker script. * testsuite/ld-mips-elf/mips-abiflags-1.ld: New test linker script. * testsuite/ld-mips-elf/reginfo-1.s: New test source. * testsuite/ld-mips-elf/reginfo-2.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-02-19LD: Support fixed-size sections some psABIs may requireMaciej W. Rozycki5-10/+43
Define a SEC_FIXED_SIZE section flag for target backends to use for output sections whose size has been fixed in the psABI. The size of such sections will not be changed anyhow by the generic linker and it is up to the target backend to get their size right. bfd/ * section.c (SEC_FIXED_SIZE): New macro. * bfd-in2.h: Regenerate. ld/ * ldlang.c (insert_pad): Do not change output section's size if SEC_FIXED_SIZE is set in the flags. (size_input_section): Likewise. (lang_size_sections_1): Likewise. (lang_reset_memory_regions): Likewise.
2018-02-19BFD: Remove unused SEC_HAS_GOT_REF section flagMaciej W. Rozycki3-16/+5
Remove the SEC_HAS_GOT_REF section flag no longer in use since commit a252afa4cdff ("Fix linking of PIC code on PA"), <https://sourceware.org/ml/binutils/2003-08/msg00467.html>, to make the bit position available for reuse. bfd/ * section.c (SEC_HAS_GOT_REF): Remove macro. * bfd-in2.h: Regenerate.
2018-02-19Add attribute printf to _bfd_error_handlerAlan Modra6-15/+28
and fix a few stray errors. * elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler arguments. * elfxx-mips.c (_bfd_mips_elf_final_link): Likewise. * elfnn-riscv.c (_bfd_riscv_relax_align): Likewise. (_bfd_riscv_relax_pc): Likewise and fix typos. * libbfd-in.h (_bfd_error_handler): Add attribute printf. * libbfd.h: Regenerate.
2018-02-19Don't use %llAlan Modra3-6/+12
* dwarf2.c (read_section): Don't use 'll' format modifier. (find_abstract_instance): Likewise. * elfcore.h (elf_core_file_p): Likewise.
2018-02-19%L conversionsAlan Modra66-461/+603
* bfd-in.h: Include inttypes.h or if not available define PRId64, PRIu64 and PRIx64. * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L modifier to print bfd_vma. * coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c, * peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64, and cast input to uint64_t, and similarly for Ld and Lu. * bfd-in2.h: Regenerate.
2018-02-19Use %pI, %pR, %pS, %pT in place of %I, %R, %S and %T.Alan Modra34-189/+204
bfd/ * elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c, * elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c, * elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * reloc.c: Replace use of %R and %T in format strings passed to einfo and friends by %pR and %pT. ld/ * ldmisc.c (vfinfo) Handle %pI, %pR, %pS and %pT in place of %I, %R, %S and %T. * ldcref.c, * ldctor.c, * ldemul.c, * ldexp.c, * ldgram.y, * ldlang.c, * ldlex.l, * ldmain.c, * ldmisc.c, * pe-dll.c, * emultempl/sh64elf.em: Replace use of of %I, %R, %S and %T in format strings passed to einfo and friends by %pI, %pR, %pS and %pT.
2018-02-19Use %pA and %pB in messages rather than %A and %BAlan Modra149-1309/+1473
First step towards compiler verification of _bfd_error_handler arguments, and better verification of translated messages. bfd/ * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place of %A and %B. * aout-adobe.c: Update all messages using %A and %B. * aout-cris.c: Likewise. * aoutx.h: Likewise. * archive.c: Likewise. * binary.c: Likewise. * cache.c: Likewise. * coff-alpha.c: Likewise. * coff-arm.c: Likewise. * coff-i860.c: Likewise. * coff-mcore.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic4x.c: Likewise. * coff-tic54x.c: Likewise. * coff-tic80.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * coffswap.h: Likewise. * compress.c: Likewise. * cpu-arm.c: Likewise. * ecoff.c: Likewise. * elf-attrs.c: Likewise. * elf-eh-frame.c: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-properties.c: Likewise. * elf-s390-common.c: Likewise. * elf.c: Likewise. * elf32-arc.c: Likewise. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-d10v.c: Likewise. * elf32-d30v.c: Likewise. * elf32-epiphany.c: Likewise. * elf32-fr30.c: Likewise. * elf32-frv.c: Likewise. * elf32-gen.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i370.c: Likewise. * elf32-i386.c: Likewise. * elf32-i960.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc12.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mcore.c: Likewise. * elf32-mep.c: Likewise. * elf32-metag.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-moxie.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-nds32.c: Likewise. * elf32-nios2.c: Likewise. * elf32-or1k.c: Likewise. * elf32-pj.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-sh64.c: Likewise. * elf32-sparc.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-v850.c: Likewise. * elf32-vax.c: Likewise. * elf32-visium.c: Likewise. * elf32-wasm32.c: Likewise. * elf32-xgate.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-gen.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-sparc.c: Likewise. * elf64-x86-64.c: Likewise. * elfcode.h: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * elfnn-riscv.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.c: Likewise. * hpux-core.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * libbfd.c: Likewise. * linker.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * oasys.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * peXXigen.c: Likewise. * peicode.h: Likewise. * reloc.c: Likewise. * rs6000-core.c: Likewise. * srec.c: Likewise. * stabs.c: Likewise. * vms-alpha.c: Likewise. * xcofflink.c: Likewise. ld/ * ldmisc.c (vfinfo): Handle %pA and %pB in place of %A and %B. * ldcref.c: Update all messages using %A and %B. * ldexp.c: Likewise. * ldlang.c: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * pe-dll.c: Likewise. * plugin.c: Likewise. * emultempl/beos.em: Likewise. * emultempl/cr16elf.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/m68kelf.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/nds32elf.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/xtensaelf.em: Likewise.
2018-02-19ld: Add -z separate-code tests to frame.expH.J. Lu2-15/+26
On x86, "-z separate-code" leads to assertion fail at bfd/elf.c:5917. Alsp skip tests if -shared isn't supported. PR ld/22845 * testsuite/ld-elf/frame.exp: Skip if -shared isn't supported. Add tests for "-z noseparate-code" and "-z separate-code". Remove unsupported -shared check.
2018-02-19[ARM] Fix bxns maskThomas Preud'homme2-1/+5
Bit 7 of BXNS is a fixed bit which distinguish it from BLXNS. Yet it is not set in the disassembler entry mask. This commit fixes that. 2018-02-19 Thomas Preud'homme <thomas.preudhomme@arm.com> opcodes/ * arm-dis.c (thumb_opcodes): Fix BXNS mask.
2018-02-19Fix mistake in the declaration of the --include-all-whitespace option of the ↵Matthias Klose2-1/+6
strings utility. * strings.c (long_options): Include-all-whitespace does not take an extra agument.
2018-02-19Add common/ dir in build directoriesAlan Hayward9-101/+81
gdb/ * Makefile.in: (COMMON_SFILES): Add common/*.c files. (SFILES): Remove common/*.c files. (COMMON_OBS): Remove some *.o files built from common/*.c files. * common/common.host: Add common reference. * configure.ac: Likewise. * configure: Regenerate. gdbserver/ * Makefile.in: Add common directory in build. * configure.ac: Add common reference. * configure: Regenerate.
2018-02-19PT_LOAD and PT_GNU_RELRO segment overlapAlan Modra2-13/+18
Commit 325ba6fb34 excluded degenerate zero length PT_LOAD segments, but that only fixed part of the problem, which was that the load segment limits were not calculated properly. PR 22845 * elf.c (IS_TBSS): Define. (_bfd_elf_map_sections_to_segments): Use IS_TBSS. (assign_file_positions_for_non_load_sections): Revert last change. Properly calculate load segment limits to compare against relro limits.
2018-02-19Automatic date update in version.inGDB Administrator1-1/+1
2018-02-18Automatic date update in version.inGDB Administrator1-1/+1
2018-02-17ld-elf/ehdr_start: Pass --build-id to ldH.J. Lu2-1/+6
ld-elf/ehdr_start fails with -z separate-code. Since there is no data LOAD segment before code LOAD segment: There are 2 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000 LOAD 0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R 0x200000 Section to Segment mapping: Segment Sections... 00 .text 01 .rodata the program header isn't included in any LOAD segment. As the result, reference to __ehdr_start is resolved to zero. Pass --build-id to ld to add a data LOAD segment before code LOAD segment to put the program header in the data LOAD segment. PR ld/22845 * testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.
2018-02-17ld: Add -z separate-code test for zero size sectionH.J. Lu2-2/+10
PR ld/22845 * testsuite/ld-elf/binutils.exp (tls_opts): Add tests for "-z noseparate-code" and "-z separate-code".
2018-02-17ld-elf/eh4: Pass -z max-page-size=0x200000 -z noseparate-code to ldH.J. Lu2-1/+7
-z separate-code creates separate code LOAD segment, aligns it to the maximum page size and places .plt section before .text section. But ld-elf/eh4 passes -Ttext 0x400 to linker to place .text section at address 0x400, which is impossible for linker to accomplish: $ ld -shared -Ttext 0x400 -z separate-code -o x.so eh4.o ld: section .eh_frame LMA [0000000000200000,000000000020006b] overlaps section .plt LMA [0000000000200000,000000000020001f] Since ld-elf/eh4 also checks exact addresses, this patch passes -z max-page-size=0x200000 -z noseparate-code to ld. PR ld/22845 * ld-elf/eh4.d: Pass -z max-page-size=0x200000 -z noseparate-code to ld.
2018-02-17Add .nop assembler directiveH.J. Lu30-111/+812
Implement the '.nop SIZE[, CONTROL]' assembler directive, which emits SIZE bytes filled with no-op instructions. SIZE is absolute expression. The optional CONTROL byte controls how no-op instructions should be generated. If the comma and @var{control} are omitted, CONTROL is assumed to be zero. For Intel 80386 and AMD x86-64 targets, CONTROL byte specifies the size limit of a single no-op instruction. The valid values of CONTROL byte are between 0 and 8 for 16-bit mode, between 0 and 10 for 32-bit mode, between 0 and 11 for 64-bit mode. When 0 is used, the no-op size limit is set to the maximum supported size. 2 new relax states, rs_space_nop and rs_fill_nop, are added to enum _relax_state, which are similar to rs_space and rs_fill, respectively, but they fill with no-op instructions, instead of a single byte. A target backend must override the default md_generate_nops to generate proper no-op instructions. Otherwise, an error of unimplemented .nop directive will be issued whenever .nop directive is used. * NEWS: Mention .nop directive. * as.h (_relax_state): Add rs_space_nop and rs_fill_nop. * read.c (potable): Add .nop. (s_nop): New function. * read.h (s_nop): New prototype. * write.c (cvt_frag_to_fill): Handle rs_space_nop and rs_fill_nop. (md_generate_nops): New function. (relax_segment): Likewise. (write_contents): Use md_generate_nops for rs_fill_nop. * config/tc-i386.c (alt64_11): New. (alt64_patt): Likewise. (md_convert_frag): Handle rs_space_nop. (i386_output_nops): New function. (i386_generate_nops): Likewise. (i386_align_code): Call i386_output_nops. * config/tc-i386.h (i386_generate_nops): New. (md_generate_nops): Likewise. * doc/as.texinfo: Document .nop directive. * testsuite/gas/i386/i386.exp: Run .nop directive tests. * testsuite/gas/i386/nop-1.d: New file. * testsuite/gas/i386/nop-1.s: Likewise. * testsuite/gas/i386/nop-2.d: Likewise. * testsuite/gas/i386/nop-2.s: Likewise. * testsuite/gas/i386/nop-3.d: Likewise. * testsuite/gas/i386/nop-3.s: Likewise. * testsuite/gas/i386/nop-4.d: Likewise. * testsuite/gas/i386/nop-4.s: Likewise. * testsuite/gas/i386/nop-5.d: Likewise. * testsuite/gas/i386/nop-5.s: Likewise. * testsuite/gas/i386/nop-6.d: Likewise. * testsuite/gas/i386/nop-6.s: Likewise. * testsuite/gas/i386/nop-bad-1.l: Likewise. * testsuite/gas/i386/nop-bad-1.s: Likewise. * testsuite/gas/i386/x86-64-nop-1.d: Likewise. * testsuite/gas/i386/x86-64-nop-2.d: Likewise. * testsuite/gas/i386/x86-64-nop-3.d: Likewise. * testsuite/gas/i386/x86-64-nop-4.d: Likewise. * testsuite/gas/i386/x86-64-nop-5.d: Likewise. * testsuite/gas/i386/x86-64-nop-6.d: Likewise.
2018-02-17Automatic date update in version.inGDB Administrator1-1/+1
2018-02-17Ignore degenerate PT_LOAD segmentsAlan Modra2-0/+8
Fixes a failure triggered by -z separate-code. p_memsz is tested rather than p_filesz for objcopy --only-keep-debug where p_filesz is set to zero. PR 22845 * elf.c (assign_file_positions_for_non_load_sections): Ignore degenerate zero size PT_LOAD segments when finding one overlapping the PT_GNU_RELRO segment.
2018-02-16x86-64: Add -z max-page-size=0x200000 -z noseparate-code to linker testsH.J. Lu51-50/+104
Add -z max-page-size=0x200000 -z noseparate-code since these tests check for exact addresses. * testsuite/ld-x86-64/bnd-branch-1-now.d: Add -z max-page-size=0x200000 -z noseparate-code. * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/load1a.d: Likewise. * testsuite/ld-x86-64/load1b.d: Likewise. * testsuite/ld-x86-64/load1c.d: Likewise. * testsuite/ld-x86-64/load1d.d: Likewise. * testsuite/ld-x86-64/pie3.d: Likewise. * testsuite/ld-x86-64/pr14207.d: Likewise. * testsuite/ld-x86-64/pr17618.d: Likewise. * testsuite/ld-x86-64/pr19162.d: Likewise. * testsuite/ld-x86-64/pr19636-2d.d: Likewise. * testsuite/ld-x86-64/pr19636-2l.d: Likewise. * testsuite/ld-x86-64/pr20253-1b.d: Likewise. * testsuite/ld-x86-64/pr20253-1d.d: Likewise. * testsuite/ld-x86-64/pr20253-1f.d: Likewise. * testsuite/ld-x86-64/pr20253-1h.d: Likewise. * testsuite/ld-x86-64/pr20253-1j.d: Likewise. * testsuite/ld-x86-64/pr20253-1l.d: Likewise. * testsuite/ld-x86-64/pr20830a-now.d: Likewise. * testsuite/ld-x86-64/pr20830a.d: Likewise. * testsuite/ld-x86-64/pr20830b-now.d: Likewise. * testsuite/ld-x86-64/pr20830b.d: Likewise. * testsuite/ld-x86-64/pr21038a-now.d: Likewise. * testsuite/ld-x86-64/pr21038a.d: Likewise. * testsuite/ld-x86-64/pr21038b-now.d: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038c-now.d: Likewise. * testsuite/ld-x86-64/pr21038c.d: Likewise.
2018-02-16x86-64: Update tests for -z separate-codeH.J. Lu3-10/+15
"-z separate-code" generates different addresses. Update these tests to accept any addresses. * testsuite/ld-x86-64/bnd-ifunc-1.d: Updated. * testsuite/ld-x86-64/ilp32-4.d: Likewise.
2018-02-16mpx.exp: Add -z max-page-size=0x200000 -z noseparate-codeH.J. Lu2-3/+11
Add -z max-page-size=0x200000 -z noseparate-code since these tests check for exact addresses. * testsuite/ld-x86-64/mpx.exp: Add -z max-page-size=0x200000 -z noseparate-code.
2018-02-16x86-64.exp: Add -z noseparate-code -z max-page-size=0x200000H.J. Lu2-18/+48
Add -z noseparate-code -z max-page-size=0x200000 since these tests check for exact addresses and don't expect extra PT_LOAD segment. But don't add them to nacl targets since they generate different addresses. * testsuite/ld-x86-64/x86-64.exp: Add -z noseparate-code -z max-page-size=0x200000, excluding NaCl target.
2018-02-16x86: Add -z noseparate-code to IFUNC testsH.J. Lu8-7/+17
Add -z noseparate-code since these tests check for exact addresses. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-21-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-22-i386.d: Likewise. * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. * testsuite/ld-ifunc/pr17154-i386.d: Likewise.
2018-02-16x86-64: Add -z max-page-size=0x200000 -z noseparate-code to IFUNC testsH.J. Lu8-7/+18
Add -z max-page-size=0x200000 -z noseparate-code since these tests check for exact addresses. * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Add -z max-page-size=0x200000 -z noseparate-code. * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
2018-02-16i386: Update IFUNC tests for PLT addressH.J. Lu4-3/+9
i386 generates 161: e8 ea ff ff ff call 150 <*ABS*@plt> instead of 1e1: e8 ea ff ff ff callq 1d0 <*ABS*+0x1e0@plt> * testsuite/ld-ifunc/ifunc-1-local-x86.d: Update PLT address for i386. * testsuite/ld-ifunc/ifunc-1-x86.d: Likewise. * testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.
2018-02-16x86: Update IFUNC tests for -z separate-codeH.J. Lu4-3/+9
"-z separate-code" generates different PLT addresses. Update these tests to accept any PLT addresses. * testsuite/ld-ifunc/ifunc-1-local-x86.d: Updated. * testsuite/ld-ifunc/ifunc-1-x86.d: Likewise. * testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.
2018-02-16i386: Add -z noseparate-code to linker testsH.J. Lu20-19/+41
Add -z noseparate-code since these tests check for exact addresses. * testsuite/ld-i386/ibt-plt-1.d: Add -z noseparate-code. * testsuite/ld-i386/ibt-plt-2a.d: Likewise. * testsuite/ld-i386/ibt-plt-2b.d: Likewise. * testsuite/ld-i386/ibt-plt-2c.d: Likewise. * testsuite/ld-i386/ibt-plt-2d.d: Likewise. * testsuite/ld-i386/ibt-plt-3a.d: Likewise. * testsuite/ld-i386/ibt-plt-3b.d: Likewise. * testsuite/ld-i386/ibt-plt-3c.d: Likewise. * testsuite/ld-i386/ibt-plt-3d.d: Likewise. * testsuite/ld-i386/load1.d: Likewise. * testsuite/ld-i386/pie1.d: Likewise. * testsuite/ld-i386/pr20244-1a.d: Likewise. * testsuite/ld-i386/pr20244-1b.d: Likewise. * testsuite/ld-i386/pr20244-2a.d: Likewise. * testsuite/ld-i386/pr20244-2b.d: Likewise. * testsuite/ld-i386/pr20244-2c.d: Likewise. * testsuite/ld-i386/pr20244-4a.d: Likewise. * testsuite/ld-i386/pr20244-4b.d: Likewise. * testsuite/ld-i386/pr20830.d: Likewise.
2018-02-16i386: Update tests for -z separate-codeH.J. Lu7-6/+15
"-z separate-code" generates: 0x00002080 00200000 00000000 00000000 00000000 . .............. There is a space ' ', instead of '.'. Update these tests to expect ".*". * testsuite/ld-i386/pr19636-1a.d: Updated. * testsuite/ld-i386/pr19636-1b.d: Likewise. * testsuite/ld-i386/pr19636-1j.d: Likewise. * testsuite/ld-i386/pr19636-1k.d: Likewise. * testsuite/ld-i386/pr19636-2a.d: Likewise. * testsuite/ld-i386/pr19636-2b.d: Likewise.
2018-02-16i386.exp: Add -z noseparate-codeH.J. Lu2-9/+22
These tests fail due to one extra PT_LOAD segment with -z separate-code. * testsuite/ld-i386/i386.exp: Add -z noseparate-code.
2018-02-16New class allocate_on_obstackYao Qi5-24/+50
This patch adds a new class allocate_on_obstack, and let dwarf2_per_objfile inherit it, so that dwarf2_per_objfile is automatically allocated on obstack, and "delete dwarf2_per_objfile" doesn't de-allocate any space. gdb: 2018-02-16 Yao Qi <yao.qi@linaro.org> * block.c (block_namespace_info): Inherit allocate_on_obstack. (block_initialize_namespace): Use new. * dwarf2read.c (dwarf2_per_objfile): Inherit allocate_on_obstack. (dwarf2_free_objfile): Use delete. * gdbtypes.c (type_pair): Inherit allocate_on_obstack. (copy_type_recursive): Use new. * gdb_obstack.h (allocate_on_obstack): New.
2018-02-16Add -z noseparate-code to ld-elf testsH.J. Lu6-5/+13
These tests fail due to one extra PT_LOAD segment with -z separate-code. * testsuite/ld-elf/pr19162.d: Add -z noseparate-code. * testsuite/ld-elf/textaddr1.d: Likewise. * testsuite/ld-elf/textaddr2.d: Likewise. * testsuite/ld-elf/textaddr4.d: Likewise. * testsuite/ld-elf/textaddr6.d: Likewise.
2018-02-16Remove bfd stub function casts.Alan Modra94-1211/+2306
This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15Fix symbol resolution with linker plugins for defsym symbols.Sriraman Tallam10-13/+261
2018-02-07 Sriraman Tallam <tmsriram@google.com> * expression.cc (Symbol_expression::set_expr_sym_in_real_elf): New method. (Unary_expression::set_expr_sym_in_real_elf): New method. (Binary_expression::set_expr_sym_in_real_elf): New method. (Trinary_expression::set_expr_sym_in_real_elf): New method. * plugin.cc (get_symbol_resolution_info): Fix symbol resolution if defined or used in defsyms. * plugin.h (Plugin_manager::is_defsym_def): New method. (Plugin_manager::Plugin_manager): Initialize defsym_defines_set_. (Plugin_manager::defsym_defines_set_): New member. (Plugin_manager::Defsym_defines_set): New typedef. * script.cc (Script_options::set_defsym_uses_in_real_elf): New method. (Script_options::find_defsym_defs): New method. * script.h (Expression::set_expr_sym_in_real_elf): New method. (Symbol_assignment::is_defsym): New method. (Symbol_assignment::value): New method. (Script_options::find_defsym_defs): New method. (Script_options::set_defsym_uses_in_real_elf): New method. * testsuite/Makefile.am (plugin_test_defsym): New test. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test.c: Check for new symbol resolution. * testsuite/plugin_test_defsym.sh: New script. * testsuite/plugin_test_defsym.c: New test source.
2018-02-16Automatic date update in version.inGDB Administrator1-1/+1
2018-02-15RISC-V: Fix relocation failure with zero address sections.Jim Wilson2-0/+9
bfd/ * elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore symbols whose section address is zero.
2018-02-15RISC-V: Give error for ignored pcrel_lo addend.Jim Wilson6-6/+54
bfd/ * elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous when pcrel_lo reloc has an addend. Use reloc_dangerous callback for bfd_reloc_dangerous. Use einfo instead of warning callback for errors. Add %X%P to error messages. ld/ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run pcrel-lo-addend test. * testsuite/ld-riscv-elf/pcrel-lo-addend.d: New. * testsuite/ld-riscv-elf/pcrel-lo-addend.s: New.
2018-02-15Fix AArch32 build attributes for Armv8.4-A.Tamar Christina3-1/+23
The build attribute number for Armv8.4-A is currently incorrectly set to that of Armv8-M. This patch fixes that by setting it as part of the Armv8-A family and adds a test for it. gas/ 2018-02-15 Tamar Christina <tamar.christina@arm.com> * config/tc-arm.c (cpu_arch_ver): Renumber ARM_ARCH_V8_4A. * testsuite/gas/arm/attr-march-armv8_4-a.d: New.
2018-02-15PR ld/22832 on SPARC.Eric Botcazou2-1/+9
The fix for PR ld/22727 on SPARC passed TRUE as the 'create' argument in the call to bfd_link_hash_lookup. It turns out this was a bad idea because, if the symbol is created at this point, the link will abort later in elf_link_output_extsym. This changes the TRUE into a FALSE and puts an assertion on the result of the call, making it easier to debug the issue; that's exactly in keeping with what Gold does. bfd/ * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>: Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup and assert that the result of the call is not NULL.
2018-02-15Reset inferior::control on inferior exitYao Qi2-0/+7
When we kill an inferior, the inferior is not deleted. What is more, it is reused when the new process is created, so we need to reset inferior's state when it exits. gdb: 2018-02-15 Yao Qi <yao.qi@linaro.org> PR gdb/22849 * inferior.c (exit_inferior_1): Reset inf->control.
2018-02-14delete ada-lang.c::ada_to_fixed_value_create advance declarationJoel Brobecker2-3/+5
This advance declaration really isn't necesary, since the implementation of this function comes before the first reference to it. gdb/ChangeLog: * ada-lang.c (ada_to_fixed_value_create): Delete advance declaration. Tested by rebuilding GDB.
2018-02-15Automatic date update in version.inGDB Administrator1-1/+1
2018-02-14Fix GDB crash after Quit thrown from unwinder snifferPedro Alves4-1/+25
I ran into a GDB crash in gdb.base/bp-cmds-continue-ctrl-c.exp in my multi-target branch, which turns out exposed a bug that exists in master too. That testcase has a breakpoint with a "continue" command associated. Then the breakpoint is constantly being hit. At the same time, the testcase is continualy interrupting the program with Ctrl-C, and re-resuming it, in a loop. Running that testcase manually under Valgrind, after a few sequences of 'Ctrl-C' + 'continue', I got: Breakpoint 1, Quit (gdb) ==21270== Invalid read of size 8 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==21270== ==21270== ==21270== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==21270== Access not within mapped region at address 0x0 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== If you believe this happened as a result of a stack ==21270== overflow in your program's main thread (unlikely but ==21270== possible), you can try to increase the size of the ==21270== main thread stack using the --main-stacksize= flag. ==21270== The main thread stack size used in this run was 8388608. ==21270== Above, when we get to compute_frame_id, fi->unwind is non-NULL, meaning, we found an unwinder, in this case the Python unwinder, but somehow, fi->prologue_cache is left NULL. pyuw_this_id then crashes because it assumes fi->prologue_cache is non-NULL: static void pyuw_this_id (struct frame_info *this_frame, void **cache_ptr, struct frame_id *this_id) { *this_id = ((cached_frame_info *) *cache_ptr)->frame_id; ^^^^^^^^^^ '*cache_ptr' here is 'fi->prologue_cache'. There's a quit() call in pyuw_sniffer that I believe is the one that sometimes triggers the crash above. The crash can be reproduced easily with this hack to force a quit out of the python unwinder: --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -497,6 +497,8 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, struct gdbarch *gdbarch = (struct gdbarch *) (self->unwind_data); cached_frame_info *cached_frame; + quit (); + gdbpy_enter enter_py (gdbarch, current_language); TRACE_PY_UNWIND (3, "%s (SP=%s, PC=%s)\n", __FUNCTION__, After that quit is thrown, any subsequent operation that involves unwinding results in GDB crashing with SIGSEGV like above. The problem is that this commit: commit 30a9c02feff56bd58a276c2a7262f364baa558ac CommitDate: Sun Oct 8 23:16:42 2017 -0600 Subject: Remove cleanup from frame_prepare_for_sniffer missed that we need to call frame_cleanup_after_sniffer before rethrowing the exception too. Without the fix, the "bt" added to gdb.base/bp-cmds-continue-ctrl-c.exp in this commit makes GDB crash: Running src/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp ... ERROR: Process no longer exists gdb/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * frame-unwind.c (frame_unwind_try_unwinder): Always call frame_cleanup_after_sniffer on exception. gdb/testsuite/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * gdb.base/bp-cmds-continue-ctrl-c.exp (do_test): Test "bt" after getting a "Quit".
2018-02-14Constify target_so_ops::bfd_openTom Tromey6-9/+20
This constifies the bfd_open method of struct target_so_ops. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solist.h (struct target_so_ops) <bfd_open>: Make pathname const. (solib_bfd_open): Make pathname const. * solib.c (solib_bfd_open): Make pathname const. * solib-spu.c (spu_bfd_fopen): Make name const. (spu_bfd_open): Make pathname const. * solib-darwin.c (darwin_bfd_open): Make pathname const. * solib-aix.c (solib_aix_bfd_open): Make pathname const.