aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-09-09S/390: Fix opcode of ppno.Andreas Krebbel2-2/+2
opcodes/ChangeLog: 2015-09-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * s390-opc.txt: Fix opcode of ppno instruction. gas/testsuite/ChangeLog: 2015-09-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gas/s390/zarch-z13.d: Fix opcode of ppno instruction.
2015-09-09Update the simplified Chinese translation.Nick Clifton2-794/+1130
* po/zh_CN.po: Updated simplified Chinese translation.
2015-09-09btrace: kernel address filteringMarkus Metzger6-64/+73
For the BTS recording format, we sometimes get a FROM->TO record where the FROM address lies in the kernel and the TO address lies in user space at whatever address the user process was resumed. GDB has a heuristic to filter out such records based on looking at the most significant bit in the PC. This works fine for 64-bit systems but it doesn't always work for 32-bit systems. Libraries that are loaded at fairly high addresses might be mistaken for kernel code and branches inside the library are filtered out. Change the heuristic to (again heuristically) try to determine the lowest address in kernel space. Any PC that is smaller than that should be in user space. On today's systems, there should be a symbol "_text" at that address. Read /proc/kallsyms and search for that symbol. It is not guaranteed that /proc/kallsyms is readable on all systems. On 64-bit systems, we fall back to check the most significant bit. On 32-bit systems, we refrain from filtering out addresses. The filtering should really be done by the kernel. And it soon will be: https://lkml.org/lkml/2015/8/31/212. gdb/ * nat/linux-btrace.h (struct btrace_target_info) <ptr_bits>: Remove. * nat/linux-btrace.c: Include filestuff.h and inttypes.h. Remove include of sys/utsname.h. (linux_determine_kernel_ptr_bits): Remove. (linux_determine_kernel_start): New. (perf_event_is_kernel_addr): Remove tinfo argument. Update users. Update check. (perf_event_skip_bts_record): Remove tinfo argument. Update users. (linux_enable_bts, linux_enable_pt): Remove tinfo->ptr_bits initialization. * x86-linux-nat.c (x86_linux_enable_btrace): Remove ptr_bits assignment. gdbserver/ * linux-low.c (linux_low_enable_btrace): Remove. (linux_target_ops): Replace linux_low_enable_btrace with linux_enable_btrace.
2015-09-08Improve hand-call-in-threads.exp failure handling.Sandra Loosemore2-3/+24
2015-09-08 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.threads/hand-call-in-threads.exp: Make sure the thread command actually switches threads. Give up on remaining tests if target fails to stop at breakpoint.
2015-09-09Automatic date update in version.inGDB Administrator1-1/+1
2015-09-08config/tc-avr.c (md_section_align): Append UL for -1 to avoid the latest ↵Chen Gang2-1/+6
gcc's warning The related warning is: gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/gas -I. -I../../binutils-gdb/gas -I../bfd -I../../binutils-gdb/gas/config -I../../binutils-gdb/gas/../include -I../../binutils-gdb/gas/.. -I../../binutils-gdb/gas/../bfd -DLOCALEDIR="\"/upstream/release-avr32/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I../../binutils-gdb/gas/../zlib -g -O2 -MT tc-avr.o -MD -MP -MF .deps/tc-avr.Tpo -c -o tc-avr.o `test -f 'config/tc-avr.c' || echo '../../binutils-gdb/gas/'`config/tc-avr.c ../../binutils-gdb/gas/config/tc-avr.c: In function ‘md_section_align’: ../../binutils-gdb/gas/config/tc-avr.c:1233:43: error: left shift of negative value [-Werror=shift-negative-value] return ((addr + (1 << align) - 1) & (-1 << align)); ^ 2015-09-05 Chen Gang <gang.chen.5i5j@gmail.com> * config/tc-avr.c (md_section_align): Append UL for -1 to avoid the latest gcc's warning.
2015-09-08Extend the descriptiopn of how to access linker defined symbols from C.Nick Clifton2-0/+18
* ld.texinfo (Source Code Reference): Extend description to include an example using arrays.
2015-09-08Automatic date update in version.inGDB Administrator1-1/+1
2015-09-07ld: Fix failures in new orphan handling tests.Andrew Burgess4-7/+16
The new orphan handling tests added in commit c005eb9 fail on a range of targets. Some of the failures were fixed in commit e32aa93 but not all. This commit should address the remaining failures. Update results to account for orphan sections being placed in different orders, and for other, target specific sections, being discarded. ld/testsuite/ChangeLog: * ld-elf/orphan-7.map: Allow for other discarded sections. * ld-elf/orphan-8.map: Updated to allow for different section ordering on different targets. * ld-elf/orphan.ld: Place .sbss section.
2015-09-07guile: Add as_a_scm_t_subrPedro Alves24-280/+401
Building GDB in C++ mode on Fedora 20, the gdb/guile/ code shows ~280 errors like: src/gdb/guile/guile.c:515:1: error: invalid conversion from ‘scm_unused_struct* (*)(SCM, SCM) {aka scm_unused_struct* (*)(scm_unused_struct*, scm_unused_struct*)}’ to ‘scm_t_subr {aka void*}’ [-fpermissive] This commit fixes them all. gdb/ChangeLog: 2015-09-07 Pedro Alves <palves@redhat.com> * guile/guile-internal.h (as_a_scm_t_subr): New. * guile/guile.c (misc_guile_functions): Use it. * guile/scm-arch.c (arch_functions): Use it. * guile/scm-block.c (block_functions, gdbscm_initialize_blocks): Use it. * guile/scm-breakpoint.c (breakpoint_functions): Use it. * guile/scm-cmd.c (command_functions): Use it. * guile/scm-disasm.c (disasm_functions): Use it. * guile/scm-exception.c (exception_functions) (private_exception_functions): Use it. * guile/scm-frame.c (frame_functions) * guile/scm-gsmob.c (gsmob_functions): Use it. * guile/scm-iterator.c (iterator_functions): Use it. * guile/scm-lazy-string.c (lazy_string_functions): Use it. * guile/scm-math.c (math_functions): Use it. * guile/scm-objfile.c (objfile_functions): Use it. * guile/scm-param.c (parameter_functions): Use it. * guile/scm-ports.c (port_functions, private_port_functions): Use it. * guile/scm-pretty-print.c (pretty_printer_functions): Use it. * guile/scm-progspace.c (pspace_functions): Use it. * guile/scm-string.c (string_functions): Use it. * guile/scm-symbol.c (symbol_functions): Use it. * guile/scm-symtab.c (symtab_functions): Use it. * guile/scm-type.c (type_functions, gdbscm_initialize_types): Use it. * guile/scm-value.c (value_functions): Use it.
2015-09-07Fix internal error caused by IFUNC patch.Cary Coutant3-9/+16
The previous commit to fix PR gold/18886 converted STT_IFUNC to STT_FUNC when resolving to a symbol defined in a shared library. This leads to an internal error if the shared library symbol is seen first, as we do not convert the symbol at all. We need to override the STT_IFUNC in add_from_dynobj() instead of in override_base(). gold/ PR gold/18930 PR gold/18886 * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here. * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
2015-09-07Automatic date update in version.inGDB Administrator1-1/+1
2015-09-06Automatic date update in version.inGDB Administrator1-1/+1
2015-09-05Update ld-elf/orphan-8.map to support 32-bit targetsH.J. Lu2-4/+8
* ld-elf/orphan-8.map: Updated to support 32-bit targets.
2015-09-05Automatic date update in version.inGDB Administrator1-1/+1
2015-09-04ld: Extend options for altering orphan handling behaviour.Andrew Burgess18-65/+195
Replace the options --warn-orphan and --no-warn-orphan with a single option --orphan-handling=MODE, where mode can be place, warn, error, and discard. Mode 'place' is the default, and is the current behaviour, placing the orphan section into a suitable output section. Mode 'warn' is the same as '--warn-orphan'. The orphan is also placed using the same algorithm as for 'place'. Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'. Mode 'discard' assigns all output sections to the /DISCARD/ section. ld/ChangeLog: * ld.h (enum orphan_handling_enum): New. (ld_config_type): Remove warn_orphan, add orphan_handling. * ldemul.c (ldemul_place_orphan): Remove warning about orphan sections. * ldlang.c (ldlang_place_orphan): New function. (lang_place_orphans): Call ldlang_place_orphan. * ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING. * lexsup.c (ld_options): Remove 'warn-orphan' and 'no-warn-orphan', add 'orphan-handling'. (parse_args): Remove handling for OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING. * NEWS: Replace text about --warn-orphan with --orphan-handling. * ld.texinfo (Options): Remove --warn-orphan entry and add entry on --orphan-handling. (Orphan Sections): Add reference to relevant command line options. ld/testsuite/ChangeLog: * ld-elf/elf.exp: Switch to rely on run_dump_test. * ld-elf/orphan-5.l: Update expected output. * ld-elf/orphan-5.d: New file. * ld-elf/orphan-6.d: New file. * ld-elf/orphan-6.l: New file. * ld-elf/orphan-7.d: New file. * ld-elf/orphan-7.map: New file. * ld-elf/orphan-8.d: New file. * ld-elf/orphan-8.map: New file.
2015-09-04gdb/tui: Remove casts of NULL during assignment.Andrew Burgess7-24/+45
In the following code: struct symbol *wsym = (struct symbol *) NULL; the cast of NULL is redundant, it adds noise, and is just one more thing to change if the type of wsym ever changes. There are a relatively small number of places in gdb where the above code pattern is used. Usually the cast is removed like this: struct symbol *wsym = NULL; This commit updates all the places within the gdb/tui directory where we cast NULL during assignment, removing the cast. gdb/ChangeLog: * tui/tui-data.c (win_with_focus): Remove cast of NULL pointer. (tui_next_win): Likewise. (tui_prev_win): Likewise. (tui_partial_win_by_name): Likewise. (tui_init_generic_part): Likewise. (init_content_element): Likewise. (tui_del_window): Likewise. (tui_free_window): Likewise. (tui_del_data_windows): Likewise. (tui_free_data_content): Likewise. * tui/tui-layout.c (make_source_or_disasm_window): Likewise. * tui/tui-regs.c (tui_show_register_group): Likewise. * tui/tui-win.c (tui_resize_all): Likewise. (tui_set_focus): Likewise. (tui_set_win_height): Likewise. (make_invisible_and_set_new_height): Likewise. * tui/tui-windata.c (tui_delete_data_content_windows): Likewise. * tui/tui-wingeneral.c (make_visible): Likewise.
2015-09-04gdb/cli: Remove casts of NULL during assignment.Andrew Burgess2-1/+5
In the following code: struct symbol *wsym = (struct symbol *) NULL; the cast of NULL is redundant, it adds noise, and is just one more thing to change if the type of wsym ever changes. There are a relatively small number of places in gdb where the above code pattern is used. Usually the cast is removed like this: struct symbol *wsym = NULL; This commit updates all the places within the gdb/cli directory where we cast NULL during assignment, removing the cast. gdb/ChangeLog: * cli/cli-decode.c (find_cmd): Remove cast of NULL pointer.
2015-09-04gdb: Remove casts of NULL during assignment.Andrew Burgess7-8/+18
In the following code: struct symbol *wsym = (struct symbol *) NULL; the cast of NULL is redundant, it adds noise, and is just one more thing to change if the type of wsym ever changes. There are a relatively small number of places in gdb where the above code pattern is used. Usually the cast is removed like this: struct symbol *wsym = NULL; This commit updates all the places within the gdb/ directory where we cast NULL during assignment, removing the cast. gdb/ChangeLog: * c-valprint.c (print_unpacked_pointer): Remove cast of NULL pointer. * dbxread.c (dbx_end_psymtab): Likewise. * gnu-nat.c (gnu_write_inferior): Likewise. * mdebugread.c (cross_ref): Likewise. * p-valprint.c (pascal_val_print): Likewise. * xcoffread.c (xcoff_end_psymtab): Likewise.
2015-09-04Mention multi-arch debugging support in NEWSYao Qi2-0/+8
gdb: 2015-09-04 Yao Qi <yao.qi@linaro.org> * NEWS: Mention the aarch64 multi-arch debugging support.
2015-09-04Automatic date update in version.inGDB Administrator1-1/+1
2015-09-03[Ada] Make string_char_type a true TYPE_CODE_CHAR type in AdaPierre-Marie de Rodat5-1/+77
Before this change, trying to call an overloaded function with at least one character literal in argument would fail. For instance, given these two functions: function F (C : Character) return Integer is begin return Character'Pos (C); end F; function F (I : Integer) return Integer is begin return -I; end F; We would get the following GDB session: (gdb) p f('A') $1 = -65 (gdb) p f(1) $1 = -1 This is wrong because the first call should select the first F function and thus return 65. The root problem is that ada-lang.c:ada_language_arch_info stores in string_char_type a type whose code is TYPE_CODE_INT instead of TYPE_CODE_CHAR. As a result, all parsed character literals are turned into integer values and during overload matching, the TYPE_CODE_CHAR formal rejects the TYPE_CODE_INT actual. This change turns string_char_type into a true TYPE_CODE_CHAR type in ada-lang.c so that we have instead the expected: (gdb) p f('A') $1 = 65 gdb/ChangeLog: * ada-lang.c (ada_language_arch_info): Create a TYPE_CODE_CHAR type instead of a TYPE_CODE_INT one for the string_char_type and the ada_primitive_type_char types. gdb/testsuite/ChangeLog: * gdb.ada/funcall_char.exp: New testcase. * gdb.ada/funcall_char/foo.adb: New file. Tested on x86_64-linux, no regression.
2015-09-03Fix typo in desription of linker script symbols.Nick Clifton2-1/+6
(Source Code Reference): Fix off-by-one typo in example of how to use linker script symbols in C source code.
2015-09-03Fix seg-fault in readelf when scanniing a corrupt binary.Nick Clifton2-1/+20
PR binutils/18879 * readelf.c (get_unwind_section_word): Check for negative offsets and very small sections. (dump_arm_unwind): Warn if the table offset is too large.
2015-09-03[aarch64] Check region OK for HW watchpoint in GDBserverYao Qi6-35/+66
Nowadays, if user requests HW watchpoint to monitor a large memory area or unaligned area, aarch64 GDB will split into multiple aligned areas, and use multiple debugging registers to watch them. However, the registers are not updated in a transaction way. GDBserver doesn't revert updates in previous iterations if some debugging registers fail to update due to some reason, like no free debugging registers available, in the latter iteration. For example, if we have a char buf[34], and watch buf in gdb, (gdb) watch buf Hardware watchpoint 2: buf (gdb) c Continuing. infrun: clear_proceed_status_thread (Thread 13466) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT) infrun: step-over queue now empty infrun: resuming [Thread 13466] for step-over Sending packet: $m410838,22#35...Packet received: 00000000000000000000000000000000000000000000000000000000000000000000 infrun: skipping breakpoint: stepping past insn at: 0x400524 infrun: skipping breakpoint: stepping past insn at: 0x400524 Sending packet: $Z2,410838,22#80...Packet received: E01 <----- [1] Packet Z2 (write-watchpoint) is supported Sending packet: $Z0,7fb7fe0a8c,4#43...Packet received: OK Warning: Could not insert hardware watchpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. GDB receives E01 for Z2 packet [1] but GDBserver updates the debugging register status, insert_point (addr=0x00410838, len=34, type=hw-write-watchpoint): BREAKPOINTs: BP0: addr=0x0, ctrl=0x00000000, ref.count=0 BP1: addr=0x0, ctrl=0x00000000, ref.count=0 BP2: addr=0x0, ctrl=0x00000000, ref.count=0 BP3: addr=0x0, ctrl=0x00000000, ref.count=0 BP4: addr=0x0, ctrl=0x00000000, ref.count=0 BP5: addr=0x0, ctrl=0x00000000, ref.count=0 WATCHPOINTs: WP0: addr=0x410850, ctrl=0x00001ff5, ref.count=1 WP1: addr=0x410848, ctrl=0x00001ff5, ref.count=1 WP2: addr=0x410840, ctrl=0x00001ff5, ref.count=1 WP3: addr=0x410838, ctrl=0x00001ff5, ref.count=1 four debugging registers can not monitor 34-byte long area, so the last iteration of updating debugging register state fails but previous iterations succeed. This makes GDB think no HW watchpoint is inserted but some debugging registers are used. This problem was exposed by "watch buf" gdb.base/watchpoint.exp with aarch64 GDBserver debugging arm 32-bit program. The buf is 30-byte long but 4-byte aligned, and four debugging registers can't cover 34-byte (extend 4 bytes to be 8-byte aligned) area. However, this problem does exist on non-multi-arch debugging scenario as well. This patch moves code in aarch64_linux_region_ok_for_hw_watchpoint to aarch64_linux_region_ok_for_watchpoint in nat/aarch64-linux-hw-point.c. Then, checks with aarch64_linux_region_ok_for_watchpoint, like what we are doing in GDB. If the region is OK, call aarch64_handle_watchpoint. Regression tested on aarch64 with both 64-bit program and 32-bit program. Some fails in gdb.base/watchpoint.exp are fixed. gdb: 2015-09-03 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_region_ok_for_hw_watchpoint): Move code to aarch64_linux_region_ok_for_watchpoint. Call aarch64_linux_region_ok_for_watchpoint. * nat/aarch64-linux-hw-point.c (aarch64_linux_region_ok_for_watchpoint): New function. * nat/aarch64-linux-hw-point.h (aarch64_linux_region_ok_for_watchpoint): Declare it. gdb/gdbserver: 2015-09-03 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_insert_point): Call aarch64_handle_watchpoint if aarch64_linux_region_ok_for_watchpoint returns true.
2015-09-03Fix a typo in the linker documentation: The COFF section .build-id should be ↵Nick Clifton2-1/+6
.buildid.
2015-09-03Remove convert_mov_to_leaH.J. Lu2-32/+26
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove convert_mov_to_lea.
2015-09-03Add ifunc tests for call, jmp, add, testH.J. Lu9-81/+50
* ld-ifunc/ifunc-21-i386.s: Add tests for call, jmp, add, test. * ld-ifunc/ifunc-21-x86-64.s: Likewise. * ld-ifunc/ifunc-22-i386.s: Likewise. * ld-ifunc/ifunc-22-x86-64.s: Likewise. * ld-ifunc/ifunc-21-i386.d: Updated. * ld-ifunc/ifunc-21-x86-64.d: Likewise. * ld-ifunc/ifunc-22-i386.d: Likewise. * ld-ifunc/ifunc-22-x86-64.d: Likewise.
2015-09-02Use gdbarch obstack to allocate the TYPE_NAME string in arch_typePatrick Palka7-1/+51
Since the type whose name is being set is now being allocated on the gdbarch obstack, we should allocate its TYPE_NAME on the obstack too. This reduces the number of individual valgrind warnings for the command "gdb gdb" from ~300 to ~150. Tested on x86_64-unknown-linux-gnu. gdb/ChangeLog: * gdb_obstack.h (obstack_strdup): Declare. * gdb_obstack.c (obstack_strdup): Define. * gdbarch.sh (gdbarch_obstack_strdup): Declare and define. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbtypes.c (arch_type): Use gdbarch_obstack_strdup.
2015-09-02Update documentation of function copy_type_recursivePatrick Palka2-3/+7
Following commit 8f57eec2fb3 ("Use gdbarch obstack to allocate types in alloc_type_arch") it is no longer the case that the type returned by copy_type_recursive is allocated using malloc. Because the function uses alloc_type_arch internally, the new type is now allocated on the gdbarch associated with the type, and is thus owned by that gdbarch. gdb/ChangeLog: * gdbtypes.c (copy_type_recursive): Update documentation.
2015-09-03Automatic date update in version.inGDB Administrator1-1/+1
2015-09-02Add 2 ifunc tests for i386 and x86-64H.J. Lu9-0/+211
* ld-ifunc/ifunc-21-i386.d: Likewise. * ld-ifunc/ifunc-21-i386.s: Likewise. * ld-ifunc/ifunc-21-x86-64.d: Likewise. * ld-ifunc/ifunc-21-x86-64.s: Likewise. * ld-ifunc/ifunc-22-i386.d: Likewise. * ld-ifunc/ifunc-22-i386.s: Likewise. * ld-ifunc/ifunc-22-x86-64.d: Likewise. * ld-ifunc/ifunc-22-x86-64.s: Likewise.
2015-09-02Rename R_386_irelative to R_386_ext2H.J. Lu2-6/+14
* elf32-i386.c (R_386_irelative): Renamed to ... (R_386_ext2): This. (R_386_vt_offset): Updated. (elf_i386_rtype_to_howto): Likewise. (elf_i386_relocate_section): Likewise.
2015-09-02Turn IFUNC symbols from shared libraries into normal FUNC symbolsH.J. Lu3-5/+16
Turn IFUNC symbols from shared libraries into normal FUNC symbols when we are resolving symbol references, instead of when we are writing out the symbol table. PR gold/18886 * resolve.cc (Symbol::override_base): Turn IFUNC symbols from shared libraries into normal FUNC symbols. * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC symbols aren't from shared libraries.
2015-09-02[GOLD] ppc64 out-of-line register save/restore functionsAlan Modra2-17/+88
Gold version of a4b6fadd. Don't emit long branch or plt branch stubs to save/restore functions. Copy them instead. PR 18878 * powerpc.cc (Target_powerpc): Add savres_section_ and accessor. (Target_powerpc::Branch_info::make_stub): Determine whether long branch stub is for save/restore function. (Branch_stub_ent): Add save_res_, and extra parm to constructor. (Stub_table): Add need_save_res_. (Stub_table:clear_stubs): Clear need_save_res_. (Stub_table:set_address_and_size): Add save/restore section size. (Stub_table::add_long_branch_entry): Add save_res param. Set need_save_res_, but don't add space for save/restore stubs. (Stub_table::find_long_branch_entry): Return offset to local copy of save/restore func. (Stub_table::do_write): Don't output save/restore stubs. Instead copy the save/restore functions. (Output_data_save_res:contents): New accessor. (Target_powerpc::define_save_restore_funcs): Set savres_section_.
2015-09-02Initialize yet another variable to silence GCC warning from last-but-one commitSergio Durigan Junior2-1/+6
Yet another BuildBot e-mail, yet another breakage on RHEL-7.1 s390x (which uses an older GCC). This time, solib-svr4.c:solib_event_probe_action has the probe_argc variable, which is now inside a TRY..CATCH and therefore needs to be initialized. Pushed as obvious. gdb/ChangeLog: 2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * solib-svr4.c (solib_event_probe_action): Initialize 'probe_argc' as zero.
2015-09-02Initialize variable and silence GCC warning from last commitSergio Durigan Junior2-1/+5
BuildBot e-mailed me to let me know that my last commit broke GDB on RHEL-7.1 s390x. On solib-svr4.c:svr4_handle_solib_event, 'val' now needs to be initialized as NULL because it is inside a TRY..CATCH block. This patch does that. Pushed as obvious. gdb/ChangeLog: 2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * solib-svr4.c (svr4_handle_solib_event): Initialize 'val' as NULL
2015-09-02Catching errors on probes-based dynamic linker interfaceSergio Durigan Junior2-3/+46
This patch is intended to make the interaction between the probes-based dynamic linker interface and the SystemTap SDT probe code on GDB more robust. It does that by wrapping the calls to the probe API with TRY...CATCH'es, so that any exception thrown will be caught and handled properly. The idea for this patch came from <https://bugzilla.redhat.com/show_bug.cgi?id=1196181>, which is a bug initially filed against Fedora GDB (but now under Fedora GLIBC). This bug happens on armhfp (although it could happen on other targets as well), and is triggered because GCC generates a strange argument for one of the probes used by GDB in the dynamic linker interface. As can be seen in the bug, this argument is "-4@.L1052". I don't want to discuss the reasons for this argument to be there (this discussion belongs to the bug, or to another thread), but GDB could definitely do a better error handling here. Currently, one sees the following message when there is an error in the probes-based dynamic linker interface: (gdb) run Starting program: /bin/inferior warning: Probes-based dynamic linker interface failed. Reverting to original interface. Cannot parse expression `.L976 4@r4'. (gdb) Which means that one needs to explicitly issue a "continue" command to make GDB continue running the inferior, even though this error is not fatal and GDB will fallback to the old interface automatically. This is where this patch helps: it makes GDB still print the necessary warnings or error messages, but it *also* does not stop the inferior unnecessarily. I have tested this patch on the systems where this error happens, but I could not come up with a way to create a testcase for it. Nevertheless, it should be straightforward to see that this patch does improve the current situation. gdb/ChangeLog: 2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * solib-svr4.c (solib_event_probe_action): Call get_probe_argument_count using TRY...CATCH. (svr4_handle_solib_event): Likewise, for evaluate_probe_argument.
2015-09-02Improve error reporting when handling SystemTap SDT probesSergio Durigan Junior3-13/+53
This patch improves the error reporting when handling SystemTap SDT probes. "Handling", in this case, mostly means "parsing". On gdb/probe.h, only trivial changes on functions' comments in order to explicitly mention that some of them can throw exceptions. This is just to make the API a bit more clear. On gdb/stap-probe.c, I have s/internal_error/error/ on two functions that are responsible for parsing specific bits of the probes' arguments: stap_get_opcode and stap_get_expected_argument_type. It is not correct to call internal_error on such situations because it is not really GDB's fault if the probes have malformed arguments. I also improved the error reported on stap_get_expected_argument_type by also including the probe name on it. Aside from that, and perhaps most importantly, I added a check on stap_get_arg to make sure that we don't try to extract an argument from a probe that has no arguments. This check issues an internal_error, because it really means that GDB is doing something it shouldn't. Although it can be considered almost trivial, and despite the fact that I am the maintainer for this part of the code, I am posting this patch for review. I will wait a few days, and if nobody has anything to say, I will go ahead and push it. gdb/ChangeLog: 2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * probe.h (struct probe_ops) <get_probe_argument_count, evaluate_probe_argument, enable_probe, disable_probe>: Mention in the comment that the function can throw an exception. (get_probe_argument_count): Likewise. (evaluate_probe_argument): Likewise. * stap-probe.c (stap_get_opcode): Call error instead of internal_error. (stap_get_expected_argument_type): Likewise. Add argument 'probe'. Improve error message by mentioning the probe's name. (stap_parse_probe_arguments): Adjust call to stap_get_expected_argument_type. (stap_get_arg): Add comment. Assert that 'probe->args_parsed' is not zero. Call internal_error if GDB requests an argument but the probe has no arguments.
2015-09-02Automatic date update in version.inGDB Administrator1-1/+1
2015-09-01[Ada] Fix completion for multiple function matchesPierre-Marie de Rodat9-2/+96
Before this change, trying to complete an expression ending with an ambiguous function name (i.e. for which there are multiple matches) would display a menu with a prompt for the user to pick one. For instance: (gdb) p func<tab>Multiple matches for func [0] cancel [1] pack2.func at pack2.adb:5 [2] pack.func at pack.adb:5 > This is not user friendly and actually triggered a segmentation fault after the user did pick one. It is not clear whether the segmentation fault needs a separate fix, but this is the only known case which exhibits it at the moment, and this case must be fixed itself. The problem lies in ada-lang.c (ada_resolve_function): when we got multiple matches, we should not display the menu if we are in completion mode. This patch adjusts the corresponding condition accordingly. gdb/ChangeLog: * ada-lang.c (ada_resolve_function): Do not ask the user what match to use when in completion mode. gdb/testsuite/ChangeLog: * gdb.ada/complete.exp: Add "pck.ambiguous_func" to the relevant expected outputs. Add two testcases for completing ambiguous functions. * gdb.ada/complete/aux_pck.adb: New file. * gdb.ada/complete/aux_pck.ads: New file. * gdb.ada/complete/foo.adb: Pull Aux_Pck and call the two Ambiguous_Func functions. * gdb.ada/complete/pck.ads: Add an Ambiguous_Func function. * gdb.ada/complete/pck.adb: Likewise. Tested on x86_64-linux, no regression.
2015-09-01Skip PLT for function pointer initializationH.J. Lu19-33/+349
We use its PLT entry to initialize function pointer at run-time. If there is no other usage for the PLT entry, we can generate run-time function pointer relocations in read-write section, which can be resolved by dynamic linker, to initialize function pointers. It avoids the extra indirect branch overhead in PLT. bfd/ PR ld/18900 * elf32-i386.c (elf_i386_link_hash_entry): Add func_pointer_refcount. (elf_i386_link_hash_newfunc): Clear func_pointer_refcount. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_copy_indirect_symbol): Also copy func_pointer_refcount. (elf_i386_check_relocs): Increment func_pointer_refcount. (elf_i386_gc_sweep_hook): Decrement func_pointer_refcount. (elf_i386_allocate_dynrelocs): Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. Keep dynanamic relocations for run-time function pointer initialization. (elf_i386_relocate_section): Copy dynamic function pointer relocations. * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add func_pointer_refcount. (elf_x86_64_link_hash_newfunc): Clear func_pointer_refcount. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_copy_indirect_symbol): Also copy func_pointer_refcount. (elf_x86_64_check_relocs): Increment func_pointer_refcount. (elf_x86_64_gc_sweep_hook): Decrement func_pointer_refcount. (elf_x86_64_allocate_dynrelocs): Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. Keep dynanamic relocations for run-time function pointer initialization. (elf_x86_64_relocate_section): Copy dynamic function pointer relocations. ld/testsuite/ PR ld/18900 * ld-i386/i386.exp: Run tests for PR ld/18900. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr18900.out: New file. * ld-i386/pr18900a.c: Likewise. * ld-i386/pr18900a.c: Likewise. * ld-i386/pr18900a.rd: Likewise. * ld-i386/pr18900b.c: Likewise. * ld-i386/pr18900b.rd: Likewise. * ld-i386/pr18900c.c: Likewise. * ld-x86-64/pr18900.out: Likewise. * ld-x86-64/pr18900a.c: Likewise. * ld-x86-64/pr18900a.rd: Likewise. * ld-x86-64/pr18900b.c: Likewise. * ld-x86-64/pr18900b.rd: Likewise. * ld-x86-64/pr18900c.c: Likewise. * ld-x86-64/mpx3.dd: Updated.
2015-09-01Wrong function reported for linker error messageAlan Modra2-1/+22
OPD lookup goes awry when .opd has been shuffled to remove unused functions. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value if .opd section has been edited.
2015-09-01ppc64 out-of-line register save/restore functionsAlan Modra2-49/+171
Don't emit long branch or plt branch stubs to save/restore functions. Copy them instead. The problem is that plt branch stubs currently trash r12, one of the parameters to some of the save/restore functions, and there is no free register available to use instead of r12. 6f20ed8a is prerequisite for this patch. PR 18878 * elf64-ppc.c (ARRAY_SIZE): Define. Use throughout. (enum ppc_stub_type): Add ppc_stub_save_res. (struct map_stub): Add "next" and "needs_save_res". (struct ppc_link_hash_entry): Add "save_res" flag. (struct ppc_link_hash_table): Add "group". (sfpr_define): Add stub_sec param. Define symbol in stub_sec if stub_sec is non-null. Set "save_res". (save_res_funcs): Make file scope, rename from funcs. Adjust uses. (ppc64_elf_adjust_dynamic_symbol): Prohibit plt call to save_res syms. (ppc_build_one_stub): Handle ppc_stub_save_res. (ppc_size_one_stub): Set stub type to ppc_size_one_stub on finding stub for linker defined save_res sym. (group_sections): Init new fields of struct map_stub. (ppc64_elf_size_stubs): Reserve space for save/restore func copy. (ppc64_elf_build_stubs): Copy save/restore funcs to groups. Emit alias syms too. (ppc64_elf_relocate_section): Set destination for ppc_stub_save_res.
2015-09-01Automatic date update in version.inGDB Administrator1-1/+1
2015-08-31Optimise PowerPC64 r2 adjusting stubsAlan Modra2-12/+28
Sometimes these stubs don't need to change the low 16-bits of r2, so in that case omit a useless addi r2,r2,0 insn. Also, change the get_r2off error return from 0 to -1 since 0 is a valid return for ELFv2 -R objects. * elf64-ppc.c (get_r2off): Return -1 on error. (ppc_build_one_stub): Adjust for get_r2off change. Don't emit addi r2,r2,0 on r2off stubs when the low 16-bit delta is zero. (ppc_size_one_stub): Corresponding size changes for r2off stubs. Add condition in test for -R objects.
2015-08-31ppc64 section group handlingAlan Modra4-176/+192
Two organizational changes to the array of additional info kept for sections. 1) Move group info into a per-group allocated struct, in preparation for future changes that need per-group accounting. 2) Expand the array to include output sections, which simplifies sizing and removes the need for a separate output section array. * section.c (section_id): Make file scope. (bfd_get_next_section_id): New function. * elf64-ppc.c (struct map_stub): Remove toc_off field. Move decl. (struct ppc_stub_hash_entry): Delete stub_sec and id_sec. Add group. Update all uses. (struct ppc_link_hash_table): Delete top_id, top_index, and input_list. Add sec_info_arr_size. Rename stub_group to sec_info, and make group info indirect. Update stub_group refs throughout file. (ppc_add_stub): Don't look for stub_sec on link_sec stub_group entry. (ppc_build_one_stub): Delete FIXME. (ppc64_elf_setup_section_lists): Size htab->sec_info for all sections, not just input sections. Don't create htab->input_list. (ppc64_elf_next_input_section): Update to use sec_info union as list pointer. (PREV_SEC): Delete. (group_sections): Pass "info" param rather than "htab". Iterate over output sections rather than input_list. Use sec_info union as list pointers. Alloc atruct map_stub, and return fail status. * bfd-in2.h: Regenerate.
2015-08-31gdb/tui: Make local variable const.Andrew Burgess2-1/+6
Small clean up to make a local variable const and remove a cast of NULL. gdb/ChangeLog: * tui/tui-data.c (tui_win_name): Make local variable const, remove cast of NULL.
2015-08-31xtensa: initialize call_abi in xtensa_tdepMax Filippov2-1/+8
Use XSHAL_ABI value provided by xtensa-config.h to correctly initialize xtensa_tdep.call_abi This fixes calls to functions from GDB that otherwise fail with the following assertion in call0 configuration: gdb/regcache.c:602: internal-error: regcache_raw_read: Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. 2015-08-31 Max Filippov <jcmvbkbc@gmail.com> gdb/ * xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Initialize call_abi using XSHAL_ABI macro.
2015-08-31More "Make asection->id and asection->index unsigned"Alan Modra4-5/+13
Fixes regressions introduced by 7292b3ac. * elflink.c (elf_sort_symbol): Use correctly sized type for calculating signed section->id difference. (elf_link_add_object_symbols): Likewise. * pef.c (bfd_pef_scan_start_address): Warning fix. * vms-alpha.c (vms_new_section_hook): Likewise.