aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-08-15sim: unify symbol table handlingMike Frysinger17-170/+164
The common sim tracing code already handles loading and tracking of symbols from the target program so that it can show symbol info in trace/disassembly calls. Once we touch up the trace code and add a few API callbacks, ports don't need to do loading and searching of symbol tables themselves anymore.
2016-08-15[GDB] Fix builds broken by proc-service changes.Matthew Wahab2-2/+8
GLIBC BZ#20311 introduced a change to install proc_service.h so that gdb didn't have to use the version it embeds in gdb_proc_service.h. The embedded version is guarded by HAVE_PROC_SERVICE_H and gdb_proc_service.h has a number other of includes and definitions, all of which are uncondional except for an include for gregset.h. This is only included if HAVE_PROC_SERIVCE_H is not defined. This causes a build failure when cross compiling gdb with the latest glibc because type definitions in gregset are used independently of HAVE_PROC_SERIVCE_H. In particular, they are used in gdb_proc_service.h when PRFPREGSET_T_BROKEN is set. The error messages on the failure are ---- binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does not name a type; did you mean ‘elf_fpregset_t’? typedef gdb_fpregset_t gdb_prfpregset_t; ^~~~~~~~~~~~~~ elf_fpregset_t binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does not name a type; did you mean ‘elf_fpregset_t’? typedef gdb_fpregset_t gdb_prfpregset_t; ^~~~~~~~~~~~~~ elf_fpregset_t binutils-gdb/gdb/proc-service.c:218:15: error: ‘gdb_prfpregset_t’ does not name a type; did you mean ‘gdb_fpregset_t’? const gdb_prfpregset_t *fpregset) ^~~~~~~~~~~~~~~~ gdb_fpregset_t ---- This patch moves the include for gregset.h to before the code guarded by HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to fix the build. 2016-08-15 Matthew Wahab <matthew.wahab@arm.com> PR gdb/20457 * gdb_proc_service.h: Add an include of gregset.h [!HAVE_PROC_SERVICE_H]: Remove the include of gregset.h.
2016-08-15Fix heap-buffer-overflow in explicit_location_lex_oneYao Qi2-3/+8
I build GDB with -fsanitize=address, and see the error in tests, (gdb) PASS: gdb.linespec/ls-errs.exp: lang=C++: break 3 foo break -line 3 foo^M =================================================================^M ==4401==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000047487 at pc 0x819d8e bp 0x7fff4e4e6bb0 sp 0x7fff4e4e6ba8^M READ of size 1 at 0x603000047487 thread T0^[[1m^[[0m^M #0 0x819d8d in explicit_location_lex_one /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:502^M #1 0x81a185 in string_to_explicit_location(char const**, language_defn const*, int) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:556^M #2 0x81ac10 in string_to_event_location(char**, language_defn const*) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:687^ the code in question is: > /* Special case: C++ operator,. */ > if (language->la_language == language_cplus > && strncmp (*inp, "operator", 8) <--- [1] > && (*inp)[9] == ',') > (*inp) += 9; > ++(*inp); The error is caused by the access to (*inp)[9] if 9 is out of its bounds. However [1] looks odd to me, because if strncmp returns true (non-zero), the following check "(*inp)[9] == ','" makes no sense any more. I suspect it was a typo in the code we meant to "strncmp () == 0". Another problem in the code above is that if *inp is "operator,", we first increment *inp by 9, and then increment it by one again, which is wrong to me. We should only increment *inp by 8 to skip "operator", and go back to the loop header to decide where we stop. gdb: 2016-08-15 Yao Qi <yao.qi@linaro.org> * location.c (explicit_location_lex_one): Compare the return value of strncmp with zero. Don't check (*inp)[9]. Increment *inp by 8.
2016-08-15Automatic date update in version.inGDB Administrator1-1/+1
2016-08-13sim: m68hc11: standardize sim_cpu namingMike Frysinger10-347/+366
We use "sim_cpu *cpu" in the sim code base, not "struct _sim_cpu" or the name "proc", so clean up this sim to follow along.
2016-08-13sim: m68hc11: fix up various prototype related warningsMike Frysinger8-12/+29
A few funcs are only used locally, so mark them static to avoid warnings due to -Wmissing-prototypes. Some funcs cast the return value wrong, so drop them (and let void * just work by default). Update some prototypes to be new style.
2016-08-13sim: cgen: constify mode_namesMike Frysinger3-2/+7
2016-08-14Automatic date update in version.inGDB Administrator1-1/+1
2016-08-13sim: cgen: drop unused argv/envp definitionsMike Frysinger2-8/+5
The common argv/envp are used now by all ports, so drop this old cgen fragment.
2016-08-13sim: bfin: split out common mach/model defines into arch.h [PR sim/20438]Mike Frysinger4-26/+55
The current machs.h mixes common enums with Blackfin-specific defines. This causes us troubles with header inclusion order such that we can't drop the old SIM_CPU typedef (which is duplicated in common code). By splitting the two up, we can unwind this dependency chain, and drop the old typedef. It also fixes building with older gcc versions.
2016-08-13Automatic date update in version.inGDB Administrator1-1/+1
2016-08-12Warn if the sh_info field of a symbol table does not index the first ↵Nick Clifton2-0/+11
non-local symbol in the section. * readelf.c (process_symbol_table): Generate a warning if a local symbol is found at and offste greater than or equal to the sh_info field of it's section header.
2016-08-12PR gold/20462: Fix bogus layout on ARM with linker script using PHDRS clauseRoland McGrath2-20/+27
gold/ PR gold/20462 * script-sections.cc (Script_sections::release_segments): Reset this->segments_created_.
2016-08-12[gold] Implement HIDDEN syntax in linker scriptsRoland McGrath3-1/+11
gold/ * yyscript.y (HIDDEN): New %token. (assignment): Handle HIDDEN(string = expr) syntax. * script.cc (script_keyword_parsecodes): Add HIDDEN.
2016-08-13Correct .dynsym sh_infoAlan Modra17-22/+41
bfd/ * elf-bfd.h (struct elf_link_hash_table): Add local_dynsymcount. * elflink.c (_bfd_elf_link_renumber_dynsyms): Set local_dynsymcount. (bfd_elf_final_link): Set .dynsym sh_info from local_dynsymcount. ld/ * testsuite/ld-tic6x/shlib-1.rd: Correct expected .dynsym sh_info. * testsuite/ld-tic6x/shlib-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-noindex.rd: Likewise. * testsuite/ld-tic6x/static-app-1.rd: Likewise. * testsuite/ld-tic6x/static-app-1b.rd: Likewise. * testsuite/ld-tic6x/static-app-1r.rd: Likewise. * testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
2016-08-12Undo the previous change to the aarch64 sim - exporting aarch64_step() - and ↵Nick Clifton3-9/+19
instead make aarch64_run correctly process sim events. * simulator.c (aarch64_step): Revert pervious delta. (aarch64_run): Call sim_events_tick after each instruction is simulated, and if necessary call sim_events_process. * simulator.h: Revert previous delta.
2016-08-12Fix warning in gdb.base/signals-state-child.cYao Qi2-1/+6
I see the following warning when running signals-state-child.exp. gdb/testsuite/gdb.base/signals-state-child.c:77:4: warning: too many arguments for format [-Wformat-extra-args] fprintf (out, "sigaction={sa_handler=", i); ^ this patch is to remove the argument from fprintf. gdb/testsuite: 2016-08-12 Yao Qi <yao.qi@linaro.org> * gdb.base/signals-state-child.c (main): Remove "i" from fprintf's argument list.
2016-08-12Add undefined weak function testsAlan Modra4-45/+91
* testsuite/ld-undefined/weak-fundef.s: New. * testsuite/ld-undefined/weak-undef.t: Don't specify filename. * testsuite/ld-undefined/weak-undef.exp: Run new tests. Rearrange much of old code. Use is_elf_format to select targets.
2016-08-12Automatic date update in version.inGDB Administrator1-1/+1
2016-08-11Fix ERROR: target-cc does not existAlan Modra2-6/+16
PR ld/20436 * testsuite/lib/ld-lib.exp (at_least_gcc_version): Don't ignore remote_exec status. (check_gcc_plugin_enabled): Likewise.
2016-08-11Export the single step function from the AArch64 simulator.Nick Clifton4-9/+19
* interp.c (sim_create_inferior): Allow for being called with a NULL abfd parameter. If a bfd is provided, initialise the sim with that start address. * simulator.c (HALT_NYI): Just print out the numeric value of the instruction when not tracing. (aarch64_step): Change from static to global. * simulator.h: Add a prototype for aarch64_step().
2016-08-11Fix fallout from gdb/20413's fix (x32: linux_ptrace_test_ret_to_nx: Cannot ↵Pedro Alves2-1/+7
PTRACE_PEEKUSER) Fixes, on NIOS GNU/Linux: In file included from /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../nat/linux-ptrace.c:26:0: /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:27:23: error: unknown type name 'gregset_t' #define GDB_GREGSET_T gregset_t ^ Fix this by including sys/procfs.h directly. We shouldn't really be including a gdb-only header in a gdb/nat/ file, anyway. Whoops. gdb/ChangeLog: 2016-08-11 Pedro Alves <palves@redhat.com> PR gdb/20413 * nat/linux-ptrace.c: Include <sys/procfs.h> instead of "gregset.h".
2016-08-11Avoid testsuite errors about missing compilers.Nick Clifton2-1/+11
PR ld/20436 * testsuite/lib/ld-lib.exp (check_gcc_plugin_enabled): When not testing remotely, check to see if target compiler is installed before trying to run it.
2016-08-11[AArch64] Reject -0.0 as an 8-bit FP immediateRichard Sandiford4-2/+32
parse_aarch64_imm_float was accepting -0.0 even though that's not a valid immediate for any instruction. The FPIMM0 caller rejected it, but the FPIMM one would silently treat it as -2.0. This patch rejects -0.0 and adds testcases to illegal.[sd]. Before the patch, the final error emitted for illegal.s was: Error: cannot do 16-byte relocation which was matched by: [^:]*:569: Error: .* The error was reported against the last line of the file rather than the instruction that required the reloc. Adding more instructions meant that the line number also changed. Reporting against the wrong line isn't good from a QoI perspective but isn't what I'm trying to fix here. Until it's fixed, I thought it would be better to adjust the match to be against an end-of-file comment rather than against whatever the last instruction happens to be. gas/ * config/tc-aarch64.c (parse_aarch64_imm_float): Reject -0.0. * testsuite/gas/aarch64/illegal.s, testsuite/gas/aarch64/illegal.l: Add tests for -0.0. Add an end-of-file comment.
2016-08-11PowerPC64 ELFv1 undefined weak functionsAlan Modra2-20/+17
Undefined weak functions, like __gmon_start__, were not being made dynamic or emitting plt call code. While the behaviour of undefined weak symbols is not defined in the ELF standard, the intention on powerpc64 was to make it possible to link without a definition of such symbols and at run time behave the same as if a definition was found at link time in a shared library. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't exit with non_got_ref true in any case where we could have generated dynbss copies but decide not to do so.
2016-08-11Automatic date update in version.inGDB Administrator1-1/+1
2016-08-11PR ld/15428: MIPS/LD/testsuite: Un-KFAIL `__ehdr_start' test 2Maciej W. Rozycki2-3/+6
Complement commit b75d42bce560 ("Fix mips segfault on GOT access of absolute symbol") and unmark the `__ehdr_start' test 2 as known to fail for the n32 and n64 ABIs, as with the change referred in place the causing issue has been properly addressed and consequently the tests do not fail anymore and neither are supposed to. ld/ PR ld/15428 * testsuite/ld-mips-elf/mips-elf.exp: Un-KFAIL `__ehdr_start' test 2.
2016-08-10Fix PR gdb/19187 (process record over a fork causes internal error)Pedro Alves4-4/+20
Right after a fork is detected, we detach breakpoints from the child (detach_breakpoints), which calls into target_remove_breakpoint with inferior_ptid pointing at the child process, but leaves the breakpoint marked inserted (in the parent). The problem is that record-full.c always deletes all knowledge of the breakpoint. Then when we later really delete the breakpoint from the parent, we fail the assertion, since the breakpoint is unexpectedly not found in the record-full.c breakpoint table. The fix is simply to not forget about the breakpoint if we're detaching it from a fork child. gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * record-full.c (record_full_remove_breakpoint): Don't remove the breakpoint from the record_full_breakpoints VEC if we're detaching the breakpoint from a fork child. gdb/testsuite/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * gdb.reverse/waitpid-reverse.exp: Add comment and remove setup_kfails.
2016-08-10Plumb enum remove_bp_reason all the way to target_remove_breakpointPedro Alves16-51/+125
So the target knows whether we're detaching breakpoints. Nothing uses the parameter in this patch yet. gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * break-catch-sig.c (signal_catchpoint_remove_location): Adjust interface. * break-catch-syscall.c (remove_catch_syscall): * breakpoint.c (enum remove_bp_reason): Moved to breakpoint.h. (remove_breakpoint_1): Pass 'reason' down. (remove_catch_fork, remove_catch_vfork, remove_catch_solib) (remove_catch_exec, remove_watchpoint, remove_masked_watchpoint) (base_breakpoint_remove_location, bkpt_remove_location) (bkpt_probe_remove_location, bkpt_probe_remove_location): Adjust interface. * breakpoint.h (enum remove_bp_reason): Moved here from breakpoint.c. (struct breakpoint_ops) <remove_location>: Add 'reason' parameter. * corelow.c (core_remove_breakpoint): New function. (init_core_ops): Install it as to_remove_breakpoint method. * exec.c (exec_remove_breakpoint): New function. (init_exec_ops): Install it as to_remove_breakpoint method. * mem-break.c (memory_remove_breakpoint): Adjust interface. * record-btrace.c (record_btrace_remove_breakpoint): Adjust interface. * record-full.c (record_full_remove_breakpoint) (record_full_core_remove_breakpoint): Adjust interface. * remote.c (remote_remove_breakpoint): Adjust interface. * target-debug.h (target_debug_print_enum_remove_bp_reason): New macro. * target-delegates.c: Regenerate. * target.c (target_remove_breakpoint): Add 'reason' parameter. * target.h (struct target_ops) <to_remove_breakpoint>: Add 'reason' parameter. (target_remove_breakpoint, memory_remove_breakpoint): Add 'reason' parameter.
2016-08-10Introduce 'enum remove_bp_reason'Pedro Alves2-14/+27
Makes the code more obvious. gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * breakpoint.c (insertion_state_t): Delete. (enum remove_bp_reason): New. (detach_breakpoints, remove_breakpoint_1, remove_breakpoint): Adjust to use enum remove_bp_reason instead of insertion_state_t.
2016-08-10Simplify remove_breakpoint interfacePedro Alves2-7/+16
All callers pass mark_uninserted, so there's no need for the 'is' parameter. gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * breakpoint.c (remove_breakpoint): Remove 'is' parameter and always pass mark_uninserted to remove_breakpoint_1. (insert_breakpoint_locations, remove_breakpoints) (remove_breakpoints_pid, update_global_location_list): Update callers.
2016-08-10MIPS/LD/testsuite: Verify microMIPS LA25 stub generationMaciej W. Rozycki8-0/+196
Repeat `PIC and non-PIC test 1' checks for microMIPS LA25 stubs, covering code generation and stub symbol annotation. ld/ * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s: New test source. * testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-08-10MIPS/BFD: Actually produce short microMIPS LA25 stubsMaciej W. Rozycki2-0/+8
For the case where a function which requires an LA25 stub is at the beginning of a section we use a short sequence comprised of a LUI/ADDIU instruction pair only and prepended to the associated function rather than using a trailing jump to reach the function. This works by checking for the offset into section of the function symbol being 0. This is however never the case for microMIPS function symbols, which have the ISA bit set. Consequently the short LA25 sequence is never produced for microMIPS functions, like with the following example: $ cat la25a.s .abicalls .global f1 .ent f1 f1: .set noreorder .cpload $25 .set reorder .option pic0 jal f2 .option pic2 jr $31 .end f1 .global f2 .ent f2 f2: jr $31 .end f2 $ cat la25b.s .abicalls .option pic0 .global __start .ent __start __start: jal f1 jal f2 .end __start $ as -mmicromips -32 -EB -o la25a.o la25a.s $ as -mmicromips -32 -EB -o la25b.o la25b.s $ ld -melf32btsmip -o la25 la25a.o la25b.o $ objdump -d la25 la25: file format elf32-tradbigmips Disassembly of section .text: 004000d0 <.pic.f2>: 4000d0: 41b9 0040 lui t9,0x40 4000d4: d420 0083 j 400106 <f2> 4000d8: 3339 0107 addiu t9,t9,263 4000dc: 0000 0000 nop 004000e0 <.pic.f1>: 4000e0: 41b9 0040 lui t9,0x40 4000e4: d420 0078 j 4000f0 <f1> 4000e8: 3339 00f1 addiu t9,t9,241 4000ec: 0000 0000 nop 004000f0 <f1>: 4000f0: 41bc 0002 lui gp,0x2 4000f4: 339c 801f addiu gp,gp,-32737 4000f8: 033c e150 addu gp,gp,t9 4000fc: f420 0083 jal 400106 <f2> 400100: 0000 0000 nop 400104: 45bf jrc ra 00400106 <f2>: 400106: 45bf jrc ra ... 00400110 <__start>: 400110: f420 0070 jal 4000e0 <.pic.f1> 400114: 0000 0000 nop 400118: f420 0068 jal 4000d0 <.pic.f2> 40011c: 0000 0000 nop $ where `.pic.f1' could omit the trailing jump and the filler NOP and just fall through to `f1'. Correct the problem by masking out the ISA bit from microMIPS functions, which fixes the earlier example: $ objdump -d la25 la25: file format elf32-tradbigmips Disassembly of section .text: 004000d0 <.pic.f2>: 4000d0: 41b9 0040 lui t9,0x40 4000d4: d420 0083 j 400106 <f2> 4000d8: 3339 0107 addiu t9,t9,263 ... 004000e8 <.pic.f1>: 4000e8: 41b9 0040 lui t9,0x40 4000ec: 3339 00f1 addiu t9,t9,241 004000f0 <f1>: 4000f0: 41bc 0002 lui gp,0x2 4000f4: 339c 801f addiu gp,gp,-32737 4000f8: 033c e150 addu gp,gp,t9 4000fc: f420 0083 jal 400106 <f2> 400100: 0000 0000 nop 400104: 45bf jrc ra 00400106 <f2>: 400106: 45bf jrc ra ... 00400110 <__start>: 400110: f420 0074 jal 4000e8 <.pic.f1> 400114: 0000 0000 nop 400118: f420 0068 jal 4000d0 <.pic.f2> 40011c: 0000 0000 nop $ There is no need to do anything for MIPS16 functions, because if any LA25 stub has been generated for such a function, then it is only required for an associated call thunk only, which is regular MIPS code and the address of which, with the ISA bit clear, is returned by `mips_elf_get_la25_target'. This problem has been there since the beginning of microMIPS support: commit df58fc944dbc6d5efd8d3826241b64b6af22f447 Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Sun Jul 24 14:20:15 2011 +0000 <https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS: microMIPS ASE support"). bfd/ * elfxx-mips.c (mips_elf_add_la25_stub): Clear the ISA bit of the stub address retrieved if associated with a microMIPS function.
2016-08-10MIPS/BFD: Add microMIPS annotation to LA25 stub symbolsMaciej W. Rozycki2-1/+9
Fix a problem with missing microMIPS symbol annotation with microMIPS LA25 stub symbols. The consequence of the issue is these symbols appear in the symbol table as regular MIPS symbols with the ISA bit set, as shown with the example below: $ cat la25a.s .abicalls .global f1 .ent f1 f1: .set noreorder .cpload $25 .set reorder .option pic0 jal f2 .option pic2 jr $31 .end f1 .global f2 .ent f2 f2: jr $31 .end f2 $ cat la25b.s .abicalls .option pic0 .global __start .ent __start __start: jal f1 jal f2 .end __start $ as -mmicromips -32 -EB -o la25a.o la25a.s $ as -mmicromips -32 -EB -o la25b.o la25b.s $ ld -melf32btsmip -o la25 la25a.o la25b.o $ readelf -s la25 Symbol table '.symtab' contains 18 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00400098 0 SECTION LOCAL DEFAULT 1 2: 004000b0 0 SECTION LOCAL DEFAULT 2 3: 004000d0 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 SECTION LOCAL DEFAULT 5 6: 00418110 0 NOTYPE LOCAL DEFAULT 3 _gp 7: 004000e1 16 FUNC LOCAL DEFAULT 3 .pic.f1 8: 004000d1 16 FUNC LOCAL DEFAULT 3 .pic.f2 9: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata 10: 00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start 11: 00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2 12: 004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext 13: 00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start 14: 004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1 15: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata 16: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _end 17: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss $ where microMIPS annotation is missing for `.pic.f1' and `.pic.f2' even though these stubs are associated with microMIPS functions `f1' and `f2' respectively. Add the missing annotation then, by copying it from the function symbol an LA25 stub is associated with, correcting the example above: $ readelf -s la25 Symbol table '.symtab' contains 18 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00400098 0 SECTION LOCAL DEFAULT 1 2: 004000b0 0 SECTION LOCAL DEFAULT 2 3: 004000d0 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 SECTION LOCAL DEFAULT 5 6: 00418110 0 NOTYPE LOCAL DEFAULT 3 _gp 7: 004000e0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f1 8: 004000d0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f2 9: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata 10: 00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start 11: 00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2 12: 004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext 13: 00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start 14: 004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1 15: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata 16: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _end 17: 00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss $ This problem has been there since the beginning of microMIPS support: commit df58fc944dbc6d5efd8d3826241b64b6af22f447 Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Sun Jul 24 14:20:15 2011 +0000 <https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS: microMIPS ASE support"). bfd/ * elfxx-mips.c (mips_elf_create_stub_symbol): For a microMIPS stub also add STO_MICROMIPS annotation.
2016-08-10MIPS/BFD: Set the ISA bit in microMIPS LA25 stub referencesMaciej W. Rozycki2-3/+12
Fix a linker regression introduced with commit 9d862524f6ae ("MIPS: Verify the ISA mode and alignment of branch and jump targets") causing a build failure in microMIPS glibc where the `zdump' tool fails to link: .../timezone/zdump.o: In function `yeartot': .../timezone/zdump.c:758:(.text+0x62): Jump to a non-instruction-aligned address .../timezone/zdump.c:758:(.text+0x76): Jump to a non-instruction-aligned address .../timezone/zdump.c:768:(.text+0x112): Jump to a non-instruction-aligned address .../timezone/zdump.c:774:(.text+0x1b8): Jump to a non-instruction-aligned address .../timezone/zdump.c:774:(.text+0x1cc): Jump to a non-instruction-aligned address collect2: error: ld returned 1 exit status make[2]: *** [.../timezone/zdump] Error 1 The cause of the failure is the stricter check introduced with the said change for jump and branch targets tripping on the address of microMIPS LA25 stubs. Despite being microMIPS code these stubs do not have the ISA bit set throughout the relocation calculation process, because they have their address set to the memory offset into the stub section they are placed in. The `mips_elf_la25_stub' structure does not carry ISA mode information, but there is no need to extend it, because the ISA mode can be inferred from the original symbol, which will have STO_MICROMIPS annotation, so use that instead to set the ISA bit appropriately. Also only LA25 stubs associated with microMIPS symbols need to have the ISA bit set, because other LA25 stubs are made with regular MIPS code, even if associated with a MIPS16 symbol (in which case they are needed by a call thunk only rather than the MIPS16 function proper). bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): Set the ISA bit in microMIPS LA25 stub references.
2016-08-10Support setting thread names (MS-Windows)Руслан Ижбулатов3-11/+100
This is done by catching an exception number 0x406d1388 (it has no documented name, though MSDN dubs it "MS_VC_EXCEPTION" in one code example), which is thrown by the program. The exception record contains an ID of a thread and a name to give it. This requires rolling back some changes in handle_exception(), which now again returns more than two distinct values. The new HANDLE_EXCEPTION_IGNORED value means that gdb should just continue, without returning the thread ID up the stack (which would result in further handling of the exception, which is not what we want). gdb/ChangeLog: 2016-08-10 Руслан Ижбулатов <lrn1986@gmail.com> Pedro Alves <palves@redhat.com> * windows-nat.c (MS_VC_EXCEPTION): New define. (handle_exception_result): New enum. (windows_delete_thread): Free the thread's name. (handle_exception): Handle MS_VC_EXCEPTION. (get_windows_debug_event): Handle HANDLE_EXCEPTION_IGNORED. (windows_thread_name): New function. (windows_target): Install it as to_thread_name method. * NEWS: Mention the thread naming support on MS-Windows.
2016-08-10Fix extraneous complaints about missing expected TLS relocation.Cary Coutant4-4/+16
With some versions of gas, the call to tls_get_addr uses a GOTPCREL relocation instead of a GOTPCRELX relocation. We should allow for that when skip_call_tls_get_addr_ is true. We should also build the test objects with the in-tree assembler. This patch also fixes some cascading error messages caused by not resetting the skip_call_tls_get_addr_ flag after printing the error. gold/ PR gold/20216 * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing error message. * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/. (pr20216_ld.o): Likewise. * testsuite/Makefile.in: Regenerate.
2016-08-10Fix potential crashes when Target::make_symbol() returns NULL.James Clarke2-4/+18
2016-08-10 James Clarke <jrtc27@jrtc27.com> gold/ PR gold/20443 * symtab.cc (Symbol_table::add_from_relobj): Handle NULL symbols, which will be present for STT_SPARC_REGISTER. (Symbol_table::add_from_pluginobj): Likewise. (Symbol_table::add_from_dynobj): Likewise. (Symbol_table::add_from_incrobj): Removed dead code.
2016-08-10Fix improper handling of R_SPARC_GOTDATA_OP_LOX10 relocation.James Clarke2-7/+13
The fall-through in Target_sparc::Relocate::relocate for R_SPARC_GOTDATA_OP_LOX10 is currently R_SPARC_GOT13, but should clearly be R_SPARC_GOT10. GCC has been seen to emit a sethi/xor rather than a sethi/or sequence to load a 32-bit immediate, but if R_SPARC_GOT13 is used then bits 10-12 get zeroed out as both the sethi and xor immediates contain them. gold/ PR gold/20442 * sparc.cc (Target_sparc::Relocate::relocate): R_SPARC_GOTDATA_OP_LOX10 should fall back on R_SPARC_GOT10, not R_SPARC_GOT13.
2016-08-10Add support for R_SPARC_32 relocation.James Clarke2-1/+7
gold/ PR gold/20441 * sparc.cc (Target_sparc::Scan::check_non_pic): Allow R_SPARC_32 on sparc64.
2016-08-10Quiet ARI gettext checksPedro Alves2-4/+10
The ARI complains about this new file: common/signals-state-save-restore.c:46: warning: gettext: All messages should be marked up with _. common/signals-state-save-restore.c:59: warning: gettext: All messages should be marked up with _. common/signals-state-save-restore.c:87: warning: gettext: All messages should be marked up with _. common/signals-state-save-restore.c:92: warning: gettext: All messages should be marked up with _. Since these are untranslatable strings, use () instead of _(). gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> * common/signals-state-save-restore.c (save_original_signals_state, restore_original_signals_state): Wrap perror_with_name arguments with '()'.
2016-08-10Automatic date update in version.inGDB Administrator1-1/+1
2016-08-09Skip LTO tests for --disable-pluginH.J. Lu2-3/+35
Don't run LTO tests if compiler is configured with --disable-plugin. PR ld/20436 * testsuite/lib/ld-lib.exp (check_gcc_plugin_enabled): New proc. (check_lto_available): Return 0 if check_gcc_plugin_enabled returns 0. (check_lto_fat_available): Likewise. (check_lto_shared_available): Likewise.
2016-08-09Fix PR gdb/20418 - Problems with synchronous commands and new-uiPedro Alves11-30/+238
When executing commands on a secondary UI running the MI interpreter, some commands that should be synchronous are not. MI incorrectly continues processing input right after the synchronous command is sent, before the target stops. The problem happens when we emit MI async events (=library-loaded, etc.), and we go about restoring the previous terminal state, we end up calling target_terminal_ours, which incorrectly always installs the current UI's input_fd in the event loop... That is, code like this: old_chain = make_cleanup_restore_target_terminal (); target_terminal_ours_for_output (); fprintf_unfiltered (mi->event_channel, "library-loaded"); ... do_cleanups (old_chain); The fix is to move the add_file_handler/delete_file_handler calls out of target_terminal_$foo, making these completely no-ops unless called with the main UI as current UI. gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/20418 * event-top.c (ui_register_input_event_handler) (ui_unregister_input_event_handler): New functions. (async_enable_stdin): Register input in the event loop. (async_disable_stdin): Unregister input from the event loop. (gdb_setup_readline): Register input in the event loop. * infrun.c (check_curr_ui_sync_execution_done): Register input in the event loop. * target.c (target_terminal_inferior): Don't unregister input from the event loop. (target_terminal_ours): Don't register input in the event loop. * target.h (target_terminal_inferior) (target_terminal_ours_for_output, target_terminal_ours): Update comments. * top.h (ui_register_input_event_handler) (ui_unregister_input_event_handler): New declarations. * utils.c (ui_unregister_input_event_handler_cleanup) (prepare_to_handle_input): New functions. (defaulted_query, prompt_for_continue): Use prepare_to_handle_input. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@ericsson.com> PR gdb/20418 * gdb.mi/new-ui-mi-sync.c, gdb.mi/new-ui-mi-sync.exp: New files. * lib/mi-support.exp (mi_expect_interrupt): Remove anchors.
2016-08-09Fix PR mi/20431 - Missing MI prompts after sync execution MI command ↵Pedro Alves4-0/+98
(-exec-continue, etc.) errors gdb 7.11 introduced an MI regression: a failing MI sync execution command misses printing the MI prompt, and then all subsequent command miss it too: $ gdb-7.11.1 -i=mi [...] p 1 &"p 1\n" ~"$1 = 1" ~"\n" ^done (gdb) <<< prompted ok -exec-continue ^error,msg="The program is not being run." <<< missing prompt after this print 1 &"print 1\n" ~"$2 = 1" ~"\n" ^done <<< missing prompt after this gdb 7.10.1 behaved correctly, even with "set mi-async on": -exec-continue ^error,msg="The program is not being run." (gdb) <<< prompted ok etc. Bisecting points at: commit 0b333c5e7d6c Author: Pedro Alves <palves@redhat.com> Date: Wed Sep 9 18:23:23 2015 +0100 Merge async and sync code paths some more [...] The problem is that when an exception is thrown, we leave the prompt state set to PROMPT_BLOCKED, and then mi_execute_command_input_handler doesn't print the prompt. It used to work because before that patch, we happened to skip disabling stdin if the current target didn't do async (which it never does before execution). I was surprised to find that this bug isn't caught by the testsuite, so I made a thorough test that tests all combinations of pairs of: - a failing synchronous execution command - a failing non-execution command - a non-failing command gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR mi/20431 * mi/mi-main.c (mi_execute_command): Enable input and set prompt state to PROMPT_NEEDED. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR mi/20431 * gdb.mi/mi-cmd-error.exp: New file.
2016-08-09Fix PR gdb/18653: gdb disturbs inferior's inherited signal dispositionsPedro Alves18-7/+386
gdb's (or gdbserver's) own signal handling should not interfere with the signal dispositions their spawned children inherit. However, it currently does. For example, some paths in gdb cause SIGPIPE to be set to SIG_IGN, and as consequence, the child starts with SIGPIPE to set to SIG_IGN too, even though gdb was started with SIGPIPE set to SIG_DFL. This is because the exec family of functions does not reset the signal disposition of signals that are set to SIG_IGN: http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html Signals set to the default action (SIG_DFL) in the calling process image are set to the default action in the new process image. Signals set to be ignored (SIG_IGN) by the calling process image are set to be ignored by the new process image. Signals set to be caught by the calling process image are set to the default action in the new process image (see <signal.h>). And neither does it reset signal masks or flags. In order to be transparent, when spawning new child processes to debug (with "run", etc.), reset signal actions and mask back to what was originally inherited from gdb/gdbserver's parent, just before execing the target program to debug. gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * Makefile.in (SFILES): Add common/signals-state-save-restore.c. (HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h. (COMMON_OBS): Add signals-state-save-restore.o. (signals-state-save-restore.o): New rule. * configure: Regenerate. * fork-child.c: Include "signals-state-save-restore.h". (fork_inferior): Call restore_original_signals_state. * main.c: Include "signals-state-save-restore.h". (captured_main): Call save_original_signals_state. * common/common.m4: Add sigaction to AC_CHECK_FUNCS checks. * common/signals-state-save-restore.c: New file. * common/signals-state-save-restore.h: New file. gdb/gdbserver/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * Makefile.in (OBS): Add signals-state-save-restore.o. (signals-state-save-restore.o): New rule. * config.in: Regenerate. * configure: Regenerate. * linux-low.c: Include "signals-state-save-restore.h". (linux_create_inferior): Call restore_original_signals_state. * server.c: Include "dispositions-save-restore.h". (captured_main): Call save_original_signals_state. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/18653 * gdb.base/signals-state-child.c: New file. * gdb.base/signals-state-child.exp: New file. * gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern.
2016-08-09Support -pie for arm*-eabi targets.Roland McGrath2-0/+5
ld/ * emulparams/armelf.sh (GENERATE_PIE_SCRIPT): Set to yes.
2016-08-09Correct the calculation of the use_counts of merged .got entries.Jiaming Wei2-1/+6
* elf64-alpha.c (elf64_alpha_copy_indirect_symbol): Fix thinko adjusting the use_count of merged .got entries.
2016-08-09Fix PR gdb/20295: GDB segfaults printing bitfield member of optimized out valuePedro Alves4-8/+111
With something like: struct A { int bitfield:4; } var; If 'var' ends up wholly-optimized out, printing 'var.bitfield' crashes gdb here: (top-gdb) bt #0 0x000000000058b89f in extract_unsigned_integer (addr=0x2 <error: Cannot access memory at address 0x2>, len=2, byte_order=BFD_ENDIAN_LITTLE) at /home/pedro/gdb/mygit/src/gdb/findvar.c:109 #1 0x00000000005a187a in unpack_bits_as_long (field_type=0x16cff70, valaddr=0x0, bitpos=16, bitsize=12) at /home/pedro/gdb/mygit/src/gdb/value.c:3347 #2 0x00000000005a1b9d in unpack_value_bitfield (dest_val=0x1b5d9d0, bitpos=16, bitsize=12, valaddr=0x0, embedded_offset=0, val=0x1b5d8d0) at /home/pedro/gdb/mygit/src/gdb/value.c:3441 #3 0x00000000005a2a5f in value_fetch_lazy (val=0x1b5d9d0) at /home/pedro/gdb/mygit/src/gdb/value.c:3958 #4 0x00000000005a10a7 in value_primitive_field (arg1=0x1b5d8d0, offset=0, fieldno=0, arg_type=0x16d04c0) at /home/pedro/gdb/mygit/src/gdb/value.c:3161 #5 0x00000000005b01e5 in do_search_struct_field (name=0x1727c60 "bitfield", arg1=0x1b5d8d0, offset=0, type=0x16d04c0, looking_for_baseclass=0, result_ptr=0x7fffffffcaf8, [...] unpack_value_bitfield is already optimized-out/unavailable -aware: (...) VALADDR points to the contents of VAL. If the VAL's contents required to extract the bitfield from are unavailable/optimized out, DEST_VAL is correspondingly marked unavailable/optimized out. however, it is not considering the case of the value having no contents buffer at all, as can happen through allocate_optimized_out_value. gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> * value.c (unpack_value_bitfield): Skip unpacking if the parent has no contents buffer to begin with. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> * gdb.dwarf2/bitfield-parent-optimized-out.exp: New file.
2016-08-09Automatic date update in version.inGDB Administrator1-1/+1