aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-03Fix integer overflow problems when reading an ELF binary with corrupt ↵Nick Clifton2-25/+50
augmentation data. PR 22386 * dwarf.c (read_cie): Use bfd_size_type for augmentation_data_len. (display_augmentation_data): New function. (display_debug_frames): Use it. Check for integer overflow when testing augmentation_data_len.
2017-11-03[ARC] Sync opcode data base.claziss3-1588/+3455
New EM and HS variants are developed, sync the data base to match them. opcodes/ 2017-11-03 Claudiu Zissulescu <claziss@synopsys.com> * arc-tbl.h (abss, abssh, adc, adcs, adds, aslacc, asls, aslsacc) (asrs, asrsr, cbflyhf0r, cbflyhf1r, cmacchfr, cmacchnfr, cmachfr) (cmachnfr, cmpychfr, cmpychnfr, cmpyhfmr, cmpyhfr, cmpyhnfr, divf) (dmachbl, dmachbm, dmachf, dmachfr, dmacwhf, dmpyhbl, dmpyhbm) (dmpyhf, dmpyhfr, dmpyhwf, dmpywhf, dsync, flagacc, getacc, macdf) (macf, macfr, macwhfl, macwhflr, macwhfm, macwhfmr, macwhkl) (macwhkul, macwhl, macwhul, mpydf, mpyf, mpyfr, mpywhfl, mpywhflr) (mpywhfm, mpywhfmr, mpywhkl, mpywhkul, mpywhl, mpywhul, msubdf) (msubf, msubfr, msubwhfl, msubwhflr, msubwhfm, msubwhfmr, mul64) (negs, negsh, normacc, qmachf, qmpyh, qmpyhf, rndh, satf, sath) (sbcs, setacc, sflag, sqrt, sqrtf, subs, swi_s, vabs2h, vabss2h) (vadd4b, vadds2, vadds2h, vadds4h, vaddsubs, vaddsubs2h) (vaddsubs4h, valgn2h, vasl2h, vasls2h, vasr2h, vasrs2h, vasrsr2h) (vext2bhl, vext2bhlf, vext2bhm, vext2bhmf, vlsr2h, vmac2hf) (vmac2hfr, vmac2hnfr, vmax2h, vmin2h, vmpy2h, vmpy2hf, vmpy2hfr) (vmpy2hwf, vmsub2hf, vmsub2hfr, vmsub2hnfr, vneg2h, vnegs2h) (vnorm2h, vpack2hbl, vpack2hblf, vpack2hbm, vpack2hbmf, vpack2hl) (vpack2hm, vperm, vrep2hl, vrep2hm, vsext2bhl, vsext2bhm, vsub4b) (vsubadds, vsubadds2h, vsubadds4h, vsubs2, vsubs2h, vsubs4h): Changed opcodes. (prealloc, prefetch*): Place them before ld instruction. * arc-opc.c (skip_this_opcode): Add ARITH class.
2017-11-03Skip gdb.mi/list-thread-groups-available.exp if no xml supportYao Qi2-0/+11
I see the following test fail in gdb (configured --with-expat=no), -list-thread-groups --available^M &"warning: Can not parse XML OS data; XML support was disabled at compile time\n"^M ^error,msg="Can not fetch data now."^M (gdb) ^M FAIL: gdb.mi/list-thread-groups-available.exp: list available thread groups (unexpected output) This patch skips it if XML parsing in GDB is disabled, like what you did in gdb.mi/mi-info-os.exp. gdb/testsuite: 2017-11-03 Yao Qi <yao.qi@linaro.org> * gdb.mi/list-thread-groups-available.exp: Skip it if XML parsing in GDB is disabled.
2017-11-03Fix excessive memory allocation attempts and possible integer overfloaws ↵Nick Clifton2-2/+23
when attempting to read a COFF binary with a corrupt symbol count. PR 22385 * coffgen.c (_bfd_coff_get_external_symbols): Check for an overlarge raw syment count. (coff_get_normalized_symtab): Likewise.
2017-11-03Skip gdb.python/py-thrhandle.exp if python is not enabled.Yao Qi2-0/+9
gdb/testsuite: 2017-11-03 Yao Qi <yao.qi@linaro.org> * gdb.python/py-thrhandle.exp: Skip it if python is not enabled.
2017-11-03Automatic date update in version.inGDB Administrator1-1/+1
2017-11-02aarch64: Remove AARCH64_FEATURE_F16 from AARCH64_ARCH_V8_2Siddhesh Poyarekar2-1/+5
The FP16 feature is optional in ARMv8.2, so it is wrong to add it to the default AARCH64_ARCH_V8_2 feature flags. This patch makes the behaviour consistent with that of gcc, which also does not assume FP16 for ARMv8.2. include/ * opcode/aarch64.h (AARCH64_ARCH_V8_2): Drop AARCH64_FEATURE_F16.
2017-11-02Work around integer overflows when readelf is checking for corrupt ELF notes ↵Mingi Cho2-16/+23
when run on a 32-bit host. PR 22384 * readelf.c (print_gnu_property_note): Improve overflow checks so that they will work on a 32-bit host.
2017-11-02Construct readonly regcache without address spaceYao Qi6-12/+18
The address space is useless to readonly regcache, so this patch removes the parameter to construct readonly regcache. address_space was added in regcache by 6c95b8d, but for read-write regcache. regcache::aspace is used for various breakpoint/watchpoint checking, and these regcache are not read-only regcache. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * frame.c (do_frame_register_read): Remove aspace. * jit.c (jit_frame_sniffer): Likwise. * ppc-linux-tdep.c (ppu2spu_sniffer): Likewise. * regcache.c (regcache::regcache): Pass nullptr. (regcache_print): Caller updated. * regcache.h (regcache::regcache): Remove one constructor parameter aspace.
2017-11-02const-fy regcache::m_readonly_pYao Qi2-1/+5
gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.h (regcache) <m_readonly_p>: Change it to const bool.
2017-11-02const-fy regcache::m_aspaceYao Qi11-31/+56
regcache::m_aspace is a const, never changed during the lifetime of regcache object. The address_space object is a const object too. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * breakpoint.c (insert_single_step_breakpoints): Update. * frame.c (struct frame_info) <aspace>: Add const. (frame_save_as_regcache): Add const. (get_frame_address_space): Return const address_space *. * frame.h (get_frame_address_space): Update declaration. * infrun.c (struct step_over_info) <aspace>: Add const. (set_step_over_info): Make aspace const. (displaced_step_prepare_throw): Change variable const. (resume): Likewise. (proceed): Likewise. (adjust_pc_after_break): Likewise. (save_waitstatus): Likewise. (handle_signal_stop): Likewise. (keep_going_pass_signal): Likewise. * jit.c (jit_frame_sniffer): Add const. * mips-tdep.c (mips_single_step_through_delay): Likewise. * ppc-linux-tdep.c (ppu2spu_sniffer): Likewise. * record-full.c (record_full_wait_1): Likewise. * regcache.c (regcache::regcache): Change parameter to const. * regcache.h (regcache::regcache): Likewise. (regcache::aspace): Return const address_space *. (regcache) <m_aspace>: Add const.
2017-11-02s/get_regcache_aspace (regcache)/regcache->aspace ()/gYao Qi8-36/+50
and remove get_regcache_aspace. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * darwin-nat.c (cancel_breakpoint): Use regcache->aspace (). * frame.c (create_sentinel_frame): Likewise. * infrun.c (displaced_step_prepare_throw): Likewise. (resume): Likewise. (thread_still_needs_step_over_bp): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_syscall_event): Likewise. (save_waitstatus): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (keep_going_pass_signal): Likewise. * linux-nat.c (status_callback): Likewise. (save_stop_reason): Likewise. (resume_stopped_resumed_lwps): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_wait_1): Likewise. * regcache.c (get_regcache_aspace): Remove. * regcache.h (get_regcache_aspace): Remove.
2017-11-02Remove regcache_descr::nr_raw_registersYao Qi3-13/+32
struct regcache_descr has fields nr_raw_registers and gdbarch, and nr_raw_registers can be got via gdbarch_num_regs (gdbarch), so it looks nr_raw_registers is redundant. This patch removes it and adds a protected method num_raw_registers. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache_descr) <nr_raw_registers>: Remove. (init_regcache_descr): Use gdbarch_num_regs. (regcache::regcache): Likewise. (regcache::get_register_status): Likewise. (regcache::assert_raw_regnum): Likewise. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache::cooked_write): Likewise. (regcache::dump): Likewise. (regcache::num_raw_registers): New method. * regcache.h (class regcache) <num_raw_registers>: New.
2017-11-02New method regcache::assert_regnumYao Qi3-13/+36
class regcache has some methods checking the range of register number, this patch is to move it in a new method assert_regnum. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache::assert_regnum): New method. (regcache::invalidate): Call assert_regnum. (regcache::raw_update): Likewise. (regcache::raw_write): Likewise. (regcache::raw_read_part): Likewise. (regcache::raw_write_part): Likewise. (regcache::raw_supply): Likewise. (regcache::raw_supply_integer): Likewise. (regcache::raw_supply_zeroed): Likewise. (regcache::raw_collect): Likewise. (regcache::raw_collect_integer): Likewise. * regcache.h (regcache::assert_regnum): Declare.
2017-11-02Remove code wrapped by "#if 0"Yao Qi2-15/+4
These code wrapped by "#if 0" was added by af030b9a, which added the new command to dump registers in 2002. The email didn't mention this either https://sourceware.org/ml/gdb-patches/2002-08/msg00227.html It was there for 15 years, and nobody needs it, so we can remove it. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache::dump): Remove code.
2017-11-02Remove regcache_descr fields sizeof_raw_register_status and ↵Yao Qi2-9/+14
sizeof_cooked_register_status struct regcache_descr has two fields sizeof_raw_register_status and sizeof_cooked_register_status, but they equal to nr_cooked_registers and nr_raw_registers respectively, so this patch removes them. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache_descr) <sizeof_raw_register_status>: Remove. <sizeof_cooked_register_status>: Remove. (init_regcache_descr): Update. (regcache::regcache): Use nr_cooked_registers and nr_raw_registers. (regcache::save): Likewise. (regcache::dump): Likewise.
2017-11-02[ARM] Help wince objdump on coproc testsThomas Preud'homme3-2/+8
Object files other than ELF do not have mapping symbols to indicate the type of data for objdump to work reliably. This is why the following tests FAIL on arm-wince-pe targets: ARMv6T2 Thumb CoProcessor Instructions (1) ARMv6T2 Thumb CoProcessor Instructions (2) This patch adds the force-thumb disassembler option to objdump for this test to PASS on these targets as well. 2017-11-02 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: Add --disassembler-options=force-thumb to objdump options. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: Likewise.
2017-11-01FT32: support for FT32B processor - part 2/2James Bowman4-13/+48
FT32B is a new FT32 family member. This patch adds support for the compressed instructions to gdb and sim. gdb/ChangeLog: * ft32-tdep.c (ft32_fetch_instruction): New function. (ft32_analyze_prologue): Use ft32_fetch_instruction(). sim/ChangeLog: * ft32/interp.c (step_once): Add ft32 shortcode decoder.
2017-11-02Automatic date update in version.inGDB Administrator1-1/+1
2017-11-01Merge remote-tracking branch 'origin/master' into users/hjl/linux/masterH.J. Lu327-2339/+7861
2017-11-01FT32B is a new FT32 family member. It has a code compression scheme, which ↵James Bowman32-392/+3875
requires the use of linker relaxations. The change is quite large, so submission is in several parts. Part 2 adds a relaxation pass, which actually implements the code compression scheme. bfd * archures.c: Add bfd_mach_ft32b. * cpu-ft32.c: Add arch_info_struct. * elf32-ft32.c: Add R_FT32_RELAX, SC0, SC1, DIFF32. (ft32_elf_relocate_section): Add clauses for R_FT32_SC0, SC1, DIFF32. (ft32_reloc_shortable, elf32_ft32_is_diff_reloc, elf32_ft32_adjust_diff_reloc_value, elf32_ft32_adjust_reloc_if_spans_insn, elf32_ft32_relax_delete_bytes, elf32_ft32_relax_is_branch_target, ft32_elf_relax_section): New function. * reloc.c: Add BFD_RELOC_FT32_RELAX, SC0, SC1, DIFF32. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas * config/tc-ft32.c (md_assemble): add relaxation reloc BFD_RELOC_FT32_RELAX. (md_longopts): Add "norelax" and "no-relax". (md_apply_fix): Add reloc BFD_RELOC_FT32_DIFF32. (relaxable_section, ft32_validate_fix_sub, ft32_force_relocation, ft32_allow_local_subtract): New function. * config/tc-ft32.h: remove unused MD_PCREL_FROM_SECTION. * testsuite/gas/ft32/insnsc.s: New test exercising all FT32B shortcodes. include * elf/ft32.h: Add R_FT32_RELAX, SC0, SC1, DIFF32.
2017-11-01Prevent illegal memory accesses when attempting to read excessively large ↵Nick Clifton2-0/+14
COFF line number tables. PR 22376 * coffcode.h (coff_slurp_line_table): Check for an excessively large line number count.
2017-11-01Update check for invalid values in pe_bfd_read_buildid function.Nick Clifton2-3/+8
PR 22373 * peicode.h (pe_bfd_read_buildid): Revise check for invalid size and offset in light of further possible bogus values.
2017-11-01Fix an invalid free called when attempting to link a COFF object against an ↵Nick Clifton4-3/+27
ELF archive with --no-keep-memory enabled. PR 22369 * coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF file. * cofflink.c (coff_link_check_archive_element): Skip non-COFF members of an archive.
2017-11-01[ARM] Fix Coprocessor instructions availabilityThomas Preud'homme26-35/+328
A few coprocessor instructions introduced in ARMv2 are currently accepted by GAS when targeting ARMv1 due to a typo in the code. This patch fixes the issue and introduce a more fine grained testing for coprocessor instructions availability. Coprocessor instructions are grouped as follows: * ARM coprocessor instructions introduced in ARMv2 Includes: ldc, stc, mcr, mrc, cdp, ldcl, stcl Guarded by: ARM_EXT_V2 Tests: copro-arm_v2plus-arm_v*.d * ARM coprocessor instructions introduced in ARMv5 Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2 Guarded by: ARM_EXT_V5 Tests: copro-arm_v5plus-arm_v*.d * ARM coprocessor instructions introduced in ARMv5TE Includes: mcrr, mrrc Guarded by: ARM_EXT_V5E Tests: copro-arm_v5teplus-arm_v*.d * ARM coprocessor instructions introduced in ARMv6 Includes: mcrr2, mrrc2 Guarded by: ARM_EXT_V6 Tests: copro-arm_v6plus-arm_v*.d * Thumb coprocessor instructions introduced in ARMv6T2 Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc, cdp, ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2, mrrc2 Guarded by: ARM_EXT_V6T2 Tests: copro-thumb_v6t2plus-thumb_v*.d For each of these groups, at least 2 tests are performed: * instructions are not available in earlier architecture * instructions are available in architecture where they were introduced More tests need to be performed when instructions in a group span several assembly files. Note that an instruction in the original coprocessor testcase is changed to unified syntax to allow the testcase to be assembled for ARM and Thumb state. Correct processing of legacy syntax is covered in other testcases. 2017-11-01 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit. * testsuite/gas/arm/copro.s: Split into ... * testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s: This while changing it to unified syntax and ... * testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s: this and ... * testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ... * testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s: This. * testsuite/gas/arm/copro.d: Split into ... * testsuite/gas/arm/copro-arm_v2plus-arm_v2.d: This but target ARMv2 and ... * testsuite/gas/arm/copro-arm_v5plus-arm_v5.d: this but target ARMv5 and ... * testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d: This but target ARMv5TE and ... * testsuite/gas/arm/copro-arm_v6plus-arm_v6.d: This but target ARMv6. * testsuite/gas/arm/copro-arm_v2plus-arm_v1.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d: New testcase. * testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: New testcase. * testsuite/gas/arm/copro-arm_v5plus-arm_v4.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d: New testcase. * testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: New testcase. * testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d: New testcase. * testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d: New testcase. * testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d: New testcase. * testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d: New testcase.
2017-11-01PR22374, PowerPC unnecessary PLT entriesAlan Modra5-13/+58
We don't need a PLT entry when function pointer initialization in a read/write section is the only reference to a given function symbol. This patch prevents the unnecessary PLT entry, and ensures no dynamic relocs are emitted when UNDEFWEAK_NO_DYNAMIC_RELOC says so. bfd/ PR 22374 * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't create a plt entry when just a dynamic reloc can serve. Ensure no dynamic relocations when UNDEFWEAK_NO_DYNAMIC_RELOC by setting non_got_ref. Expand and move the non_got_ref comment. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. ld/ * testsuite/ld-powerpc/ambiguousv2.d: Remove FIXME.
2017-11-01PR22374 testcase, function pointer references in .dataAlan Modra6-0/+39
Function pointer references in .data ought to use a dynamic reloc. There shouldn't be any need for a PLT entry and definitely no copy reloc. This test fails on quite a few targets, but isn't something that anyone should worry about too much. It's really just a missed optimization. PR 22374 * testsuite/ld-elf/pr22374a.s, * testsuite/ld-elf/pr22374b.s, * testsuite/ld-elf/pr22374-1.r, * testsuite/ld-elf/pr22374-2.r: New test. * testsuite/ld-elf/elf.exp: Run it.
2017-11-01Tidy elf.expAlan Modra2-36/+29
* testsuite/ld-elf/elf.exp: Merge some conditionals, a better name than "shared library for next test", and use xfail arg of run_ld_link_tests in a few places.
2017-10-31Use console uiout when executing breakpoint commandsSimon Marchi4-6/+31
As reported here https://sourceware.org/ml/gdb/2017-10/msg00020.html the output of certain commands, like backtrace, doesn't appear anywhere when it is run as a breakpoint command and when using MI. The reason is that the current_uiout is set to the mi_ui_out while these commands run, whereas we want the output as CLI output. Some commands like "print" work, because they use printf_filtered (gdb_stdout, ...) directly, bypassing the current ui_out. The fix I did is to force setting the cli_uiout as the current_uiout when calling execute_control_command. I am not sure if this is the right way to fix the problem, comments about the approach would be appreciated. I enhanced gdb.mi/mi-break.exp to test the backtrace command. Regtested on the buildbot. gdb/ChangeLog: * cli/cli-script.c (execute_control_command): Rename to ... (execute_control_command_1): ... this. (execute_control_command): New function. gdb/testsuite/ChangeLog: * gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace as a breakpoint command.
2017-11-01Automatic date update in version.inGDB Administrator1-1/+1
2017-10-31tracepoint: Remove unnecessary const_castSimon Marchi2-1/+5
We are passing a const char * to a const char * parameter, the const_cast is not necessary. gdb/ChangeLog: * tracepoint.c (tfind_command): Remove const_cast.
2017-10-31Fix illegal memory access triggered when parsing a PE binary with a corrupt ↵Nick Clifton2-3/+12
data dictionary. PR 22373 * peicode.h (pe_bfd_read_buildid): Check for invalid size and data offset values.
2017-10-31Remind users to use the --use-dynamic command line option to dump dynamic ↵Nick Clifton2-1/+21
relocations. * readelf.c (process_relocs): Tell users if no static relocs were found, but if they had added --use-dynamic to the command line then relocs would have been displayed.
2017-10-30gdb/Makefile.in: fix 'make tags' failureMike Gulick2-1/+4
'make tags' fails with the following error: make[2]: Entering directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb' make[2]: *** No rule to make target 'gdb.h', needed by 'TAGS'. Stop. make[2]: Leaving directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb' The file gdb/gdb.h was removed in commit 65630365f7d073430e62b4fe65f34dcdc0a4b05e. gdb/ChangeLog: 2017-10-30 Mike Gulick <mgulick@mathworks.com> * Makefile.in (HFILES_NO_SRCDIR): Remove reference to gdb.h.
2017-10-31Automatic date update in version.inGDB Administrator1-1/+1
2017-10-30Introduce in_inclusive_range, fix -Wtautological-compare warningsSimon Marchi4-9/+27
When compiling with clang or gcc 8, we see warnings like this: /home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:10013:13: error: comparison of 0 <= unsigned expression is always true [-Werror,-Wtautological-compare] if (0 <= insn_op1 && 3 >= insn_op1) ~ ^ ~~~~~~~~ /home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:11722:20: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] else if (opB >= 0 && opB <= 2) ~~~ ^ ~ This is because an unsigned integer (opB in this case) will always be >= 0. It is still useful to keep both bounds of the range in the expression, even if one is at the edge of the data type range. This patch introduces a utility function in_inclusive_range that gets rid of the warning while conveying that we are checking for a range. Tested by rebuilding. gdb/ChangeLog: * common/common-utils.h (in_inclusive_range): New function. * arm-tdep.c (arm_record_extension_space): Use in_inclusive_range. (thumb_record_ld_st_reg_offset): Use in_inclusive_range. * cris-tdep.c (cris_spec_reg_applicable): Use in_inclusive_range.
2017-10-30remote.c, QCatchSyscalls: Build std::string instead of unique_xmalloc_ptrPedro Alves2-15/+13
Simplify the code a little bit using std::string + string_appendf. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@ericsson.com> * remote.c (remote_set_syscall_catchpoint): Build a std::string instead of a gdb::unique_xmalloc_ptr, using string_appendf.
2017-10-30Introduce string_appendf/string_vappendfPedro Alves4-0/+104
string_appendf is like string_printf, but instead of allocating a new string, it appends to an existing string. This allows reusing a std::string's memory buffer across several calls, for example. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> * common/common-utils.c (string_appendf, string_vappendf): New functions. * common/common-utils.h (string_appendf, string_vappendf): New declarations. * unittests/common-utils-selftests.c (string_appendf_func) (test_appendf_func, string_vappendf_wrapper, string_appendf_tests) (string_vappendf_tests): New functions. (_initialize_common_utils_selftests): Register "string_appendf" and "string_vappendf tests".
2017-10-30Merge/shared string_printf and string_vprintf unit testsPedro Alves2-15/+38
Merge the string_printf and string_vprintf tests, running them all against both functions. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> * unittests/common-utils-selftests.c (format_func): New typedef. (string_printf_tests, string_vprintf_tests): Tests factored out and merged to ... (test_format_func): ... this new function. (string_printf_tests, string_vprintf_tests): Reimplement on top of test_format_func.
2017-10-29darwin-nat: Remove gdb.h includeSimon Marchi2-1/+4
gdb.h has been removed in Eliminate catch_exceptions/catch_exceptions_with_msg 65630365f7d073430e62b4fe65f34dcdc0a4b05e Remove the include in darwin-nat.c. Tested by rebuilding. gdb/ChangeLog: * darwin-nat.c: Remove include of gdb.h.
2017-10-30frv-elf --gc-sections failuresAlan Modra2-1/+5
git commit 81742b83e9 exposed an frv-elf bug, with the object id not matching the hash table id. * elf32-frv.c (ELF_TARGET_ID): Don't define for generic elf target.
2017-10-30relocs_compatible test for gc-sectionsAlan Modra2-0/+8
I noticed when looking at pr22300 that before calling check_relocs we have an elf_object_id test (added for pr11933) as well as the relocs_compatible test. I believe backend gc_mark_hook and gc_sweep_hook ought to be protected similarly from being confused by unexpected relocations (for example, both elf64-ppc.c and elf32-ppc.c use _bfd_elf_relocs_compatible, so I think it would be possible for the ppc64 gc_mark_hook to be presented with a ppc32 relocatable object). * elflink.c (elf_gc_sweep): Test elf_object_id in addition to relocs_compatible. (bfd_elf_gc_sections): Likewise.
2017-10-30Fix hppa-linux pr22269-1 failAlan Modra2-81/+92
Adds UNDEFWEAK_NO_DYNAMIC_RELOC in the rest of places needed in this file, reduces dynamic relocations in a number of cases, and removes some bogus code that was attempting to handle dynamic common symbols specially. PR 22269 * elf32-hppa.c (elf32_hppa_check_relocs): Move SEC_ALLOC test to ensure non_got_ref is not set due to debug references. (elf32_hppa_adjust_dynamic_symbol): Tidy plabel handling. Use SYMBOL_CALLS_LOCAL and UNDEFWEAK_NO_DYNAMIC_RELOC when determining need for a plt entry. (allocate_dynrelocs): Similarly for got entries. Tidy code discarding dynamic relocs when pic. Remove bogus code attempting to handle commons. (elf32_hppa_relocate_section): Similarly. Delete resolved_to_zero and simplify. (elf32_hppa_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC and SYMBOL_REFERENCES_LOCAL in GOT handling.
2017-10-30Automatic date update in version.inGDB Administrator1-1/+1
2017-10-29xtensa-xtregs: Fix formatting issuesSimon Marchi2-15/+20
Fix a few formatting issues in that file. gdb/ChangeLog: * xtensa-xtregs.c: Fix formatting issues.
2017-10-29xtensa-xtregs: Constify fieldSimon Marchi2-1/+5
Fix: In file included from /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c:46:0: /home/emaisin/src/binutils-gdb/gdb/xtensa-xtregs.c:37:1: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings] }; ^ gdb/ChangeLog: * xtensa-xtregs.c (xtensa_regtable_t) <name>: Constify.
2017-10-29Automatic date update in version.inGDB Administrator1-1/+1
2017-10-28Make gdb.selected_thread().inferior return a new referenceMaksim Dzabraev4-0/+22
thpy_get_inferior function should return a new reference to the existing inferior object, and therefore should increment its refcount. Fixed bug looks like this. If multiple time call gdb.selected_thread ().inferior, gdb throws exception: (gdb) pi gdb.selected_thread().inferior <gdb.Inferior object at 0x7f1952bea698> (gdb) pi gdb.selected_thread().inferior Python Exception <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'inferior': Error while executing Python code. (gdb) info threads Id Target Id Frame * 1 Thread 0x7f54f0474740 (LWP 584) "mc" 0x00007f54ef055c33 in
2017-10-28PR22361 readelf buffer overflow on fuzzed archive headerAlan Modra2-0/+18
PR 22361 * readelf.c (process_archive_index_and_symbols): Ensure ar_size field is zero terminated for strtoul. (setup_archive, get_archive_member_name): Likewise.
2017-10-28PR22300, Abort in elf32_hppa_relocate_section building polymlAlan Modra5-5/+11
polyml produces object files with the wrong OS/ABI for hppa-linux. This, along with the fact that elf32-hppa.c is using the strictest backend relocs_compatible, results in wrong merging of ELF symbols. So, remove the relocs_compatible check in _bfd_elf_merge_symbol. _bfd_elf_merge_symbol is only called nowadays from within blocks protected by is_elf_hash_table, so "we are doing an ELF link" as the removed comment says, is true. Also relax relocs_compatible for hppa and powerpc. relocs_compatible is used for more than just merging symbols, as the name suggests. This allows objects that are in fact reasonably compatible to be linked. PR 22300 * elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check. * elf32-hppa.c (elf_backend_relocs_compatible): Define. * elf32-ppc.c (elf_backend_relocs_compatible): Define. * elf64-ppc.c (elf_backend_relocs_compatible): Define.