summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix type casts losing typedefs and reimplement "whatis" typedef strippingPedro Alves2017-08-2113-31/+654
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Ref: https://sourceware.org/ml/gdb/2017-06/msg00020.html) Assuming int_t is a typedef to int: typedef int int_t; gdb currently loses this expression's typedef: (gdb) p (int_t) 0 $1 = 0 (gdb) whatis $1 type = int or: (gdb) whatis (int_t) 0 type = int or, to get "whatis" out of the way: (gdb) maint print type (int_t) 0 ... name 'int' code 0x8 (TYPE_CODE_INT) ... This prevents a type printer for "int_t" kicking in, with e.g.: (gdb) p (int_t) 0 From the manual, we can see that that "whatis (int_t) 0" command invocation should have printed "type = int_t": If @var{arg} is a variable or an expression, @code{whatis} prints its literal type as it is used in the source code. If the type was defined using a @code{typedef}, @code{whatis} will @emph{not} print the data type underlying the @code{typedef}. (...) If @var{arg} is a type name that was defined using @code{typedef}, @code{whatis} @dfn{unrolls} only one level of that @code{typedef}. That one-level stripping is currently done here, in gdb/eval.c:evaluate_subexp_standard, handling OP_TYPE: ... else if (noside == EVAL_AVOID_SIDE_EFFECTS) { struct type *type = exp->elts[pc + 1].type; /* If this is a typedef, then find its immediate target. We use check_typedef to resolve stubs, but we ignore its result because we do not want to dig past all typedefs. */ check_typedef (type); if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) type = TYPE_TARGET_TYPE (type); return allocate_value (type); } However, this stripping is reachable in both: #1 - (gdb) whatis (int_t)0 # ARG is an expression with a cast to # typedef type. #2 - (gdb) whatis int_t # ARG is a type name. while only case #2 should strip the typedef. Removing that code from evaluate_subexp_standard is part of the fix. Instead, we make the "whatis" command implementation itself strip one level of typedefs when the command argument is a type name. We then run into another problem, also fixed by this commit: value_cast always drops any typedefs of the destination type. With all that fixed, "whatis (int_t) 0" now works as expected: (gdb) whatis int_t type = int (gdb) whatis (int_t)0 type = int_t value_cast has many different exit/convertion paths, for handling many different kinds of casts/conversions, and most of them had to be tweaked to construct the value of the right "to" type. The new tests try to exercise most of it, by trying castin of many different combinations of types. With: $ make check TESTS="*/whatis-ptype*.exp */gnu_vector.exp */dfp-test.exp" ... due to combinatorial explosion, the testsuite results for the tests above alone grow like: - # of expected passes 246 + # of expected passes 3811 You'll note that the tests exposed one GCC buglet, filed here: Missing DW_AT_type in DW_TAG_typedef of "typedef of typedef of void" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81267 gdb/ChangeLog: 2017-08-21 Pedro Alves <palves@redhat.com> * eval.c (evaluate_subexp_standard) <OP_TYPE>: Don't dig past typedefs. * typeprint.c (whatis_exp): If handling "whatis", and expression is OP_TYPE, strip one typedef level. Otherwise don't strip typedefs here. * valops.c (value_cast): Save "to" type before resolving stubs/typedefs. Use that type as resulting value's type. gdb/testsuite/ChangeLog: 2017-08-21 Pedro Alves <palves@redhat.com> * gdb.base/dfp-test.c (d32_t, d64_t, d128_t, d32_t2, d64_t2, d128_t2, v_d32_t, v_d64_t) (v_d128_t, v_d32_t2, v_d64_t2, v_d128_t2): New. * gdb.base/dfp-test.exp: Add whatis/ptype/cast tests. * gdb.base/gnu_vector.exp: Add whatis/ptype/cast tests. * gdb.base/whatis-ptype-typedefs.c: New. * gdb.base/whatis-ptype-typedefs.exp: New. * gdb.python/py-prettyprint.c (int_type, int_type2): New typedefs. (an_int, an_int_type, an_int_type2): New globals. * gdb.python/py-prettyprint.exp (run_lang_tests): Add tests involving typedefs and cast expressions. * gdb.python/py-prettyprint.py (class pp_int_typedef): New. (lookup_typedefs_function): New. (typedefs_pretty_printers_dict): New. (top level): Register lookup_typedefs_function in gdb.pretty_printers.
* PR ld/20125, MMIX weak symbolsHans-Peter Nilsson2017-08-215-6/+52
| | | | | Weak undefineds with PUSHJ relocs were "lost", causing internal inconsistencies and an abort.
* Automatic date update in version.inGDB Administrator2017-08-211-1/+1
|
* Update testsuite/ld-x86-64/plt-main-bnd.ddH.J. Lu2017-08-202-1/+7
| | | | | | | | 2017-08-20 A. Wilcox <awilfox@adelielinux.org> PR ld/21976 * testsuite/ld-x86-64/plt-main-bnd.dd: Accept '_' in symbol name.
* Automatic date update in version.inGDB Administrator2017-08-201-1/+1
|
* Automatic date update in version.inGDB Administrator2017-08-191-1/+1
|
* Remove save_inferior_ptidTom Tromey2017-08-1813-133/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes save_inferior_ptid, a cleanup function, in favor of scoped_restore. This also fixes a possible (it seems unlikely that it could happen in practice) memory leak -- save_inferior_ptid should have used make_cleanup_dtor, because it allocated memory. I tested this on the buildbot. However, there are two caveats to this. First, sometimes it seems I misread the results. Second, I think this patch touches some platforms that can't be tested by the buildbot. So, extra care seems warranted. ChangeLog 2017-08-18 Tom Tromey <tom@tromey.com> Pedro Alves <palves@redhat.com> * spu-multiarch.c (parse_spufs_run): Use scoped_restore. * sol-thread.c (sol_thread_resume, sol_thread_wait) (sol_thread_xfer_partial, rw_common): Use scoped_restore. * procfs.c (procfs_do_thread_registers): Use scoped_restore. * proc-service.c (ps_xfer_memory): Use scoped_restore. * linux-tdep.c (linux_corefile_thread): Remove a cleanup. (linux_get_siginfo_data): Add "thread" argument. Use scoped_restore. * linux-nat.c (linux_child_follow_fork) (check_stopped_by_watchpoint): Use scoped_restore. * infrun.c (displaced_step_prepare_throw, write_memory_ptid) (THREAD_STOPPED_BY, handle_signal_stop): Use scoped_restore. (restore_inferior_ptid, save_inferior_ptid): Remove. * btrace.c (btrace_fetch): Use scoped_restore. * bsd-uthread.c (bsd_uthread_fetch_registers) (bsd_uthread_store_registers): Use scoped_restore. * breakpoint.c (reattach_breakpoints, detach_breakpoints): Use scoped_restore. * aix-thread.c (aix_thread_resume, aix_thread_wait) (aix_thread_xfer_partial): Use scoped_restore. * inferior.h (save_inferior_ptid): Remove.
* [ARM] Mark USER_SPECIFIED_MACHINE_TYPE in disassemble_info.flagsYao Qi2017-08-182-0/+14
| | | | | | | | | | | | | | | | | | | | opcodes/arm-dis.c:print_insn may update disassemble_info.mach to bfd_mach_arm_unknown unless USER_SPECIFIED_MACHINE_TYPE is marked. When default_print_insn is called for the first time, disassemble_info.mach is correctly set in GDB, but arm-dis.c:print_insn sets it to bfd_mach_arm_unknown. Then, when default_print_insn is called again (in a loop), it triggers the assert. The patch fixes the assert by marking USER_SPECIFIED_MACHINE_TYPE so that opcodes won't reset disassemble_info.mach. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> PR tdep/21818 * arm-tdep.c (gdb_print_insn_arm): Mark USER_SPECIFIED_MACHINE_TYPE if exec_bfd isn't NULL.
* GDBserver self testsYao Qi2017-08-1816-18/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-08-18 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. gdb/testsuite: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest".
* Remove some GDB specific stuff from selftest.cYao Qi2017-08-182-5/+8
| | | | | | | | | | | | | | | | | | The next patch moves selftest.c to common/selftest.c, so that GDBserver can use it as well. However selftest.c uses something isn't "portable" on GDB and GDBserver. First, this patch removes QUIT. I don't expect that we type ctrl-c during self/unit tests, and each test shouldn't take long time. Secondly, I replace exception_fprintf and printf_filtered with debug_printf. Verified that unit tests still catch fails. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * selftest.c (run_tests): Don't call QUIT. Call debug_printf instead of exception_fprintf and printf_filtered.
* Put selftests api into selftests namespaceYao Qi2017-08-1821-27/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes register_self_test to selftests::register_test, and run_self_tests to selftest::run_tests. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * selftest.c (register_self_test): Rename it to selftests::register_test. (run_self_tests): selftest::run_tests. * selftest.h: Update declarations. * selftest-arch.c (register_self_test_foreach_arch): Rename it to selftests::register_test_foreach_arch. * selftest-arch.h: Update declaration. * aarch64-tdep.c: Update. * arm-tdep.c: Likewise. * disasm-selftests.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2-frame.c: Likewise. * findvar.c: Likewise. * gdbarch-selftests.c: Likewise. * maint.c (maintenance_selftest): Likewise. * regcache.c: Likewise. * rust-exp.y: Likewise. * selftest-arch.c: Likewise. * unittests/environ-selftests.c: Likewise. * unittests/function-view-selftests.c: Likewise. * unittests/offset-type-selftests.c: Likewise. * unittests/optional-selftests.c: Likewise. * unittests/scoped_restore-selftests.c: Likewise. * utils-selftests.c: Likewise.
* Fix buffer overrun parsing a corrupt tekhex binary.Nick Clifton2017-08-182-1/+7
| | | | | | PR binutils/21962 * tekhex.c (getsym): Fix check for source pointer walking off the end of the input buffer.
* Automatic date update in version.inGDB Administrator2017-08-181-1/+1
|
* Plug source_command leakPedro Alves2017-08-172-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The heap-allocated 'old_source_verbose' local was accidentally left behind by commit 2ec845e75876 ("More uses of scoped_restore"). Valgrind caught it, like: ==20123== 8 bytes in 1 blocks are definitely lost in loss record 4,609 of 13,785 ==20123== at 0x4C2A988: calloc (vg_replace_malloc.c:711) ==20123== by 0x60A2F8: xcalloc (common-utils.c:84) ==20123== by 0x4CDBE5: build_command_line(command_control_type, char const*) (cli-script.c:159) ==20123== by 0x4CDC32: get_command_line(command_control_type, char const*) (cli-script.c:172) ==20123== by 0x5230F1: python_command(char*, int) (python.c:421) ==20123== by 0x4C61AD: do_cfunc(cmd_list_element*, char*, int) (cli-decode.c:106) ==20123== by 0x4C911F: cmd_func(cmd_list_element*, char*, int) (cli-decode.c:1902) ==20123== by 0x7CA79E: execute_command(char*, int) (top.c:650) ==20123== by 0x695A0C: command_handler(char*) (event-top.c:590) ==20123== by 0x7CA33F: read_command_file(_IO_FILE*) (top.c:461) ==20123== by 0x4D0C3A: script_from_file(_IO_FILE*, char const*) (cli-script.c:1584) ==20123== by 0x4C2727: source_script_from_stream(_IO_FILE*, char const*, char const*) (cli-cmds.c:589) gdb/ChangeLog: 2017-08-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (source_command): Delete 'old_source_verbose' local.
* Plug line_header leaksPedro Alves2017-08-172-33/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This plugs a couple leaks introduced by commit fff8551cf549 ("dwarf2read.c: Some C++fycation, use std::vector, std::unique_ptr"). The first problem is that nothing owns the temporary line_header that handle_DW_AT_stmt_list creates in some cases. Before the commit mentioned above, the temporary line_header case used to have: make_cleanup (free_cu_line_header, cu); and that cleanup was assumed to be run by process_die, after handle_DW_AT_stmt_list returns and before child DIEs were processed. The second problem is found in setup_type_unit_groups: that also used to have a similar make_cleanup call, and ended up with a similar leak after the commit mentioned above. Fix both cases by recording in dwarf2_cu whether a line header is owned by the cu/die, and have process_die explicitly free the line_header if so, making use of a new RAII object that also replaces the reset_die_in_process cleanup, while at it. Thanks to Philippe Waroquiers for noticing the leak and pointing in the right direction. gdb/ChangeLog: 2017-08-17 Pedro Alves <palves@redhat.com> * dwarf2read.c (struct dwarf2_cu) <line_header_die_owner>: New field. (reset_die_in_process): Delete, replaced by ... (process_die_scope): ... this new class. Make it responsible for freeing cu->line_header too. (process_die): Use process_die_scope. (handle_DW_AT_stmt_list): Record the line header's owner CU/DIE in cu->line_header_die_owner. Don't release the line header if it's owned by the CU. (setup_type_unit_groups): Make the CU/DIE own the line header. Don't release the line header here.
* Add test of V2 GNU build attribute notes.Nick Clifton2017-08-178-1/+232
| | | | | | | | | | | * testsuite/binutils-all/note-3-64.s: New test. Checks assembly and decoding of version2 GNU build attribute notes. * testsuite/binutils-all/note-3-32.s: New test. 32-bit version of the above test. * testsuite/binutils-all/note-3-64.d: New test driver. * testsuite/binutils-all/note-3-32.d: New test driver. * testsuite/binutils-all/objcopy.exp: Run the new test. * readelf.c (is_64bit_abs_reloc): Add R_SPARC_64.
* [AArch64] Skip IFUNC relocations in debug sectionsSzabolcs Nagy2017-08-172-3/+28
| | | | | | | | | | | | | | | | Skip IFUNC relocations in debug sections ignored by ld.so. Fixes the following ld test failures on aarch64: FAIL: Build libpr18808.so FAIL: Build libpr18808.so_2 FAIL: Run pr18808 aborting at bfd/elfnn-aarch64.c:4986 in elf64_aarch64_final_link_relocate. bfd/ PR ld/18808 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC relocations in debug sections, change abort to _bfd_error_handler.
* Add new Brazilian Portuguese translation for the ld subdirectory.Nick Clifton2017-08-174-2/+2958
| | | | | | * po/pt_BR.po: New Brazilian Portuguese translation. * configure.ac (ALL_LINGUAS): Add pt_BR. * configure: Regenerate.
* Synthetic symbol leak in elf_read_minimal_symbolsAlex Lindsay2017-08-172-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Detected this leak with valgrind memcheck: ==30840== 194 bytes in 1 blocks are definitely lost in loss record 9,138 of 10,922 ==30840== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==30840== by 0x80DF82: bfd_malloc (libbfd.c:193) ==30840== by 0x80E12D: bfd_zmalloc (libbfd.c:278) ==30840== by 0x819E80: elf_x86_64_get_synthetic_symtab (elf64-x86-64.c:6835) ==30840== by 0x4F7B01: elf_read_minimal_symbols(objfile*, int, elfinfo const*) (elfread.c:1124) ==30840== by 0x4F7CE7: elf_symfile_read(objfile*, enum_flags<symfile_add_flag>) (elfread.c:1182) ==30840== by 0x7557FC: read_symbols(objfile*, enum_flags<symfile_add_flag>) (symfile.c:861) ==30840== by 0x755EE1: syms_from_objfile_1(objfile*, section_addr_info*, enum_flags<symfile_add_flag>) (symfile.c:1062) We perform a dynamic allocation in elf64-x86-64.c:elf_x86_64_get_synthetic_symtab s = *ret = (asymbol *) bfd_zmalloc (size); that appear to never get freed. gdb: 2017-08-17 Alex Lindsay <alexlindsay239@gmail.com> * elfread.c (elf_read_minimal_symbols): xfree synthsyms.
* Mention new TUI Single-Key mode shortcuts for nexti and stepi in NEWSRuslan Kabatsayev2017-08-172-0/+8
| | | | | | | gdb/ChangeLog: * NEWS: Mention new shortcuts for nexti and stepi in TUI Single-Key mode
* Automatic date update in version.inGDB Administrator2017-08-171-1/+1
|
* Add shortcuts for "nexti" and "stepi" commands in Single-Key modeRuslan Kabatsayev2017-08-164-0/+20
| | | | | | | | | | | | | | | | | | Currently, "layout asm" is not so useful as "layout src" with Single-Key mode: you have to use multi-key commands like "ni" and "si" to do single-stepping. This patch adds, in addition to "next" and "step" commands, corresponding assembly-level ones - "nexti" and "stepi" - to Single-Key mode, with the shortcuts of "o" (from "step Over") and "i" (from "Step Into") respectively. gdb/ChangeLog: * tui/tui.c (tui_commands): Add "nexti" and "stepi" to the Single-Key mode command list. gdb/doc/ChangeLog: * gdb.texinfo (TUI Single Key Mode): Document the new shortcuts in Single-Key mode.
* Automatic date update in version.inGDB Administrator2017-08-161-1/+1
|
* Add new NT_PPC_* available since Linux 4.8Gustavo Romero2017-08-164-0/+73
| | | | | | | | | | | | | | | | | | | | | | | Add new note types available since Linux 4.8 to elf/common.h and make the 'readelf' tool aware of it. include/ * elf/common.h (NT_PPC_TAR): New macro. (NT_PPC_PPR): Likewise. (NT_PPC_DSCR): Likewise. (NT_PPC_EBB): Likewise. (NT_PPC_PMU): Likewise. (NT_PPC_TM_CGPR): Likewise. (NT_PPC_TM_CFPR): Likewise. (NT_PPC_TM_CVMX): Likewise. (NT_PPC_TM_CVSX): Likewise. (NT_PPC_TM_SPR): Likewise. (NT_PPC_TM_CTAR): Likewise. (NT_PPC_TM_CPPR): Likewise. (NT_PPC_TM_CDSCR): Likewise. binutils/ * readelf.c (get_note_type): Handle PPC note types available since Linux 4.8.
* Add myself as a write-after-approval GDB maintainer.Stafford Horne2017-08-162-0/+5
| | | | | | gdb/ChangeLog: * MAINTAINERS (Write After Approval): Add Stafford Horne.
* xtensa: Properly strdup string when building reggroupStafford Horne2017-08-162-5/+5
| | | | | | | | | | | | | I noticed this while looking at the reggroup intializations. It seems for xtensa the "cpN" reggroup->name is getting assigned to the same text pointer for each iteration of XTENSA_MAX_COPROCESSOR. Note, internally reggroup_new() does not do any xstrdup(). gdb/ChangeLog: 2017-08-15 Stafford Horne <shorne@gmail.com> * xtensa-tdep.c (xtensa_init_reggroups): Use xstrdup for cpname.
* Fix PR gdb/21954: make 'unset environment' work againSergio Durigan Junior2017-08-154-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | When I made commit 9a6c7d9c021cfeb290d76584db7a01e57e7c3d4e, which C++-fied gdb/common/environ.[ch], I mistakenly altered the behaviour of the 'unset environment' command. This command, which should delete all environment variables, is now resetting the list of variables to the state they were when GDB was started. This commit fixes this regression, and also adds a test on gdb.base/environ.exp which really checks if 'unset environment' worked. gdb/ChangeLog: 2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/21954 * infcmd.c (unset_environment_command): Use the 'clear' method on the environment instead of resetting it. gdb/testsuite/ChangeLog: 2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/21954 * gdb.base/environ.exp: Add test to check if 'unset environment' works.
* Fix compile on big-endian platforms in siginfo_t converter.John Baldwin2017-08-152-1/+6
| | | | | | | gdb/ChangeLog: * fbsd-nat.c (fbsd_convert_siginfo): Fix compile on big-endian platforms.
* [Patch AArch64] Turn lr, fp, ip0 and ip1 into proper aliasesRamana Radhakrishnan2017-08-157-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | We got a report from the linux-arm-kernel folks about getting spurious warnings when building the kernel with binutils 2.29. See https://www.spinics.net/lists/arm-kernel/msg599929.html which boils down to this testcase. $> cat /tmp/tst.s lr .req x30 /tmp/tst.s: Assembler messages: /tmp/tst.s:1: Warning: ignoring attempt to redefine built-in register 'lr' Instead let's treat this as a proper alias at startup time thus avoiding the problem and treating these as proper aliases rather than new registers. This means that attempts to redefine the alias with the same "name" will provoke no warning and attempts to redefine the alias to something else will provoke the above mentioned warning. Tested make check-gas and no regressions. Ok to apply to trunk (and backport to 2.29 branch)? Regards Ramana
* GDB testsuite: Suppress GCC's colored outputAndreas Arnez2017-08-142-1/+34
| | | | | | | | | | | | | Newer GCC versions yield colored diagnostic messages by default, which may be useful when executing GDB interactively from a terminal. But when run from a GDB test case, the compiler output is written into gdb.log, where such escape sequences are usually more inhibiting than helpful to the evaluation of test results. So this patch suppresses that. gdb/testsuite/ChangeLog: * lib/gdb.exp (universal_compile_options): New caching proc. (gdb_compile): Suppress GCC's coloring of messages.
* Remove BITS_IN_BYTES defineTom Tromey2017-08-142-6/+9
| | | | | | | | | | | | While working on the previous patch, I noticed that BITS_IN_BYTES can be replaced by HOST_CHAR_BIT, which is used more widely in gdb. ChangeLog 2017-08-14 Tom Tromey <tom@tromey.com> * valprint.c (print_octal_chars): Use HOST_CHAR_BIT. (print_binary_chars): Likewise. (BITS_IN_BYTES): Remove.
* Fix two regressions in scalar printingTom Tromey2017-08-147-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR gdb/21675 points out a few regressions in scalar printing. One type of regression is due to not carrying over the old handling of floating point printing -- where a format like "/d" causes a floating point number to first be cast to a signed integer. This patch restores this behavior. The other regression is a longstanding bug in print_octal_chars: one of the constants was wrong. This patch fixes the constant and adds static asserts to help catch this sort of error. ChangeLog 2017-08-14 Tom Tromey <tom@tromey.com> PR gdb/21675 * valprint.c (LOW_ZERO): Change value to 034. (print_octal_chars): Add static_asserts for octal constants. * printcmd.c (print_scalar_formatted): Add 'd' case. testsuite/ChangeLog 2017-08-14 Tom Tromey <tom@tromey.com> PR gdb/21675: * gdb.base/printcmds.exp (test_radices): New function. * gdb.dwarf2/var-access.exp: Use p/u, not p/d. * gdb.base/sizeof.exp (check_valueof): Use p/d. * lib/gdb.exp (get_integer_valueof): Use p/d.
* Fix memory leak in add_symbol_file_commandTom Tromey2017-08-142-32/+15
| | | | | | | | | | | | | | | | | | | | | | I happened to notice that add_symbol_file_command leaks "sect_opts". This patch fixes the leak by changing sect_opts to be a std::vector. I had to change the logic in the loop a little bit. Previously, it was incrementing section_index after completing an entry; but this changes it to push a new entry when the name is seen. I believe the argument parsing here is mildly incorrect, in that nothing checks whether the -s option actually had any arguments. Maybe gdb can crash if "-s NAME" is given without an argument. I didn't try to fix this in this patch, but I do have another patch I can send later that fixes it up. Regression tested on the buildbot. ChangeLog 2017-08-11 Tom Tromey <tom@tromey.com> * symfile.c (add_symbol_file_command): Use std::vector.
* Use std::move in a few placesTom Tromey2017-08-144-3/+10
| | | | | | | | | | | | | | This patch adds std::move to few spots where it seems to be missing. Regression tested by the buildbot. ChangeLog 2017-08-14 Tom Tromey <tom@tromey.com> * break-catch-throw.c (handle_gnu_v3_exceptions): Use std::move. * break-catch-syscall.c (create_syscall_event_catchpoint): Use std::move. * break-catch-sig.c (create_signal_catchpoint): Use std::move.
* Fix null pointer dereference when parsing a corrupt ELF binary.Nick Clifton2017-08-143-1123/+1180
| | | | | | | PR 21957 * elf.c (setup_group): Check for an empty or very small group section. * po/bfd.pot: Regenerate.
* Automatic date update in version.inGDB Administrator2017-08-141-1/+1
|
* PR21441, Unnecessary padding of .eh_frame sectionAlan Modra2017-08-146-19/+45
| | | | | | | | | | | | | | | | | Until all .eh_frame sections have been edited we don't know their sizes. So it isn't possible to properly decide whether a non-empty .eh_frame section follows a given section until editing is complete. bfd/ PR 21441 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add alignment padding here. * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here in a reverse pass over sections. ld/ PR 21441 * testsuite/ld-x86-64/pr21038a.d: Adjust. * testsuite/ld-x86-64/pr21038a-now.d: Adjust.
* ld: Restore linker scripts in PR ld/21884 testsH.J. Lu2017-08-1311-0/+67
| | | | | | | | | | | | | | | | | OUTPUT_FORMAT in linker script of PR ld/21884 tests is needed to trigger PR ld/21884. Restore linker scripts and add nacl versions of the same tests. * testsuite/ld-i386/i386.exp: Run pr21884-nacl. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr21884.d: Don't run on nacl targets. * testsuite/ld-x86-64/pr21884.d: Likewise. * testsuite/ld-i386/pr21884.t: Revert the last change. * testsuite/ld-x86-64/pr21884.t: Likewise. * testsuite/ld-i386/pr21884-nacl.d: New file. * testsuite/ld-i386/pr21884-nacl.t: Likewise. * testsuite/ld-x86-64/pr21884-nacl.d: Likewise. * testsuite/ld-x86-64/pr21884-nacl.t: Likewise.
* Fix i686-nacl and x86_64-nacl pr21884 failuresAlan Modra2017-08-133-8/+5
| | | | | | | | OUTPUT_FORMAT in the script results in "./ld-new: target elf32-i386 not found" and similarly for the x86_64 test. * testsuite/ld-i386/pr21884.t: Remove unneeded format, arch and entry. * testsuite/ld-x86-64/pr21884.t: Likewise.
* Automatic date update in version.inGDB Administrator2017-08-131-1/+1
|
* Fix typo on documentation ("show set startup-with-shell")Sergio Durigan Junior2017-08-122-1/+7
| | | | | | | | | | | | | The documentation was erroneously saying that there is a command named "show set startup-with-shell", while the correct version is "show startup-with-shell". This commit fixes obvious mistake. gdb/doc/ChangeLog: 2017-08-12 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/21925 * gdb.texinfo (Starting) <startup-with-shell>: Fix typo ("show set...").
* testsuite: Exclude end-of-line characters from get_valueof resultSimon Marchi2017-08-122-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_valueof procedure allows tests to conveniently make gdb evaluate an expression an return the value as a string. However, it includes an end-of-line character in its result. I stumbled on this when trying to use that result as part of a regex further in a test. You can see this for example by adding a puts in gdb.dwarf2/implref-struct.exp:get_members: set members [get_valueof "" ${var} ""] puts "<$members>" The output is <{a = 0, b = 1, c = 2} > This is because the regex in get_valueof is too greedy, the captured portion matches anything up to the gdb_prompt, including the end of line characters. This patch changes it to capture everything but end of line characters. The output of the puts becomes: <{a = 0, b = 1, c = 2}> I tested this by running gdb.dwarf2/implref-array.exp and gdb.dwarf2/implref-struct.exp, the two only current users of that procedure. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_valueof): Don't capture end-of-line characters.
* Collision between NT_GNU_BUILD_ATTRIBUTE_OPEN and NT_PPC_VMXAlan Modra2017-08-122-4/+15
| | | | | * readelf.c (process_note): Qualify NT_GNU_BUILD_ATTRIBUTE notes by name data.
* Automatic date update in version.inGDB Administrator2017-08-121-1/+1
|
* x86: Allocate space for symbol names with symbol tableH.J. Lu2017-08-113-84/+73
| | | | | | | | | | | When synthesizing symbols for PLT entries, allocate space for symbol names with @plt suffixes together with symbol table so that all memory is returned when symbol table is freed. PR binutils/21943 * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space for @plt suffixes first. * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
* Add -z globalaudit linker command line option to set the DF_GLOBALAUDIT flag ↵Nick Clifton2017-08-117-0/+36
| | | | | | | | | | | | | | | bit in the dynamic tags. * emultempl/elf32.em (handle_option): Accept the -z globalaudit command line option. * lexsup.c (elf_static_list_options): Add -z globalaudit. * ld.texinfo: Document the support for the new command line option. * NEWS: Mention the new feature. * testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit command line option. * testsuite/ld-elf/globalaudit.rd: New file: Expected output from readelf.
* Add 2 more tests for PR ld/21884H.J. Lu2017-08-117-0/+52
| | | | | | | | | | PR ld/21884 * testsuite/ld-i386/i386.exp: Run pr21884. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr21884.d: New file. * testsuite/ld-i386/pr21884.t: Likewise. * testsuite/ld-x86-64/pr21884.d: Likewise. * testsuite/ld-x86-64/pr21884.t: Likewise.
* Also disallow global alias of common symbolH.J. Lu2017-08-1114-4/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can't create alias of common symbol. Local alias of common symbol has been disallowed. But global alias of common symbol is disallowed when the common symbol is seen first and silently dropped otherwise. This patch disallows alias of common symbol in all cases. gas/ PR gas/21667 * read.c (pseudo_set): Update error message for alias of common symbol. * write.c (write_object_file): Disallow both local and global aliases of common symbol. * testsuite/gas/elf/common5a.d: New file. * testsuite/gas/elf/common5a.l: Likewise. * testsuite/gas/elf/common5a.s: Likewise. * testsuite/gas/elf/common5b.d: Likewise. * testsuite/gas/elf/common5b.l: Likewise. * testsuite/gas/elf/common5b.s: Likewise. * testsuite/gas/elf/common5c.d: Likewise. * testsuite/gas/elf/common5c.s: Likewise. * testsuite/gas/elf/common5d.d: Likewise. * testsuite/gas/elf/common5d.s: Likewise. * testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c and common5d.
* More gdb/skip.c C++ificationPedro Alves2017-08-114-238/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make skiplist_entry a class with private data members. - Move all construction logic to the ctor. - Make skip_file_p etc be methods of skiplist_entry. - Use std::list for the skip entries chain. Make the list own its elements. - Get rid of the ALL_SKIPLIST_ENTRIES/ALL_SKIPLIST_ENTRIES_SAFE macros, use range-for / iterators instead. - function_name_is_marked_for_skip 'function_sal' argument must be non-NULL, so make it a reference instead. All skiplist_entry invariants are now controlled by skiplist_entry methods/internals. Some gdb_asserts disappear for being redundant. gdb/ChangeLog: 2017-08-11 Pedro Alves <palves@redhat.com> * infrun.c (process_event_stop_test): Adjust function_name_is_marked_for_skip call. * skip.c: Include <list>. (skiplist_entry): Make it a class with private fields, and getters/setters. (skiplist_entry_chain): Delete. (skiplist_entries): New. (skiplist_entry_count): Delete. (highest_skiplist_entry_num): New. (ALL_SKIPLIST_ENTRIES, ALL_SKIPLIST_ENTRIES_SAFE): Delete. (add_skiplist_entry): Delete. (skiplist_entry::skiplist_entry): New. (skiplist_entry::add_entry): New. (skip_file_command, skip_function): Adjust. (compile_skip_regexp): Delete. (skip_command): Don't compile regexp here. Adjust to use skiplist_entry::add_entry. (skip_info): Adjust to use range-for and getters. (skip_enable_command, skip_disable_command): Adjust to use range-for and setters. (skip_delete_command): Adjust to use std::list. (add_skiplist_entry): Delete. (skip_file_p): Delete, refactored as ... (skiplist_entry::do_skip_file_p): ... this new method. (skip_gfile_p): Delete, refactored as ... (skiplist_entry::do_gskip_file_p): ... this new method. (skip_function_p, skip_rfunction_p): Delete, refactored as ... (skiplist_entry::skip_function_p): ... this new method. (function_name_is_marked_for_skip): Now returns bool, and takes the function sal by const reference. Adjust to use range-for and skiplist_entry methods. (_initialize_step_skip): Remove references to skiplist_entry_chain, skiplist_entry_count. * skip.h (function_name_is_marked_for_skip): Now returns bool, and takes the function sal by const reference.
* Reset *THIS_CACHE in frame_unwind_try_unwinder in case of exceptionYao Qi2017-08-114-16/+17
| | | | | | | | | | | | | | | | | | | | | | It is required that unwinder->sniffer should set *this_cache to NULL if the unwinder is not applicable or exception is thrown, so 78ac5f831692f70b841044961069e50d4ba6a76f adds clear_pointer_cleanup to set *this_cache to NULL in case of exception in order to fix PR 14100. https://sourceware.org/ml/gdb-patches/2012-08/msg00075.html This patch removes that clear_pointer_cleanup, and catch all exception in the caller of unwinder->sniffer. In case of exception, reset *this_case. gdb: 2017-08-11 Yao Qi <yao.qi@linaro.org> * dwarf2-frame.c (clear_pointer_cleanup): Remove. (dwarf2_frame_cache): Remove reset_cache_cleanup. (dwarf2_frame_cache): * frame-unwind.c (frame_unwind_try_unwinder): Catch RETURN_MASK_ALL and set *this_case to NULL. * frame-unwind.h: Update comments.