summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Remove elf_backend_write_core_noteusers/palves/core-prstatus-reworkAlan Modra2016-01-2213-594/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function was added in 2007 to support powerpc gdb "gcore" writing 32-bit powerpc linux core files on a 64-bit powerpc host, when PowerPC64 glibc lacked (and still lacks) 32-bit versions of prstatus_t and prpsinfo_t. Now that gdb has elfcore_write_linux_prstatus32/64 and elfcore_write_linux_prpsinfo32/64, this linux specific backend function should disappear. * elf-bfd.h (struct elf_backend_data): Remove elf_backend_write_core_note. * elf.c (elfcore_write_prpsinfo, elfcore_write_prstatus): Don't call elf_backend_write_core_note. * elf32-arm.c (elf32_arm_nabi_write_core_note): Delete function. (elf_backend_write_core_note): Don't define. * elf32-ppc.c (ppc_elf_write_core_note): Delete function. (elf_backend_write_core_note): Don't define. * elf64-ppc.c (ppc64_elf_write_core_note): Delete function. (elf_backend_write_core_note): Don't define. * elf64-x86-64.c (elf_x86_64_write_core_note): Delete function. (elf_backend_write_core_note): Don't define. (CORE_HEADER): Don't include. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Delete function. * elfxx-aarch64.h (_bfd_aarch64_elf_write_core_note): Delete prototype. (elf_backend_write_core_note): Don't define. * elfxx-target.h (elf_backend_write_core_note): Don't define. (elfNN_bed): Adjust. * hosts/x86-64linux.h: Delete file. * configure.ac (CORE_HEADER): Delete. * configure: Regenerate. * config.in: Regenerate.
* x32 write_linux_prstatusAlan Modra2016-01-225-6/+27
| | | | | | | | | | | | | | | x32 uses an elf_gregset64_t in the prstatus struct, which aligns the struct to eight bytes. This means four bytes of padding at the end of the struct. * amd64-linux-tdep.c: Include elf-bfd.h. (amd64_x32_write_linux_prstatus): New function. (amd64_x32_linux_init_abi): Use it. * linux-tdep.c (linux_collect_regset_section_cb): Allocate an extra four bytes for regset buffer. * gdbarch.sh (elfcore_write_linux_prstatus): Remove const from info. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
* Use elfcore_write_linux_prstatus in gdbAlan Modra2016-01-218-11/+111
| | | | | | | | | | | The gdb side. Nothing fancy here, though it'd be easier to fill in more fields now. Targets that are known to need a custom gdbarch_elfcore_write_linux_prstatus but don't have one yet can install a stop-gap hook implementation that still calls into elfcore_write_prstatus. It is currently installed for MIPS n32 and Sparc64 (though we're not writting any of pr_{u,s,cu,cs}time yet), and x86-64 x32 too. Signed-off-by: Pedro Alves <palves@redhat.com>
* Linux core prstatus supportAlan Modra2016-01-213-1/+176
| | | | | | | This and the next patch are the first steps towards making gcore support writing NT_PRSTATUS on remote/cross targets. I'm not going to commit this one and I'm hoping someone from the gdb camp will run with it as I'm going to be busy with other things in the near future.
* gdb: Respect CXXFLAGS when building with C++ compilerPedro Alves2016-01-217-11/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, even when built with --enable-build-with-cxx, gdb uses CFLAGS instead of CXXFLAGS. This commit fixes it. CXXFLAGS set in the environment when configure was run is now honored in the generated gdb/Makefile, and you can also override CXXFLAGS in the command like at make time, with the usual 'make CXXFLAGS="..."' Objects built with a C compiler (e.g., gnulib) still honor CFLAGS instead. gdb/ChangeLog: 2016-01-21 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER_CFLAGS): New. (CXXFLAGS): Get it from configure. (INTERNAL_CFLAGS_BASE, INTERNAL_LDFLAGS): Use COMPILER_CFLAGS instead of CFLAGS. * build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Set and AC_SUBST COMPILER_CFLAGS. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-01-21 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER_CFLAGS, CXXFLAGS): New. (INTERNAL_CFLAGS_BASE): Use COMPILER_CFLAGS instead of CFLAGS. * configure: Regenerate.
* Fix unexpected failures in the linker testsuite for ARM VxWorks targets.Nick Clifton2016-01-219-21/+56
| | | | | | | | | | | | | | | | | PR ld/19455 * elf32-arm.c (elf32_arm_create_dynamic_sections): Set the ELF class of the linker stub bfd. (elf32_arm_check_relocs): Skip check for pic format after processing a vxWorks R_ARM_ABS12 reloc. * elflink.c (bfd_elf_final_link): Check for ELFCLASSNONE when reporting a class mismatch. * testsuite/ld-arm/vxworks1-lib.dd: Update for current disassmebler output. * testsuite/ld-arm/vxworks1-lib.rd: Likewise. * testsuite/ld-arm/vxworks1.dd: Likewise. * testsuite/ld-arm/vxworks1.rd: Likewise. * testsuite/ld-arm/vxworks1.ld: Set the output format.
* Fix regression introduced in "break *<EXPR>" by explicit location patches.Joel Brobecker2016-01-2112-12/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A relatively recent patch support for explicit locations, and part of that patch cleaned up the way we parse breakpoint locations. Unfortunatly, a small regression crept in for "*<EXPR>" breakpoint locations. In particular, on PIE programs, one can see the issue by doing the following, with any program: (gdb) b *main Breakpoint 1 at 0x51a: file hello.c, line 3. (gdb) run Starting program: /[...]/hello Error in re-setting breakpoint 1: Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x51a Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x51a Just for the record, this regression was introduced by: commit a06efdd6effd149a1d392df8d62824e44872003a Date: Tue Aug 11 17:09:35 2015 -0700 Subject: Explicit locations: introduce address locations What happens is that the patch makes the implicit assumption that the address computed the first time is static, as if it was designed to only support litteral expressions (Eg. "*0x1234"). This allows the shortcut of not re-computing the breakpoint location's address when re-setting breakpoints. However, this does not work in general, as demonstrated in the example above. This patch plugs that hole simply by saving the original expression used to compute the address as part of the address location, so as to then re-evaluate that expression during breakpoint re-set. gdb/ChangeLog: * location.h (new_address_location): Add new parameters "addr_string" and "addr_string_len". (get_address_string_location): Add declaration. * location.c (new_address_location): Add new parameters "addr_string" and "addr_string_len". If not NULL, store a copy of the addr_string in the new location as well. (get_address_string_location): New function. (string_to_event_location): Update call to new_address_location. * linespec.c (event_location_to_sals) <ADDRESS_LOCATION>: Save the event location in the parser's state before passing it to convert_address_location_to_sals. * breakpoint.c (create_thread_event_breakpoint): Update call to new_address_location. (init_breakpoint_sal): Get the event location's string, if any, and use it to update call to new_address_location. * python/py-finishbreakpoint.c (bpfinishpy_init): Update call to new_address_location. * spu-tdep.c (spu_catch_start): Likewise. * config/djgpp/fnchange.lst: Add entries for gdb/testsuite/gdb.base/break-fun-addr1.c and gdb/testsuite/gdb.base/break-fun-addr2.c. gdb/testsuite/ChangeLog: * gdb.base/break-fun-addr.exp: New file. * gdb.base/break-fun-addr1.c: New file. * gdb.base/break-fun-addr2.c: New file.
* [AArch64] Relax long branch veneer insertion for non STT_FUNC symbolJiong Wang2016-01-2112-33/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As defined at AArch64 ELF Specification (4.6.7 Call and Jump relocations), symbol with type of non STT_FUNC but in different input section with relocation place should insert long branch veneer also. Meanwhile the current long branch veneer infrastructure havn't considered the situation where the branch destination is "sym_value + rela->addend". This was OK because we only insert veneer for long call destination is STT_FUNC symbol for which the addend is always zero. But as we relax the support to other situations by this patch, we need to handle addend be non-zero value. For example, for static function, relocation against "local symbol" are turned into relocation against "section symbol + offset" where there is a valid addend. bfd/ * elfnn-aarch64.c (aarch64_type_of_stub): Allow insert long branch veneer for sym_sec != input_sec. (elfNN_aarch64_size_stub): Support STT_SECTION symbol. (elfNN_aarch64_final_link_relocate): Take rela addend into account when calculation destination. ld/ * testsuite/ld-aarch64/farcall-section.d: Delete. * testsuite/ld-aarch64/farcall-section.s: Delete. * testsuite/ld-aarch64/farcall-b-section.d: New expectation file. * testsuite/ld-aarch64/farcall-bl-section.d: Likewise. * testsuite/ld-aarch64/farcall-b-section.s: New testcase. * testsuite/ld-aarch64/farcall-bl-section.s: Likewise. * testsuite/ld-aarch64/aarch64-elf.exp: Likewise.
* Convert macros in elf-linux-core.h to inline functionsAlan Modra2016-01-214-84/+87
| | | | | | | | | | | | | | | Besides changing some macros into inline functions, this removes redundant memsets and uses bfd_put_* rather than H_PUT_*. * elf-linux-core.h (swap_linux_prpsinfo32_out): New function. (swap_linux_prpsinfo64_out): New function. (LINUX_PRPSINFO32_SWAP_FIELDS): Delete. (LINUX_PRPSINFO64_SWAP_FIELDS): Delete. * elf.c (elfcore_write_linux_prpsinfo32): Adjust. Don't memset. (elfcore_write_linux_prpsinfo64): Likewise. * elf32-ppc.c (swap_ppc_linux_prpsinfo32_out): New function. (PPC_LINUX_PRPSINFO32_SWAP_FIELDS): Delete. (elfcore_write_ppc_linux_prpsinfo32): Adjust. Don't memset.
* Rename elf-linux-psinfo.h to elf-linux-core.hAlan Modra2016-01-217-5/+13
| | | | | | | | | | | | Since it will sometime have more than just prpsinfo. Also, elf32-ppc.c needlessly includes this header. * elf-linux-core.h: Rename from elf-linux-psinfo.h. * elf.c: Adjust #include. * elf32-ppc.c: Don't #include elf-linux-psinfo.h * Makefile.am (SOURCE_HFILES): Update. * Makefile.in: Regenerate. * po/SRC-PORFILES.in: Regenerate.
* bfd/configure reorganisationAlan Modra2016-01-213-1063/+1067
| | | | | | | | | Corefile code should be moved after running config.bfd, because it uses want64. * configure.ac: Move corefile selection later in file. Move tdefaults code immediately after other target vector code. * configure: Regenerate.
* Detect the arm/thumb mode of code SIGRETURN or RT_SIGRETURN returns toYao Qi2016-01-214-6/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the following regression introduced by commit d0e59a68 step^M 39 } /* handler */^M 1: x/i $pc^M => 0x8740 <handler+80>: sub sp, r11, #0^M (gdb) step^M ^M Program received signal SIGSEGV, Segmentation fault.^M setitimer () at ../sysdeps/unix/syscall-template.S:81^M 81 ../sysdeps/unix/syscall-template.S: No such file or directory.^M 1: x/i $pc^M => 0xb6eff9c0 <setitimer>: push {r7}^M (gdb) FAIL: gdb.base/sigstep.exp: continue to handler, si+advance in handler, step from handler: leave handler in my test setting, program is compiled in arm mode, but the glibc is built in thumb mode, so when we do 'step' to step over syscall instruction svc for SIGRETURN, GDB should set breakpoint for arm mode in the program, even though the current program in glibc is in thumb mode. Current GDB doesn't consider the case that the mode of program SIGRETURN goes to can be different from current program mode. In fact, GDB has taken care of this arm/thumb mode changes already, see /* Copy the value of next pc of sigreturn and rt_sigrturn into PC, return 1. In addition, set IS_THUMB depending on whether we will return to ARM or Thumb code. Return 0 if it is not a rt_sigreturn/sigreturn syscall. */ static int arm_linux_sigreturn_return_addr (struct frame_info *frame, unsigned long svc_number, CORE_ADDR *pc, int *is_thumb) but in the commit d0e59a68 > - arm_linux_sigreturn_return_addr (frame, svc_number, &return_addr, &is_thumb); > + if (svc_number == ARM_SIGRETURN || svc_number == ARM_RT_SIGRETURN) > + next_pc = arm_linux_sigreturn_next_pc (regcache, svc_number); the IS_THUMB setting is lost, so it is a regression. gdb: 2016-01-21 Yao Qi <yao.qi@linaro.org> * arm-linux-tdep.c (arm_linux_sigreturn_next_pc): Add parameter is_thumb and set it according to CPSR saved on the stack. (arm_linux_get_next_pcs_syscall_next_pc): Pass is_thumb to arm_linux_sigreturn_next_pc. gdb/gdbserver: 2016-01-21 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c (arm_sigreturn_next_pc): Add parameter is_thumb and set it according to CPSR saved on the stack. (get_next_pcs_syscall_next_pc): Pass is_thumb to arm_sigreturn_next_pc.
* Automatic date update in version.inGDB Administrator2016-01-211-1/+1
|
* Fix sorting of enum values in FlagEnumerationPrinterSimon Marchi2016-01-205-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lambda function used to sort the enumerator list does not work properly. This list consists of tuples, (enum label, enum value). The key function returns x.enumval. enumval not being defined for a tuple, we see this exception in the test log: Python Exception <class 'AttributeError'> 'tuple' object has no attribute 'enumval' The function should return the second item of the tuple, which is the enumval. The pretty-printer still worked mostly correctly, except that the enumeration values were not sorted. The test still passed because the enumeration values are already sorted where they are defined. The test also passed despite the exception being printed, because the right output was printed after the exception: print (enum flag_enum) (FLAG_1) Python Exception <type 'exceptions.AttributeError'> 'tuple' objecthas no attribute 'enumval':M $7 = 0x1 [FLAG_1] (gdb) PASS: gdb.python/py-pp-maint.exp: print FLAG_1 New in v2: - Improved test case, I stole Pedro's example directly. It verifies that the sorting of enumerators by value works, by checking that printing FOO_MASK appears as FOO_1 | FOO_2 | FOO_3. I noticed that I could change the regexps to almost anything and the tests would still pass. I think it was because of the | in there. I made them more robust by using string_to_regexp. I used curly braces { } instead of quoting marks " " for strings, so that I could use square brackets [ ] in them without having to escape them all. I also removed the "message" part of the tests, since they are redundant with the command, and it's just more maintenance to have to update them. Tested with Python 2.7 and 3.5. gdb/ChangeLog: * python/lib/gdb/printing.py (FlagEnumerationPrinter.__call__): Fix enumerators sort key function. gdb/testsuite/ChangeLog: * gdb.python/py-pp-maint.exp: Change/add enum flag tests. * gdb.python/py-pp-maint.c (enum flag_enum): Use more complex enum flag values.
* gnu_vector.exp: Respect `should_kfail' for PR 8549Andreas Arnez2016-01-202-1/+22
| | | | | | | | | | | | | | | | | | | The gnu_vector test case yields a new FAIL on s390x: FAIL: gdb.base/gnu_vector.exp: verify vector return value It was introduced by commit 77ae9c1933b50 "gdb.base/gnu_vector.exp: Don't test output from the inferior". That commit dropped the special handling for GDB's inability (on some targets) to set the return value. This change re-establishes the logic from before, converting the above FAIL to a KFAIL (PRMS gdb/8549). gdb/testsuite/ChangeLog: * gdb.base/gnu_vector.exp: Re-establish handling for should_kfail when GDB can not set the vector return value. Add more comments for clarification.
* Fix missing IPA lib in tspeed.exp in some configurations.Antoine Tremblay2016-01-202-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | On Ubuntu 14.04 the following failure would be seen when running the tspeed.exp test on a target that supports fast tracepoints like x86_64: Target returns error code '.In-process agent library not loaded in process. Fast and static tracepoints unavailable.'. (gdb) FAIL: gdb.trace/tspeed.exp: start trace experiment This is because the default is to link with --as-needed and the gdb_compile for the test is using the libs argument instead of shlib which corrects this issue since 6ebea266fd0a7a56c90db3ab6237ff9f6c919747 by adding -Wl,--no-as-needed. This patch fixes the issue by passing the lib as the shlib argument to gdb_compile. Tested on Ubuntu 14.04 x86_64. gdb/testsuite/ChangeLog: * gdb.trace/tspeed.exp: Use shlib instead of libs in gdb_compile command.
* Fix unexpected failures in GAS testsuite for ARM VxWorks target.Nick Clifton2016-01-209-21/+32
| | | | | | | | | | | | PR 19456 * testsuite/gas/arm/weakdef-1.d: Skip for VxWorks. * testsuite/gas/arm/blx-bl-convert.d * testsuite/gas/arm/plt-1.d: Likewise. * testsuite/gas/arm/reloc-bad.d: Likewise. * testsuite/gas/arm/thumb-w-good.d: Likewise. * testsuite/gas/arm/thumb2_pool.d: Likewise. * testsuite/gas/arm/ldconst.d: Adjust so that it works with VxWorks * testsuite/gas/arm/tls_vxworks.d: Update expected output.
* Upda the documentation on assembler error message generation.Nick Clifton2016-01-202-8/+31
| | | | | | PR 19499 * doc/as.texinfo (Errors): Correct documentation describing the interaction of .file and .line with warning and error messages.
* Fix linker testsuite failures for arm-pe targets.Nick Clifton2016-01-204-3/+20
| | | | | | | | PR 19457 * testsuite/ld-scripts/script.exp (extract_symbol_test): Stop test early for PE based targets. * testsuite/ld-scripts/align.t: Use 0x1000 as VMA alignment. * testsuite/ld-pe/tlssec32.d: Allow for relocatable output.
* Skip ARM v8 tests for COFF based targets.Nick Clifton2016-01-204-0/+10
|
* Fix dlltool tests for ARM targets, which do not support the ↵Nick Clifton2016-01-202-12/+37
| | | | | | | | --leading-underscore option. PR 19495 * testsuite/binutils-all/dlltool.exp: Fix tests for targets which do not support inserting leading underscores.
* [AArch64] Reject invalid immediate operands to MSR UAOMatthew Wahab2016-01-206-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | In the instruction to write to the ARMv8.2 PSTATE field UAO, MSR UAO, #<imm>, the immediate should be either 0 or 1 but GAS accepts any unsigned 4-bit integer. This patch implements the constraint on the immediate, generating an error if the immediate operand is invalid, and adds tests for the illegal forms. opcodes/ 2016-01-20 Matthew Wahab <matthew.wahab@arm.com> * aarch64-opc.c (operand_general_constraint_met_p): Check validity of MSR UAO immediate operand. gas/ 2016-01-20 Matthew Wahab <matthew.wahab@arm.com> * testsuite/gas/aarch64/armv8_2-a-illegal.d: New. * testsuite/gas/aarch64/armv8_2-a-illegal.l: New. * testsuite/gas/aarch64/armv8_2-a-illegal.s: New. Change-Id: Ibdec4967c00b1ef3be9dbc43d23b2c70d1a0b28c
* Fix gdb/ChangeLog typoPedro Alves2016-01-201-1/+1
|
* Move ChangeLog entry to proper place (gdb/testsuite/ -> gdb/)Pedro Alves2016-01-201-0/+63
|
* Add support for an ARM specific 'y' section attribute flag to mark the ↵Mickael Guene2016-01-2018-18/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | section as NOREAD. bfd/ChangeLog: * elf32-arm.c ((elf32_arm_special_sections): Remove catch of noread section using '.text.noread' pattern. gas/ChangeLog: * config/obj-elf.c (obj_elf_change_section) : Allow arm section with SHF_ARM_NOREAD section flag. * config/tc-arm.h (md_elf_section_letter) : Implement this hook to handle letter 'y'. (arm_elf_section_letter) : Declare it. * config/tc-arm.c (arm_elf_section_letter): Handle letter 'y' to set SHF_ARM_NOREAD section flag. * doc/c-arm.texi (ARM section attribute 'y'): Document it. gas/testsuite/ChangeLog: * gas/arm/section-execute-only.s: New test case. * gas/arm/section-execute-only.d: Expected output. ld/testsuite/ChangeLog: * ld-arm/thumb1-noread-not-present-mixing-two-section.s: Add 'y' attribute usage. * ld-arm/thumb1-noread-present-one-section.s: Likewise. * ld-arm/thumb1-noread-present-two-section.s: Likewise. * ld-arm/thumb1-input-section-flag-match.s: Likewise. binutils/ChangeLog: * readelf.c (get_elf_section_flags): Display y letter for section with SHF_ARM_NOREAD section flag in readelf section output. (process_section_headers): Add y letter in readelf section output key mapping for ARM architecture.
* minor reformatting in printcmd.c::print_scalar_formattedJoel Brobecker2016-01-202-3/+9
| | | | | | | | | | (GNU Coding Standard...) gdb/ChangeLog: * printcmd.c (print_scalar_formatted): move binary operator from end of line to beginning of next line. Adjust formatting accordingly.
* Automatic date update in version.inGDB Administrator2016-01-201-1/+1
|
* Use a separate variable for the size passed to sysctl.John Baldwin2016-01-192-2/+9
| | | | | | | | | This fixes a sign mismatch warning. gdb/ChangeLog: * fbsd-nat.c (fbsd_pid_to_exec_file): Use new "buflen" instead of "len" with sysctl.
* Remove an unused variable.John Baldwin2016-01-192-2/+4
| | | | | | binutils/ChangeLog: * readelf.c (get_freebsd_elfcore_note_type): Remove unused variable.
* Dump register notes for each thread when generating a FreeBSD core.John Baldwin2016-01-192-26/+131
| | | | | | | | | | | | | | | gdb/ChangeLog: * fbsd-tdep.c (find_stop_signal): Remove. (struct fbsd_collect_regset_section_cb) <lwp>: New field. <stop_signal>: New field. <abort_iteration>: New field. (fbsd_collect_regset_section_cb): Use new fields. (fbsd_collect_thread_registers): New function. (struct fbsd_corefile_thread_data): New structure. (fbsd_corefile_thread): New function. (fbsd_make_corefile_notes): Use new function to dump notes for each non-exited thread in a process.
* Add support for LWP-based threads on FreeBSD.John Baldwin2016-01-198-32/+469
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older versions of FreeBSD supported userland threading via a pure user-space threading library (N threads scheduled on 1 process) and a N:M model (N threads scheduled on M LWPs). However, modern FreeBSD versions only support a M:M threading model where each user thread is backed by a dedicated LWP. This thread target only supports this threading model. It also uses ptrace to query and alter LWP state directly rather than using libthread_db to simplify the implementation. FreeBSD recently gained support for reporting LWP events (birth and death of LWPs). GDB will use LWP events when present. For older systems it fetches the list of LWPs in the to_update_thread_list target op to update the list of threads on each stop. This target supports scheduler locking by using ptrace to suspend individual LWPs as necessary before resuming a process. gdb/ChangeLog: * configure.ac: Check for support for LWP names on FreeBSD. * fbsd-nat.c [PT_LWPINFO] New variable debug_fbsd_lwp. [TDP_RFPPWAIT || HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME] (fbsd_fetch_kinfo_proc): Move function earlier. [PT_LWPINFO] (fbsd_thread_alive): New function. [PT_LWPINFO] (fbsd_pid_to_str): New function. [HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME] (fbsd_thread_name): New function. [PT_LWP_EVENTS] (fbsd_enable_lwp_events): New function. [PT_LWPINFO] (fbsd_add_threads): New function. [PT_LWPINFO] (fbsd_update_thread_list): New function. [PT_LWPINFO] New variable super_resume. [PT_LWPINFO] (resume_one_thread_cb): New function. [PT_LWPINFO] (resume_all_threads_cb): New function. [PT_LWPINFO] (fbsd_resume): New function. (fbsd_remember_child): Save full ptid instead of plain pid. (fbsd_is_child_pending): Return ptid of saved child process. (fbsd_wait): Include lwp in returned ptid and switch to LWP ptid on first stop. [PT_LWP_EVENTS] Handle LWP events. [TDP_RFPPWAIT] Include LWP in child ptid. (fbsd_post_startup_inferior) [PT_LWP_EVENTS]: Enable LWP events. (fbsd_post_attach) [PT_LWP_EVENTS]: Enable LWP events. Add threads for existing processes. (fbsd_nat_add_target) [PT_LWPINFO]: Set "to_thread_alive" to "fbsd_thread_alive". Set "to_pid_to_str" to "fbsd_pid_to_str". [HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME]: Set "to_thread_name" to "fbsd_thread_name". [PT_LWPINFO]: Set "to_update_thread_list" to "fbsd_update_thread_list". Set "to_has_thread_control" to "tc_schedlock". Set "to_resume" to "fbsd_resume". (_initialize_fbsd_nat): New function. * configure: Regenerate. * config.in: Regenerate. gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Document "set/show debug fbsd-lwp".
* Use LWP IDs with ptrace register requests on FreeBSD.John Baldwin2016-01-196-34/+55
| | | | | | | | | | | | | | | | | | | | | | | | | This allows gdb to fetch per-thread registers for multi-threaded FreeBSD processes. Export get_ptrace_pid() from inf-ptrace.c and use it to determine the PID to pass to ptrace in pan-BSD native targets. NetBSD and OpenBSD also accept LWP IDs for ptrace requests to fetch per-thread state. gdb/ChangeLog: * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Use get_ptrace_pid. (amd64bsd_store_inferior_registers): Use get_ptrace_pid. (amd64bsd_dr_get): Use get_ptrace_pid. (amd64bsd_dr_set): Use get_ptrace_pid. * i386bsd-nat.c (i386bsd_fetch_inferior_registers): Use get_ptrace_pid. (i386bsd_store_inferior_registers): Use get_ptrace_pid. (i386bsd_dr_get): Use get_ptrace_pid. (i386bsd_dr_set): Use get_ptrace_pid. * inf-ptrace.c (get_ptrace_pid): Export. * inf-ptrace.h (get_ptrace_pid): Declare. * ppcfbsd-nat.c (ppcfbsd_fetch_inferior_registers): Use lwp id. (ppcfbsd_store_inferior_registers): Use lwp id.
* Display per-thread information for threads in FreeBSD cores.John Baldwin2016-01-192-0/+73
| | | | | | | | | | | | Display the LWP ID of each thread in a FreeBSD core. Extract thread names from the per-thread THRMISC note. gdb/ChangeLog: * fbsd_tdep.c (fbsd_core_pid_to_str): New function. (fbsd_core_thread_name): New function. (fbsd_init_abi): Add "core_pid_to_str" gdbarch method. Add "core_thread_name" gdbarch method.
* Add support for extracting thread names from cores.John Baldwin2016-01-195-0/+64
| | | | | | | | | | | | | | | Add a new gdbarch method to extract a thread name from a core for a given thread. Use this new method in core_thread_name to implement the to_thread_name target op. gdb/ChangeLog: * corelow.c (core_thread_name): New function. (init_core_ops): Use "core_thread_name" for the "to_thread_name" target op. * gdbarch.sh (core_thread_name): New gdbarch callback. * gdbarch.h: Re-generate. * gdbarch.c: Re-generate.
* Add a pseudosection for the NT_FREEBSD_THRMISC note.John Baldwin2016-01-192-0/+11
| | | | | | bfd/ChangeLog: * elf.c (elfcore_grok_note): Recognize NT_FREEBSD_THRMISC notes.
* Add support to readelf for reading FreeBSD ELF core notes.John Baldwin2016-01-194-0/+67
| | | | | | | | | | | | | | | | | | | | binutils/ChangeLog: * readelf.c (get_freebsd_elfcore_note_type): New (process_note): Add support for FreeBSD core notes. include/ChangeLog: * elf/common.h (NT_FREEBSD_THRMISC): Define. (NT_FREEBSD_PROCSTAT_PROC): Define. (NT_FREEBSD_PROCSTAT_FILES): Define. (NT_FREEBSD_PROCSTAT_VMMAP): Define. (NT_FREEBSD_PROCSTAT_GROUPS): Define. (NT_FREEBSD_PROCSTAT_UMASK): Define. (NT_FREEBSD_PROCSTAT_RLIMIT): Define. (NT_FREEBSD_PROCSTAT_OSREL): Define. (NT_FREEBSD_PROCSTAT_PSSTRINGS): Define. (NT_FREEBSD_PROCSTAT_AUXV): Define.
* Fix enum flag with Python 3Simon Marchi2016-01-192-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using Python 3.5 (I assume it's the same with 3.4 and lower, but I didn't test), I see this: print (enum flag_enum) (FLAG_1)^M Python Exception <class 'TypeError'> %x format: an integer is required, not gdb.Value: ^M $7 = ^M (gdb) FAIL: gdb.python/py-pp-maint.exp: print FLAG_1 Apparently, this idiom, where v is a gdb.Value, was possible with Python 2, but not with Python 3: '%x' % v In Python 2, it would automatically get converted to an integer. To solve it, I simply added wrapped v in a call to int(). '%x' % int(v) In Python 2, the int type is implemented with a "long" in C, so on x86-32 it's 32-bits. I was worried that doing int(v) would truncate the value and give wrong results for enum values > 32-bits. However, the int type != the int function. The int function does the right thing, selecting the right integer type for the given value. I tested with large enum values on x86-32 and Python 2, and everything works as expected. gdb/ChangeLog: * python/lib/gdb/printing.py (_EnumInstance.to_string): Explicitly convert gdb.Value to integer type using int().
* testsuite: Factor out --status in DO_RUNTESTSimon Marchi2016-01-192-6/+10
| | | | | | gdb/testsuite/ChangeLog: * Makefile.in (DO_RUNTEST): Add --status and update usages.
* Add missing ChangeLog entries for the last 2 commitsSimon Marchi2016-01-191-0/+10
| | | | | I did a wrong manipulation and pushed the last 2 commits without amending them with the ChangeLog entries.
* testsuite: Add --status to runtest invocationSimon Marchi2016-01-191-2/+2
| | | | | | | | | | | | | | | | By default, if a test driver (a test .exp) ends with an uncaught error/exception, the runtest command will still have a return code of 0 (success). However, if a test (or the environment) is broken and does not work properly, it should be considered as failed so that we can notice it and fix it. Passing the --status flag to runtest will make it return an error if one of the test it runs ends up with an uncaught error. gdb/testsuite/ChangeLog: * Makefile.in (check-single): Pass --status to runtest. (check/%.exp): Likewise.
* testsuite: Make check-parallel return non-zero if a test failedSimon Marchi2016-01-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using the check-parallel target, the return code of make is always 0, regardless of test results. This patch makes it return the same code as the "make do-check-parallel" sub-command. So if there is a FAIL somewhere, non-zero will be returned by make. For the sake of example, I introduced a failure in gdb.base/break.exp. $ make check-single TESTS="gdb.base/break.exp gdb.python/py-value.exp" && echo 'Success :D' || echo 'Fail :(' ... FAIL: gdb.base/break.exp: allo ... Fail :( I think the parallel run should do the same. Currently: $ make check-parallel TESTS="gdb.base/break.exp gdb.python/py-value.exp" && echo 'Success :D' || echo 'Fail :(' ... FAIL: gdb.base/break.exp: allo ... Success :D And with the patch (no big surprises there): $ make check-parallel TESTS="gdb.base/break.exp gdb.python/py-value.exp" && echo 'Success :D' || echo 'Fail :(' ... FAIL: gdb.base/break.exp: allo ... Fail :( What do you think? gdb/testsuite/ChangeLog: * Makefile.in (check-parallel): Propagate return code from make do-check-parallel.
* Fix detection of "r_fs" and "r_gs" on FreeBSD.John Baldwin2016-01-193-3/+12
| | | | | | | | | | | | Include <sys/types.h> as a prerequisite for <machine/reg.h> when checking for the r_fs and r_gs members in struct reg. Note that the previous test for <machine/reg.h> already includes <sys/types.h> as a prerequisite. gdb/ChangeLog: * configure.ac: Include <sys/types.h when checking for "r_fs" in "struct reg". * configure: Regenerate.
* Add PIC and TLS support to the ARC target.Miranda Cupertino2016-01-199-608/+1951
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ChangeLog: * arc-plt.def: New file. * arc-plt.h: Likewise. * elf32-arc.c (elf_arc_abs_plt0_entry, elf_arc_abs_pltn_entry, elf_arcV2_abs_plt0_entry, elf_arcV2_abs_pltn_entry, elf_arc_pic_plt0_entry, elf_arc_pic_pltn_entry, elf_arcV2_pic_plt0_entry, elf_arcV2_pic_pltn_entry): Remove. (name_for_global_symbol): Added. (ADD_RELA): Helper to create dynamic relocs. (new_got_entry_to_list): Create a new got entry in linked list. (symbol_has_entry_of_type): Search for specific type of entry in list. (is_reloc_for_GOT): return FALSE for any TLS related relocs. (is_reloc_for_TLS, arc_elf_set_private_flags) (arc_elf_print_private_bfd_data, arc_elf_copy_private_bfd_data) (arc_elf_merge_private_bfd_data): New functions. (debug_arc_reloc): Cleaned debug info printing. (PDATA reloc): Changed not to perform address alignment. (reverse_me): Added. Fix for ARC_32 relocs. (arc_do_relocation): Return bfd_reloc_of when no relocation should occur. (arc_get_local_got_ents): Renamed from arc_get_local_got_offsets. Changed function to access an array of list of GOT entries instead of just an array of offsets. (elf_arc_relocate_section): Added support for PIC and TLS related relocations. (elf_arc_check_relocs): Likewise. (elf_arc_adjust_dynamic_symbol, elf_arc_finish_dynamic_symbol, (elf_arc_finish_dynamic_sections): Likewise (arc_create_dynamic_sections): Modified conditions to create dynamic sections. (ADD_SYMBOL_REF_SEC_AND_RELOC): New macro. (plt_do_relocs_for_symbol, relocate_plt_for_symbol) (relocate_plt_for_entry): Changed to support new way to define PLT related code. (add_symbol_to_plt): Likewise. (arc_elf_link_hash_table_create): New function. include/ChangeLog: * elf/arc-reloc.def (ARC_32, ARC_GOTPC, ARC_TLS_GD_GOT) (ARC_TLS_IE_GOT, ARC_TLS_DTPOFF, ARC_TLS_DTPOFF_S9, ARC_TLS_LE_S9) (ARC_TLS_LE_32): Fixed formula. (ARC_TLS_GD_LD): Use new special function. * opcode/arc-func.h: Changed all the replacement functions to clear the patching bits before doing an or it with the value argument.
* Limit breakpoint re-set to the current program spacePedro Alves2016-01-1913-121/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
* testsuite/gdb.trace: Fix expected message on continue.Marcin Kościelnicki2016-01-194-22/+41
| | | | | | | | | | | | | | This is fallout from f303dbd60d9c7984832446eeb9d4e4d89703c615. The testcases themselves are single-threaded, but they load the IPA library, which injects a thread in the inferior - making them multithreaded. This results in printing the thread numbers in breakpoint messages. gdb/testsuite/ChangeLog: * gdb.trace/ftrace.exp: Fix expected message on continue. * gdb.trace/pending.exp: Fix expected message on continue. * gdb.trace/trace-break.exp: Fix expected message on continue.
* Fix PR18735 test for RL78.Nick Clifton2016-01-192-0/+6
| | | | | * testsuite/ld-elf/pr18735.d: Allow for extra symbols between foo@FOO and bar@@FOO.
* Automatic date update in version.inGDB Administrator2016-01-191-1/+1
|
* MIPS: Remove remnants of 48-bit microMIPS instruction supportMaciej W. Rozycki2016-01-186-72/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The POOL48A major opcode was defined in early revisions of the 64-bit microMIPS ISA, has never been implemented, and was removed before the 64-bit microMIPS ISA specification[1] has been finalized. This complements commit a6c7053929dd ("MIPS/opcodes: Remove microMIPS 48-bit LI instruction"). References: [1] "MIPS Architecture for Programmers, Volume II-B: The microMIPS64 Instruction Set", MIPS Technologies, Inc., Document Number: MD00594, Revision 3.06, October 17, 2012, Table 6.2 "microMIPS64 Encoding of Major Opcode Field", p. 578 gas/ * config/tc-mips.c (micromips_insn_length): Remove the mention of 48-bit microMIPS instructions. gdb/ * mips-tdep.c (mips_insn_size): Remove 48-bit microMIPS instruction support. (micromips_next_pc): Likewise. (micromips_scan_prologue): Likewise. (micromips_deal_with_atomic_sequence): Likewise. (micromips_stack_frame_destroyed_p): Likewise. (mips_breakpoint_from_pc): Likewise. opcodes/ * mips-dis.c (print_insn_micromips): Remove 48-bit microMIPS instruction support.
* MIPS: Only build microMIPS specific simulator functions if microMIPS support ↵Andrew Bennett2016-01-182-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | is required. This fixes PR sim/19441. In the MIPS simulator the microMIPS functions in micromips.igen were not predicated on the microMIPS models. This was causing build issues for some target triples. This patch sets all the microMIPS specific functions to only be built if the micromips32, micromips64 or micromipsdsp models are used. PR sim/19441 * micromips.igen (delayslot_micromips): Enable for `micromips32', `micromips64' and `micromipsdsp' only. (process_isa_mode): Enable for `micromips32' and `micromips64' only. (do_micromips_jalr, do_micromips_jal): Likewise. (compute_movep_src_reg): Likewise. (compute_andi16_imm): Likewise. (convert_fmt_micromips): Likewise. (convert_fmt_micromips_cvt_d): Likewise. (convert_fmt_micromips_cvt_s): Likewise. (FMT_MICROMIPS): Likewise. (FMT_MICROMIPS_CVT_D): Likewise. (FMT_MICROMIPS_CVT_S): Likewise.
* MIPS: Fix microMIPS instruction size determinationMaciej W. Rozycki2016-01-182-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a bug in `micromips_insn_at_pc_has_delay_slot' in instruction size determination via `mips_insn_size'. In the microMIPS case the latter function expects a lone 16-bit instruction word containing the major opcode regardless of whether the opcode requires another 16-bit word to follow, to form a complete 32-bit instruction. Code however passes the 16-bit word previously retrieved shifted left by 16 bits. Consequently `mips_insn_size', which examines the low 16-bit only, always sees 0. By pure coincidence a major opcode of 0 denotes a 32-bit instruction in the microMIPS instruction set, so the size of 4 is always returned here, and the following 16-bit word is then merged in the low 16 bits of the instruction previously shifted by 16 bits. The resulting 32-bit value is then passed to `micromips_instruction_has_delay_slot' for delay slot presence determination. This function in turn first examines the high 16 bits of the instruction word received and ignores the low 16 bits for 16-bit instructions. Consequently the only effect of this bug is an extraneous memory read issued to retrieve a subsequent 16-bit word where a 16-bit instruction is being examined. Which in turn may fail if the instruction is located right at the end of a readable memory area, in which case the lack of a delay slot will be reported to the caller, which may be incorrect. This code is used in breakpoint maintenance, for delay slot avoidance, so the bug would only trigger for the unlikely case of someone placing a breakpoint in a delay slot of an instruction which is at the end of readable memory. Which explains why the bug remained unnoticed so long. gdb/ * mips-tdep.c (micromips_insn_at_pc_has_delay_slot): Pass unshifted 16-bit microMIPS instruction word to `mips_insn_size'.