aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-10-01[ARC] Refactored location where GOT information is collected.Cupertino Miranda2-37/+46
Change location where GOT information is collected for ARC target, avoiding posible use conflicts of the previous .got field in the symbols hash_entry. bfd/ 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (get_got_entry_list_for_symbol): Changed. * ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed. (elf_arc_link_hash_newfunc): Changed. (arc_elf_link_hash_table_create): Removed old initializations. (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
2018-10-01Remove ancient workaroundGary Benson6-87/+11
This commit removes a workaround for a bug in glibc 2.1.3, which was released 2000-02-24 and superseded 2000-11-09. gdb/ChangeLog: * gdb_proc_service.h (gdb_prfpregset_t): Remove typedef. * proc-service.c (ps_lgetfpregs, ps_lsetfpregs): Use prfpregset_t instead of gdb_prfpregset_t. * configure.ac (PRFPREGSET_T_BROKEN): Remove check. * configure, config.in: Rebuild.
2018-10-01Move duplicated code to common/gdb_proc_service.hGary Benson6-300/+187
This commit moves now-identical code from gdb/gdb_proc_service.h and gdb/gdbserver/gdb_proc_service.h into the new shared file gdb/common/gdb_proc_service.h. gdb/ChangeLog: * common/gdb_proc_service.h: New file, factored out from... * gdb_proc_service.h: Moved common code to the above file. * Makefile.in (HFILES_NO_SRCDIR): Add the above new file. gdb/gdbserver/ChangeLog: * gdb_proc_service.h: Moved common code to common/gdb_proc_service.h.
2018-10-01Update GDB gdb_proc_service.h workaround to match gdbserverGary Benson2-2/+7
This commit updates GDB's gdb_proc_service.h to use elf_{g,fp}regset_t instead of gdb_{g,fp}regset_t if pr{g,fp}regset_t are undefined. The types have been equivalent on GNU/Linux since at least 2005. gdb/ChangeLog: * gdb_proc_service.h: Use elf_gregset_t if prgregset_t is undefined. Use elf_fpregset_t if prfpregset_t is undefined.
2018-10-01Add workaround from gdbserver's gdb_proc_service.h to GDBGary Benson5-2/+63
This commit adds a workaround from gdbserver's gdb_proc_service.h to GDB's. It doesn't seem to have been needed on any glibc as far back as 2001, but it's possibly required for other C libraries so I've retained it. gdb/ChangeLog: * configure.ac: Check if sys/procfs.h defines elf_fpregset_t. (AC_CHECK_HEADERS): Check for linux/elf.h. * configure, config.in: Rebuild. * gdb_proc_service.h: Include linux/elf.h if sys/procfs.h doesn't define elf_fpregset_t.
2018-10-01gdb_proc_service.h comment and whitespace synchronizationGary Benson4-9/+42
This commit updates comments and whitespace in GDB's and gdbserver's gdb_proc_service.h. gdb/ChangeLog: * gdb_proc_service.h: Whitespace change. gdb/gdbserver/ChangeLog: * gdb_proc_service.h: Synchronize comments and whitespace with GDB's version of this file.
2018-10-01Don't check HAVE_UNISTD_HTom Tromey4-15/+9
I noticed some spots that were checking HAVE_UNISTD_H. There is no need to do this, as <unistd.h> is unconditionally included in many places in gdb. This sort of cleanup was done once before, in 2013: 2013-07-01 Pedro Alves <palves@redhat.com> * defs.h: Don't check HAVE_UNISTD_H before including <unistd.h>. (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete. * tracepoint.c: Don't check HAVE_UNISTD_H before including <unistd.h>. HAVE_UNISTD_H seems to come from gnulib, so there are still mentions of it in the source. gdb/ChangeLog 2018-10-01 Tom Tromey <tom@tromey.com> * unittests/scoped_mmap-selftests.c: Don't check HAVE_UNISTD_H. * unittests/scoped_fd-selftests.c: Don't check HAVE_UNISTD_H. * common/scoped_fd.h: Don't check HAVE_UNISTD_H.
2018-10-01Copy configure option documentation to gdb.texinfoTom Tromey4-5/+160
I realized that while I'd updated the README, I didn't update gdb.texinfo to document the options to configure. This patch copies the text from README into gdb.texinfo, adding Texinfo markup. gdb/ChangeLog 2018-10-01 Tom Tromey <tom@tromey.com> * README: Minor change. gdb/doc/ChangeLog 2018-10-01 Tom Tromey <tom@tromey.com> * gdb.texinfo (Configure Options): Document configure options.
2018-10-01testsuite: fix is_amd64_regs_targetMarkus Metzger2-6/+12
Commit c221b2f Testsuite: Add gdb_can_simple_compile changed the source file name extension of the test program from .s to .c resulting in compile fails. This, in turn, causes is_amd64_regs_target checks to fail. In gdb.btrace/tailcall.exp and others, this causes the wrong source file to be picked and the test to fail on 64-bit targets. Change the test source from an assembly program to a C program using inline assembly. testsuite/ * lib/gdb.exp (is_amd64_regs_target): Change assembly to C inline assembly.
2018-10-01Automatic date update in version.inGDB Administrator1-1/+1
2018-09-30Darwin: Remove unused variables [-Werror=unused-variable]Pedro Alves4-37/+14
Building GDB with --host=x86_64-apple-darwin15 using G++ 5.3.0 runs into a number of -Werror=unused-variable warnings/errors: ../../src/gdb/i386-darwin-nat.c: In function 'void i386_darwin_dr_set(int, CORE_ADDR)': ../../src/gdb/i386-darwin-nat.c:283:7: error: unused variable 'current_pid' [-Werror=unused-variable] int current_pid; ^ [etc, etc.] This commit fixes all such warnings. gdb/ChangeLog: 2018-09-30 Pedro Alves <palves@redhat.com> * darwin-nat-info.c (darwin_debug_regions_recurse) (info_mach_exceptions_command): Remove unused local variables. * darwin-nat.c (darwin_decode_notify_message) (darwin_nat_target::resume, darwin_nat_target::mourn_inferior) (darwin_stop_inferior, darwin_setup_exceptions) (darwin_nat_target::kill, darwin_attach_pid, darwin_ptrace_him) (darwin_nat_target::attach, darwin_nat_target::detach) (darwin_read_write_inferior, darwin_read_dyld_info): Remove unused local variables. * i386-darwin-nat.c (i386_darwin_dr_set): Remove unused local variables.
2018-09-30Automatic date update in version.inGDB Administrator1-1/+1
2018-09-29Remove some leftover text in gdb/READMETom Tromey2-3/+4
I accidentally left some stray text in gdb/README. This removes it. I'm checking this in as obvious. gdb/ChangeLog 2018-09-29 Tom Tromey <tom@tromey.com> * README: Remove some leftover text.
2018-09-29Update gdb's configure instructionsTom Tromey5-182/+208
gdb's README and configure instructions in the manual are quite out of date. They mention options that haven't existed for many years, among other things. This patch attempts to modernize the instructions somewhat. It is not exhaustive, just an improvement -- more could be done. Perhaps even a couple of the nodes should simply be removed and replaced by references to the Autoconf manual. The README file seems to have been generated from the Texinfo at some point in the past. I did not continue this, but instead edited it separately. gdb/ChangeLog 2018-09-29 Tom Tromey <tom@tromey.com> * PROBLEMS: Rewrite. * README: Update. gdb/doc/ChangeLog 2018-09-29 Tom Tromey <tom@tromey.com> * gdb.texinfo (Requirements): Mention C++, GNU make. (Requirements): Sort the table. Add more libraries. (Running Configure): Remove obsolete text. (Separate Objdir): Likewise. (Configure Options): Likewise.
2018-09-29Automatic date update in version.inGDB Administrator1-1/+1
2018-09-28bfd: Use elfclass instead of bed->s->elfclassH.J. Lu2-2/+7
elfclass has been set to bed->s->elfclass earlier. * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Use elfclass instead of bed->s->elfclass.
2018-09-28Use the existing instruction to determine the RISC-V breakpoint kind.John Baldwin3-20/+49
RISC-V supports instructions of varying lengths. Standard existing instructions in the base ISA are 4 bytes in length, but the 'C' extension adds support for compressed, 2 byte instructions. RISC-V supports two different breakpoint instructions: EBREAK is a 4 byte instruction in the base ISA, and C.EBREAK is a 2 byte instruction only available on processors implementing the 'C' extension. Using EBREAK to set breakpoints on compressed instructions causes problems as the second half of EBREAK will overwrite the first 2 bytes of the following instruction breaking other threads in the process if their PC is the following instruction. Thus, breakpoints on compressed instructions need to use C.EBREAK instead of EBREAK. Previously, the riscv architecture checked the MISA register to determine if the 'C' extension was available. If so, it used C.EBREAK for all breakpoints. However, the MISA register is not necessarily available to supervisor mode operating systems. While native targets could provide a fake MISA register value, this patch instead examines the existing instruction at a breakpoint target to determine which breakpoint instruction to use. If the existing instruction is a compressed instruction, C.EBREAK is used, otherwise EBREAK is used. gdb/ChangeLog: * disasm-selftests.c (print_one_insn_test): Add bfd_arch_riscv to case with explicit breakpoint kind. * riscv-tdep.c (show_use_compressed_breakpoints): Remove 'additional_info' and related logic. (riscv_debug_breakpoints): New variable. (riscv_breakpoint_kind_from_pc): Use the length of the existing instruction to determine the breakpoint kind. (_initialize_riscv_tdep): Add 'set/show debug riscv breakpoints' flag. Update description of 'set/show riscv use-compressed-breakpoints' flag.
2018-09-28Change "xor" name in cpu_core to allow building with iso646.h or C++ compilerКомпан, Вячеслав Олегович3-4/+14
This code was introduced back in 1998, and C99 appeared next year, defining the `xor` as an 'alternative keyword' if iso646.h is included. Moreover, C++98 defines it on the language level. As a result, the code is not buildable with C++ compiler or if iso646.h is included beforehand. According to comment, `sim_cpu_core` is mostly a clone of `sim_core`, so I renamed it to `byte_xor` as it's called in `sim_core`. sim/common/ChangeLog: * sim-core.h (sim_cpu_core): Rename cpu_core.xor to cpu_core.byte_xor. * sim-core.c (sim_core_set_xor): Likewise. (sim_core_xor_read_buffer): Likewise. (sim_core_xor_write_buffer): Likewise.
2018-09-28gdb: Change how frames are selected for 'frame' and 'info frame'.Andrew Burgess12-208/+870
The 'frame' command, and thanks to code reuse the 'info frame' and 'select-frame' commands, currently have an overloaded mechanism for selecting a frame. These commands take one or two parameters, if it's one parameter then we first try to use the parameter as an integer to select a frame by level (or depth in the stack). If that fails then we treat the parameter as an address and try to select a stack frame by stack-address. If we still have not selected a stack frame, or we initially had two parameters, then GDB allows the user to view a stack frame that is not part of the current backtrace. Internally, a new frame is created with the given stack and pc addresses, and this is shown to the user. The result of this is that a typo by the user, entering the wrong stack frame level for example, can result in a brand new frame being viewed rather than an error. The purpose of this commit is to remove this overloading, while still offering the same functionality through some new sub-commands. By making the default behaviour of 'frame' (and friends) be to select a stack frame by level index, it is hoped that enough backwards-compatibility is maintained that users will not be overly inconvenienced. The 'frame', 'select-frame', and 'info frame' commands now all take a frame specification string as an argument, this string can be any of the following: (1) An integer. This is treated as a frame level. If a frame for that level does not exist then the user gets an error. (2) A string like 'level <LEVEL>', where <LEVEL> is a frame level as in option (1) above. (3) A string like 'address <STACK-ADDRESS>', where <STACK-ADDRESS> is a stack-frame address. If there is no frame for this address then the user gets an error. (4) A string like 'function <NAME>', where <NAME> is a function name, the inner most frame for function <NAME> is selected. If there is no frame for function <NAME> then the user gets an error. (5) A string like 'view <STACK-ADDRESS>', this views a new frame with stack address <STACK-ADDRESS>. (6) A string like 'view <STACK-ADDRESS> <PC-ADDRESS>', this views a new frame with stack address <STACK-ADDRESS> and the pc <PC-ADDRESS>. This change assumes that the most common use of the commands like 'frame' is to select a frame by frame level, it is for this reason that this is the behaviour that is kept for backwards compatibility. Any of the alternative behaviours, which are assumed to be less used, now require a change in user behaviour. The MI command '-stack-select-frame' has not been changed. This ensures that we maintain backwards compatibility for existing frontends. gdb/ChangeLog: (NEWS): Mention changes to frame related commands. * cli/cli-decode.c (add_cmd_suppress_notification): New function. (add_prefix_cmd_suppress_notification): New function. (add_com_suppress_notification): Call add_cmd_suppress_notification. * command.h (add_cmd_suppress_notification): Declare. (add_prefix_cmd_suppress_notification): Declare. * mi/mi-cmd-stack.c: Add 'safe-ctype.h' include. (parse_frame_specification): Moved from stack.c, with simplification to handle a single argument. (mi_cmd_stack_select_frame): Use parse_frame_specification, the switch to the selected frame. Add a header comment. * stack.c: Remove 'safe-ctype.h' include. (find_frame_for_function): Add declaration. (find_frame_for_address): New function. (parse_frame_specification): Moved into mi/mi-cmd-stack.c. (frame_selection_by_function_completer): New function. (info_frame_command): Rename to... (info_frame_command_core): ...this, and update parameter types. (select_frame_command): Rename to... (select_frame_command_core): ...this, and update parameter types. (frame_command): Rename to... (frame_command_core): ...this, and update parameter types. (class frame_command_helper): New class to wrap implementations of frame related sub-commands. (frame_apply_cmd_list): New static global. (frame_cmd_list): Make static. (select_frame_cmd_list): New global for sub-commands. (info_frame_cmd_list): New global for sub-commands. (_initialize_stack): Register sub-commands for 'frame', 'select-frame', and 'info frame'. Update 'frame apply' commands to use frame_apply_cmd_list. Move function local static frame_apply_list to file static frame_apply_cmd_list for consistency. * stack.h (select_frame_command): Delete declarationn. (select_frame_for_mi): Declare new function. gdb/doc/ChangeLog: * gdb.texinfo (Frames): Rewrite the description of 'frame number' to highlight that the number is also the frame's level. (Selection): Rewrite documentation for 'frame' and 'select-frame' commands. (Frame Info): Rewrite documentation for 'info frame' command. gdb/testsuite/ChangeLog: * gdb.base/frame-selection.exp: New file. * gdb.base/frame-selection.c: New file.
2018-09-27RISC-V: Pc-rel to gp-rel relaxation function cleanup.Jim Wilson2-42/+32
bfd/ * elfnn-riscv.c (riscv_init_pcgp_relocs): Add explanatory comment. (riscv_free_pcgp_relocs, riscv_record_pcgp_reloc): Likewise. (riscv_find_pcgp_hi_reloc, riscv_reocrd_pcgp_lo_reloc): Likewise. (riscv_find_pcgp_lo_reloc): Likewise. (riscv_delete_pcgp_hi_reloc, riscv_use_pcgp_hi_reloc): Delete. (riscv_delete_pcgp_lo_reloc): Likewise. (_bfd_riscv_relax_pc): Don't call riscv_use_pcgp_hi_reloc. Replace calls to riscv_delete_pcgp_lo_reloc and riscv_delete_pcgp_hi_reloc with TRUE. Mark abfd arg as ATTRIBUTE_UNUSED.
2018-09-28Automatic date update in version.inGDB Administrator1-1/+1
2018-09-27testsuite: Fix race condition in check-libthread-dbAlan Hayward2-0/+14
It is possible for the created thread to reach the breakpoint before the main thread has set errno to 23. Prevent this using a pthread barrier. * gdb.threads/check-libthread-db.c (thread_routine): Use a pthread barrier. (main): Likewise.
2018-09-27Automatic date update in version.inGDB Administrator1-1/+1
2018-09-26Skip broken assembler test on Windows host.Sandra Loosemore2-1/+10
2018-09-26 Sandra Loosemore <sandra@codesourcery.com> gas/ * testsuite/gas/all/gas.exp: Skip "Output file must be distinct from input" test on Windows host.
2018-09-26gdb/riscv: Improve non-dwarf stack unwindingAndrew Burgess7-21/+189
This commit improves the prologue scanning stack unwinder, to better support AUIPC, LUI, and more variants of ADD and ADDI. This allows unwinding over frames containing large local variables, where the frame size does not fit into a single instruction immediate, and is first loaded into a temporary register, before being added to the stack pointer. A new test is added that tests this behaviour. As there's nothing truely RiscV specific about this test I've added it into gdb.base, but as this depends on target specific code to perform the unwind it is possible that some targets might fail this new test. gdb/ChangeLog: * riscv-tdep.c (riscv_insn::decode): Decode c.lui. (riscv_scan_prologue): Split handling of AUIPC, LUI, ADD, ADDI, and NOP. gdb/testsuite/ChangeLog: * gdb.base/large-frame-1.c: New file. * gdb.base/large-frame-2.c: New file. * gdb.base/large-frame.exp: New file. * gdb.base/large-frame.h: New file.
2018-09-26elf32-nds32: Remove elf32_nds32_allocate_dynrelocsSimon Marchi2-13/+4
It is unused, removing it fixes this error when building with clang: /home/emaisin/src/binutils-gdb/bfd/elf32-nds32.c:3172:1: error: unused function 'elf32_nds32_allocate_dynrelocs' [-Werror,-Wunused-function] elf32_nds32_allocate_dynrelocs (struct bfd_link_info *info, asection *sreloc, ^ 1 error generated. gcc only reports the error if you remove "inline". I don't know if this is actually a mistake and it should actually be used though. gdb/ChangeLog: * elf32-nds32.c (elf32_nds32_allocate_dynrelocs): Remove.
2018-09-26Remove dead definition from valops.cTom Tromey2-7/+4
This removes a variable definition in valops.c that has been surrounded by "#if 0" since gdb moved to sourceware. gdb/ChangeLog 2018-09-26 Tom Tromey <tom@tromey.com> * valops.c (auto_abandon): Remove dead code.
2018-09-26Small fix for "winheight" usageTom Tromey2-1/+5
I noticed that the usage string for "winheight" has a couple of extraneous ">"s in it. I must have forgotten to remove these back when I changed the text to use the GNU style for metasyntactic variables. gdb/ChangeLog 2018-09-26 Tom Tromey <tom@tromey.com> * tui/tui-win.c (WIN_HEIGHT_USAGE): Remove extra ">"s.
2018-09-26Automatic date update in version.inGDB Administrator1-1/+1
2018-09-25RISC-V: Give error for RVE PLTs.Jim Wilson2-8/+46
bfd/ * elfnn-riscv.c (riscv_make_plt_header): New arg output_bfd. Change return type to bfd_boolean. If EF_RISCV_RVE call _bfd_error_handler and return FALSE. Return TRUE at end. (riscv_make_plt_entry): Likewise. (riscv_elf_finish_dynamic_symbol): Update call to riscv_make_plt_entry. (riscv_elf_finish_dynamic_sections): Update call to riscv_make_plt_header.
2018-09-25S/390: Fix symbolic displacement in layAndreas Krebbel4-1/+8
Increase the fixup length to 4 for the 20 bit displacement. gas/ChangeLog: 2018-09-25 Andreas Krebbel <krebbel@linux.ibm.com> * config/tc-s390.c (md_apply_fix): Set fx_size to 4 for 20 bit displacements. * testsuite/gas/s390/s390.exp: Run new test. * testsuite/gas/s390/zarch-z990-symbol-lay.s: New test.
2018-09-25Remove dead code from gdbserver's configureTom Tromey3-11/+5
gdbserver's configure removes -Wmissing-prototypes from the warning flags. However, this flag is only useful for C, so this deletion is no longer needed. gdb/gdbserver/ChangeLog 2018-09-25 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac (WARN_CFLAGS): Don't remove -Wmissing-prototypes.
2018-09-25Couple of minor tweaks to the linker testsuite.Eric Botcazou3-1/+15
This gets rid of the couple of linker failures for visium-elf: FAIL: ld-elf/pr14156b FAIL: ld-elf/pr22677 by tweaking the respective testcases. The first tweak is the same as the one made to the sibling testcase ld-elf/pr14156a.d about one year ago and the second tweak adds the usual main/start/_start/__start symbols. ld/ * testsuite/ld-elf/pr14156b.d: Adjust for extra symbols. * testsuite/ld-elf/pr22677.s: Define main/start/_start/__start.
2018-09-25Automatic date update in version.inGDB Administrator1-1/+1
2018-09-24RISC-V: For PCREL_LO12, fix addend handling in auipc lookup.Jim Wilson2-2/+11
bfd/ * elfnn-riscv.c (_bfd_riscv_relax_pc) <R_RISCV_PCREL_LO12_I>: New local hi_sec_off which is symbol address with addend subtracted. Use in riscv_find_pcgp_hi_reloc and riscv_record_pcgp_lo_reloc calls.
2018-09-24RISC-V: Allow pcrel_lo addends, error on addend overflow.Jim Wilson7-13/+58
bfd/ * elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Add check for reloc overflow with addend. Use reloc_dangerous instead of reloc_overflow. Add strings for the two errors handled here. (riscv_elf_relocate_section) In case R_RISCV_PCREL_LO12_I, rewrite comment. Only give error with addend when used with section symbol. In case bfd_reloc_dangerous, update error string. ld/ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run pcrel-lo-addend-2. * testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.d: New. * testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.s: New. * testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend.d: Update name and error string.
2018-09-24Fix PR gdb/20948: --write option to GDB causes segmentation faultJozef Lawrynowicz5-0/+91
When opening a BFD for update, as gdb --write does, modifications to anything but the contents of sections is restricted. Do not try to write back any ELF headers in this case. bfd/ChangeLog 2018-09-24 Jozef Lawrynowicz <jozef.l@mittosystems.com> PR gdb/20948 * elf.c (_bfd_elf_write_object_contents): Return from function early if abfd->direction == both_direction. gdb/testsuite/ChangeLog 2018-09-24 Jozef Lawrynowicz <jozef.l@mittosystems.com> PR gdb/20948 * gdb.base/write_mem.exp: New test. * gdb.base/write_mem.c: Likewise.
2018-09-24Add "const" to a few locals in gdbTom Tromey4-4/+11
I noticed that some code in gdb was doing: char *mumble = getenv (...) However, using "const char *" here would be clearer. This patch fixes the instances I could readily build. Tested by rebuilding. gdb/ChangeLog 2018-09-24 Tom Tromey <tom@tromey.com> * common/pathstuff.c (get_standard_cache_dir): Make "xdg_cache_home" and "home" const. * top.c (init_history): Make "tmpenv" const. * main.c (get_init_files): Make "homedir" const.
2018-09-23Allow setting a parameter to raise gdb.GdbErrorTom Tromey6-4/+57
A convention in the Python layer is that raising a gdb.GdbError will not print the Python stack -- instead the exception is treated as any other gdb exception. PR python/18852 asks that this treatment be extended the the get_set_value method of gdb.Parameter. This makes sense, because it lets Python-created parameters act like gdb parameters. 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18852: * python/py-param.c (get_set_value): Use gdbpy_handle_exception. gdb/doc/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18852: * python.texi (Parameters In Python): Document exception behavior of get_set_string. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18852: * gdb.python/py-parameter.exp: Add test for parameter that throws on "set".
2018-09-23Consolidate gdb.GdbError handlingTom Tromey5-97/+66
I noticed two nearly identical copies of the same code for handling gdb.GdbError. The only differences were in some error messages. These differences didn't seem very important, so this patch pulls the code out into a new function. 2018-09-23 Tom Tromey <tom@tromey.com> * python/py-function.c (fnpy_call): Use gdbpy_handle_exception. * python/py-cmd.c (cmdpy_function): Use gdbpy_handle_exception. * python/python-internal.h (gdbpy_handle_exception): Declare. * python/py-utils.c (gdbpy_handle_exception): New function.
2018-09-23Check for negative argument in Type.template_argumentTom Tromey4-0/+23
typy_template_argument did not check if the template argument was non-negative. A negative value could cause a gdb crash. 2018-09-23 Tom Tromey <tom@tromey.com> PR python/17284: * python/py-type.c (typy_template_argument): Check for negative argument number. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/17284: * gdb.python/py-template.exp (test_template_arg): Add test for negative template argument number.
2018-09-23Report Python errors coming from gdb.post_eventTom Tromey4-3/+23
PR python/14062 points out that errors coming from the gdb.post_event callback are not reported. This can make it hard to understand why your Python code in gdb isn't working. Because users have control over whether exceptions are printed at all, it seems good to simply have post_event report errors in the usual way. 2018-09-23 Tom Tromey <tom@tromey.com> PR python/14062: * python/python.c (gdbpy_run_events): Do not ignore exceptions. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/14062: * gdb.python/python.exp: Add test for post_event error.
2018-09-23Allow conversion of pointers to Python intTom Tromey4-3/+23
PR python/18170 questions why it's not possible to convert a pointer value to a Python int. Digging a bit shows that the Python 2.7 int() constructor will happily return a long in some cases. And, it seems gdb already understands this in other places -- this is what gdb_py_object_from_longest handles. So, this patch simply extends valpy_int to allow pointer conversions, as valpy_long does. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18170: * python/py-value.c (valpy_int): Allow conversion from pointer type. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18170: * gdb.python/py-value.exp (test_value_numeric_ops): Add tests to convert pointers to int and long.
2018-09-23Preserve sign when converting gdb.Value to Python intTom Tromey4-1/+23
PR python/20126 points out that sometimes the conversion of a gdb.Value can result in a negative Python integer. This happens because valpy_int does not examine the signedness of the value's type. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/20126: * python/py-value.c (valpy_int): Respect type sign. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/20126: * gdb.python/py-value.exp (test_value_numeric_ops): Add signed-ness conversion tests.
2018-09-23Allow more Python scalar conversionsTom Tromey4-3/+48
PR python/18352 points out that the gdb Python code can't convert an integer-valued gdb.Value to a Python float. While writing the test I noticed that, similarly, converting integer gdb.Values to float does not work. However, all of these cases seem reasonable. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18352; * python/py-value.c (valpy_float): Allow conversions from int or char. (valpy_int, valpy_long): Allow conversions from float. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/18352; * gdb.python/py-value.exp (test_float_conversion): New proc. Use it.
2018-09-24Automatic date update in version.inGDB Administrator1-1/+1
2018-09-23Fix incorrect extraction of signed constants in nios2 disassembler.Sandra Loosemore2-13/+21
2018-09-23 Sandra Loosemore <sandra@codesourcery.com> opcodes/ * nios2-dis.c (nios2_print_insn_arg): Make sure signed conversions are used when extracting signed fields and converting them to potentially 64-bit types.
2018-09-23Mark more file descriptors close-on-execTom Tromey3-3/+12
I noticed a couple of spots in gdb that were opening files but not marking the file descriptors as close-on-exec. This patch fixes these. There are still a few more of these, but they are in code that I can't compile, so I'd prefer not to touch. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> * ctf.c (ctf_start): Use gdb_fopen_cloexec. * common/scoped_mmap.c (mmap_file): Use gdb_open_cloexec.
2018-09-23Also recognize __sighndlr on Solaris/x86Rainer Orth3-2/+10
Unlike Solaris/SPARC, the __sighndlr function isn't recognized as part of a signal handler, causing a couple of testcases to fail. The following patch fixes that. A followup patch will move this to common code to avoid such unnecessary discrepancies between Solaris/SPARC and x86 in the future. While this fixes a couple of backtraces to now correctly print #1 <signal handler called> they often fail later with #2 0x0ff3ffffff00857f in ?? () Backtrace stopped: Cannot access memory at address 0xff3000002e0886f which needs further investigation. Tested on amd64-pc-solaris2.11 (running the tests with both -m64 and -m32). * amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Also recognize __sighndlr. * i386-sol2-tdep.c (i386_sol2_sigtramp_p): Likewise.
2018-09-23Remove a spurious target_terminal::ours() from windows_nat_target::wait()Jon Turney2-2/+5
This causes the inferior to stop with SIGTTIN if it tries to read from the terminal after it has been continued. See https://cygwin.com/ml/cygwin/2016-09/msg00285.html for reproduction. Since MinGW doesn't have a tcsetpgrp(), I don't think this problem would be observed there, but Cygwin does so target_terminal::ours() will call it. Calling target_terminal::ours() here seems to be is no longer appropriate after the "Merge async and sync code paths" changes (as the inferior is now in a separate process group even in sync mode(?), which is always used on Windows targets) This call was added in commit c44537cf (and see https://sourceware.org/ml/gdb-patches/2007-02/msg00167.html for what it fixed, which is not regressed by this change) When windows_nat_target::wait() is entered, the inferior is running (either it's been just been started or attached to, or windows_continue() was called), so grabbing the controlling terminal away from it here seems to be wrong, since infrun.c takes care of calling target_terminal::ours() when the inferior stops. gdb/ChangeLog: 2018-08-02 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (windows_nat_target::wait): Remove a spurious target_terminal::ours().