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.
Maciej W. Rozycki [Tue, 25 Oct 2016 01:08:26 +0000 (02:08 +0100)]
elfxx-mips: Correct STUB_JALR's description
bfd/
* elfxx-mips.c (STUB_JALR): Correct description.
GDB Administrator [Tue, 25 Oct 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Luis Machado [Mon, 24 Oct 2016 22:51:33 +0000 (17:51 -0500)]
Fix potential NULL pointer dereference
This patch addresses a potential NULL pointer dereference when we try to
duplicate a string. The input pointer can be NULL and that may lead to
crashes. We simply add a check for that case.
gdb/ChangeLog:
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
* exec.c (exec_file_locate_attach): Prevent NULL pointer dereference
when duplicating a string.
Luis Machado [Mon, 24 Oct 2016 22:44:56 +0000 (17:44 -0500)]
Fix obvious gotcha in string comparison
This patch fixes a gotcha when comparing exception's messages in
exception_print_same. It should've used the statically-allocated
string versions msg1 and msg2 instead.
As is, it could lead to crashes.
gdb/ChangeLog:
2016-10-24 Luis Machado <lgustavo@codesourcery.com>
* exec.c (exception_print_same): Fix string comparison to use
statically-allocated ones.
Jan Kratochvil [Mon, 24 Oct 2016 12:13:51 +0000 (14:13 +0200)]
testsuite: Fix false FAIL for gdb.base/morestack.exp
Since
[commit] [testsuite patch] Fix gcc_compiled for gcc 6 & 7
https://sourceware.org/ml/gdb-patches/2016-10/msg00620.html
there has started running again
Running gdb/testsuite/gdb.base/morestack.exp ...
+FAIL: gdb.base/morestack.exp: continue
+PASS: gdb.base/morestack.exp: up 3000
but as you can see it FAILs now - on Fedora 24 x86_64 (although for example it
still PASSes on CentOS-7.2 x86_64).
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
4181 unlink(av, nextchunk, bck, fwd);
(gdb) bt
[...]
[...]
This apparently is due to - man gcc - -fsplit-stack:
When code compiled with -fsplit-stack calls code compiled without
-fsplit-stack, there may not be much stack space available for the
latter code to run. If compiling all code, including library code,
with -fsplit-stack is not an option, then the linker can fix up these
calls so that the code compiled without -fsplit-stack always has
a large stack. Support for this is implemented in the gold linker in
GNU binutils release 2.21 and later.
gdb/testsuite/ChangeLog
2016-10-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/morestack.exp: Try to build it using -fuse-ld=gold first.
Yao Qi [Mon, 24 Oct 2016 09:59:11 +0000 (10:59 +0100)]
[GDBserver] Fix conversion warning
I got the following warning if I build GDBserver for aarch64_be-linux-gnu,
git/gdb/gdbserver/linux-aarch64-low.c:1539:39: error: invalid conversion from 'void*' to 'uint32_t* {aka unsigned int*}' [-fpermissive]
uint32_t *le_buf = xmalloc (byte_len);
^
The patch is to fix the warning.
gdb/gdbserver:
2016-10-24 Yao Qi <yao.qi@linaro.org>
PR server/20733
* linux-aarch64-low.c (append_insns): Cast the return value to
'uint32_t *'.
GDB Administrator [Mon, 24 Oct 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 23 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 22 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 20 Oct 2016 03:38:38 +0000 (21:38 -0600)]
Make some dwarf_expr_context methods pure virtual
This patch changes some dwarf_expr_context to be pure virtual, as
mentioned during the discussion of an earlier patch in this series.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2expr.h (class dwarf_expr_context)
<get_frame_base, get_frame_cfa, get_tls_address, dwarf_call,
push_dwarf_block_entry_value, get_addr_index, get_object_address>:
Now pure virtual.
* dwarf2-frame.c (class dwarf_expr_executor)
<get_frame_base, get_frame_cfa, get_tls_address, dwarf_call,
push_dwarf_block_entry_value, get_addr_index, get_object_address>:
New methods.
<invalid>: New method.
Tom Tromey [Fri, 14 Oct 2016 21:19:03 +0000 (15:19 -0600)]
Change minimal_symbol_reader::record_full to take a bool
This changes an "int" to a "bool" in the signature for
minimal_symbol_reader::record_full, and then fixes the callers.
2016-10-21 Tom Tromey <tom@tromey.com>
* minsyms.h (minimal_symbol_reader::record_full): "copy_name" now
a bool.
(record, record_with_info): Update.
* minsyms.c (record): Fix indentation.
(record_full): Fix indentation. Update for type change.
* elfread.c (record_minimal_symbol): "copy_name" now a bool.
(elf_symtab_read): "copy_names" now a bool.
(elf_rel_plt_read, elf_read_minimal_symbols): Update.
Tom Tromey [Wed, 12 Oct 2016 02:02:23 +0000 (20:02 -0600)]
Remove last cleanup from captured_main_1
An earlier patch split captured_main into two parts. This patch
removes the last remaining cleanup from captured_main_1, and also
replaces a second hand-rolled VEC-like array with a std::vector.
2016-10-21 Tom Tromey <tom@tromey.com>
* main.c: Include <vector>.
(cmdarg_s): Remove typedef. Don't define VEC.
(captured_main_1): Use vector, not VEC. Remove cleanups.
Tom Tromey [Mon, 26 Sep 2016 14:59:13 +0000 (08:59 -0600)]
Convert dwarf_expr_context_funcs to methods
This patch converts the function pointers in dwarf_expr_context_funcs
into methods on dwarf_expr_context, and then updates the various
implementations and callers to follow.
NB this patch uses "override" (which caught a couple of renaming bugs
during development) -- but this is C++11, so this patch at least has
to wait for Pedro's patch that adds the OVERRIDE macro.
After this patch it would be possible to do one more, that makes
various members of dwarf_expr_context "protected"; but I haven't done
this.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (struct dwarf_expr_context_funcs): Don't declare.
(dwarf_expr_read_addr_from_reg, dwarf_expr_get_reg_value)
(dwarf_expr_read_mem, dwarf_expr_frame_base): Rename; turn into
methods.
(get_frame_pc_for_per_cu_dwarf_call): New function.
(dwarf_expr_frame_cfa, dwarf_expr_frame_pc)
(dwarf_expr_tls_address): Rename; turn into methods.
(per_cu_dwarf_call): Remove arguments. Use
get_frame_pc_for_per_cu_dwarf_call.
(dwarf_evaluate_loc_desc): New class.
(dwarf_expr_dwarf_call, dwarf_expr_context)
(dwarf_expr_push_dwarf_reg_entry_value)
(dwarf_expr_get_addr_index, dwarf_expr_get_obj_addr): Rename; turn
into methods.
(dwarf_expr_ctx_funcs): Remove.
(dwarf2_evaluate_loc_desc_full): Update.
(dwarf2_locexpr_baton_eval): Update.
(symbol_needs_eval_context): New class.
(symbol_needs_read_addr_from_reg, symbol_needs_get_reg_value)
(symbol_needs_read_mem, symbol_needs_frame_base)
(symbol_needs_frame_cfa, symbol_needs_tls_address)
(symbol_needs_dwarf_call, needs_dwarf_reg_entry_value): Rename;
turn into methods.
(needs_get_addr_index, needs_get_obj_addr): Remove; turn into
methods.
(symbol_needs_ctx_funcs): Remove.
(dwarf2_loc_desc_get_symbol_read_needs): Update.
* dwarf2expr.h (struct dwarf_expr_context_funcs): Remove; turn
contents into methods.
(struct dwarf_expr_context) <baton, funcs>: Remove.
<read_addr_from_reg, get_reg_value, read_mem, get_frame_base,
get_frame_cfa, get_frame_pc, get_tls_address, dwarf_call,
impl_get_base_type, push_dwarf_block_entry_value, get_addr_index,
get_object_address>: Declare new methods.
(ctx_no_get_frame_base, ctx_no_get_frame_cfa)
(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
(ctx_no_get_base_type, ctx_no_push_dwarf_reg_entry_value)
(ctx_no_get_addr_index): Don't declare.
* dwarf2expr.c (get_base_type): Use impl_get_base_type.
(execute_stack_op): Update.
(ctx_no_get_frame_base, ctx_no_get_frame_cfa)
(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
(ctx_no_get_base_type, ctx_no_push_dwarf_reg_entry_value)
(ctx_no_get_addr_index): Remove; now methods on
dwarf_expr_context.
* dwarf2-frame.c (read_addr_from_reg): Take a frame_info, not a
baton.
(class dwarf_expr_executor): New class.
(get_reg_value, read_mem): Rename, turn into methods.
(execute_stack_op): Use dwarf_expr_executor.
Tom Tromey [Sun, 25 Sep 2016 22:48:47 +0000 (16:48 -0600)]
Convert DWARF expr functions to methods
This converts various DWARF expr functions to be members on
dwarf_expr_context, then fixes up the various users. This results in
somewhat less wordy code and sets the stage for the next patch.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (per_cu_dwarf_call)
(dwarf_expr_push_dwarf_reg_entry_value)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval)
(needs_dwarf_reg_entry_value)
(dwarf2_loc_desc_get_symbol_read_needs): Update.
* dwarf2expr.h (dwarf_expr_context) <push_address, eval, fetch,
fetch_address, fetch_in_stack_memory, address_type, grow_stack,
push, stack_empty_p, add_piece, get_base_type, execute_stack_op,
pop>: New method declarations.
(dwarf_expr_push_address, dwarf_expr_eval, dwarf_expr_fetch)
(dwarf_expr_fetch_address, dwarf_expr_fetch_in_stack_memory):
Don't declare.
* dwarf2expr.c (address_type, grow_stack, push, push_address)
(pop, fetch, fetch_address, fetch_in_stack_memory)
(stack_empty_p, add_piece, eval, get_base_type)
(execute_stack_op): Rename. Turn into methods.
* dwarf2-frame.c (execute_stack_op): Update.
Tom Tromey [Sun, 25 Sep 2016 22:28:03 +0000 (16:28 -0600)]
Initial conversion of dwarf_expr_ctx
This is the first step in the conversion of dwarf_expr_ctx to a C++
class. This conversion is done in steps to make the patches, and the
reviews, a bit simpler. This patch changes dwarf_expr_ctx to be
stack-allocated and removes the associated cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf2_locexpr_baton_eval)
(dwarf2_loc_desc_get_symbol_read_needs): Likewise.
* dwarf2expr.h (dwarf_expr_context, ~dwarf_expr_context): Add
constructors and destructors.
(new_dwarf_expr_context, free_dwarf_expr_context)
(make_cleanup_free_dwarf_expr_context): Don't declare.
* dwarf2-frame.c (execute_stack_op): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf_expr_context): Rename from new_dwarf_expr_context. Turn
into constructor.
(free_dwarf_expr_context, free_dwarf_expr_context_cleanup):
Remove.
(~dwarf_expr_context): Rename from
make_cleanup_free_dwarf_expr_context. Turn into destructor.
Tom Tromey [Sun, 25 Sep 2016 22:17:15 +0000 (16:17 -0600)]
Some cleanup removal in dwarf2loc.c
This removes some cleanups and manual allocation handling in
dwarf2loc.c with std::vector. Note that this patch has a case where
the vector would normally fall into the "use gdb::unique_ptr"
guidelines -- but here because the vector is immediately initialized,
I moved the initialization into the constructor call, for further
code savings.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c: Include <vector>.
(read_pieced_value, write_pieced_value)
(dwarf2_compile_expr_to_ax): Use std::vector.
Tom Tromey [Sun, 25 Sep 2016 03:53:54 +0000 (21:53 -0600)]
Remove make_cleanup_restore_current_uiout
This removes make_cleanup_restore_current_uiout in favor of an
RAII-based class.
2016-10-21 Tom Tromey <tom@tromey.com>
* stack.c (print_stack_frame_to_uiout): Use scoped_restore.
* ui-out.c (make_cleanup_restore_current_uiout)
(restore_current_uiout_cleanup): Remove.
* infrun.c (print_stop_event): Use scoped_restore.
* ui-out.h (make_cleanup_restore_current_uiout): Don't declare.
Tom Tromey [Sun, 25 Sep 2016 03:31:36 +0000 (21:31 -0600)]
Use gdb::unique_ptr in elf_read_minimal_symbols
This changes elf_read_minimal_symbols to use gdb::unique_ptr rather
than an explicit allocation. This removes a cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* elfread.c (elf_read_minimal_symbols): Use gdb::unique_ptr.
Tom Tromey [Sun, 25 Sep 2016 03:21:35 +0000 (21:21 -0600)]
Replace two xmallocs with unique_ptr
This replaces a couple of uses of xmalloc with gdb::unique_ptr, also
removing a couple of cleanups.
2016-10-21 Tom Tromey <tom@tromey.com>
* cli/cli-dump.c (dump_memory_to_file): Use gdb::unique_ptr.
(restore_binary_file): Likewise.
Tom Tromey [Sun, 25 Sep 2016 03:10:45 +0000 (21:10 -0600)]
Change command stats reporting to use class
This removes make_command_stats_cleanup in favor of an RAII class.
The patch is reasonably straightforward, but keeping the same
semantics without excessive reindentation required splitting
captured_main in two.
2016-10-21 Tom Tromey <tom@tromey.com>
* maint.h (scoped_command_stats): New class.
(make_command_stats_cleanup): Don't declare.
* maint.c (struct cmd_stats): Remove.
(~scoped_command_stats): Rename from report_command_stats. Now a
destructor.
(scoped_command_stats): Rename from make_command_stats_cleanup.
Now a constructor.
* main.c (captured_main_1): New function. Use
scoped_command_stats.
(captured_main): Call captured_main_1.
* event-top.c (command_handler): Use scoped_command_stats.
Tom Tromey [Sun, 25 Sep 2016 02:56:12 +0000 (20:56 -0600)]
Remove some cleanups in MI
This patch removes a couple of cleanups from MI by using
gdb::unique_ptr.
2016-10-21 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (mi_cmd_data_read_memory): Use gdb::unique_ptr.
Remove some cleanups.
Tom Tromey [Sat, 24 Sep 2016 22:11:14 +0000 (16:11 -0600)]
Remove make_cleanup_restore_current_ui
This removes make_cleanup_restore_current_ui by converting the last
use. The last use was in a few functions used to iterate over all
UIs. This patch replaces these functions with a class, and arranges
for the class destructor to do the needed cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received)
(tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited)
(tui_on_no_history, tui_on_user_selected_context_changed):
Update.
* top.h (switch_thru_all_uis): New class.
(SWITCH_THRU_ALL_UIS): Rewrite.
(make_cleanup_restore_current_ui, switch_thru_all_uis_init)
(switch_thru_all_uis_cond, switch_thru_all_uis_next): Don't
declare.
* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
(mi_inferior_exit, mi_inferior_removed, mi_on_signal_received)
(mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited)
(mi_on_no_history, mi_on_normal_stop, mi_traceframe_changed)
(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
(mi_breakpoint_created, mi_breakpoint_deleted)
(mi_breakpoint_modified, mi_output_running_pid, mi_on_resume)
(mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed)
(mi_memory_changed, mi_user_selected_context_changed): Update.
* infrun.c (all_uis_check_sync_execution_done)
(all_uis_on_sync_execution_starting, normal_stop): Update.
* event-top.c (restore_ui_cleanup)
(make_cleanup_restore_current_ui, switch_thru_all_uis_init)
(switch_thru_all_uis_cond, switch_thru_all_uis_next): Remove.
* cli/cli-interp.c (cli_on_normal_stop, cli_on_signal_received)
(cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited)
(cli_on_no_history, cli_on_user_selected_context_changed):
Update.
* breakpoint.c (watchpoint_check): Update.
Tom Tromey [Thu, 22 Sep 2016 20:25:08 +0000 (14:25 -0600)]
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
Tom Tromey [Thu, 22 Sep 2016 19:57:15 +0000 (13:57 -0600)]
Change minimal_symbol_reader to store objfile
This changes minimal_symbol_reader to require the objfile to be
passed to the constructor. The class now records the objfile and
automatically uses it later in "install".
This is a minor cleanup that will come in useful in the next patch.
It is separate from the first patch to keep that one a bit simpler to
understand.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Update.
* mipsread.c (mipscoff_symfile_read): Update.
* minsyms.c (minimal_symbol_reader): Add obj argument.
Initialize member.
(install): Remove objfile argument. Update.
* mdebugread.c (elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symfile_read): Update.
* elfread.c (elf_read_minimal_symbols): Update.
* dbxread.c (dbx_symfile_read): Update.
* coffread.c (coff_symfile_read): Update.
* minsyms.h (minimal_symbol_reader): Add m_objfile member.
(constructor): Add objfile argument.
(minimal_symbol_reader::install): Remove objfile argument.
Tom Tromey [Thu, 22 Sep 2016 19:47:48 +0000 (13:47 -0600)]
Introduce minimal_symbol_reader
This patch introduced minimal_symbol_reader, a RAII-based class which
replaces the current make_cleanup_discard_minimal_symbols.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Use
minimal_symbol_reader.
* mipsread.c (mipscoff_symfile_read): Use
minimal_symbol_reader.
* minsyms.h (minimal_symbol_reader): New class.
(init_minimal_symbol_collection)
(make_cleanup_discard_minimal_symbols, install_minimal_symbols):
Don't declare.
* minsyms.c (minimal_symbol_reader): Renamed from
init_minimal_symbol_collection, turned into constructor.
(~minimal_symbol_reader): Renamed from
do_discard_minimal_symbols_cleanup, turned into destructor.
(make_cleanup_discard_minimal_symbols): Remove.
(minimal_symbol_reader::install): Rename form
install_minimal_symbols.
* mdebugread.c (elfmdebug_build_psymtabs): Use
minimal_symbol_reader.
* machoread.c (macho_symfile_read): Use
minimal_symbol_reader.
* elfread.c (elf_read_minimal_symbols): Use
minimal_symbol_reader.
* dbxread.c (dbx_symfile_read): Use minimal_symbol_reader.
* coffread.c (coff_symfile_read): Use
minimal_symbol_reader.
Tom Tromey [Fri, 23 Sep 2016 02:50:52 +0000 (20:50 -0600)]
Use scoped_restore for current_ui
This changes most uses of make_cleanup_restore_current_ui to use
scoped_restore. The use in switch_thru_all_uis_init still remains;
that is dealt with in a later patch by replacing this iterator with a
real class.
2016-10-21 Tom Tromey <tom@tromey.com>
* top.c (new_ui_command, wait_sync_command_done)
(gdb_readline_wrapper): Use scoped_restore.
* infrun.c (fetch_inferior_event): Use scoped_restore.
* infcall.c (call_thread_fsm_should_stop): Use scoped_restore.
Tom Tromey [Fri, 23 Sep 2016 02:33:30 +0000 (20:33 -0600)]
Use scoped_restore for ui_file
This replaces all the uses of make_cleanup_restore_ui_file with
scoped_restore.
2016-10-21 Tom Tromey <tom@tromey.com>
* utils.c (make_cleanup_restore_ui_file, do_restore_ui_file)
(struct restore_ui_file_closure): Remove.
* utils.h (make_cleanup_restore_ui_file): Don't declare.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Use
scoped_restore.
* top.c (execute_command_to_string): Use scoped_restore.
Tom Tromey [Fri, 23 Sep 2016 02:29:11 +0000 (20:29 -0600)]
Use RAII to save and restore scalars
This patch replaces many (but not all) uses of
make_cleanup_restore_integer with a simple RAII-based template class.
It also removes the similar restore_execution_direction cleanup in
favor of this new class. Subsequent patches will replace other
similar cleanups with this class.
The class is typically instantiated using make_scoped_restore. This
allows for template argument deduction.
2016-10-21 Tom Tromey <tom@tromey.com>
* common/scoped_restore.h: New file.
* utils.h: Include scoped_restore.h.
* top.c (execute_command_to_string): Use scoped_restore.
* python/python.c (python_interactive_command): Use
scoped_restore.
(python_command, execute_gdb_command): Likewise.
* printcmd.c (do_one_display): Use scoped_restore.
* mi/mi-main.c (exec_continue): Use scoped_restore.
* mi/mi-cmd-var.c (mi_cmd_var_assign): Use scoped_restore.
* linux-fork.c (checkpoint_command): Use scoped_restore.
* infrun.c (restore_execution_direction): Remove.
(fetch_inferior_event): Use scoped_restore.
* compile/compile.c (compile_file_command): Use
scoped_restore.
(compile_code_command, compile_print_command): Likewise.
* cli/cli-script.c (execute_user_command): Use
scoped_restore.
(while_command, if_command, script_from_file): Likewise.
* arm-tdep.c (arm_insert_single_step_breakpoint): Use
scoped_restore.
Tom Tromey [Fri, 21 Oct 2016 20:09:57 +0000 (14:09 -0600)]
Fix build failure in xcoffread.c
This changes read_xcoff_symtab to be const-correct. This fixes a
build failure.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab): Make "filestring" const.
H.J. Lu [Fri, 21 Oct 2016 19:16:32 +0000 (12:16 -0700)]
X86: Remove pcommit instruction
Remove x86 pcommit instruction support, which has been deprecated:
https://software.intel.com/en-us/blogs/2016/09/12/deprecate-pcommit-instruction
gas/
* config/tc-i386.c (cpu_arch): Remove .pcommit.
* doc/c-i386.texi: Likewise.
* testsuite/gas/i386/i386.exp: Remove pcommit tests.
* testsuite/gas/i386/pcommit-intel.d: Removed.
* testsuite/gas/i386/pcommit.d: Likewise.
* testsuite/gas/i386/pcommit.s: Likewise.
* testsuite/gas/i386/x86-64-pcommit-intel.d: Likewise.
* testsuite/gas/i386/x86-64-pcommit.d: Likewise.
* testsuite/gas/i386/x86-64-pcommit.s: Likewise.
opcodes/
* i386-dis.c (PREFIX_RM_0_0FAE_REG_7): Removed.
(prefix_table): Remove the PREFIX_RM_0_0FAE_REG_7 entry.
(rm_table): Update the RM_0FAE_REG_7 entry.
* i386-gen.c (cpu_flag_init): Remove CPU_PCOMMIT_FLAGS.
(cpu_flags): Remove CpuPCOMMIT.
* i386-opc.h (CpuPCOMMIT): Removed.
(i386_cpu_flags): Remove cpupcommit.
* i386-opc.tbl: Remove pcommit.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Gergely Nagy [Fri, 21 Oct 2016 18:08:20 +0000 (11:08 -0700)]
Fix PR 17704.
This fix keeps the section with the highest alignment when folding sections with ICF.
PR gold/17704
* icf.cc (match_sections): Add new parameter section_addraligns.
Check section alignment and keep the section with the strictest
alignment.
(find_identical_sections): New local variable section_addraligns.
Store each section's alignment.
* testsuite/pr17704a_test.s: New file.
* testsuite/Makefile.am (pr17704a_test): New test.
* testsuite/Makefile.in: Regenerate.
Ulrich Weigand [Fri, 21 Oct 2016 15:47:15 +0000 (17:47 +0200)]
Fix symbol table file name on AIX
When xlc -qfuncsect or gcc -ffunction-sections options is used in AIX,
each function csect is associated with each psymtab, so each psymtab
will have it's corresponding filename entries set.
If the pst filename isn't set then we will be seeing the below output
when we set a breakpoint.
(gdb) br main
Breakpoint 1 at 0x10000374: file _start_ , line 18.
With the fix it will be.
(gdb) br main
Breakpoint 1 at 0x10000518: file test.c, line 24.
Attached patch resolve this issue and correct filename will be set.
gdb/
2016-10-21 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
* xcoffread.c (read_xcoff_symtab): Make name of current file as
pst->filename instead of _start_ in AIX.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Philipp Rudo [Fri, 21 Oct 2016 10:32:52 +0000 (12:32 +0200)]
Delete target_so_ops->special_symbol_handling hook
No one(!) actually implements this hook. So simply delete it.
gdb/ChangeLog:
* solist.h (struct target_so_ops): Delete special_symbol_handling
hook.
* solib.c (solib_add, reload_shared_libraries): Adjust.
* solib-aix.c (solib_aix_special_symbol_handling): Delete
(_initialize_solib_aix): Adjust
* solib-darwin.c (darwin_special_symbol_handling): Delete
(_initialize_darwin_solib): Adjust
* solib-dsbt.c (dsbt_special_symbol_handling): Delete
(_initialize_dsbt_solib): Adjust
* solib-frv.c (frv_special_symbol_handling): Delete
(_initialize_frv_solib): Adjust
* solib-svr4.c (svr4_special_symbol_handling): Delete
(_initialize_svr4_solib): Adjust
* solib-target.c (solib_target_special_symbol_handling): Delete
(_initialize_solib_target): Adjust
GDB Administrator [Fri, 21 Oct 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 20 Oct 2016 22:07:42 +0000 (15:07 -0700)]
Check invalid mask registers
In 32-bit, the REX_B bit in the 3-byte VEX prefix is ignored and the
the highest bit in VEX.vvvv is either 1 or ignored. In 64-bit, we
need to check invalid mask registers.
gas/
PR binutis/20705
* testsuite/gas/i386/i386.exp: Run x86-64-opcode-bad.
* testsuite/gas/i386/x86-64-opcode-bad.d: New file.
* testsuite/gas/i386/x86-64-opcode-bad.s: Likewise.
opcodes/
PR binutis/20705
* i386-dis.c (get_valid_dis386): Ignore the REX_B bit and
the highest bit in VEX.vvvv for the 3-byte VEX prefix in
32-bit mode. Don't check vex.register_specifier in 32-bit
mode.
(OP_E_register): Check invalid mask registers.
(OP_G): Likewise.
(OP_VEX): Likewise.
Jan Kratochvil [Thu, 20 Oct 2016 19:58:54 +0000 (21:58 +0200)]
testsuite: Fix gcc_compiled for gcc 6 & 7
gdb/testsuite/ChangeLog
2016-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.
Nick Clifton [Thu, 20 Oct 2016 10:44:51 +0000 (11:44 +0100)]
Regenerate bfd.pot.