Nathan Sidwell [Fri, 4 Nov 2016 03:42:23 +0000 (20:42 -0700)]
Fix gas crash with unreasonably long lines
gas/
* input-scrub.c (partial_size): Make size_t.
(buffer_length): Likewise. Adjust meaning.
(struct input_save): Adjust partial_size type.
(input_scrub_reinit): New.
(input_scrub_push, input_scrub_begin): Use it.
(input_scrub_next_buffer): Fix buffer extension logic. Only scan
newly read buffer for newline.
Simon Marchi [Sat, 5 Nov 2016 03:47:32 +0000 (23:47 -0400)]
Fix a few typos
gdb/ChangeLog:
* maint.c (scoped_command_stats::scoped_command_stats): Fix typo.
* ppcnbsd-tdep.c (_initialize_ppcnbsd_tdep): Likewise.
* ppcobsd-tdep.c (_initialize_ppcobsd_tdep): Likewise.
* ui-out.c (ui_out_new): Likewise.
* utils.c (init_page_info): Likewise.
(reset_prompt_for_continue_wait_time): Likewise.
* windows-nat.c (windows_init_thread_list): Likewise.
* xtensa-tdep.c (call0_analyze_prologue): Likewise.
GDB Administrator [Sat, 5 Nov 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 27 Sep 2016 11:06:01 +0000 (12:06 +0100)]
arc/nps400: Validate address type operands correctly
When we match against an address type operand within an instruction it
is important that we match exactly the right address type operand early
on, during the opcode selection phase. If we wait until the operand
insertion phase to check that we have the correct address operand, then
it is too late to select an alternative opcode. This becomes important
only when we have multiple opcodes with the same mnemonic, and operand
lists that differ only in the type of the address operands.
This commit fixes this issue, and adds some example instructions that
require this issue to be fixed (the instructions are identical except
for the address type operand).
gas/ChangeLog:
* config/tc-arc.c (find_opcode_match): Use insert function to
validate matching address type operands.
* testsuite/gas/arc/nps400-10.d: New file.
* testsuite/gas/arc/nps400-10.s: New file.
opcodes/ChangeLog:
* arc-opc.c (arc_flag_operands): Add F_DI14.
(arc_flag_classes): Add C_DI14.
* arc-nps400-tbl.h: Add new exc instructions.
Andrew Burgess [Thu, 11 Aug 2016 15:04:59 +0000 (16:04 +0100)]
objcopy: Close some memory leaks in error paths
Closes some memory leaks within objcopy for error paths.
binutils/ChangeLog:
* objcopy.c (copy_section): Add extra calls to free for error
paths.
Tom Tromey [Mon, 22 Aug 2016 03:47:14 +0000 (21:47 -0600)]
set default-directory in dwarf-browse
I've been using dwarf-mode.el again recently and I found it mildly
annoying that the mode doesn't set default-directory. Setting it
means that operations in the dwarf-browsing buffer default to the
directory holding the object file being investigated.
This bumps the version number as well so that updating it via the
package manager works properly.
2016-11-04 Tom Tromey <tom@tromey.com>
* dwarf-mode.el (dwarf-browse): Set default-directory. Bump
version number.
Andreas Krebbel [Fri, 4 Nov 2016 18:48:35 +0000 (19:48 +0100)]
S/390: Fix 16 bit pc relative relocs.
Since the bpp instruction has been added the 16 bit wide pc relative
relocs might occur at offset 2 as well at offset 4 in an instruction.
With this patch the different adjustment is passed from
md_gather_operand to md_apply_fix via fx_pcrel_adjust field in the fix
data structure.
No regressions on s390x.
gas/ChangeLog:
2016-11-04 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (md_gather_operands): Set fx_pcrel_adjust.
(md_apply_fix): Use/Set fx_pcrel_adjust.
* testsuite/gas/s390/zarch-zEC12.d: Add bpp reloc test pattern.
* testsuite/gas/s390/zarch-zEC12.s: Add bpp reloc test.
Thomas Preud'homme [Fri, 4 Nov 2016 16:32:08 +0000 (16:32 +0000)]
Commit missing ChangeLog entry for Cortex-M33 support
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
include/
* opcode/arm.h (ARM_AEXT_V8M_MAIN_DSP): Define.
(ARM_AEXT2_V8M_MAIN_DSP): Likewise.
(ARM_ARCH_V8M_MAIN_DSP): Likewise.
Thomas Preud'homme [Fri, 4 Nov 2016 16:24:59 +0000 (16:24 +0000)]
Add support for ARM Cortex-M33 processor
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (cortex-m33): Declare new processor.
* doc/c-arm.texi (-mcpu ARM command line option): Document new
Cortex-M33 processor.
* NEWS: Mention ARM Cortex-M33 support.
Thomas Preud'homme [Fri, 4 Nov 2016 16:24:08 +0000 (16:24 +0000)]
Add support for ARM Cortex-M23 processor
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (cortex-m23): Declare new processor.
* doc/c-arm.texi (-mcpu ARM command line option): Document new
Cortex-M23 processor.
* NEWS: Mention ARM Cortex-M23 support.
Palmer Dabbelt [Fri, 4 Nov 2016 16:08:31 +0000 (16:08 +0000)]
Add maintainers for RISC-V target.
* MAINTAINERS: Add myself and Andrew Waterman as maintainers for
the RISC-V target.
Palmer Dabbelt [Fri, 4 Nov 2016 14:18:06 +0000 (14:18 +0000)]
Update RISC-V documentation and make sure that it is included in the gas info file.
* Makefile.am (CPU_DOCS): Add c-riscv.texi.
* Makefile.in: Regenerate.
* doc/all.texi: Set RISCV.
* doc/as.texinfo: Add RISCV options.
Add RISC-V-Dependent node.
Include c-riscv.texi.
* doc/c-riscv.texi: Rename RISC-V Options to RISC-V-Opts.
Nick Clifton [Fri, 4 Nov 2016 13:57:40 +0000 (13:57 +0000)]
Remove support for $PLATFORM in rpath search paths.
* emultempl/elf32.em (search_needed): Remove use of getauxval and
inclusion of <sys/auxv.h>. Replace support for $PLATFORM with a
warning message.
* configure.ac (AC_CHECK_FUNCS): Remove getauxval.
* configure: Regenerate.
* config.in: Regenerate.
Nick Clifton [Fri, 4 Nov 2016 13:50:01 +0000 (13:50 +0000)]
Fix building binutils for all 32-bit targets by moving riscv32 target into 64-bit builds only.
* targets.c (bfd_target_vector): Only add riscv_elf32_vec target
when supporting 64-bit BFD targets.
Andrew Burgess [Tue, 20 Sep 2016 13:21:05 +0000 (14:21 +0100)]
ld: Allow EXCLUDE_FILE to be used outside of the section list
Currently the EXCLUDE_FILE linker script construct can only be used
within the input section list, and applied only to the section pattern
immediately following the EXCLUDE_FILE. For example:
*.o (EXCLUDE_FILE (a.o) .text .rodata)
In this case all sections matching '.text' are included from all files
matching '*.o' but not from the file 'a.o'. All sections matching
'.rodata' are also included from all files matching '*.o' (incluing from
'a.o').
If the user wants to restrict the inclusion of section '.rodata' so that
this too is not taken from the file 'a.o' then the above example must be
extended like this:
*.o (EXCLUDE_FILE (a.o) .text EXCLUDE_FILE (a.o) .rodata)
However, due to the internal grammar of the linker script language the
snippet 'EXCLUDE_FILE (a.o) .text' is parsed by a pattern called
'wildcard_spec'. The same 'wildcard_spec' pattern is also used to parse
the input file name snippet '*.o' in the above examples. As a result of
this pattern reuse within the linker script grammar then the following
is also a valid linker script construct:
EXCLUDE_FILE (a.o) *.o (.text .rodata)
However, though the linker accepts this without complaint the
EXCLUDE_FILE part is silently ignored and has no effect.
This commit takes this last example and makes it a useful, valid,
construct. The last example now means to include sections '.text' and
'.rodata' from all files matching '*.o' except for the file 'a.o'.
If the list of input sections is long, and the user knows that the file
exclusion applies across the list then the second form might be a
clearer alternative to replicating the EXCLUDE_FILE construct.
I've added a set of tests for EXCLUDE_FILE to the linker, including
tests for the new functionality.
ld/ChangeLog:
* ldlang.h (struct lang_wild_statement_struct): Add
exclude_name_list field.
* ldlang.c (walk_wild_file_in_exclude_list): New function.
(walk_wild_consider_section): Use new
walk_wild_file_in_exclude_list function.
(walk_wild_file): Add call to walk_wild_file_in_exclude_list.
(print_wild_statement): Print new exclude_name_list field.
(lang_add_wild): Initialise new exclude_name_list field.
* testsuite/ld-scripts/exclude-file-1.d: New file.
* testsuite/ld-scripts/exclude-file-1.map: New file.
* testsuite/ld-scripts/exclude-file-1.t: New file.
* testsuite/ld-scripts/exclude-file-2.d: New file.
* testsuite/ld-scripts/exclude-file-2.map: New file.
* testsuite/ld-scripts/exclude-file-2.t: New file.
* testsuite/ld-scripts/exclude-file-3.d: New file.
* testsuite/ld-scripts/exclude-file-3.map: New file.
* testsuite/ld-scripts/exclude-file-3.t: New file.
* testsuite/ld-scripts/exclude-file-4.d: New file.
* testsuite/ld-scripts/exclude-file-4.map: New file.
* testsuite/ld-scripts/exclude-file-4.t: New file.
* testsuite/ld-scripts/exclude-file-a.s: New file.
* testsuite/ld-scripts/exclude-file-b.s: New file.
* testsuite/ld-scripts/exclude-file.exp: New file.
* ld.texinfo (Input Section Basics): Update description of
EXCLUDE_FILE to cover the new features.
* NEWS: Mention new EXCLUDE_FILE usage.
Andrew Burgess [Tue, 20 Sep 2016 14:25:55 +0000 (15:25 +0100)]
ld: Create test object files based on source file name
When creating object files during testing, base the name of the object
file on the name of the source file, rather than using dump0.o,
dump1.o, etc. There's a few places where we have multiple source
files with the same name but in different directories, in these cases,
even after this change, we still add a numerical suffix to make the
object file names unique. So if we have 'foo/src.s' and 'bar/src.s',
we will create object files 'src.o' and 'src1.o'.
Update the few tests that hard code the object file name into the
expected test results.
ld/ChangeLog:
* testsuite/lib/ld-lib.exp (run_dump_test): Use object file names
based on the original source file name.
* testsuite/ld-discard/extern.d: Update object file names.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/orphan-8.map: Likewise.
Andrew Burgess [Sun, 30 Oct 2016 08:11:30 +0000 (08:11 +0000)]
ld/xc16x: This target does not support -shared
Add the xc16x-elf target to the list of targets that do not support
the -shared option. Being missing from this list was causing the
linker to add '-z norelro' to the link line of many tests, which in
turn caused these tests to fail.
ld/ChangeLog:
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Add
xc16x-*-elf to the list of targets that don't support -shared.
Andrew Burgess [Tue, 20 Sep 2016 10:18:12 +0000 (11:18 +0100)]
ld: Rename pattern within yacc grammar file
Rename file_NAME_list to section_NAME_list in the linker's grammar
file. This rename reflects how the pattern is now being used, and makes
the grammar easier to understand.
There should be no functional change after this commit.
ld/ChangeLog:
* ldgram.y: Rename file_NAME_list to section_NAME_list
throughout.
GDB Administrator [Fri, 4 Nov 2016 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Manish Goregaokar [Sat, 29 Oct 2016 12:55:58 +0000 (05:55 -0700)]
Add support for the sizeof function in Rust
2016-10-29 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-exp.y: Parse `sizeof(exp)` as `UNOP_SIZEOF`
gdb/testsuite/ChangeLog:
* gdb.rust/simple.exp: Add tests for `sizeof(expr)`
Manish Goregaokar [Sat, 29 Oct 2016 01:00:43 +0000 (18:00 -0700)]
Add support for untagged unions in Rust
2016-10-28 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_union_is_untagged): Add function to
check if a union is an untagged unioni
(rust_val_print): Handle printing of untagged union values
(rust_print_type): Handle printing of untagged union types
(rust_evaluate_subexp): Handle evaluating field
access on untagged unions
Manish Goregaokar [Thu, 27 Oct 2016 23:46:34 +0000 (16:46 -0700)]
Fix handling of discriminantless univariant enums in Rust; fix bug with encoded enums
2016-10-27 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_get_disr_info): Treat univariant enums
without discriminants as encoded enums with a real field
* rust-lang.c (rust_evaluate_subexp): Handle field access
on encoded struct-like enums
gdb/testsuite/ChangeLog:
* simple.rs: Add test for univariant enums without discriminants
and for encoded struct-like enums
* simple.exp: Add test expectations
Graham Markall [Wed, 26 Oct 2016 16:53:21 +0000 (17:53 +0100)]
[ARC] Fix ldbit test on 32-bit systems
The long immediate operand chosen for one of the ldbit tests is
equivalent to a small negative value that would fit inside an s9
operand, leading to the assembler to choose an unexpected (but
legitimate) encoding of the instruction on 32-bit systems, and
therefore causing the test to fail. This commit fixes the test by
changing the offending limm value so that it can no longer be
interpreted as an s9 operand.
gas/ChangeLog:
* testsuite/gas/arc/nps400-6.s: Change ldbit tests so that
limm operands are out of the range of an s9, in order to fix
the test.
* testsuite/gas/arc/nps400-6.d: Updated to match new expected
output.
Graham Markall [Tue, 18 Oct 2016 19:10:25 +0000 (20:10 +0100)]
arc: Implement NPS-400 dcmac instruction
gas/ChangeLog:
* testsuite/gas/arc/nps-400-9.d: Added.
* testsuite/gas/arc/nps-400-9.s: Added.
include/ChangeLog:
* opcode/arc.h: Add PROTOCOL_DECODE to insn_class_t.
opcodes/ChangeLog:
* arc-dis.c (arc_insn_length): Return length 8 for instructions with
major opcode 0xa.
* arc-nps-400-tbl.h: Add dcmac instruction.
* arc-opc.c (arc_operands): Added operands for dcmac instruction.
(insert_nps_rbdouble_64): Added.
(extract_nps_rbdouble_64): Added.
(insert_nps_proto_size): Added.
(extract_nps_proto_size): Added.
Andrew Burgess [Wed, 6 Jul 2016 18:39:55 +0000 (19:39 +0100)]
arc: Change max instruction length to 64-bits
The current handling for arc instructions longer than 32-bits is all
handled as a special case in both the assembler and disassembler.
The problem with this approach is that it leads to code duplication,
selecting a long instruction is exactly the same process as selecting a
short instruction, except over more bits, in both cases we select based
on bit comparison, and initial operand insertion and extraction.
This commit unifies both the long and short instruction worlds,
converting the core opcodes library from being largely 32-bit focused,
to being largely 64-bit focused.
The changes are, on the whole, not too much. There's obviously a lot of
type changes but otherwise the bulk of the code just works. Most of the
actual functional changes are to code that previously handled the longer
48 or 64 bit instructions. The insert/extract handlers for these have
now been brought into line with the short instruction insert/extract
handlers.
All of the special case handling code that was previously added has now
been removed again. Overall, this commit reduces the amount of code in
the arc assembler and disassembler.
gas/ChangeLog:
* config/tc-arc.c (struct arc_insn): Change type of insn field.
(md_number_to_chars_midend): Support 6- and 8-byte values.
(emit_insn0): Update debug output.
(find_opcode_match): Likewise.
(build_fake_opcode_hash_entry): Delete.
(find_special_case_long_opcode): Delete.
(find_special_case): Remove long format special case handling.
(insert_operand): Change instruction type and update debug print
format.
(assemble_insn): Change instruction type, update debug print
formats, and remove unneeded assert.
include/ChangeLog:
* opcode/arc.h (struct arc_opcode): Change type of opcode and mask
fields.
(struct arc_long_opcode): Delete.
(struct arc_operand): Change types for insert and extract
handlers.
opcodes/ChangeLog:
* arc-dis.c (struct arc_operand_iterator): Remove all fields
relating to long instruction processing, add new limm field.
(OPCODE): Rename to...
(OPCODE_32BIT_INSN): ...this.
(OPCODE_AC): Delete.
(skip_this_opcode): Handle different instruction lengths, update
macro name.
(special_flag_p): Update parameter type.
(find_format_from_table): Update for more instruction lengths.
(find_format_long_instructions): Delete.
(find_format): Update for more instruction lengths.
(arc_insn_length): Likewise.
(extract_operand_value): Update for more instruction lengths.
(operand_iterator_next): Remove code relating to long
instructions.
(arc_opcode_to_insn_type): New function.
(print_insn_arc):Update for more instructions lengths.
* arc-ext.c (extInstruction_t): Change argument type.
* arc-ext.h (extInstruction_t): Change argument type.
* arc-fxi.h: Change type unsigned to unsigned long long
extensively throughout.
* arc-nps400-tbl.h: Add long instructions taken from
arc_long_opcodes table in arc-opc.c.
* arc-opc.c: Update parameter types on insert/extract handlers.
(arc_long_opcodes): Delete.
(arc_num_long_opcodes): Delete.
(arc_opcode_len): Update for more instruction lengths.
Graham Markall [Thu, 13 Oct 2016 08:34:16 +0000 (09:34 +0100)]
arc: Swap highbyte and lowbyte in print_insn_arc
highbyte and lowbyte actually refer to the low byte and the high
byte respectively, but are used consistently in this swapped
order. This commit swaps them round so that highbyte refers to the
high byte and lowbyte refers to the low byte.
There should be no functional change after this commit.
opcodes/ChangeLog:
* arc-dis.c (print_insn_arc): Swap highbyte and lowbyte.
Graham Markall [Wed, 6 Jul 2016 18:01:53 +0000 (19:01 +0100)]
opcodes/arc: Make some macros 64-bit safe
In preparation to moving to a world where arc instructions can be 2, 4,
6, or 8 bytes long, make some macros 64-bit safe.
There should be no functional change after this commit.
include/ChangeLog:
* opcode/arc.h: Make macros 64-bit safe.
Graham Markall [Thu, 29 Sep 2016 18:25:25 +0000 (19:25 +0100)]
arc: Replace ARC_SHORT macro with arc_opcode_len function
In preparation for moving to a world where arc instructions can be 2, 4,
6, or 8 bytes in length, replace the ARC_SHORT macro (which is either
true of false) with an arc_opcode_len function that returns a length in
bytes.
There should be no functional change after this commit.
gas/ChangeLog:
* config/tc-arc.c (assemble_insn): Replace use of ARC_SHORT with
arc_opcode_len.
include/ChangeLog:
* opcode/arc.h (arc_opcode_len): Declare.
(ARC_SHORT): Delete.
opcodes/ChangeLog:
* arc-dis.c (find_format_from_table): Replace use of ARC_SHORT
with arc_opcode_len.
(find_format_long_instructions): Likewise.
* arc-opc.c (arc_opcode_len): New function.
Graham Markall [Wed, 6 Jul 2016 14:04:37 +0000 (15:04 +0100)]
gas/arc: Replace short_insn flag with insn length field
When assembling an instruction replace the short_insn boolean flag with
an integer field for holding the instruction length. This is in
preparation for moving to a world where instructions can be 2, 4, 6, or
8 bytes in length.
gas/ChangeLog:
* config/tc-arc.c (struct arc_insn): Replace short_insn flag with
len field.
(apply_fixups): Update to use len field.
(emit_insn0): Simplify code, making use of len field.
(md_convert_frag): Update to use len field.
(assemble_insn): Update to use len field.
Andrew Burgess [Thu, 29 Sep 2016 16:51:16 +0000 (17:51 +0100)]
arc/opcodes/nps400: Fix some instruction masks
A few masks were incorrect, there were opcode bits that lives outside of
the instruction mask, the effected instructions are decode1, zncv, and
efabgt.
Previously these instructions would assemble and disassemble correctly,
and a correctly encoded binary should behave no differently. The only
difference would be seen in a few incorrectly encoded binaries,
previously these would have decoded to the above instructions, while now
they will not.
opcodes/ChangeLog:
* arc-nps400-tbl.h: Fix some instruction masks.
Siddhesh Poyarekar [Wed, 19 Oct 2016 18:59:34 +0000 (00:29 +0530)]
New option falkor for Qualcomm server part
This adds an option for the Qualcomm falkor core, the corresponding
gcc patch is here:
https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00262.html
This was tested with aarch64 and armhf builds and make check and also
by building and running SPEC2006.
* config/tc-aarch64.c (aarch64_cpus): Add falkor.
* config/tc-arm.c (arm_cpus): Likewise.
* doc/c-aarch64.texi: Likewise.
* doc/c-arm.texi: Likewise.
H.J. Lu [Thu, 3 Nov 2016 16:55:01 +0000 (09:55 -0700)]
X86: Reuse opcode 0x80 decoder for opcode 0x82
Since opcode 0x82 is an alias of opcode 0x80, we can reuse opcode 0x80
decoder.
* i386-dis.c (REG_82): Removed.
(X86_64_82_REG_0): Likewise.
(X86_64_82_REG_1): Likewise.
(X86_64_82_REG_2): Likewise.
(X86_64_82_REG_3): Likewise.
(X86_64_82_REG_4): Likewise.
(X86_64_82_REG_5): Likewise.
(X86_64_82_REG_6): Likewise.
(X86_64_82_REG_7): Likewise.
(X86_64_82): New.
(dis386): Use X86_64_82 instead of REG_82.
(reg_table): Remove REG_82.
(x86_64_table): Add X86_64_82. Remove X86_64_82_REG_0,
X86_64_82_REG_1, X86_64_82_REG_2, X86_64_82_REG_3,
X86_64_82_REG_4, X86_64_82_REG_5, X86_64_82_REG_6 and
X86_64_82_REG_7.
H.J. Lu [Thu, 3 Nov 2016 16:13:01 +0000 (09:13 -0700)]
X86: Decode opcode 0x82 as opcode 0x80 in 32-bit mode
Update x86 disassembler to treat opcode 0x82 as an aliase of opcode 0x80
in 32-bit mode.
gas/
PR binutils/20754
* testsuite/gas/i386/opcode.s: Add tests for opcode 0x82.
* testsuite/gas/i386/opcode-intel.d: Updated.
* testsuite/gas/i386/opcode.d: Likewise.
opcodes/
PR binutils/20754
* i386-dis.c (REG_82): New.
(X86_64_82_REG_0): Likewise.
(X86_64_82_REG_1): Likewise.
(X86_64_82_REG_2): Likewise.
(X86_64_82_REG_3): Likewise.
(X86_64_82_REG_4): Likewise.
(X86_64_82_REG_5): Likewise.
(X86_64_82_REG_6): Likewise.
(X86_64_82_REG_7): Likewise.
(dis386): Use REG_82.
(reg_table): Add REG_82.
(x86_64_table): Add X86_64_82_REG_0, X86_64_82_REG_1,
X86_64_82_REG_2, X86_64_82_REG_3, X86_64_82_REG_4,
X86_64_82_REG_5, X86_64_82_REG_6 and X86_64_82_REG_7.
Yao Qi [Thu, 3 Nov 2016 16:09:42 +0000 (16:09 +0000)]
Replace YY_NULL with YY_NULLPTR in LANG-exp.c
As we require c++11, GDB fails to build if bison is not new enough.
I see the following error on the system (fedora 19) that bison is
2.6.4,
g++ -std=gnu++11 .... \
-c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF .deps/ada-exp.Tpo 'if test -f ada-exp.c; then echo ada-exp.c; else echo ../../binutils-gdb/gdb/ada-exp.c; fi`
In file included from ../../binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:113:0: error: "YY_NULL" redefined [-Werror]
#define YY_NULL 0
^
ada-exp.c:158:0: note: this is the location of the previous definition
# define YY_NULL nullptr
^
cc1plus: all warnings being treated as errors
make: *** [ada-exp.o] Error 1
Both ada-exp.c and ada-lex.c has macro YY_NULL, like this,
$ cat 1.c
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# else
# define YY_NULL 0
# endif
# endif
#define YY_NULL 0
as we can see, YY_NULL is defined differently (nullptr vs 0)
$ g++ -std=c++11 -Wall 1.c -c
1.c:9:0: warning: "YY_NULL" redefined
#define YY_NULL 0
^
1.c:3:0: note: this is the location of the previous definition
# define YY_NULL nullptr
^
$ g++ -Wall 1.c -c
bison renames YY_NULL to YY_NULLPTR in 2013 Nov,
https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00002.html
and bison released later than 2013 Nov have this patch. Bison 3.0.2,
released on 2013 Dec, is OK.
The fix is to replace YY_NULL with YY_NULLPTR via sed. With old bison,
YY_NULL becomes YY_NULLPTR; with new bison, YY_NULLPTR becomes
YY_NULLPTRPTR,
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR.
Tristan Gingold [Tue, 27 Sep 2016 13:06:51 +0000 (15:06 +0200)]
Deprecate old platforms
bfd/
* config.bfd: Deprecate many old triplets.
H.J. Lu [Thu, 3 Nov 2016 15:38:13 +0000 (08:38 -0700)]
X86: Rename REG_82 to REG_83
The REG_82 entry in x86 disassembler is for opcode 0x83, not opcode
0x82.
* i386-dis.c (REG_82): Renamed to ...
(REG_83): This.
(dis386): Updated.
(reg_table): Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION
Both of them are used in conversion. We can remove them since the
conversion is done.
There are many architectures only have one breakpoint instruction,
so their gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind look very similar. Instead of macro, we
use template "template <size_t, const gdb_byte *> struct bp_manipulation"
for these architectures. In order to use template, I also change
breakpoint instruction of type "static const gdb_byte[]" to
"constexpr gdb_byte[]", and rename them to ARCH_break_insn.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* aarch64-tdep.c (aarch64_default_breakpoint): Change it to
constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(aarch64_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* alpha-tdep.c (break_insn): Rename to alpha_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(alpha_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arc-tdep.c (arc_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Remove.
(struct bp_manipulation): New.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Remove.
(struct bp_manipulation_endian): New.
(BP_MANIPULATION): New.
(BP_MANIPULATION_ENDIAN): New.
* arm-tdep.c (arm_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* avr-tdep.c (avr_break_insn): Change it constexpr.
(avr_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cris-tdep.c (cris_gdbarch_init): Likewise.
* frv-tdep.c (breakpoint): Rename it to frv_break_insn, and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(frv_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* ft32-tdep.c (breakpoint): Rename it to ft32_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(ft32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* h8300-tdep.c (breakpoint): Rename it to h8300_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(h8300_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* hppa-tdep.c (breakpoint): Rename it to h8300_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(hppa_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* i386-tdep.c (break_insn): Rename it to i386_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(i386_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* iq2000-tdep.c (iq2000_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* lm32-tdep.c (breakpoint): Rename it to lm32_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(lm32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m32c-tdep.c (break_insn): Rename it to m32c_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m32c_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* m68hc11-tdep.c (breakpoint): Rename it to m68hc11_break_insn and
change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m68hc11_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m68k-tdep.c (break_insn): Rename it to m68k_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m68k_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m88k-tdep.c (break_insn): Rename it to m88k_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m88k_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mep-tdep.c (breakpoint): Rename it to mep_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(mep_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* microblaze-tdep.c (break_insn): Rename it to
microblaze_break_insn and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(microblaze_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (breakpoint): Rename it to mn10300_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(mn10300_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* moxie-tdep.c (breakpoint): Rename it to moxie_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(moxie_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* msp430-tdep.c (breakpoint): Rename it to msp430_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(msp430_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* nds32-tdep.c (break_insn): Rename it to nds32_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(nds32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* rl78-tdep.c (breakpoint): Rename it to rl78_break_ins
and change its type to rl78_break_insn. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(rl78_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* rs6000-tdep.c (big_breakpoint): Change its type to
constexpr.
(little_breakpoint): Likewise.
Don't use GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN.
(rs6000_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* rx-tdep.c (breakpoint): Rename it to rx_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(rx_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* s390-linux-tdep.c (breakpoint): Rename it to s390_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION
(s390_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* score-tdep.c (score_gdbarch_init): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* sparc-tdep.c (break_insn): Rename it to sparc_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(sparc32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* spu-tdep.c (breakpoint): Rename it to spu_break_insn and change
its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(spu_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* tilegx-tdep.c (breakpoint): Rename it to tilegx_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(tilegx_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* vax-tdep.c (break_insn): Rename it to vax_break_insn and
change its type to constexpr.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(vax_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* xstormy16-tdep.c (breakpoint): Rename it to
xstormy16_break_insn and change its type to constexpr.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(xstormy16_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove arm_override_mode
GDB can determine the kind of single step breakpoint by gdbarch
breakpoint_kind_from_current_state, so global variable
arm_override_mode is no longer needed. This patch removes it.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_override_mode): Remove.
(arm_pc_is_thumb): Update.
(arm_insert_single_step_breakpoint): Update.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Determine the kind of single step breakpoint
This patch adds a new gdbarch method breakpoint_kind_from_current_state
for single step breakpoint, and uses it in breakpoint_kind.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_kind_from_current_state):
New function.
* arch-utils.h (default_breakpoint_kind_from_current_state):
Declare.
* arm-tdep.c (arm_breakpoint_kind_from_current_state): New
function.
(arm_gdbarch_init): Call
set_gdbarch_breakpoint_kind_from_current_state.
* breakpoint.c (breakpoint_kind): Call
gdbarch_breakpoint_kind_from_current_state for single step
breakpoint. Update comments.
* gdbarch.sh (breakpoint_kind_from_current_state): New.
* gdbarch.c, gdbarch.h: Regenerate.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Add default_breakpoint_from_pc
This patch adds the default implementation of gdbarch breakpoint_from_pc,
which is,
const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
so gdbarch can only defines sw_breakpoint_from_kind and
breakpoint_kind_from_pc.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_from_pc): New function.
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
GDBARCH_BREAKPOINT_FROM_PC.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
set_gdbarch_breakpoint_from_pc.
(default_breakpoint_from_pc): Remove declaration.
* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
* gdbarch.c, gdbarch.h: Regenerate.
* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove gdbarch_remote_breakpoint_from_pc
This patch removes gdbarch method remote_breakpoint_from_pc, as it
is no longer used.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_remote_breakpoint_from_pc): Remove.
* arch-utils.h (default_remote_breakpoint_from_pc): Remove.
* arm-tdep.c (arm_remote_breakpoint_from_pc): Remove.
(arm_gdbarch_init): Don't call
set_gdbarch_remote_breakpoint_from_pc.
* gdbarch.sh (remote_breakpoint_from_pc): Remove.
* gdbarch.c, gdbarch.h: Regenerate.
* mips-tdep.c (mips_remote_breakpoint_from_pc): Remove.
(mips_gdbarch_init): Don't call
set_gdbarch_remote_breakpoint_from_pc.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Rename placed_size to kind
This patch renames placed_size to kind.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* breakpoint.h (struct bp_target_info) <placed_size>: Remove.
<kind>: New field.
Update all users.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Split breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind
We convert each ARCH_breakpoint_from_pc to ARCH_breakpoint_kind_from_pc
and ARCH_sw_breakpoint_from_kind. Note that gdbarch doesn't have methods
breakpoint_kind_from_pc and sw_breakpoint_from_kind so far.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): New macro.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): New macro.
* arm-tdep.c (arm_breakpoint_from_pc): Remove.
(arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): New function.
(arm_breakpoint_from_pc): Call arm_breakpoint_kind_from_pc
and arm_sw_breakpoint_from_kind.
Use GDBARCH_BREAKPOINT_FROM_PC.
(arm_remote_breakpoint_from_pc): Call
arm_breakpoint_kind_from_pc.
(arm_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc
with SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arc-tdep.c: Likewise.
* bfin-tdep.c: Likewise.
* cris-tdep.c: Likewise.
* iq2000-tdep.c: Likewise.
* m32r-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* rs6000-tdep.c: Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* sh64-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Add enum for mips breakpoint kinds
This patch adds an enum mips_breakpoint_kind to avoid using magic
numbers as much as possible.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* mips-tdep.c (mips_breakpoint_kind): New enum.
(mips_breakpoint_from_pc): Use it.
(mips_remote_breakpoint_from_pc): Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION
Many archs have only one kind of breakpoint, so their breakpoint_from_pc
implementations are quite similar. This patch uses macro
GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION
for breakpoint_from_pc, so that we can easily switch from
breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind
later.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): New macro.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): New macro.
aarch64-tdep.c (aarch64_breakpoint_from_pc): Remove. Use
GDBARCH_BREAKPOINT_MANIPULATION.
(aarch64_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc
with SET_GDBARCH_BREAKPOINT_MANIPULATION.
* alpha-tdep.c: Likewise.
* avr-tdep.c: Likewise.
* frv-tdep.c: Likewise.
* ft32-tdep.c: Likewise.
* h8300-tdep.c: Likewise.
* hppa-tdep.c: Likewise.
* i386-tdep.c: Likewise.
* lm32-tdep.c: Likewise.
* m32c-tdep.c: Likewise.
* m68hc11-tdep.c: Likewise.
* m68k-tdep.c: Likewise.
* m88k-tdep.c: Likewise.
* mep-tdep.c: Likewise.
* microblaze-tdep.c: Likewise.
* mn10300-tdep.c: Likewise.
* moxie-tdep.c: Likewise.
* msp430-tdep.c: Likewise.
* rl78-tdep.c: Likewise.
* rx-tdep.c: Likewise.
* s390-linux-tdep.c: Likewise.
* sparc-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* vax-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
gdbarch_breakpoint_from_pc doesn't return NULL
gdbarch_breakpoint_from_pc doesn't return NULL except for
ia64_breakpoint_from_pc, and we checked its return value in three
places. In microblaze_linux_memory_remove_breakpoint and
ppc_linux_memory_remove_breakpoint, gdbarch_breakpoint_from_pc never
returns NULL, so we can remove the NULL checking. In
default_memory_insert_breakpoint, gdbarch_breakpoint_from_pc can't
returns NULL too because ia64 defines its own memory_insert_breakpoint.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* mem-break.c (default_memory_insert_breakpoint): Don't check
'bp' against NULL.
* microblaze-linux-tdep.c (microblaze_linux_memory_remove_breakpoint):
Likewise.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
Jiong Wang [Thu, 3 Nov 2016 12:00:53 +0000 (12:00 +0000)]
[ARM] Allow MOV/MOV.W to accept all possible immediates
gas/
* config/tc-arm.c (SBIT_SHIFT): New.
(T2_SBIT_SHIFT): Likewise.
(t32_insn_ok): Return TRUE for MOV in ARMv8-M Baseline.
(md_apply_fix): Try UINT16 encoding when ARM/Thumb modified immediate
encoding failed.
* testsuite/gas/arm/archv6t2-bad.s: New error case.
* testsuite/gas/arm/archv6t2-bad.l: New error match.
* testsuite/gas/arm/archv6t2.s: New testcase.
* testsuite/gas/arm/archv6t2.d: New expected result.
* testsuite/gas/arm/archv8m.s: New testcase.
* testsuite/gas/arm/archv8m-base.d: New expected result.
* testsuite/gas/arm/archv8m-main.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
Nick Clifton [Thu, 3 Nov 2016 11:31:53 +0000 (11:31 +0000)]
Updated Danish translation for the BFD library.
GDB Administrator [Thu, 3 Nov 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 31 Oct 2016 02:45:08 +0000 (20:45 -0600)]
Fix dwarf_expr_context method regressions
This fixes some regressions found in the patch to convert
dwarf_expr_context to use methods. Specifically:
* get_base_type could erroneously throw; this was rewritten to move
the size checks into the only spot needing them.
* Previously the "symbol needs frame" implementation reused th
"cfa" function for the get_frame_pc slot; this reimplements
it under the correct name.
* Not enough members were saved and restored in one implementation
of push_dwarf_reg_entry_value; this patch fixes this oversight
and also takes the opportunity to remove an extraneous structure
definition.
2016-11-02 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (dwarf_evaluate_loc_desc::get_base_type): Rename
from impl_get_base_type. Rewrite.
(struct dwarf_expr_baton): Remove.
(dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value): Save and
restore more fields.
(symbol_needs_eval_context::get_frame_pc): New method.
* dwarf2expr.h (dwarf_expr_context::get_base_type): Now public,
virtual.
(dwarf_expr_context::impl_get_base_type): Remove.
* dwarf2expr.c (dwarf_expr_context::get_base_type): Remove.
Igor Tsimbalist [Wed, 2 Nov 2016 19:31:25 +0000 (12:31 -0700)]
Enable Intel AVX512_4VNNIW instructions
gas/
* config/tc-i386.c: (cpu_arch) Add .avx512_4vnniw.
(cpu_noarch): Add noavx512_4vnniw.
* doc/c-i386.texi: Document avx512_4vnniw, noavx512_4vnniw.
* testsuite/gas/i386/i386.exp: Run AVX512_4VNNIW tests.
* testsuite/gas/i386/avx512_4vnniwd_vl-intel.d: New test.
* testsuite/gas/i386/avx512_4vnniwd_vl.d: Ditto.
* testsuite/gas/i386/avx512_4vnniwd_vl.s: Ditto.
* testsuite/gas/i386/avx512_4vnniwd-intel.d: Ditto.
* testsuite/gas/i386/avx512_4vnniwd.d: Ditto.
* testsuite/gas/i386/avx512_4vnniwd.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd_vl-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd_vl.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd_vl.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4vnniwd.s: Ditto.
opcodes/
* i386-dis.c (enum): Add PREFIX_EVEX_0F3852, PREFIX_EVEX_0F3853.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_4VNNIW_FLAGS,
CPU_ANY_AVX512_4VNNIW_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_4VNNIW.
* i386-opc.h (enum): (AVX512_4VNNIW): New.
(i386_cpu_flags): Add cpuavx512_4vnniw.
* i386-opc.tbl: Add Intel AVX512_4VNNIW instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.
Igor Tsimbalist [Wed, 2 Nov 2016 19:24:39 +0000 (12:24 -0700)]
Enable Intel AVX512_4FMAPS instructions
gas/
* config/tc-i386.c (cpu_arch): Add .avx512_4fmaps.
(cpu_noarch): Add noavx512_4fmaps.
(process_operands): Handle implicit quad group.
* doc/c-i386.texi: Document avx512_4fmaps, noavx512_4fmaps.
* testsuite/gas/i386/i386.exp: Add AVX512_4FMAPS tests.
* testsuite/gas/i386/avx512_4fmaps_vl-intel.d: New test.
* testsuite/gas/i386/avx512_4fmaps_vl.d: Ditto.
* testsuite/gas/i386/avx512_4fmaps_vl.s: Ditto.
* testsuite/gas/i386/avx512_4fmaps-intel.d: Ditto.
* testsuite/gas/i386/avx512_4fmaps.d: Ditto.
* testsuite/gas/i386/avx512_4fmaps.s: Ditto.
* testsuite/gas/i386/avx512_4fmaps-warn.l: Ditto.
* testsuite/gas/i386/avx512_4fmaps-warn.s: Ditto.
* testsuite/gas/i386/avx512_4fmaps_vl-warn.l: Ditto.
* testsuite/gas/i386/avx512_4fmaps_vl-warn.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps.d: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps-warn.s: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-warn.l: Ditto.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-warn.s: Ditto.
opcodes/
* i386-dis.c. (enum): Add PREFIX_EVEX_0F389A,
PREFIX_EVEX_0F389B, PREFIX_EVEX_0F38AA, PREFIX_EVEX_0F38AB.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_4FMAPS_FLAGS,
CPU_ANY_AVX512_4FMAPS_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_4FMAPS.
(opcode_modifiers): Add ImplicitQuadGroup modifier.
* i386-opc.h (AVX512_4FMAP): New.
(i386_cpu_flags): Add cpuavx512_4fmaps.
(ImplicitQuadGroup): New.
(i386_opcode_modifier): Add implicitquadgroup.
* i386-opc.tbl: Add Intel AVX512_4FMAPS instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.
GDB Administrator [Wed, 2 Nov 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 31 Oct 2016 16:14:35 +0000 (16:14 +0000)]
BFD: Fix double BFD_FAIL calls in `bfd_default_reloc_type_lookup'
Break out of the outer switch statement once the inner switch for the
BFD_RELOC_CTOR relocation has been processed, preventing double BFD_FAIL
calls from being made, once from the inner switch and then again from
the default case of the outer switch.
Noticed with a `-Wimplicit-fallthrough' build error reported by a recent
GCC version:
In file included from .../bfd/reloc.c:52:0:
.../bfd/reloc.c: In function 'bfd_default_reloc_type_lookup':
.../bfd/libbfd.h:779:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
do { bfd_assert(__FILE__,__LINE__); } while (0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../bfd/reloc.c:7780:4: note: in expansion of macro 'BFD_FAIL'
BFD_FAIL ();
^~~~~~~~
.../bfd/reloc.c:7782:5: note: here
default:
^~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [reloc.lo] Error 1
bfd/
* reloc.c (bfd_default_reloc_type_lookup) <BFD_RELOC_CTOR>: Do
not fall through to the default case.
Nick Clifton [Tue, 1 Nov 2016 16:45:57 +0000 (16:45 +0000)]
Add support for RISC-V architecture.
bfd * Makefile.am: Add entries for riscv32-elf and riscv64-elf.
* config.bdf: Likewise.
* configure.ac: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* archures.c: Add bfd_riscv_arch.
* reloc.c: Add riscv relocs.
* targets.c: Add riscv_elf32_vec and riscv_elf64_vec.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id.
* elfnn-riscv.c: New file.
* elfxx-riscv.c: New file.
* elfxx-riscv.h: New file.
binutils* readelf.c (guess_is_rela): Add EM_RISCV.
(get_machine_name): Likewise.
(dump_relocations): Add support for riscv relocations.
(get_machine_flags): Add support for riscv flags.
(is_32bit_abs_reloc): Add R_RISCV_32.
(is_64bit_abs_reloc): Add R_RISCV_64.
(is_none_reloc): Add R_RISCV_NONE.
* testsuite/binutils-all/objdump.exp (cpus_expected): Add riscv.
Expect the debug_ranges test to fail.
gas * Makefile.am: Add riscv files.
* Makefile.in: Regenerate.
* NEWS: Mention the support for this architecture.
* configure.in: Define a default architecture.
* configure: Regenerate.
* configure.tgt: Add entries for riscv.
* doc/as.texinfo: Likewise.
* testsuite/gas/all/gas.exp: Expect the redef tests to fail.
* testsuite/gas/elf/elf.exp: Expect the groupauto tests to fail.
* config/tc-riscv.c: New file.
* config/tc-riscv.h: New file.
* doc/c-riscv.texi: New file.
* testsuite/gas/riscv: New directory.
* testsuite/gas/riscv/riscv.exp: New file.
* testsuite/gas/riscv/t_insns.d: New file.
* testsuite/gas/riscv/t_insns.s: New file.
ld * Makefile.am: Add riscv files.
* Makefile.in: Regenerate.
* NEWS: Mention the support for this target.
* configure.tgt: Add riscv entries.
* emulparams/elf32lriscv-defs.sh: New file.
* emulparams/elf32lriscv.sh: New file.
* emulparams/elf64lriscv-defs.sh: New file.
* emulparams/elf64lriscv.sh: New file.
* emultempl/riscvelf.em: New file.
opcodes * configure.ac: Add entry for bfd_riscv_arch.
* configure: Regenerate.
* disassemble.c (disassembler): Add support for riscv.
(disassembler_usage): Likewise.
* riscv-dis.c: New file.
* riscv-opc.c: New file.
include * dis-asm.h: Add prototypes for print_insn_riscv and
print_riscv_disassembler_options.
* elf/riscv.h: New file.
* opcode/riscv-opc.h: New file.
* opcode/riscv.h: New file.
GDB Administrator [Tue, 1 Nov 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 31 Oct 2016 16:24:04 +0000 (16:24 +0000)]
Remove IRIX 5 <sys/proc.h> _KMEMUSER workaround
Complement commit
3831839c089c ("Delete IRIX support") and remove the
IRIX 5 <sys/proc.h> _KMEMUSER workaround from the `configure' script, as
IRIX is no longer a supported host configuration.
gdb/
* configure.ac <mips-sgi-irix5*>: Remove <sys/proc.h> _KMEMUSER
workaround.
* configure: Regenerate.
* config.in: Regenerate.
Maciej W. Rozycki [Mon, 31 Oct 2016 02:08:06 +0000 (02:08 +0000)]
MIPS: Remove remains of legacy remote target support
Complement commit
f7c382926d78 ("Remove support for "target m32rsdi" and
"target mips/pmon/ddb/rockhopper/lsi"") and remove dead MIPS target code
which used to support these legacy remote targets.
gdb/
* mips-tdep.c (mips_r3041_reg_names): Remove.
(mips_breakpoint_from_pc): Remove IDT and PMON breakpoint
encodings.
Maciej W. Rozycki [Mon, 31 Oct 2016 02:07:26 +0000 (02:07 +0000)]
MIPS: Remove remains of IRIX OS ABI support
Complement commit
3831839c089c ("Delete IRIX support") and remove dead
MIPS target IRIX OS ABI support code.
gdb/
* defs.h (gdb_osabi): Remove GDB_OSABI_IRIX enum value.
* osabi.c (gdb_osabi_names): Remove "Irix" entry.
* mips-tdep.c (mips_irix_reg_names): Remove.
(mips_register_type): Remove GDB_OSABI_IRIX code.
(mips_pseudo_register_type): Likewise.
(mips_breakpoint_from_pc): Likewise.
(mips_gdbarch_init): Likewise.
Thomas Preud'homme [Mon, 31 Oct 2016 09:44:18 +0000 (09:44 +0000)]
Initialize input statement created in add_archive_member
2016-10-31 Thomas Preud'homme <thomas.preudhomme@arm.com>
ld/
* ldmain.c (add_archive_element): Initialize input->header.type.
* plugin.c (plugin_maybe_claim): Assert the statement is an input
statement.
Alan Modra [Mon, 31 Oct 2016 02:16:38 +0000 (12:46 +1030)]
Revert part "Set dynamic tag VMA and size from dynamic section when possible"
PR 20748
* elf32-microblaze.c (microblaze_elf_finish_dynamic_sections): Revert
2016-05-13 change.
GDB Administrator [Mon, 31 Oct 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 30 Oct 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Sat, 29 Oct 2016 15:30:34 +0000 (16:30 +0100)]
gdb/NEWS: Clarify C++ requirement
gdb/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* NEWS: Clarify C++ requirement.
Pedro Alves [Sat, 29 Oct 2016 15:14:36 +0000 (16:14 +0100)]
gdb/NEWS: Mention C++11 requirement
gdb/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* NEWS: Adjust to mention C++11 requirement.
Eli Zaretskii [Sat, 29 Oct 2016 15:10:23 +0000 (18:10 +0300)]
Support command-line redirection in native MS-Windows debugging
gdb/ChangeLog
2016-10-29 Eli Zaretskii <eliz@gnu.org>
* NEWS: Mention support for redirection on MS-Windows.
* windows-nat.c (redir_open, redir_set_redirection)
(redirect_inferior_handles) [!__CYGWIN__]: New functions.
(windows_create_inferior) [!__CYGWIN__]: Use
'redirect_inferior_handles' to redirect standard handles of the
debuggee if the command line requests that.
Pedro Alves [Sat, 29 Oct 2016 15:07:31 +0000 (16:07 +0100)]
gdb/doc: Remove mention of vCont's default actions
Discussion with qemu folks suggests that the vCont description could
be even simpler and clearer. Given we now say:
For each inferior thread, the leftmost action with a matching
thread-id is applied.
There's really no need to even talk about "default" actions, which
raises doubts about whether "default" is special in some way (it's
not).
See <https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg06944.html>.
gdb/doc/ChangeLog:
2016-10-29 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Packets) <vCont>: Remove mention of default
actions.
GDB Administrator [Sat, 29 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 12 Oct 2016 23:27:45 +0000 (00:27 +0100)]
gdb: Require C++11
Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11,
and if -std=xxx switches are necessary to enable C++11.
We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine
upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly.
That doesn't work for us, because the top level Makefile passes CXX
down to subdirs, and that overrides whatever gdb/Makefile may set CXX
to. The result would be that a make invocation from the build/gdb/
directory would use "g++ -std=gnu++11" as expected, while a make
invocation at the top level would not.
So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it
to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX)
(CXX_DIALECT)' to compile/link.
Confirmed that this enables C++11 starting with gcc 4.8, the first gcc
release with full C++11 support.
Also confirmed that configure errors out gracefully with older GCC
releases:
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features by default... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++0x... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++0x... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with +std=c++11... no
checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -h std=c++11... no
configure: error: *** A compiler with support for C++11 language features is required.
Makefile:9451: recipe for target 'configure-gdb' failed
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory '/home/pedro/brno/pedro/gdb/mygit/cxx-convertion/build-gcc-4.7'
If we need to revert back to making C++11 optional, all that's
necessary is to change the "mandatory" to "optional" in configure.ac
and regenerate configure (both gdb and gdbserver).
gdb/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* Makefile.in (CXX_DIALECT): Get from configure.
(COMPILE.pre, CC_LD): Append $(CXX_DIALECT).
(FLAGS_TO_PASS): Pass CXX_DIALECT.
* acinclude.m4: Include ax_cxx_compile_stdcxx.m4.
* ax_cxx_compile_stdcxx.m4: Add FSF copyright header. Set and
AC_SUBST CXX_DIALECT instead of changing CXX/CXXCPP.
* configure.ac: Call AX_CXX_COMPILE_STDCXX.
* config.in: Regenerate.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* Makefile.in (CXX_DIALECT): Get from configure.
(COMPILE.pre, CC_LD): Append $(CXX_DIALECT).
* acinclude.m4: Include ../ax_cxx_compile_stdcxx.m4.
* configure.ac: Call AX_CXX_COMPILE_STDCXX.
* config.in: Regenerate.
* configure: Regenerate.
Pedro Alves [Fri, 28 Oct 2016 15:00:38 +0000 (16:00 +0100)]
gdb: Import AX_CXX_COMPILE_STDCXX from the GNU Autoconf Archive
This macro throws C++11 code at the compiler in order to check whether
it supports C++11. final/override, rvalue references, static_assert,
decltype, auto, constexpr, etc., and adds -std=gnu++11 to CXX if
necessary.
Nothing uses the macro yet. Simply adding it as separate preliminary
step because we'll need local changes.
gdb/ChangeLog
2016-10-28 Pedro Alves <palves@redhat.com>
* ax_cxx_compile_stdcxx.m4: New file.
Pedro Alves [Fri, 28 Oct 2016 11:03:18 +0000 (12:03 +0100)]
gdb/testsuite: Avoid a buffer overrun in `gdb.base/maint.exp'
Fixes:
PASS: gdb.base/maint.exp: maint w/o args
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/maint.exp: maint info line-table w/o a file name
The problem is just many symtabs and long line tables, enough to
overflow the expect buffer. Fix this by matching input incrementally.
gdb/testsuite/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp <maint info line-table w/o a file name>: Use
gdb_test_multiple, tighten regexps and match symtabs and line
tables incrementally.
Luis Machado [Fri, 28 Oct 2016 13:45:27 +0000 (08:45 -0500)]
Make gdb.base/foll-exec.exp test pattern more general
Testing a powerpc toolchain running gdbserver on the other end i noticed a
failure in gdb.base/foll-exec.exp. Turns out gdb is outputting a slightly
different pattern due to the presence of debug information.
--
foll-exec is about to execlp(execd-prog)...^M
Continuing.^M
process 21222 is executing new program: gdb.d/outputs/gdb.base/foll-exec/execd-prog^M
^M
Catchpoint 2 (exec'd gdb.d/outputs/gdb.base/foll-exec/execd-prog), _start () at ../sysdeps/powerpc/powerpc32/dl-start.S:32^M
--
Notice the presence of source file information.
Now, on my local machine, i get this:
--
foll-exec is about to execlp(execd-prog)...^M
Continuing.^M
process 9285 is executing new program: gdb/testsuite/outputs/gdb.base/foll-exec/execd-prog^M
^M
Catchpoint 2 (exec'd gdb/testsuite/outputs/gdb.base/foll-exec/execd-prog), 0x00007ffff7dd7cc0 in ?? () from /lib64/ld-linux-x86-64.so.2^M
--
So the output differs slightly and the testcase is actually expecting only
the second form with the "in" anchor.
This patch removes the "in" pattern and lets the test match both kinds of
output.
gdb/testsuite/ChangeLog:
2016-10-28 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/foll-exec.exp (do_exec_tests): Make test pattern more
general.
Pedro Alves [Fri, 28 Oct 2016 00:09:06 +0000 (01:09 +0100)]
Fix gdb.base/maint.exp regressions
This commit fixes these regressions:
FAIL: gdb.base/maint.exp: mt set per on for expand-symtabs
FAIL: gdb.base/maint.exp: maint set per-command on
caused by commit
1e3b796d58ac ("Change command stats reporting to use
class").
gdb.log shows that the command stats are now printing garbage:
(gdb) mt set per on
Command execution time: -6.-419590 (cpu),
1467139648.-
7706296840 (wall)
Space used:
9809920 (-
33276528 for this command)
(gdb) FAIL: gdb.base/maint.exp: mt set per on for expand-symtabs
while there should have been no output at all.
The stats printing is done from within the scoped_command_stats's
destructor, depending on whether some flags in the object are set.
The problem is simply that scoped_command_stats's ctor misses clearing
those flags on some paths.
Since scoped_command_stats objects are allocated on the stack, whether
you'll see the regression simply depends on whatever happens to
already be on the stack space the object occupies.
gdb/ChangeLog:
2016-10-28 Pedro Alves <palves@redhat.com>
* maint.c (scoped_command_stats::scoped_command_stats): Clear
m_space_enabled, m_time_enabled and m_symtab_enabled.
Markus Metzger [Thu, 21 Jan 2016 14:02:27 +0000 (15:02 +0100)]
btrace: bridge gaps
Most of the time, the trace should be in one piece. This case is handled fine
by GDB. In some cases, however, there may be gaps in the trace. They result
from trace decode errors or from overflows.
A gap in the trace means we lost an unknown amount of trace. Gaps can be very
small, such as a few instructions in the same function, or they can be rather
big. We may, for example, lose a few function calls or returns. The trace may
continue in a different function and we likely don't know how we got there.
Even though we can't say how the program executed across a gap, higher levels
may not be impacted too much by it. Let's assume we have functions a-e and a
trace that looks roughly like this:
a
\
b b
\ /
c <gap> c
/
d d
\ /
e
Even though we can't say for sure, it is likely that b and c are the same
function instance before and after the gap. This patch is trying to connect
the c and b function segments across the gap.
This will add a to the back trace of b on the right hand side. The changes are
reflected in GDB's internal representation of the trace and will improve:
- the output of "record function-call-history /c"
- the output of "backtrace" in replay mode
- source stepping in replay mode
will be improved indirectly via the improved back trace
I don't have an automated test for this patch; decode errors will be fixed and
overflows occur sporadically and are quite rare. I tested it by hacking GDB to
provoke a decode error and on the expected gap in the gdb.btrace/dlopen.exp
test.
The issue is that we can't predict where we will be able to re-sync in case of
errors. For the expected decode error in gdb.btrace/dlopen.exp, for example, we
may be able to re-sync somewhere in dlclose, in test, in main, or not at all.
Here's one example run of gdb.btrace/dlopen.exp with and without this patch.
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Non-contiguous trace at instruction 66608 (offset = 0xa83, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66652 (offset = 0xa9b, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66770 (offset = 0xacb, pc = 0xb7fdcc31).
warning: Non-contiguous trace at instruction 66966 (offset = 0xb60, pc = 0xb7ff5ee4).
warning: Non-contiguous trace at instruction 66994 (offset = 0xb74, pc = 0xb7ff5f24).
warning: Non-contiguous trace at instruction 67334 (offset = 0xbac, pc = 0xb7ff5e6d).
warning: Non-contiguous trace at instruction 69022 (offset = 0xc04, pc = 0xb7ff60b3).
warning: Non-contiguous trace at instruction 69116 (offset = 0xc1c, pc = 0xb7ff60b3).
warning: Non-contiguous trace at instruction 69504 (offset = 0xc74, pc = 0xb7ff605d).
warning: Non-contiguous trace at instruction 83648 (offset = 0xecc, pc = 0xb7ff6134).
warning: Decode error (-13) at instruction 83876 (offset = 0xf48, pc = 0xb7fd6380): no memory mapped at this address.
warning: Non-contiguous trace at instruction 83876 (offset = 0x11b7, pc = 0xb7ff1c70).
Recorded 83948 instructions in 912 functions (12 gaps) for thread 1 (process 12996).
(gdb) record instruction-history 83876, +2
83876 => 0xb7fec46f <call_init.part.0+95>: call *%eax
[decode error (-13): no memory mapped at this address]
[disabled]
83877 0xb7ff1c70 <_dl_close_worker.part.0+1584>: nop
Without the patch, the trace is disconnected and the backtrace is short:
(gdb) record goto 83876
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
#1 0xb7fec5d0 in _dl_init () from /lib/ld-linux.so.2
#2 0xb7ff0fe3 in dl_open_worker () from /lib/ld-linux.so.2
Backtrace stopped: not enough registers or memory available to unwind further
(gdb) record goto 83877
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
#1 0xb7ff287a in _dl_close () from /lib/ld-linux.so.2
#2 0xb7fc3d5d in dlclose_doit () from /lib/libdl.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#5 0xb7fc3d98 in dlclose () from /lib/libdl.so.2
#6 0x0804860a in test ()
#7 0x08048628 in main ()
With the patch, GDB is able to connect the trace pieces and we get a full
backtrace.
(gdb) record goto 83876
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7fec46f in call_init.part () from /lib/ld-linux.so.2
#1 0xb7fec5d0 in _dl_init () from /lib/ld-linux.so.2
#2 0xb7ff0fe3 in dl_open_worker () from /lib/ld-linux.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7ff02e2 in _dl_open () from /lib/ld-linux.so.2
#5 0xb7fc3c65 in dlopen_doit () from /lib/libdl.so.2
#6 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#7 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#8 0xb7fc3d0e in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#9 0xb7ff28ee in _dl_runtime_resolve () from /lib/ld-linux.so.2
#10 0x0804841c in ?? ()
#11 0x08048470 in dlopen@plt ()
#12 0x080485a3 in test ()
#13 0x08048628 in main ()
(gdb) record goto 83877
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
(gdb) backtrace
#0 0xb7ff1c70 in _dl_close_worker.part.0 () from /lib/ld-linux.so.2
#1 0xb7ff287a in _dl_close () from /lib/ld-linux.so.2
#2 0xb7fc3d5d in dlclose_doit () from /lib/libdl.so.2
#3 0xb7fec354 in _dl_catch_error () from /lib/ld-linux.so.2
#4 0xb7fc43dd in _dlerror_run () from /lib/libdl.so.2
#5 0xb7fc3d98 in dlclose () from /lib/libdl.so.2
#6 0x0804860a in test ()
#7 0x08048628 in main ()
It worked nicely in this case but it may, of course, also lead to weird
connections; it is a heuristic, after all.
It works best when the gap is small and the trace pieces are long.
gdb/
* btrace.c (bfun_s): New typedef.
(ftrace_update_caller): Print caller in debug dump.
(ftrace_get_caller, ftrace_match_backtrace, ftrace_fixup_level)
(ftrace_compute_global_level_offset, ftrace_connect_bfun)
(ftrace_connect_backtrace, ftrace_bridge_gap, btrace_bridge_gaps): New.
(btrace_compute_ftrace_bts): Pass vector of gaps. Collect gaps.
(btrace_compute_ftrace_pt): Likewise.
(btrace_compute_ftrace): Split into this, ...
(btrace_compute_ftrace_1): ... this, and ...
(btrace_finalize_ftrace): ... this. Call btrace_bridge_gaps.
Markus Metzger [Tue, 19 Jan 2016 13:54:19 +0000 (14:54 +0100)]
btrace: preserve function level for unexpected returns
When encountering a return for which we have not seen a corresponding call, GDB
starts a new back trace from level -1, i.e. from the level of the first function
in the trace.
In the presence of trace gaps, this may cause some rather big jump.
(gdb) record function-call-history /c 192, +8
192 sbrk
193 brk
194 __x86.get_pc_thunk.bx
195 brk
196 __kernel_vsyscall
197 [disabled]
198 __kernel_vsyscall
199 brk
200 sbrk
This doesn't help to make things more clear. Let's remain on the same level
instead.
(gdb) record function-call-history /c 192, +8
192 sbrk
193 brk
194 __x86.get_pc_thunk.bx
195 brk
196 __kernel_vsyscall
197 [disabled]
198 __kernel_vsyscall
199 brk
200 sbrk
In this case it will look like we were able to connect the trace parts across
the disabled gap. We were not. More work is required to achieve this.
In the general case, the function-call history for the two trace parts won't
match. They may be off by a few levels or they may be entirely different. All
this patch does is to preserve the indentation level of the record
function-call-history command.
The disabled gap is caused by a sysenter not returning to the next instruction.
(gdb) record function-call-history /i 196, +1
196 __kernel_vsyscall inst 66515,66519
(gdb) record instruction-history 66515
66515 0xb7fdcbf8 <__kernel_vsyscall+0>: push %ecx
66516 0xb7fdcbf9 <__kernel_vsyscall+1>: push %edx
66517 0xb7fdcbfa <__kernel_vsyscall+2>: push %ebp
66518 0xb7fdcbfb <__kernel_vsyscall+3>: mov %esp,%ebp
66519 0xb7fdcbfd <__kernel_vsyscall+5>: sysenter
[disabled]
66520 0xb7fdcc08 <__kernel_vsyscall+16>: pop %ebp
66521 0xb7fdcc09 <__kernel_vsyscall+17>: pop %edx
66522 0xb7fdcc0a <__kernel_vsyscall+18>: pop %ecx
66523 0xb7fdcc0b <__kernel_vsyscall+19>: ret
66524 0xb7e8e09e <brk+30>: xchg %ecx,%ebx
(gdb) disassemble 0xb7fdcbf8, 0xb7fdcc0c
Dump of assembler code from 0xb7fdcbf8 to 0xb7fdcc0c:
0xb7fdcbf8 <__kernel_vsyscall+0>: push %ecx
0xb7fdcbf9 <__kernel_vsyscall+1>: push %edx
0xb7fdcbfa <__kernel_vsyscall+2>: push %ebp
0xb7fdcbfb <__kernel_vsyscall+3>: mov %esp,%ebp
0xb7fdcbfd <__kernel_vsyscall+5>: sysenter
0xb7fdcbff <__kernel_vsyscall+7>: nop
0xb7fdcc00 <__kernel_vsyscall+8>: nop
0xb7fdcc01 <__kernel_vsyscall+9>: nop
0xb7fdcc02 <__kernel_vsyscall+10>: nop
0xb7fdcc03 <__kernel_vsyscall+11>: nop
0xb7fdcc04 <__kernel_vsyscall+12>: nop
0xb7fdcc05 <__kernel_vsyscall+13>: nop
0xb7fdcc06 <__kernel_vsyscall+14>: int $0x80
0xb7fdcc08 <__kernel_vsyscall+16>: pop %ebp
0xb7fdcc09 <__kernel_vsyscall+17>: pop %edx
0xb7fdcc0a <__kernel_vsyscall+18>: pop %ecx
0xb7fdcc0b <__kernel_vsyscall+19>: ret
End of assembler dump.
I've seen this on 32-bit Fedora 23. I have not investigated what causes this
and whether we can avoid the gap in the first place. Let's first try to make
GDB handle such gaps more gracefully.
gdb/
* btrace.c (ftrace_new_return): Start from the previous function's level
if we can't find a matching call for a return.
Markus Metzger [Tue, 12 Jan 2016 15:05:15 +0000 (16:05 +0100)]
btrace: update tail call heuristic
An unconditional jump to the start of a function typically indicates a tail
call.
If we can't determine the start of the function at the destination address, we
used to treat it as a tail call, as well. This results in lots of tail calls
for code for which we don't have symbol information.
Restrict the heuristic to only consider jumps as tail calls that switch
functions in the case where we can't determine the start of a function. This
effectively disables tail call detection for code without symbol information.
gdb/
* btrace.c (ftrace_update_function): Update tail call heuristic.
Markus Metzger [Mon, 18 Jan 2016 15:59:21 +0000 (16:59 +0100)]
btrace: allow leading trace gaps
GDB ignores trace gaps from decode errors or overflows at the beginning of the
trace. There isn't really a gap in the trace; the trace just starts a bit
later than expected.
In cases where there is no trace at all or where the trace is smaller than
expected, this may hide the reason for the missing trace.
Allow leading trace gaps. They will be shown as decode warnings and by the
record function-call-history command.
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Decode error (-6) at instruction 0 (offset = 0x58, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 0 (offset = 0xb0, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 0 (offset = 0x168, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xe08, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xe60, pc = 0x0): unexpected packet context.
warning: Decode error (-6) at instruction 54205 (offset = 0xed8, pc = 0x0): unexpected packet context.
Recorded 91582 instructions in 1111 functions (6 gaps) for thread 1 (process 15710).
(gdb) record function-call-history /c 1
1 [decode error (-6): unexpected packet context]
2 [decode error (-6): unexpected packet context]
3 [decode error (-6): unexpected packet context]
4 _dl_addr
5 ??
6 _dl_addr
7 ??
8 ??
9 ??
10 ??
Leading trace gaps will not be shown by the record instruction-history command
without further changes.
gdb/
* btrace.c (btrace_compute_ftrace_bts, ftrace_add_pt): Allow leading gaps.
* record-btrace.c (record_btrace_single_step_forward)
(record_btrace_single_step_backward): Jump back to last instruction if
step ends at a gap.
(record_btrace_goto_begin): Skip gaps.
Markus Metzger [Tue, 12 Jan 2016 09:44:37 +0000 (10:44 +0100)]
btrace: fix gap indication
Trace gaps due to overflows or non-contiguous trace are ignored in the 'info
record' command. Fix that.
Also add a warning when decoding the trace and print the instruction number
preceding the trace gap in that warning message. It looks like this:
(gdb) info record
Active record target: record-btrace
Recording format: Intel Processor Trace.
Buffer size: 16kB.
warning: Decode error (-13) at instruction 101044 (offset = 0x29f0, pc = 0x7ffff728a642): no memory mapped at this address.
Recorded 101044 instructions in 2093 functions (1 gaps) for thread 1 (process 5360).
(gdb) record instruction-history 101044
101044 0x00007ffff728a640: pop %r13
[decode error (-13): no memory mapped at this address]
Remove the dead code that was supposed to print a gaps warning at the end of
trace decode. This isn't really needed since we now print a warning for each
gap.
gdb/
* btrace.c (ftrace_add_pt): Fix gap indication. Add warning for non-
contiguous trace and overflow. Rephrase trace decode warning and print
instruction number. Remove dead gaps warning.
(btrace_compute_ftrace_bts): Rephrase warnings and print instruction
number.
GDB Administrator [Fri, 28 Oct 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Enable range stepping if software single step is supported
If the target can do software single step, it can do range
stepping.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_supports_agent): Return true if
can_software_single_step return true.
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Get pending events in random
Nowadays, we select events to be reported to GDB in random, however
that is not enough when many GDBserver internal events (not reported
to GDB) are generated.
GDBserver pulls all events out of kernel via waitpid, and leave them
pending. When goes through threads which have pending events,
GDBserver uses find_inferior to find the first thread which has
pending event, and consumes it. Note that find_inferior always
iterate threads in a fixed order. If multiple threads keep hitting
GDBserver breakpoints, range stepping with single-step breakpoint for
example, threads in the head of the thread list are more likely to be
processed and threads in the tail are starved. This causes some timeout
fails in gdb.threads/non-stop-fair-events.exp when range stepping is
enabled on arm-linux.
This patch fixes this issue by randomly selecting pending events. It
adds a new function find_inferior_in_random, which iterates threads
which have pending events randomly.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* inferiors.c (find_inferior_in_random): New function.
* inferiors.h (find_inferior_in_random): Declare.
* linux-low.c (linux_wait_for_event_filtered): Call
find_inferior_in_random instead of find_inferior.
Yao Qi [Thu, 27 Oct 2016 15:05:06 +0000 (16:05 +0100)]
Remove single-step breakpoint for GDBserver internal event
This patch removes single-step breakpoints if the event is only
GDBserver internal, IOW, isn't reported back to GDB.
gdb/gdbserver:
2016-10-27 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_wait_1): If single-step breakpoints are
inserted, remove them.
Andrew Burgess [Fri, 8 Jul 2016 17:01:00 +0000 (18:01 +0100)]
gas/arc: Don't rely on bfd list of cpu type for cpu selection
In the ARC assembler, when a cpu type is specified using the .cpu
directive, we rely on the bfd list of arc machine types in order to
validate the cpu name passed in.
This validation is only used in order to check that the cpu type passed
to the .cpu directive matches any machine type selected earlier on the
command line. Once that initial check has passed a full check is
performed using the assemblers internal list of know cpu types.
The problem is that the assembler knows about more cpu types than bfd,
some cpu types known by the assembler are actually aliases for a base
cpu type plus a specific set of assembler extensions. One such example
is NPS400, though more could be added later.
This commit removes the need for the assembler to use the bfd list of
machine types for validation. Instead the error checking, to ensure
that any value passed to a '.cpu' directive matches any earlier command
line selection, is moved into the function arc_select_cpu.
I have taken the opportunity to bundle the 4 separate static globals
that describe the currently selected machine type into a single
structure (called selected_cpu).
gas/ChangeLog:
* config/tc-arc.c (arc_target): Delete.
(arc_target_name): Delete.
(arc_features): Delete.
(arc_mach_type): Delete.
(mach_type_specified_p): Delete.
(enum mach_selection_type): New enum.
(mach_selection_mode): New static global.
(selected_cpu): New static global.
(arc_eflag): Rename to ...
(arc_initial_eflag): ...this, and make const.
(arc_select_cpu): Update comment, new parameter, check how
previous machine type selection was made, and record this
selection. Use selected_cpu instead of old globals.
(arc_option): Remove use of arc_get_mach, instead use
arc_select_cpu to validate machine type selection. Use
selected_cpu over old globals.
(allocate_tok): Use selected_cpu over old globals.
(find_opcode_match): Likewise.
(assemble_tokens): Likewise.
(arc_cons_fix_new): Likewise.
(arc_extinsn): Likewise.
(arc_extcorereg): Likewise.
(md_begin): Update default machine type selection, use
selected_cpu over old globals.
(md_parse_option): Update machine type selection option handling,
use selected_cpu over old globals.
* testsuite/gas/arc/nps400-0.s: Add .cpu directive.
bfd/ChangeLog:
* cpu-arc.c (arc_get_mach): Delete.
GDB Administrator [Thu, 27 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Wed, 26 Oct 2016 17:12:01 +0000 (12:12 -0500)]
PR 20569, segv in follow_exec
The following testcases make GDB crash whenever an invalid sysroot is
provided, when GDB is unable to find a valid path to the symbol file:
gdb.base/catch-syscall.exp
gdb.base/execl-update-breakpoints.exp
gdb.base/foll-exec-mode.exp
gdb.base/foll-exec.exp
gdb.base/foll-vfork.exp
gdb.base/pie-execl.exp
gdb.multi/bkpt-multi-exec.exp
gdb.python/py-finish-breakpoint.exp
gdb.threads/execl.exp
gdb.threads/non-ldr-exc-1.exp
gdb.threads/non-ldr-exc-2.exp
gdb.threads/non-ldr-exc-3.exp
gdb.threads/non-ldr-exc-4.exp
gdb.threads/thread-execl.exp
The immediate cause of the segv is that follow_exec is passing a NULL
argument (the result of exec_file_find) to strlen.
However, the problem is deeper than that: follow_exec simply isn't
prepared for the case where sysroot translation fails to locate the
new executable. Actually all callers of exec_file_find have bugs due
to confusion between host and target pathnames. This commit attempts
to fix all that.
In terms of the testcases that were formerly segv'ing, GDB now prints
a warning but continues execution of the new program, so that the
tests now mostly FAIL instead. You could argue the FAILs are due to a
legitimate problem with the test environment setting up the sysroot
translation incorrectly.
A new representative test is added which exercises the ne wwarning
code path even with native testing.
Tested on x86_64 Fedora 23, native and gdbserver.
gdb/ChangeLog:
2016-10-25 Sandra Loosemore <sandra@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
Pedro Alves <palves@redhat.com>
PR gdb/20569
* exceptions.c (exception_print_same): Moved here from exec.c.
* exceptions.h (exception_print_same): Declare.
* exec.h: Include "symfile-add-flags.h".
(try_open_exec_file): New declaration.
* exec.c (exception_print_same): Moved to exceptions.c.
(try_open_exec_file): New function.
(exec_file_locate_attach): Rename exec_file and full_exec_path
variables to avoid confusion between target and host pathnames.
Move pathname processing logic to exec_file_find. Do not return
early if pathname lookup fails; Call try_open_exec_file.
* infrun.c (follow_exec): Split and rename execd_pathname variable
to avoid confusion between target and host pathnames. Warn if
pathname lookup fails. Pass target pathname to
target_follow_exec, not hostpathname. Call try_open_exec_file.
* main.c (symbol_file_add_main_adapter): New function.
(captured_main_1): Use it.
* solib-svr4.c (open_symbol_file_object): Adjust to pass
symfile_add_flags to symbol_file_add_main.
* solib.c (exec_file_find): Incorporate fallback logic for relative
pathnames formerly in exec_file_locate_attach.
* symfile.c (symbol_file_add_main, symbol_file_add_main_1):
Replace 'from_tty' parameter with a symfile_add_file.
(symbol_file_command): Adjust to pass symfile_add_flags to
symbol_file_add_main.
* symfile.h (symbol_file_add_main): Replace 'from_tty' parameter
with a symfile_add_file.
gdb/testsuite/ChangeLog:
2016-10-25 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/exec-invalid-sysroot.exp: New file.
Pedro Alves [Wed, 26 Oct 2016 15:47:10 +0000 (16:47 +0100)]
Make symfile_add_flags and objfile->flags strongly typed
This makes these flag types be "enum flag" types. The benefit is
making use of C++'s stronger typing -- mixing the flags types by
mistake errors at compile time.
This caught one old bug in symbol_file_add_main_1 already, fixed by
this patch as well:
@@ -1318,7 +1326,7 @@ symbol_file_add_main_1 (const char *args, int from_tty, int flags)
what is frameless. */
reinit_frame_cache ();
- if ((flags & SYMFILE_NO_READ) == 0)
+ if ((add_flags & SYMFILE_NO_READ) == 0)
set_initial_language ();
}
Above, "flags" are objfile flags, not symfile_add_flags. So that was
actually checking for "flag & OBJF_PSYMTABS_READ", which has the same
value as SYMFILE_NO_READ...
I moved the flags definitions to separate files to break circular
dependencies.
Built with --enable-targets=all and tested on x86-64 Fedora 23.
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* coffread.c (coff_symfile_read): Use symfile_add_flags.
* dbxread.c (dbx_symfile_read): Ditto.
* elfread.c (elf_symfile_read): Ditto.
* inferior.h: Include symfile-add-flags.h.
(struct inferior) <symfile_flags>: Now symfile_add_flags.
* machoread.c (macho_add_oso_symfile, macho_symfile_read_all_oso)
(macho_symfile_read, mipscoff_symfile_read): Use
symfile_add_flags.
* objfile-flags.h: New file.
* objfiles.c (allocate_objfile): Use objfile_flags.
* objfiles.h: Include objfile-flags.h.
(struct objfile) <flags>: Now an objfile_flags.
(OBJF_REORDERED, OBJF_SHARED, OBJF_READNOW, OBJF_USERLOADED)
(OBJF_PSYMTABS_READ, OBJF_MAINLINE, OBJF_NOT_FILENAME): Delete.
Converted to an enum-flags in objfile-flags.h.
(allocate_objfile): Use objfile_flags.
* python/py-objfile.c (objfpy_add_separate_debug_file): Remove
unnecessary local.
* solib.c (solib_read_symbols, solib_add)
(reload_shared_libraries_1): Use symfile_add_flags.
* solib.h: Include "symfile-add-flags.h".
(solib_read_symbols): Use symfile_add_flags.
* symfile-add-flags.h: New file.
* symfile-debug.c (debug_sym_read): Use symfile_add_flags.
* symfile-mem.c (symbol_file_add_from_memory): Use
symfile_add_flags.
* symfile.c (read_symbols, syms_from_objfile_1)
(syms_from_objfile, finish_new_objfile): Use symfile_add_flags.
(symbol_file_add_with_addrs): Use symfile_add_flags and
objfile_flags.
(symbol_file_add_separate): Use symfile_add_flags.
(symbol_file_add_from_bfd, symbol_file_add): Use symfile_add_flags
and objfile_flags.
(symbol_file_add_main_1): : Use objfile_flags. Fix add_flags vs
flags confusion.
(symbol_file_command): Use objfile_flags.
(add_symbol_file_command): Use symfile_add_flags and
objfile_flags.
(clear_symtab_users): Use symfile_add_flags.
* symfile.h: Include "symfile-add-flags.h" and "objfile-flags.h".
(struct sym_fns) <sym_read>: Use symfile_add_flags.
(clear_symtab_users): Use symfile_add_flags.
(enum symfile_add_flags): Delete, moved to symfile-add-flags.h and
converted to enum-flags.
(symbol_file_add, symbol_file_add_from_bfd)
(symbol_file_add_separate): Use symfile_add_flags.
* xcoffread.c (xcoff_initial_scan): Use symfile_add_flags.
Pedro Alves [Wed, 26 Oct 2016 10:08:28 +0000 (11:08 +0100)]
gdb: Coalesce/aggregate (async) vCont packets/actions
Currently, with "maint set target-non-stop on", that is, when gdb
connects with the non-stop/asynchronous variant of the remote
protocol, even with "set non-stop off", GDB always sends one vCont
packet per thread resumed. This patch makes GDB aggregate and
coalesce vCont packets, so we send vCont packets like "vCont;s:p1.1;c"
in non-stop mode too.
Basically, this is done by:
- Adding a new target method target_commit_resume that is called
after calling target_resume one or more times. When resuming a
batch of threads, we'll only call target_commit_resume once after
calling target_resume for all threads.
- Making the remote target defer sending the actual vCont packet to
target_commit_resume.
Special care must be taken to avoid sending a vCont action with a
"wildcard" thread-id (all threads of process / all threads) when that
would resume threads/processes that should not be resumed. See
remote_commit_resume comments for details.
Unlike all-stop's remote_resume implementation, this handles the case
of too many actions resulting in a too-big vCont packet, by flushing
the vCont packet and starting a new one.
E.g., imagining that the "c" action in:
vCont;s:1;c
overflows the packet buffer, we split the actions like:
vCont;s:1
vCont;c
Tested on x86_64 Fedora 20, with and without "maint set
target-non-stop on".
Also tested with a hack that makes remote_commit_resume flush the vCont
packet after every action appended (which caught a few bugs).
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.h (ALL_NON_EXITED_INFERIORS): New macro.
* infrun.c (do_target_resume): Call target_commit_resume.
(proceed): Defer target_commit_resume while looping over threads,
resuming them. Call target_commit_resume at the end.
* record-btrace.c (record_btrace_commit_resume): New function.
(init_record_btrace_ops): Install it as to_commit_resume method.
* record-full.c (record_full_commit_resume): New function.
(record_full_wait_1): Call the beneath target's to_commit_resume
method.
(init_record_full_ops): Install record_full_commit_resume as
to_commit_resume method.
* remote.c (struct private_thread_info) <last_resume_step,
last_resume_sig, vcont_resumed>: New fields.
(remote_add_thread): Set the new thread's vcont_resumed flag.
(demand_private_info): Delete.
(get_private_info_thread, get_private_info_ptid): New functions.
(remote_update_thread_list): Adjust.
(process_initial_stop_replies): Clear the thread's vcont_resumed
flag.
(remote_resume): If connected in non-stop mode, record the resume
request and return early.
(struct private_inferior): New.
(struct vcont_builder): New.
(vcont_builder_restart, vcont_builder_flush)
(vcont_builder_push_action): New functions.
(MAX_ACTION_SIZE): New macro.
(remote_commit_resume): New function.
(thread_pending_fork_status, is_pending_fork_parent_thread): New
functions.
(check_pending_event_prevents_wildcard_vcont_callback)
(check_pending_events_prevent_wildcard_vcont): New functions.
(process_stop_reply): Adjust. Clear the thread's vcont_resumed
flag.
(init_remote_ops): Install remote_commit_resume.
* target-delegates.c: Regenerate.
* target.c (defer_target_commit_resume): New global.
(target_commit_resume, make_cleanup_defer_target_commit_resume):
New functions.
* target.h (struct target_ops) <to_commit_resume>: New field.
(target_resume): Update comments.
(target_commit_resume): New declaration.
Pedro Alves [Wed, 26 Oct 2016 15:17:25 +0000 (16:17 +0100)]
gdbserver: Leave already-vCont-resumed threads as they were
Currently GDB never sends more than one action per vCont packet, when
connected in non-stop mode. A follow up patch will change that, and
it exposed a gdbserver problem with the vCont handling.
For example, this in non-stop mode:
=> vCont;s:p1.1;c
<= OK
Should be equivalent to:
=> vCont;s:p1.1
<= OK
=> vCont;c
<= OK
But gdbserver currently doesn't handle this. In the latter case,
"vCont;c" makes gdbserver clobber the previous step request. This
patch fixes that.
Note the server side must ignore resume actions for the thread that
has a pending %Stopped notification (and any other threads with events
pending), until GDB acks the notification with vStopped. Otherwise,
e.g., the following case is mishandled:
#1 => g (or any other packet)
#2 <= [registers]
#3 <= %Stopped T05 thread:p1.2
#4 => vCont s:p1.1;c
#5 <= OK
Above, the server must not resume thread p1.2 when it processes the
vCont. GDB can't know that p1.2 stopped until it acks the %Stopped
notification. (Otherwise it wouldn't send a default "c" action.)
(The vCont documentation already specifies this.)
Finally, special care must also be given to handling fork/vfork
events. A (v)fork event actually tells us that two processes stopped
-- the parent and the child. Until we follow the fork, we must not
resume the child. Therefore, if we have a pending fork follow, we
must not send a global wildcard resume action (vCont;c). We can still
send process-wide wildcards though.
(The comments above will be added as code comments to gdb in a follow
up patch.)
gdb/gdbserver/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Link parent/child fork
threads.
(linux_wait_1): Unlink them.
(linux_set_resume_request): Ignore resume requests for
already-resumed and unhandled fork child threads.
* linux-low.h (struct lwp_info) <fork_relative>: New field.
* server.c (in_queued_stop_replies_ptid, in_queued_stop_replies):
New functions.
(handle_v_requests) <vCont>: Don't call require_running.
* server.h (in_queued_stop_replies): New declaration.
Pedro Alves [Wed, 26 Oct 2016 10:08:27 +0000 (11:08 +0100)]
gdb/doc: Clarify vCont packet description
Specifically, what happens with multiple actions that could match a
thread, and what happens when we get a vCont action that matches a
thread that was already running. E.g., what does:
"vCont;s:2"
"vCont;s:1;c"
mean for thread 2.
(Thread 2 continues stepping.)
gdb/doc/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Packets): Clarify vCont packets with multiple
actions that match a thread, and what happens when an action
matches a thread that is already running.
Pedro Alves [Wed, 26 Oct 2016 10:08:26 +0000 (11:08 +0100)]
gdb: Free inferior->priv when inferior exits
(Where "exits" includes being killed or detached.)
Nothing is clearing inferior->priv currently. This is a problem if we
change the inferior's process_stratum targets in a single debug
session. This field is currently only used by darwin-nat.c, but a
follow up patch will make remote.c use it too. Without the fix,
remote.c might end up mistaking the priv object allocated by
darwin-nat.c with its own.
(Found by inspection.)
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.c (exit_inferior_1): Free 'priv'.
Pedro Alves [Wed, 26 Oct 2016 10:08:26 +0000 (11:08 +0100)]
gdb: Clean up remote.c:remote_resume
Just some refactoring / TLC. Mainly split the old c/s/C/S packet
handling to a separate function.
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* remote.c (remote_resume_with_hc): New function, factored out
from ...
(remote_resume): ... this. Always try vCont first.
(remote_vcont_resume): Rename to ...
(remote_resume_with_vcont): ... this. Bail out if execution
direction is reverse.
Alan Modra [Tue, 25 Oct 2016 22:58:31 +0000 (09:28 +1030)]
Revert "bison warning fixes"
This reverts commit
95e61695c199a07c832153cea25ae9c331d16a3c. People
still want to use older versions of bison, apparently.
Revert 2016-10-06 Alan Modra <amodra@gmail.com>
* config/rl78-parse.y: Do use old %name-prefix syntax.
* config/rx-parse.y: Likewise.
GDB Administrator [Wed, 26 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Tue, 25 Oct 2016 13:32:35 +0000 (14:32 +0100)]
Make dwarf_expr_context's destructor virtual
Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00662.html
$ make WERROR_CFLAGS="-Wnon-virtual-dtor" dwarf2expr.o
...
In file included from .../src/gdb/dwarf2expr.c:28:0:
.../src/gdb/dwarf2expr.h:68:8: warning: ‘struct dwarf_expr_context’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
struct dwarf_expr_context
^~~~~~~~~~~~~~~~~~
Happens to not be a problem in practice currently because concrete
subclasses are allocated on the stack. I.e., we don't ever delete
objects of types that derive from dwarf_expr_context through pointers
to dwarf_expr_context.
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* dwarf2expr.h (struct dwarf_expr_context) <~dwarf_expr_context>:
Make virtual.
Rainer Orth [Tue, 25 Oct 2016 13:19:46 +0000 (15:19 +0200)]
Fix gdb C++ compilation on Solaris (PR build/20712)
gdb 7.12 doesn't compile as C++ (tried with g++ 4.9) on Solaris (tried
10 and 12, sparc and x86). The following patch (relative to the 7.12
release, though I expect most if not all issues to be present on trunk,
too) fixes this.
Only a few of the changes bear explanation:
* Initially, compilation failed whereever defs.h. was included:
In file included from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:0:
/vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:630:33: error: 'double atof(const char*)' conflicts with a previous declaration
extern double atof (const char *); /* X3.159-1989 4.10.1.1 */
^
In file included from /usr/include/stdlib.h:17:0,
from build-gnulib/import/stdlib.h:36,
from /vol/src/gnu/gdb/gdb-7.12/gdb/common/common-defs.h:32,
from /vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:28,
from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:
/vol/gcc-4.9/lib/gcc/i386-pc-solaris2.10/4.9.0/include-fixed/iso/stdlib_iso.h:119:15: note: previous declaration 'double std::atof(const char*)'
extern double atof(const char *);
^
This is due to this gem in gdb/defs.h which seems to have been present
like forever:
#ifndef atof
extern double atof (const char *); /* X3.159-1989 4.10.1.1 */
#endif
In the Solaris headers, the appropriate functions are in namespace std,
thus the conflict. I've wrapped the defs.h declaration in !__cplusplus
to avoid this; perhaps it can go completely instead.
* All the casts are necessary to appease g++ and should be pretty
obvious.
* The sol-thread.c changes are here to handle
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c: In function 'void _initialize_sol_thread()':
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1252:36: error: invalid conversion from 'void*' to 'void (*)(int)' [-fpermissive]
if (!(p_##X = dlsym (dlhandle, #X))) \
^
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1255:3: note: in expansion of macro 'resolve'
resolve (td_log);
^
and are modeled after linux-thread-db.c (try_thread_db_load_1).
The patch allowed both 32 and 64-bit C++ builds on sparc-sun-solaris2.10
and i386-pc-solaris2.10 to complete. The resulting binary hasn't seen
more than a smoke test (invoke it on itself, b main, run) yet.
When investigating the failure to detect -static-libstdc++
support (more below), I found two more issues which only show up with
-Werror:
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function 'ssd* proc_get_LDT_entry(procinfo*, int)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2487:19: error: variable 'old_chain' set but not used [-Werror=unused-but-set-variable]
struct cleanup *old_chain = NULL;
^
Unless I'm mistaken, you need to run do_cleanups on every return from
the function.
Afterwards, I ran a 32-bit compilation, which (after adding
--disable-largefile to avoid
In file included from /usr/include/sys/procfs.h:28:0,
from /vol/src/gnu/gdb/gdb/local/gdb/i386-sol2-nat.c:23:
/usr/include/sys/old_procfs.h:39:2: error: #error "Cannot use procfs in the large file compilation environment"
#error "Cannot use procfs in the large file compilation environment"
^
and two more instances) revealed
/vol/src/gnu/gdb/gdb/local/gdb/top.c: In function 'void gdb_safe_append_history()':
/vol/src/gnu/gdb/gdb/local/gdb/top.c:1170:59: error: format '%d' expects argument of type 'int', but argument 3 has type 'pid_t {aka long int}' [-Werror=format=]
= xstrprintf ("%s-gdb%d~", history_filename, getpid ());
^
Fixed by casting pid_t to long and printing it as such.
Pedro Alves [Tue, 25 Oct 2016 12:50:20 +0000 (13:50 +0100)]
common/common-defs.h: Define __STDC_FORMAT_MACROS as well
Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00694.html
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
Pedro Alves [Tue, 25 Oct 2016 12:32:26 +0000 (13:32 +0100)]
new-op.c: Add comment about -fsanitize=address
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/new-op.c: Add comment about -fsanitize=address.
Pedro Alves [Tue, 25 Oct 2016 10:47:18 +0000 (11:47 +0100)]
Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again.
Revert commit
f6abaf7a4088 (gdb: no longer define
__STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS), with the tweak suggested
in that commit's log: the macros are now defined before any system
header is included.
This should fix AIX:
https://sourceware.org/ml/gdb-patches/2016-10/msg00682.html
gdb/ChangeLog:
2016-10-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_CONSTANT_MACROS)
(__STDC_LIMIT_MACROS): Define.
Yao Qi [Tue, 25 Oct 2016 10:13:00 +0000 (11:13 +0100)]
Don't override operator new if GDB is built with -fsanitize=address
Nowadays, if we build GDB with -fsanitize=address, we can get the asan
error below,
(gdb) quit
=================================================================
==9723==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x60200003bf70
#0 0x7f88f3837527 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x55527)
#1 0xac8e13 in __gnu_cxx::new_allocator<void (*)()>::deallocate(void (**)(), unsigned long) /usr/include/c++/4.9/ext/new_allocator.h:110
#2 0xac8cc2 in __gnu_cxx::__alloc_traits<std::allocator<void (*)()> >::deallocate(std::allocator<void (*)()>&, void (**)(), unsigned long) /usr/include/c++/4.9/ext/alloc_traits.h:185
....
0x60200003bf70 is located 0 bytes inside of 8-byte region [0x60200003bf70,0x60200003bf78)
allocated by thread T0 here:
#0 0x7f88f38367ef in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x547ef)
#1 0xbd2762 in operator new(unsigned long) /home/yao/SourceCode/gnu/gdb/git/gdb/common/new-op.c:42
#2 0xac8edc in __gnu_cxx::new_allocator<void (*)()>::allocate(unsigned long, void const*) /usr/include/c++/4.9/ext/new_allocator.h:104
#3 0xac8d81 in __gnu_cxx::__alloc_traits<std::allocator<void (*)()> >::allocate(std::allocator<void (*)()>&, unsigned long) /usr/include/c++/4.9/ext/alloc_traits.h:182
The reason for this is that we override operator new but don't override
operator delete. This patch does the override if the code is NOT
compiled with asan.
gdb:
2016-10-25 Yao Qi <yao.qi@linaro.org>
PR gdb/20716
* common/new-op.c (__has_feature): New macro.
Don't override operator new if asan is used.