Michael Eager [Thu, 24 Jul 2014 02:21:42 +0000 (19:21 -0700)]
se typecast 'size_t' on 'reg', not only avoid the related warning, but
also check whether less than zero -- for 'reg' is type 'int', and sizeof
(dwarf2_to_reg_map) is less than 0x7fff.
It is quoted in gdb_assert(), so need check 'reg' whether less than zero.
And the related warning (with '-W'):
../../binutils-gdb/gdb/microblaze-tdep.c:667:3: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ChangeLog:
* microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Check whether
less tha zero in conditional expression.
Alan Modra [Thu, 24 Jul 2014 00:00:40 +0000 (09:30 +0930)]
daily update
Tom Tromey [Tue, 15 Jul 2014 18:08:54 +0000 (12:08 -0600)]
rewrite make-target-delegates matching code
This patch rewrites the make-target-delegates matching code a little
bit. The result is functionally the same (the output has some small
whitespace differences), but the new code is more forgiving regarding
the formatting of target.h. In particular now there's no need to
ensure that the return type and the method name appear on the same
line.
2014-07-23 Tom Tromey <tromey@redhat.com>
* make-target-delegates ($ARGS_PART): Match trailing close paren.
($INTRO_PART): Don't match whitespace.
($METHOD_TRAILER): Move earlier. Remove trailing semicolon and
argument matching.
($METHOD): Add $METHOD_TRAILER.
(trim): Rewrite.
(scan_target_h): New sub.
Change main loop not to collect state.
* target-delegates.c: Rebuild.
Gary Benson [Wed, 23 Jul 2014 14:25:05 +0000 (15:25 +0100)]
Fix build on systems without sigaltstack.
This commit fixes the build on systems without sigaltstack.
gdb/
2014-07-23 Gary Benson <gbenson@redhat.com>
* cp-support.c (gdb_demangle): Fix build on systems without
sigaltstack.
Alan Modra [Wed, 23 Jul 2014 00:00:42 +0000 (09:30 +0930)]
daily update
Jan Kratochvil [Tue, 22 Jul 2014 20:15:27 +0000 (22:15 +0200)]
Remove setting value address for reference entry value target data value.
I cannot reproduce any wrong case having the code removed.
I just do not find it correct to have it disabled. But at the same time I do
like much / I do not find correct the code myself. It is a bit problematic to
have struct value describing a memory content which is no longer present
there.
What happens there:
------------------------------------------------------------------------------
volatile int vv;
static __attribute__((noinline)) int
bar (int &ref) {
ref = 20;
vv++; /* break-here */
return ref;
}
int main (void) {
int var = 10;
return bar (var);
}
------------------------------------------------------------------------------
<4><c7>: Abbrev Number: 13 (DW_TAG_GNU_call_site_parameter)
<c8> DW_AT_location : 1 byte block: 55 (DW_OP_reg5 (rdi))
<ca> DW_AT_GNU_call_site_value: 2 byte block: 91 74 (DW_OP_fbreg: -12)
<cd> DW_AT_GNU_call_site_data_value: 1 byte block: 3a (DW_OP_lit10)
------------------------------------------------------------------------------
gdb -ex 'b value_addr' -ex r --args ../gdb ./1 -ex 'watch vv' -ex r -ex 'p &ref@entry'
->
6 return ref;
bar (ref=@0x7fffffffd944: 20, ref@entry=@0x7fffffffd944: 10) at 1.C:25
------------------------------------------------------------------------------
At /* break-here */ struct value variable 'ref' is TYPE_CODE_REF.
With FSF GDB HEAD:
(gdb) x/gx arg1.contents
0x6004000a4ad0: 0x00007fffffffd944
(gdb) p ((struct value *)arg1.location.computed.closure).lval
$1 = lval_memory
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
$3 = 0x7fffffffd944
With your #if0-ed code:
(gdb) x/gx arg1.contents
0x6004000a4ad0: 0x00007fffffffd944
(gdb) p ((struct value *)arg1.location.computed.closure).lval
$8 = not_lval
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
$9 = 0x0
I do not see how to access
((struct value *)arg1.location.computed.closure).location.address
from GDB CLI. Trying
(gdb) p &ref@entry
will invoke value_addr()'s:
if (TYPE_CODE (type) == TYPE_CODE_REF)
/* Copy the value, but change the type from (T&) to (T*). We
keep the same location information, which is efficient, and
allows &(&X) to get the location containing the reference. */
and therefore the address gets fetched already from
arg1.contents
and not from
((struct value *)arg1.location.computed.closure).location.address
.
And for any other type than TYPE_CODE_REF this code you removed does not get
executed at all. This DW_AT_GNU_call_site_data_value DWARF was meant
primarily for Fortran but with -O0 entry values do not get produced
and with -Og and higher Fortran always optimizes out the passing by reference.
If you do not like the removed code there I am OK with removing it as I do not
know how to make it's use reproducible for user anyway. In the worst case
- if there really is some way how to exploit it - one should just get
Attempt to take address of value not located in memory.
instead of some wrong value and it may be easy to fix then.
gdb/
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2loc.c (value_of_dwarf_reg_entry): Remove setting value address
for reference entry value target data value.
Message-ID: <
20140720150727.GA18488@host2.jankratochvil.net>
Jan Kratochvil [Tue, 22 Jul 2014 20:09:35 +0000 (22:09 +0200)]
Fix read_frame_arg for optimized-out entry values.
gdb/
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* stack.c (read_frame_arg): Verify value_optimized_out before calling
value_available_contents_eq.
gdb/testsuite/
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-entry-value-paramref.S: New file.
* gdb.arch/amd64-entry-value-paramref.cc: New file.
* gdb.arch/amd64-entry-value-paramref.exp: New file.
* gdb.arch/amd64-optimout-repeat.S: New file.
* gdb.arch/amd64-optimout-repeat.c: New file.
* gdb.arch/amd64-optimout-repeat.exp: New file.
Message-ID: <
20140720150727.GA18488@host2.jankratochvil.net>
Message-ID: <
20140711153757.GA452@host2.jankratochvil.net>
Pedro Alves [Tue, 22 Jul 2014 18:56:28 +0000 (19:56 +0100)]
Fix crash on optimized-out entry data values
The tests at
<https://sourceware.org/ml/gdb-patches/2014-07/msg00277.html> show
that comparing a fully optimized out value's contents with a value
that has not been optimized out, or is partially optimized out crashes
GDB:
(gdb) bt
#0 __memcmp_sse4_1 () at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:816
#1 0x00000000005a1914 in memcmp_with_bit_offsets (ptr1=0x202b2f0 "\n", offset1_bits=0, ptr2=0x0, offset2_bits=0, length_bits=32)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:678
#2 0x00000000005a1a05 in value_available_contents_bits_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=32)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:717
#3 0x00000000005a1c09 in value_available_contents_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=4)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:769
#4 0x00000000006033ed in read_frame_arg (sym=0x1b78d20, frame=0x19bca50, argp=0x7fff4aba82b0, entryargp=0x7fff4aba82d0)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:416
#5 0x0000000000603abb in print_frame_args (func=0x1b78cb0, frame=0x19bca50, num=-1, stream=0x1aea450) at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:671
#6 0x0000000000604ae8 in print_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:1205
#7 0x0000000000604050 in print_frame_info (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:857
#8 0x00000000006029b3 in print_stack_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:169
#9 0x00000000005fc4b8 in print_stop_event (ws=0x7fff4aba8790) at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6068
#10 0x00000000005fc830 in normal_stop () at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6214
The 'ptr2=0x0' in frame #1 is val2->contents, and since git
4f14910f:
gdb/ChangeLog
2013-11-26 Andrew Burgess <aburgess@broadcom.com>
* value.c (allocate_optimized_out_value): Mark value as non-lazy.
... a fully optimized-out value can have it's value contents buffer
NULL.
As a spotgap fix, revert
4f14910f, with a comment. A full fix would
be too invasive for 7.8.
gdb/
2014-07-22 Pedro Alves <palves@redhat.com>
* value.c (allocate_optimized_out_value): Don't mark value as
non-lazy.
Ilya Tocar [Tue, 15 Jul 2014 09:33:39 +0000 (13:33 +0400)]
Add AVX512DQ instructions and their AVX512VL variants.
gas/
* config/tc-i386.c (cpu_arch): Add .avx512dq, CPU_AVX512DQ_FLAGS.
* doc/c-i386.texi: Document avx512dq/.avx512dq.
gas/testsuite/
* gas/i386/avx512dq-intel.d: New.
* gas/i386/avx512dq.d: New.
* gas/i386/avx512dq.s: New.
* gas/i386/avx512dq_vl-intel.d: New.
* gas/i386/avx512dq_vl.d: New.
* gas/i386/avx512dq_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512dq-intel.d: New.
* gas/i386/x86-64-avx512dq.d: New.
* gas/i386/x86-64-avx512dq.s: New.
* gas/i386/x86-64-avx512dq_vl-intel.d: New.
* gas/i386/x86-64-avx512dq_vl.d: New.
* gas/i386/x86-64-avx512dq_vl.s: New.
opcodes/
* i386-dis-evex.h: Updated.
* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F54, PREFIX_EVEX_0F55,
PREFIX_EVEX_0F56, PREFIX_EVEX_0F57, PREFIX_EVEX_0F3A16,
PREFIX_EVEX_0F3A22, PREFIX_EVEX_0F3A50, PREFIX_EVEX_0F3A51,
PREFIX_EVEX_0F3A56, PREFIX_EVEX_0F3A57, PREFIX_EVEX_0F3A66,
PREFIX_EVEX_0F3A67.
(VEX_LEN enum): Add VEX_LEN_0F92_P_2, VEX_LEN_0F93_P_2,
VEX_W_0F92_P_2_LEN_0, VEX_W_0F93_P_2_LEN_0.
(VEX_W enum): Add EVEX_W_0F54_P_0, EVEX_W_0F54_P_2, EVEX_W_0F55_P_0,
EVEX_W_0F55_P_2, EVEX_W_0F56_P_0, EVEX_W_0F56_P_2, EVEX_W_0F57_P_0,
EVEX_W_0F57_P_2, EVEX_W_0F78_P_2, EVEX_W_0F79_P_2, EVEX_W_0F7A_P_2,
EVEX_W_0F7B_P_2, EVEX_W_0F3838_P_1, EVEX_W_0F3839_P_1,
EVEX_W_0F3A16_P_2, EVEX_W_0F3A22_P_2, EVEX_W_0F3A50_P_2,
EVEX_W_0F3A51_P_2, EVEX_W_0F3A56_P_2, EVEX_W_0F3A57_P_2,
EVEX_W_0F3A66_P_2, EVEX_W_0F3A67_P_2.
(prefix_table): Add entries for new instructions.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(OP_E_memory): Update xmmq_mode handling.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512DQ_FLAGS.
(cpu_flags): Add CpuAVX512DQ.
* i386-init.h: Regenerared.
* i386-opc.h (CpuAVX512DQ): New.
(i386_cpu_flags): Add cpuavx512dq.
* i386-opc.tbl: Add AVX512DQ instructions.
* i386-tbl.h: Regenerate.
Ilya Tocar [Fri, 11 Jul 2014 12:32:29 +0000 (16:32 +0400)]
Add support for AVX512BW instructions and their AVX512VL versions.
gas/
* config/tc-i386.c (cpu_arch): Add .avx512bw, CPU_AVX512BW_FLAGS.
* doc/c-i386.texi: Document avx512bw/.avx512bw.
gas/testsuite/
* gas/i386/avx512bw-intel.d: New.
* gas/i386/avx512bw-opts-intel.d: New.
* gas/i386/avx512bw-opts.d: New.
* gas/i386/avx512bw-opts.s: New.
* gas/i386/avx512bw-wig.s: New.
* gas/i386/avx512bw-wig1-intel.d: New.
* gas/i386/avx512bw-wig1.d: New.
* gas/i386/avx512bw.d: New.
* gas/i386/avx512bw.s: New.
* gas/i386/avx512bw_vl-intel.d: New.
* gas/i386/avx512bw_vl-opts-intel.d: New.
* gas/i386/avx512bw_vl-opts.d: New.
* gas/i386/avx512bw_vl-opts.s: New.
* gas/i386/avx512bw_vl-wig.s: New.
* gas/i386/avx512bw_vl-wig1-intel.d: New.
* gas/i386/avx512bw_vl-wig1.d: New.
* gas/i386/avx512bw_vl.d: New.
* gas/i386/avx512bw_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512bw-intel.d: New.
* gas/i386/x86-64-avx512bw-opts-intel.d: New.
* gas/i386/x86-64-avx512bw-opts.d: New.
* gas/i386/x86-64-avx512bw-opts.s: New.
* gas/i386/x86-64-avx512bw-wig.s: New.
* gas/i386/x86-64-avx512bw-wig1-intel.d: New.
* gas/i386/x86-64-avx512bw-wig1.d: New.
* gas/i386/x86-64-avx512bw.d: New.
* gas/i386/x86-64-avx512bw.s: New.
* gas/i386/x86-64-avx512bw_vl-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-opts-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-opts.d: New.
* gas/i386/x86-64-avx512bw_vl-opts.s: New.
* gas/i386/x86-64-avx512bw_vl-wig.s: New.
* gas/i386/x86-64-avx512bw_vl-wig1-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-wig1.d: New.
* gas/i386/x86-64-avx512bw_vl.d: New.
* gas/i386/x86-64-avx512bw_vl.s: New.
opcodes/
* i386-dis-evex.h: Add new instructions (prefixes bellow).
* i386-dis.c (fetch_data): Add EdqwS, Edb, Edw, MaskBDE.
(enum): Add dqw_swap_mode, db_mode, dw_mode, mask_bd_mode, REG_EVEX_0F71.
(PREFIX enum): Add PREFIX_VEX_0F4A, PREFIX_VEX_0F99, PREFIX_VEX_0F3A31,
PREFIX_VEX_0F3A33, PREFIX_EVEX_0F60, PREFIX_EVEX_0F61, PREFIX_EVEX_0F63,
PREFIX_EVEX_0F64, PREFIX_EVEX_0F65, PREFIX_EVEX_0F67, PREFIX_EVEX_0F68,
PREFIX_EVEX_0F69, PREFIX_EVEX_0F6B, PREFIX_EVEX_0F71_REG_2, PREFIX_EVEX_0F71_REG_4,
PREFIX_EVEX_0F71_REG_6, PREFIX_EVEX_0F73_REG_3, PREFIX_EVEX_0F73_REG_7,
PREFIX_EVEX_0F74, PREFIX_EVEX_0F75, PREFIX_EVEX_0FC4, PREFIX_EVEX_0FC5,
PREFIX_EVEX_0FD1, PREFIX_EVEX_0FD5, PREFIX_EVEX_0FD8, PREFIX_EVEX_0FD9,
PREFIX_EVEX_0FDA, PREFIX_EVEX_0FDC, PREFIX_EVEX_0FDD, PREFIX_EVEX_0FDE,
PREFIX_EVEX_0FE0, PREFIX_EVEX_0FE1, PREFIX_EVEX_0FE3, PREFIX_EVEX_0FE4,
PREFIX_EVEX_0FE5, PREFIX_EVEX_0FE8, PREFIX_EVEX_0FE9, PREFIX_EVEX_0FEA,
PREFIX_EVEX_0FEC, PREFIX_EVEX_0FED, PREFIX_EVEX_0FEE, PREFIX_EVEX_0FF1,
PREFIX_EVEX_0FF5, PREFIX_EVEX_0FF6, PREFIX_EVEX_0FF8, PREFIX_EVEX_0FF9,
PREFIX_EVEX_0FFC, PREFIX_EVEX_0FFD, PREFIX_EVEX_0F3800, PREFIX_EVEX_0F3804,
PREFIX_EVEX_0F380B, PREFIX_EVEX_0F3810, PREFIX_EVEX_0F381C, PREFIX_EVEX_0F381D,
PREFIX_EVEX_0F3820, PREFIX_EVEX_0F3826, PREFIX_EVEX_0F382B, PREFIX_EVEX_0F3830,
PREFIX_EVEX_0F3838, PREFIX_EVEX_0F383C, PREFIX_EVEX_0F383E, PREFIX_EVEX_0F3866,
PREFIX_EVEX_0F3875, PREFIX_EVEX_0F3878, PREFIX_EVEX_0F3879, PREFIX_EVEX_0F387A,
PREFIX_EVEX_0F387B, PREFIX_EVEX_0F387D, PREFIX_EVEX_0F388D, PREFIX_EVEX_0F3A0F,
PREFIX_EVEX_0F3A14, PREFIX_EVEX_0F3A15, PREFIX_EVEX_0F3A20, PREFIX_EVEX_0F3A3E,
PREFIX_EVEX_0F3A3F, PREFIX_EVEX_0F3A42.
(VEX_LEN enum): Add VEX_LEN_0F41_P_2, VEX_LEN_0F42_P_2, VEX_LEN_0F44_P_2,
VEX_LEN_0F45_P_2, VEX_LEN_0F46_P_2, VEX_LEN_0F47_P_2, VEX_LEN_0F4A_P_0,
VEX_LEN_0F4A_P_2, VEX_LEN_0F4B_P_0, VEX_LEN_0F90_P_2, VEX_LEN_0F91_P_2,
VEX_LEN_0F92_P_3, VEX_LEN_0F93_P_3, VEX_LEN_0F98_P_2, VEX_LEN_0F99_P_0,
VEX_LEN_0F99_P_2, VEX_LEN_0F3A31_P_2, VEX_LEN_0F3A33_P_2, VEX_W_0F41_P_2_LEN_1,
VEX_W_0F42_P_2_LEN_1, VEX_W_0F44_P_2_LEN_0, VEX_W_0F45_P_2_LEN_1,
VEX_W_0F46_P_2_LEN_1, VEX_W_0F47_P_2_LEN_1, VEX_W_0F4A_P_0_LEN_1,
VEX_W_0F4A_P_2_LEN_1, VEX_W_0F4B_P_0_LEN_1, VEX_W_0F90_P_2_LEN_0,
VEX_W_0F91_P_2_LEN_0, VEX_W_0F92_P_3_LEN_0, VEX_W_0F93_P_3_LEN_0,
VEX_W_0F98_P_2_LEN_0, VEX_W_0F99_P_0_LEN_0, VEX_W_0F99_P_2_LEN_0,
VEX_W_0F3A31_P_2_LEN_0, VEX_W_0F3A33_P_2_LEN_0.
(VEX_W enum): Add EVEX_W_0F6B_P_2, EVEX_W_0F6F_P_3, EVEX_W_0F7F_P_3,
EVEX_W_0F3810_P_1, EVEX_W_0F3810_P_2, EVEX_W_0F3811_P_2, EVEX_W_0F3812_P_2,
EVEX_W_0F3820_P_1, EVEX_W_0F3826_P_1, EVEX_W_0F3826_P_2, EVEX_W_0F3828_P_1,
EVEX_W_0F3829_P_1, EVEX_W_0F382B_P_2, EVEX_W_0F3830_P_1, EVEX_W_0F3866_P_2,
EVEX_W_0F3875_P_2, EVEX_W_0F3878_P_2, EVEX_W_0F3879_P_2, EVEX_W_0F387A_P_2,
EVEX_W_0F387B_P_2, EVEX_W_0F387D_P_2, EVEX_W_0F388D_P_2, EVEX_W_0F3A3E_P_2,
EVEX_W_0F3A3F_P_2, EVEX_W_0F3A42_P_2.
(prefix_table): Add entries for new instructions.
(vex_table) : Ditto.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(intel_operand_size): Add db_mode, dw_mode, dqw_swap_mode,
mask_bd_mode handling.
(OP_E_register): Add dqw_swap_mode, dw_mode, db_mode, mask_bd_mode
handling.
(OP_E_memory): Add dqw_mode, dw_mode, dqw_swap_mode, dqb_mode, db_mode
handling.
(OP_G): Add db_mode, dw_mode, dqw_swap_mode, mask_bd_mode handling.
(OP_EX): Add dqw_swap_mode handling.
(OP_VEX): Add mask_bd_mode handling.
(OP_Mask): Add mask_bd_mode handling.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512BW_FLAGS.
(cpu_flags): Add CpuAVX512BW.
* i386-init.h: Regenerated.
* i386-opc.h (CpuAVX512BW): New.
(i386_cpu_flags): Add cpuavx512bw.
* i386-opc.tbl: Add AVX512BW instructions.
* i386-tbl.h: Regenerate.
Ilya Tocar [Thu, 10 Jul 2014 10:21:48 +0000 (14:21 +0400)]
Add support for AVX512VL versions of AVX512CD instructions.
gas/testsuite/
* gas/i386/avx512cd_vl-intel.d: New.
* gas/i386/avx512cd_vl.d: New.
* gas/i386/avx512cd_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512cd_vl-intel.d: New.
* gas/i386/x86-64-avx512cd_vl.d: New.
* gas/i386/x86-64-avx512cd_vl.s: New.
opcodes/
* i386-opc.tbl: Add AVX512VL and AVX512CD instructions.
* i386-tbl.h: Regenerate.
Ilya Tocar [Fri, 18 Jul 2014 10:59:54 +0000 (14:59 +0400)]
Add support for AVX512VL. Add AVX512VL versions of AVX512F instructions.
gas/
* config/tc-i386.c (cpu_arch): Add .avx512vl, CPU_AVX512VL_FLAGS.
(build_vex_prefix): Don't abort on VEX.W.
(check_VecOperands): Support BROADCAST_1TO4 and BROADCAST_1TO2.
(check_VecOperations): Ditto.
* doc/c-i386.texi: Document avx512vl/.avx512vl.
gas/testsuite/
* gas/i386/avx512f_vl-intel.d: New.
* gas/i386/avx512f_vl-opts-intel.d: New.
* gas/i386/avx512f_vl-opts.d: New.
* gas/i386/avx512f_vl-opts.s: New.
* gas/i386/avx512f_vl-wig.s: New.
* gas/i386/avx512f_vl-wig1-intel.d: New.
* gas/i386/avx512f_vl-wig1.d: New.
* gas/i386/avx512f_vl.d: New.
* gas/i386/avx512f_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512f_vl-intel.d: New.
* gas/i386/x86-64-avx512f_vl-opts-intel.d: New.
* gas/i386/x86-64-avx512f_vl-opts.d: New.
* gas/i386/x86-64-avx512f_vl-opts.s: New.
* gas/i386/x86-64-avx512f_vl-wig.s: New.
* gas/i386/x86-64-avx512f_vl-wig1-intel.d: New.
* gas/i386/x86-64-avx512f_vl-wig1.d: New.
* gas/i386/x86-64-avx512f_vl.d: New.
* gas/i386/x86-64-avx512f_vl.s: New.
opcodes/
* i386-dis.c (intel_operand_size): Support 128/256 length in
vex_vsib_q_w_dq_mode.
(OP_E_memory): Add ymmq_mode handling, handle new broadcast.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512VL_FLAGS.
(cpu_flags): Add CpuAVX512VL.
* i386-init.h: Regenerated.
* i386-opc.h (CpuAVX512VL): New.
(i386_cpu_flags): Add cpuavx512vl.
(BROADCAST_1TO4, BROADCAST_1TO2): Define.
* i386-opc.tbl: Add AVX512VL instructions.
* i386-tbl.h: Regenerate.
Jiong Wang [Tue, 22 Jul 2014 15:22:50 +0000 (16:22 +0100)]
Fix typo in my email address.
Jiong Wang [Tue, 22 Jul 2014 15:18:02 +0000 (16:18 +0100)]
Update email address in gdb MAINTAINERS list.
Alan Modra [Tue, 22 Jul 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Joel Sherrill [Mon, 21 Jul 2014 22:38:56 +0000 (17:38 -0500)]
Disable gdb for or1k*-*-* until supported
* configure.ac (or1k*-*-*): Disable gdb.
* configure: Regenerated.
Signed-off-by: Christian Svensson <blue@cmd.nu>
Joel Sherrill [Mon, 21 Jul 2014 22:27:05 +0000 (17:27 -0500)]
Add or reactivate or1k-*-rtems*
* bfd/config.bfd (or1k-*-rtems*): Reactivate.
* gas/configure.tgt (or1k-*-rtems*): Add.
Signed-off-by: Christian Svensson <blue@cmd.nu>
Sriraman Tallam [Mon, 21 Jul 2014 18:15:38 +0000 (11:15 -0700)]
Fix ChangeLog entry:
2014-07-21 Sriraman Tallam <tmsriram@google.com>
* object.cc (Relobj::is_section_name_included): Add
".rodata.nptl_version" to not garbage collect this section.
Sriraman Tallam [Mon, 21 Jul 2014 18:12:05 +0000 (11:12 -0700)]
2014-07-21 Sriraman Tallam <tmsriram@google.com>
* object.cc (Relobj::is_section_name_included): Add
".rodata.nptl_version".
Alan Modra [Mon, 21 Jul 2014 00:01:37 +0000 (09:31 +0930)]
daily update
Doug Evans [Sun, 20 Jul 2014 22:36:23 +0000 (15:36 -0700)]
Improve error message to cope with pr 17147.
PR server/17147
* remote.c (putpkt_binary): Add text to error message.
Yao Qi [Thu, 17 Apr 2014 01:14:34 +0000 (09:14 +0800)]
Remove Chill from comments
gdb:
2014-07-20 Yao Qi <yao@codesourcery.com>
* eval.c: Remove "Chill" from comments.
* gdbtypes.h: Likewise.
* symtab.h: Likewise.
Yao Qi [Tue, 15 Apr 2014 03:39:26 +0000 (11:39 +0800)]
Update comments to TERNOP_SLICE
TERNOP_SLICE was added for language Chill, but it is used for Ada and D later.
Since language Chill was removed from GDB, TERNOP_SLICE is only used for
Ada and D. This patch is to update its comments.
gdb:
2014-07-20 Yao Qi <yao@codesourcery.com>
* std-operator.def: Update comments to TERNOP_SLICE.
Yao Qi [Tue, 15 Apr 2014 03:28:15 +0000 (11:28 +0800)]
Remove operator BINOP_RANGE
BINOP_RANGE was added by the following commit for chill language.
commit
badefd2800f5ee2dc6a0eef870771af9dc29bba7
Author: Per Bothner <per@bothner.com>
Date: Wed Nov 29 22:59:31 1995 +0000
* expression.h (enum exp_opcode): Add BINOP_RANGE.
* expprint.c (dump_expression): Support BINOP_RANGE.
* eval.c (evaluate_subexp_standard): Handle BINOP_RANGE (as error).
(case MULTI_SUBSCRIPT): Fix broken f77 value->int ad hoc conversion.
* ch-lang.c (chill_op_print_tab): Support BINOP_RANGE.
(evaluate_subexp_chill): Error on BINOP_COMMA.
Chill language is no longer supported, so we can remove BINOP_RANGE too.
This patch is to remove BINOP_RANGE.
gdb:
2014-07-20 Yao Qi <yao@codesourcery.com>
* std-operator.def: Remove BINOP_RANGE.
* breakpoint.c (watchpoint_exp_is_const): Update.
* expprint.c (dump_subexp_body_standard): Likewise.
* eval.c (init_array_element): Remove dead code.
(evaluate_subexp_standard): Likewise.
Yao Qi [Tue, 15 Apr 2014 03:10:56 +0000 (11:10 +0800)]
Remove operator BINOP_IN
Chill language support was removed several years ago, and BINOP_IN
isn't used for Pascal. This patch is to remove BINOP_IN.
gdb:
2014-07-20 Yao Qi <yao@codesourcery.com>
* std-operator.def: Remove BINOP_IN.
* breakpoint.c (watchpoint_exp_is_const): Update.
* eval.c (evaluate_subexp_standard): Likewise.
* expprint.c (dump_subexp_body_standard): Likewise.
Stefan Kristiansson [Sun, 20 Jul 2014 17:26:09 +0000 (20:26 +0300)]
or1k: add missing l.msync, l.psync and l.psync instructions.
Even though the opcodes were defined for these instructions,
the actual instruction definitions were lacking.
cpu/
* or1korbis.cpu (l-msync, l-psync, l-csync): New instructions.
opcodes/
* or1k-desc.c, * or1k-desc.h, * or1k-opc.c, * or1k-opc.h,
* or1k-opinst.c: Regenerate.
Michael Eager [Sun, 20 Jul 2014 00:47:52 +0000 (17:47 -0700)]
Fix for remote G Packet message too long error for baremetal.
Prior to version MicroBlaze v8.10.a,EDK 13.1, XMD's gdbserver stub returned 57
registers in response to GDB's G request. Starting with version MicroBlaze
v8.10.a, EDK 13.1, XMD added the slr and shr register, for a count of 59
registers. This patch adds these registers to the expected G response. This patch
fixes the above problem for baremetal and also supports the backward compatibility.
ChangeLog:
2014-07-02 Ajit Agarwal <ajitkum@xilinx.com>
* microblaze-tdep.c (microblaze_register_names): Add
the rshr and rslr register names.
(microblaze_gdbarch_init): Use of tdesc_has_registers.
Use of tdesc_find_feature. Use of tdesc_data_alloc.
Use of tdesc_numbered_register. Use of
microblaze_register_g_packet_guesses. Use of
tdesc_use_registers. Use of set_gdbarch_register_type.
(microblaze_register_g_packet_guesses): New.
* microblaze-tdep.h (microblaze_reg_num): Add
field MICROBLAZE_SLR_REGNUM MICROBLAZE_SHR_REGNUM
MICROBLAZE_NUM_REGS and MICROBLAZE_NUM_CORE_REGS.
(microblaze_frame_cache): Use of MICROBLAZE_NUM_REGS.
* features/microblaze-core.xml: New file.
* features/microblaze-stack-protect.xml: New file.
* features/microblaze-with-stack-protect.c: New file.
* features/microblaze-with-stack-protect.xml: New file.
* features/microblaze.xml: New file.
* features/microblaze.c: New file.
* features/Makefile (microblaze-with-stack-protect): Add
microblaze-with-stack-protect microblaze and
microblaze-expedite.
* regformats/microblaze-with-stack-protect.dat: New file.
* regformats/microblaze.dat: New file.
* doc/gdb.texinfo (MicroBlaze Features): New.
Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
Alan Modra [Sun, 20 Jul 2014 00:00:36 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 19 Jul 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Tom Tromey [Fri, 18 Jul 2014 15:27:17 +0000 (09:27 -0600)]
make exec_ops static
While working on some target stack changes, I noticed that exec_ops is
only used from exec.c. This patch makes it "static". This is cleaner
and makes it simpler to reason about the use of the target.
Tested by rebuilding.
I'm checking this in as obvious.
2014-07-18 Tom Tromey <tromey@redhat.com>
* exec.c (exec_ops): Now static.
* exec.h (exec_ops): Don't declare.
Tom Tromey [Fri, 11 Jul 2014 15:39:12 +0000 (09:39 -0600)]
fix calls to find_target_beneath
A long time ago Pedro pointed out that there are some calls to
find_target_beneath that pass in an explicit target_ops; but which
should instead use the ops provided to the method in question. See:
https://sourceware.org/ml/gdb-patches/2014-01/msg00429.html
This patch is just a minor cleanup to fix all such calls. There were
only three.
2014-07-18 Tom Tromey <tromey@redhat.com>
* spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Pass "self"
to find_target_beneath.
* ravenscar-thread.c (ravenscar_prepare_to_store): Pass "ops" to
find_target_beneath.
(ravenscar_mourn_inferior): Pass "self" to find_target_beneath.
Tom Tromey [Fri, 11 Jul 2014 14:30:34 +0000 (08:30 -0600)]
fix PR gdb/17130
This fixes PR gdb/17130.
The bug is that some code in utils.c was not updated during the target
delegation change:
if (job_control
/* If there is no terminal switching for this target, then we can't
possibly get screwed by the lack of job control. */
|| current_target.to_terminal_ours == NULL)
fatal ("Quit");
else
fatal ("Quit (expect signal SIGINT when the program is resumed)");
After the delegation change, to_terminal_ours will never be NULL.
I think this bug can be seen before the target delegation change by
enabling target debugging -- this would also cause to_terminal_ours to
be non-NULL.
The fix is to introduce a new target_supports_terminal_ours function,
that properly checks the target stack. This is not perhaps ideal, but
I think is a reasonable-enough approach, and in keeping with some
other existing code of the same form.
This patch also fixes a similar bug in target_supports_delete_record.
2014-07-18 Tom Tromey <tromey@redhat.com>
PR gdb/17130:
* utils.c (quit): Use target_supports_terminal_ours.
* target.h (target_supports_terminal_ours): Declare.
* target.c (target_supports_delete_record): Don't check
to_delete_record against NULL.
(target_supports_terminal_ours): New function.
Tom Tromey [Fri, 11 Jul 2014 14:02:03 +0000 (08:02 -0600)]
clean up some target delegation cases
This patch cleans up some minor inconsistencies in target delegation.
It's primary purpose is to avoid confusion in the code. A few spots
were checking the "beneath" target; however this can only be NULL for
the dummy target, so such tests are not needed. Some other spots were
iterating over the beneath targets, looking for a method
implementation. This is not needed for methods handled by
make-target-delegates, as there is always an implementation.
2014-07-18 Tom Tromey <tromey@redhat.com>
PR gdb/17130:
* spu-multiarch.c (spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Simplify delegation.
* linux-thread-db.c (thread_db_pid_to_str): Always delegate.
* windows-nat.c (windows_xfer_partial): Always delegate.
* record-btrace.c (record_btrace_xfer_partial): Simplify
delegation.
(record_btrace_fetch_registers, record_btrace_store_registers)
(record_btrace_prepare_to_store, record_btrace_resume)
(record_btrace_wait, record_btrace_find_new_threads)
(record_btrace_thread_alive): Likewise.
* procfs.c (procfs_xfer_partial): Always delegate.
* corelow.c (core_xfer_partial): Always delegate.
* sol-thread.c (sol_find_new_threads): Simplify delegation.
Tom Tromey [Fri, 18 Jul 2014 15:35:04 +0000 (09:35 -0600)]
move exec_make_note_section earlier
This patch moves exec_make_note_section a bit earlier in exec.c. This
lets us remove an otherwise unnecessary forward declaration and it
also makes the file a bit more in line with other code, as now
_initialize_exec is the final function in the file.
Tested by rebuilding.
I'm committing this as obvious.
2014-07-18 Tom Tromey <tromey@redhat.com>
* exec.c (exec_make_note_section): Move earlier.
Alan Modra [Fri, 18 Jul 2014 00:00:39 +0000 (09:30 +0930)]
daily update
Ilya Tocar [Thu, 17 Jul 2014 09:59:32 +0000 (13:59 +0400)]
Properly handle EVEX register aliases
gas/
* config/tc-i386.c (parse_register): Set need_vrex.
gas/testsuite/
* gas/i386/x86-64-equ.d: New.
* gas/i386/x86-64-equ.s: New.
* gas/i386/i386.exp: Run x86-64-equ.
Jan Kratochvil [Thu, 17 Jul 2014 11:59:03 +0000 (13:59 +0200)]
PR 17170 - testcase for GDB global --statistics regression - fix up.
Add missing file to previous entry.
Jan Kratochvil [Thu, 17 Jul 2014 11:56:24 +0000 (13:56 +0200)]
PR 17170 - testcase for GDB global --statistics regression.
gdb/testsuite/
2014-07-17 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/17170
* gdb.base/statistics.exp: New file.
Message-ID: <
20140712174217.GA1478@host2.jankratochvil.net>
Doug Evans [Thu, 17 Jul 2014 09:42:55 +0000 (02:42 -0700)]
Add reference to PR 17170 to previous entry.
Doug Evans [Thu, 17 Jul 2014 09:38:32 +0000 (02:38 -0700)]
Fix 17170.
* maint.c (count_symtabs_and_blocks): Handle NULL
current_program_space.
(report_command_stats): Check global enabled flag in addition to
recorded enabled flag.
(make_command_stats_cleanup): Handle msg_type == 0, startup.
testsuite/
* gdb.base/maint.exp: Update testing of per-command stats.
Alan Modra [Thu, 17 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update
Stefan Kristiansson [Wed, 16 Jul 2014 21:25:20 +0000 (00:25 +0300)]
or1k: increase linux TEXT_START_ADDR to 0x2000
Override the default value of 0x0000 defined in
TEXT_START_ADDR to avoid linux executables to be mapped
at zero page.
ld/
* emulparams/elf32or1k_linux.sh (TEXT_START_ADDR): Increase from
0x0 to first page boundary at 0x2000.
Pedro Alves [Wed, 16 Jul 2014 19:06:55 +0000 (20:06 +0100)]
Linux: Use kill_lwp/tkill instead of kill when killing a process
Since we use tkill everywhere, using kill to try to kill each lwp
individually looks suspiciously odd. We should really be using tgkill
everywhere, but at least while we don't get there this makes us
consistent.
gdb/gdbserver/
2014-07-16 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_kill_one_lwp): Use kill_lwp, not kill.
gdb/
2014-07-16 Pedro Alves <palves@redhat.com>
* linux-nat.c (kill_callback): Use kill_lwp, not kill.
Pedro Alves [Wed, 16 Jul 2014 18:25:41 +0000 (19:25 +0100)]
gdb.trace/tfile.c: Remove Thumb bit in one more more, general cleanup
I noticed that the existing code casts a function's address to 'long',
but that doesn't work correctly on some ABIs, like Win64, where long
is 32-bit and while pointers are 64-bit:
func_addr = (long) &write_basic_trace_file;
Fixing that showed there's actually another place in the file that
writes a function address to file, and therefore should clear the
Thumb bit. This commit adds a macro+function pair to centralize the
Thumb bit handling, and uses it in both places.
The rest is just enough changes to make the file build without
warnings with "-Wall -Wextra" with x86_64-w64-mingw32-gcc and
i686-w64-mingw32-gcc cross compilers, and with -m32/-m64 on x86_64
GNU/Linux. Currently with x86_64-w64-mingw32-gcc we get:
$ x86_64-w64-mingw32-gcc tfile.c -Wall -DTFILE_DIR=\"\"
tfile.c: In function 'start_trace_file':
tfile.c:51:23: error: 'S_IRGRP' undeclared (first use in this function)
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
^
tfile.c:51:23: note: each undeclared identifier is reported only once for each function it appears in
tfile.c:51:31: error: 'S_IROTH' undeclared (first use in this function)
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
^
tfile.c: In function 'add_memory_block':
tfile.c:79:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
ll_x = (unsigned long) addr;
^
tfile.c: In function 'write_basic_trace_file':
tfile.c:113:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
func_addr = (long) &write_basic_trace_file;
^
tfile.c:137:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default]
add_memory_block (&testglob, sizeof (testglob));
^
tfile.c:72:1: note: expected 'char *' but argument is of type 'int *'
add_memory_block (char *addr, int size)
^
tfile.c:139:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default]
add_memory_block (&testglob2, 1);
^
tfile.c:72:1: note: expected 'char *' but argument is of type 'int *'
add_memory_block (char *addr, int size)
^
tfile.c: In function 'write_error_trace_file':
tfile.c:185:3: warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration]
char *hex = alloca (len * 2 + 1);
^
tfile.c:185:15: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by default]
char *hex = alloca (len * 2 + 1);
^
tfile.c:211:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(long) &write_basic_trace_file);
^
Tested on x86_64 Fedora 20, -m64 and -m32.
Tested by Yao on arm targets.
gdb/testsuite/
2014-07-16 Pedro Alves <palves@redhat.com>
* gdb.trace/tfile.c: Include unistd.h and stdint.h.
(start_trace_file): Guard S_IRGRP and S_IROTH uses behind #ifdef.
(tfile_write_64, tfile_write_16, tfile_write_8, tfile_write_addr)
(tfile_write_buf): New functions.
(add_memory_block): Rewrite using the above.
(adjust_function_address): New function.
(FUNCTION_ADDRESS): New macro.
(write_basic_trace_file): Remove short_x local, and use
tfile_write_16. Change type of func_addr local to unsigned long
long. Use FUNCTION_ADDRESS instead of handling the Thumb bit
here. Cast argument of add_memory_block to char pointer.
(write_error_trace_file): Avoid alloca. Use FUNCTION_ADDRESS.
(main): Remove parameters.
* gdb.trace/tfile.exp: Remove nowarnings.
H.J. Lu [Wed, 16 Jul 2014 18:15:56 +0000 (11:15 -0700)]
Match PLT entry only for ELFOSABI_GNU input
* elf32-i386.c (elf_i386_plt_sym_val): Match PLT entry only for
ELFOSABI_GNU input.
* elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise.
(elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise.
H.J. Lu [Wed, 16 Jul 2014 15:16:24 +0000 (08:16 -0700)]
Properly match PLT entry against .got.plt relocation
Relocations against .got.plt section may not be in the same order as
entries in PLT section. It is incorrect to assume that the Ith reloction
index against .got.plt section always maps to the (I + 1)th entry in PLT
section. This patch matches the .got.plt relocation offset/index in PLT
entry against the index in .got.plt relocation table. It only checks
R_*_JUMP_SLOT and R_*_IRELATIVE relocations. It ignores R_*_TLS_DESC
and R_*_TLSDESC relocations since they have different PLT entries.
bfd/
PR binutils/17154
* elf32-i386.c (elf_i386_plt_sym_val): Only match R_*_JUMP_SLOT
and R_*_IRELATIVE relocation offset with PLT entry.
* elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise.
(elf_x86_64_plt_sym_val_offset_plt_bnd): New.
(elf_x86_64_get_synthetic_symtab): Use it.
ld/testsuite/
PR binutils/17154
* ld-ifunc/pr17154-i386.d: New file.
* ld-ifunc/pr17154-x86-64.d: Likewise.
* ld-ifunc/pr17154-x86.s: Likewise.
* ld-x86-64/bnd-ifunc-2.d: Likewise.
* ld-x86-64/bnd-ifunc-2.s: Likewise.
* ld-x86-64/mpx.exp: Run bnd-ifunc-2.
* ld-x86-64/tlsdesc-nacl.pd: Updated.
* ld-x86-64/tlsdesc.pd: Likewise.
Simon Marchi [Tue, 15 Jul 2014 17:04:31 +0000 (13:04 -0400)]
Add test for string evaluation with "debug expression" on
As Joel pointed out in...
https://sourceware.org/ml/gdb-patches/2014-07/msg00391.html
...it would be nice to add a test for that.
Tested on Linux x86_64 (Ubuntu 14.10).
gdb/testsuite/ChangeLog
2014-07-15 Simon Marchi <simon.marchi@ericsson.com>
* gdb.base/debug-expr.exp: Test string evaluation with
"debug expression" on.
Tom Tromey [Wed, 16 Jul 2014 14:09:27 +0000 (08:09 -0600)]
reformat comment in target.h
A comment in target.h went past the column limit. This patch
reformats it. I'm pushing this as obvious.
2014-07-16 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_delete_record>: Reformat
comment.
Tom Tromey [Wed, 16 Jul 2014 14:05:03 +0000 (08:05 -0600)]
rebuild target-delegates.c
target-delegates.c was out of date. This patch rebuilds it.
Built and regtested on x86-64 Fedora 20.
Committed as obvious.
2014-07-16 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
Alan Modra [Wed, 16 Jul 2014 00:00:55 +0000 (09:30 +0930)]
daily update
H.J. Lu [Tue, 15 Jul 2014 20:09:55 +0000 (13:09 -0700)]
Update elf_i386_compute_jump_table_size
Commit
e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 changed how
next_tls_desc_index was set up. This patch updates
elf_i386_compute_jump_table_size to use elf.srelplt->reloc_count
instead of next_tls_desc_index.
bfd/
PR ld/17057
* elf32-i386.c (elf_i386_compute_jump_table_size): Replace
next_tls_desc_index with elf.srelplt->reloc_count.
ld/testsuite/
PR ld/17057
* ld-i386/i386.exp: Run pr17057.
* ld-i386/pr17057.d: New file.
* ld-i386/pr17057.s: Likewise.
Pedro Alves [Tue, 15 Jul 2014 16:30:34 +0000 (17:30 +0100)]
gdb.base/reread.exp: Really restart GDB
The other day I noticed that default_gdb_start reuses the GDB process
if it has been spawned already:
proc default_gdb_start { } {
...
if [info exists gdb_spawn_id] {
return 0
}
I was a bit surprised, and so I hacked in an error to check whether
anything is relying on it:
+ if [info exists gdb_spawn_id] {
+ error "GDB already spawned"
+ }
And lo, that tripped on a funny buglet (see below). The comment in
reread.exp says "Restart GDB entirely", but in reality, due to the
above, that's not what is happening, as a gdb_exit call is missing.
The test is proceeding with the previous GDB process...
I don't really want to go hunt for whether there's an odd setup out
there that assumes this in its board file or something, so for now,
I'm taking the simple route of just making the test do what it says it
does. I think this much makes it an obvious fix.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(gdb) PASS: gdb.base/reread.exp: run to foo() second time
ERROR: tcl error sourcing ../src/gdb/testsuite/gdb.base/reread.exp.
ERROR: GDB already spawned
while executing
"error "GDB already spawned""
invoked from within
"if [info exists gdb_spawn_id] {
error "GDB already spawned"
}"
(procedure "default_gdb_start" line 22)
invoked from within
"default_gdb_start"
(procedure "gdb_start" line 2)
invoked from within
"gdb_start"
invoked from within
"if [is_remote target] {
unsupported "second pass: GDB should check for changes before running"
} else {
# Put the older executable back in pl..."
(file "../src/gdb/testsuite/gdb.base/reread.exp" line 114)
invoked from within
"source ../src/gdb/testsuite/gdb.base/reread.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source ../src/gdb/testsuite/gdb.base/reread.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
testcase ../src/gdb/testsuite/gdb.base/reread.exp completed in 1 seconds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdb/testsuite/
2014-07-15 Pedro Alves <palves@redhat.com>
* gdb.base/reread.exp: Use clean_restart.
Pierre Langlois [Tue, 15 Jul 2014 16:03:09 +0000 (17:03 +0100)]
Add support for the __flash qualifier on AVR
The __flash qualifier is part of the named address spaces for AVR [1]. It
allows putting read-only data in the flash memory, normally reserved for
code.
When used together with a pointer, the DW_AT_address_class attribute is set
to 1 and allows GDB to detect that when it will be dereferenced, the data
will be loaded from the flash memory (with the LPM instruction).
We can now properly debug the following code:
~~~
const __flash char data_in_flash = 0xab;
int
main (void)
{
const __flash char *pointer_to_flash = &data_in_flash;
}
~~~
~~~
(gdb) print pointer_to_flash
$1 = 0x1e8 <data_in_flash> "\253"
(gdb) print/x *pointer_to_flash
$2 = 0xab
(gdb) x/x pointer_to_flash
0x1e8 <data_in_flash>: 0xXXXXXXab
~~~
Whereas previously, GDB would revert to the default address space which is
RAM and mapped in higher memory:
~~~
(gdb) print pointer_to_flash
$1 = 0x8001e8 ""
~~~
[1] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html
2014-07-15 Pierre Langlois <pierre.langlois@embecosm.com>
gdb/
* avr-tdep.c (AVR_TYPE_ADDRESS_CLASS_FLASH): New macro.
(AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH): Likewise.
(avr_address_to_pointer): Check for AVR_TYPE_ADDRESS_CLASS_FLASH.
(avr_pointer_to_address): Likewise.
(avr_address_class_type_flags): New function.
(avr_address_class_type_flags_to_name): Likewise.
(avr_address_class_name_to_type_flags): Likewise.
(avr_gdbarch_init): Set address_class_type_flags,
address_class_type_flags_to_name and
address_class_name_to_type_flags.
gdb/testsuite/
* gdb.arch/avr-flash-qualifer.c: New.
* gdb.arch/avr-flash-qualifer.exp: New.
Pedro Alves [Tue, 15 Jul 2014 15:22:14 +0000 (16:22 +0100)]
[GDB/Linux] Avoid stale errno
The fix that went into GDBserver is also needed on the GDB side.
Although most compilers follow right-to-left evaluation order, the
order of evaluation of a function call's arguments is really
unspecified. target_pid_to_str may well clobber errno when we get to
evaluate the third argument to fprintf_unfiltered.
gdb/
2014-07-15 Pedro Alves <palves@redhat.com>
* linux-nat.c (kill_callback): Save errno and work with saved
copy.
Simon Marchi [Thu, 19 Jun 2014 14:45:33 +0000 (10:45 -0400)]
Handle OP_STRING in dump_subexp_body_standard
For some reason, OP_STRING is not handled in dump_subexp_body_standard.
This makes the output of "set debug expression 1" very bad when a string
is involved. Example:
(gdb) set debug expression 1
(gdb) print "hello"
... (random garbage, possibly segfault)
This commit handles OP_STRING and skips the appropriate number of exp
elements. The line corresponding to the string now looks like:
0 OP_STRING Language-specific string type: 0
gdb/ChangeLog:
2014-07-15 Simon Marchi <simon.marchi@ericsson.com>
* expprint.c (dump_subexp_body_standard): Handle OP_STRING.
Pedro Alves [Tue, 15 Jul 2014 14:35:28 +0000 (15:35 +0100)]
[GDBserver] Avoid stale errno
Although most compilers follow right-to-left evaluation order, the
order of evaluation of a function call's arguments is really
unspecified. target_pid_to_str or ptid_of may well clobber errno when
we get to evaluate the third argument to debug_printf.
gdb/gdbserver/
2014-07-15 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_kill_one_lwp): Save errno and work with saved
copy.
Jiong Wang [Tue, 15 Jul 2014 09:15:43 +0000 (10:15 +0100)]
[ARM] Fix 32-bit host build failure.
gas/
* config/tc-arm.c (add_to_lit_pool): Use "inst.operands[1].imm" for * sign
extension. Casting the type of imm1 and imm2 to offsetT. Fix one logic
error when checking X_op.
Jiong Wang [Tue, 15 Jul 2014 09:08:55 +0000 (10:08 +0100)]
[AArch64] Fix ld testcase linker script glitch.
Specify -T relocs.ld for emit-relocs-local-addend.d to be consistent
will all other emit-relocs* testcases
ld/testsuite/
* ld-aarch64/emit-relocs-local-addend.d: Use target linker script.
Andreas Schwab [Mon, 14 Jul 2014 18:59:50 +0000 (20:59 +0200)]
Don't complain about dbCC to long branch conversion
* config/tc-m68k.c (md_convert_frag_1): Don't complain with
--pcrel about TAB (DBCCLBR, LONG) conversion.
Alan Modra [Wed, 9 Jul 2014 10:34:40 +0000 (20:04 +0930)]
Account for trailing bytes read from bfd_bread
* cache.c (cache_bread_1): Don't return -1 when fread returns
a positive value.
Alan Modra [Wed, 9 Jul 2014 05:23:00 +0000 (14:53 +0930)]
tidy elf_merge_st_other
So that we munge isym->st_other once per symbol.
* elflink.c (elf_merge_st_other): Update comments. Simplify
visibility handling. Make isym const. Move code modifying
isym->st_other for --exclude-libs to..
(elf_link_add_object_symbols): ..here.
Alan Modra [Tue, 15 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update
Edjunior Barbosa Machado [Mon, 14 Jul 2014 23:18:10 +0000 (20:18 -0300)]
2014-07-14 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
breakpoint support correctly.
Pedro Alves [Mon, 14 Jul 2014 19:39:53 +0000 (20:39 +0100)]
Add missing ChangeLog entry for
15cd413a
Put GDB's terminal settings into effect when paginating
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Put GDB's terminal settings into effect when paginating
When the target is resumed in the foreground, we put the inferior's
terminal settings into effect, and remove stdin from the event loop.
When the target stops, we put GDB's terminal settings into effect
again, and re-register stdin in the event loop, ready for user input.
The former is done by target_terminal_inferior, and the latter by
target_terminal_ours.
There's an intermediate -- target_terminal_ours_for_output -- that is
called when printing output related to target events, and we don't
know yet whether we'll stop the program. That puts our terminal
settings into effect, enough to get proper results from our output,
but leaves input wired into the inferior.
If such output paginates, then we need the full target_terminal_ours
in order for the user to be able to provide input to answer the
pagination query.
The test in this commit hangs in async-capable targets without the fix
(as the user/test can't answer the pagination query). It doesn't hang
on sync targets because on those we don't unregister stdin from the
event loop while the target is running (because we block in
target_wait instead of in the event loop in that case).
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Fix double prompt
If an error is thrown while handling a target event (within
fetch_inferior_event), and, the interpreter is not async (but the
target is), then GDB prints the prompt twice.
One way to see that in action is throw a QUIT while in a pagination
prompt issued from within fetch_inferior_event (or one of its
callees). E.g. from the test:
---Type <return> to continue, or q <return> to quit---
^CQuit
(gdb) (gdb) p 1
^^^^^^^^^^^
$1 = 1
(gdb)
The issue is that inferior_event_handler swallows errors and notifies
the observers (the interpreters) about the command error, even if the
interpreter is forced sync while we're handling a nested event loop
(for execute_command). The observers print a prompt, and then when we
get back to the top event loop, we print another (in
start_event_loop).
I see no reason the error should be swallowed here. Just cancel the
execution related bits and let the error propagate to the top level
(start_event_loop), which re-enables stdin and notifies observers.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* inf-loop.c (inferior_event_handler): Use TRY_CATCH instead of
catch_errors. Don't re-enable stdin or notify observers where,
and rethrow error.
(fetch_inferior_event_wrapper): Delete.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.c: New file.
* gdb.base/double-prompt-target-event-error.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Remove the target from the event loop while in secondary prompts
If a pagination prompt triggers while the target is running, and the
target exits before the user responded to the pagination query, this
happens:
Starting program: foo
---Type <return> to continue, or q <return> to quit---No unwaited-for children left.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) Couldn't get registers: No such process.
(gdb)
To reiterate, the user hasn't replied to the pagination prompt above.
A pagination query nests an event loop (in gdb_readline_wrapper). In
async mode, in addition to stdin and signal handlers, we'll have the
target also installed in the event loop still. So if the target
reports an event, that wakes up the nested event loop, which calls
into fetch_inferior_event etc. to handle the event which generates
further output, all while we should be waiting for pagination
confirmation...
(TBC, any target event that generates output ends up spuriously waking
up the pagination, though exits seem to be the worse kind.)
I've played with a couple different approaches to fixing this, while
at the same time trying to avoid being invasive. Both revolve around
not listening to target events while in a pagination prompt (doing
anything else I think would be a much bigger change).
The approach taken just removes the target from the event loop while
within gdb_readline_wrapper. The other approach used gdb_select
directly, with only input_fd installed, but that had the issue that it
didn't handle the async signal handlers, and turned out to be a bit
more code than the first version.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c: Include "inf-loop.h".
(struct gdb_readline_wrapper_cleanup) <target_is_async_orig>: New
field.
(gdb_readline_wrapper_cleanup): Make the target async again, if it
was async before.
(gdb_readline_wrapper): Store whether the target is async, and
make it sync.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-inferior-exit.c: New file.
* gdb.base/paginate-inferior-exit.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +0100)]
Background execution + pagination aborts readline/gdb
If pagination occurs as result of output sent as response to a target
event while the target is executing in the background, subsequent
input aborts readline/gdb:
$ gdb program
...
(gdb) continue&
Continuing.
(gdb)
---Type <return> to continue, or q <return> to quit---
*return*
---Type <return> to continue, or q <return> to quit---
Breakpoint 2, after_sleep () at paginate-bg-execution.c:21
---Type <return> to continue, or q <return> to quit---
21 return; /* after sleep */
p 1
readline: readline_callback_read_char() called with no handler!
*abort/SIGABRT*
$
gdb_readline_wrapper_line removes the handler after a line is
processed. Usually, we'll end up re-displaying the prompt, and that
reinstalls the handler. But if the output is coming out of handling
a stop event, we don't re-display the prompt, and nothing restores the
handler. So the next input wakes up the event loop and calls into
readline, which aborts.
We should do better with the prompt handling while the target is
running (I think we should coordinate with readline, and
hide/redisplay it around output), but that's a more invasive change
better done post 7.8, so this patch is conservative and just
reinstalls the handler as soon as we're out of the readline line
callback.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c (gdb_readline_wrapper_line): Tweak comment.
(gdb_readline_wrapper_cleanup): If readline is enabled, reinstall
the input handler callback.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-bg-execution.c: New file.
* gdb.base/paginate-bg-execution.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
Canceling pagination caused by execution command from command line aborts readline/gdb
This fixes:
$ ./gdb program -ex "set height 2" -ex "start"
...
Reading symbols from /home/pedro/gdb/tests/threads...done.
---Type <return> to continue, or q <return> to quit---^CQuit << ctrl-c triggers a Quit
*type something*
readline: readline_callback_read_char() called with no handler!
Aborted
$
Usually, if an error propagates all the way to the top level, we'll
re-enable stdin, in case the command that was running was a
synchronous command. That's done in the event loop's actual loop
(event-loop.c:start_event_loop). However, if a foreground execution
command is run before the event loop starts and throws, nothing is
presently reenabling stdin, which leaves sync_execution set.
When we do start the event loop, because sync_execution is still
(mistakenly) set, display_gdb_prompt removes the readline input
callback, even though stdin is registered in the event loop. Any
input from here on results in readline aborting.
Such commands are run through catch_command_errors,
catch_command_errors_const, so add the tweak there.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* main.c: Include event-top.h.
(handle_command_errors): New function.
(catch_command_errors, catch_command_errors_const): Use it.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-execution-startup.c: New file.
* gdb.base/paginate-execution-startup.exp: New file.
* lib/gdb.exp (pagination_prompt): New global.
(default_gdb_spawn): New procedure, factored out from
default_gdb_spawn.
(default_gdb_start): Adjust to call default_gdb_spawn.
(gdb_spawn): New procedure.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
testsuite: Introduce gdb_assert
Often we'll do something like:
if {$ok} {
fail "whatever"
} else {
pass "whatever"
}
This adds a helper procedure for that, and converts one random place
to use it, as an example.
2014-07-14 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_assert): New procedure.
* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
Pedro Alves [Mon, 14 Jul 2014 18:55:31 +0000 (19:55 +0100)]
Move catch_command_errors and catch_command_errors_const to main.c
We'll need to add error handling code to commands run before the event
loop starts (commands in .gdbinit, -ex commands, etc.). Turns out
those are run through catch_command_errors, and, catch_command_errors
is used nowhere else. Move it (and the _const variant) to main.c, so
that we can further specialize it freely.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (catch_command_errors, catch_command_errors_const):
Moved to main.c.
* exceptions.h (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved to main.c.
(catch_command_errors, catch_command_errors_const): Delete
declarations.
* main.c (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved here from exceptions.h.
(catch_command_errors, catch_command_errors_const)): Moved here
from exceptions.c and make static.
Pedro Alves [Mon, 14 Jul 2014 18:55:30 +0000 (19:55 +0100)]
Eliminate exceptions.c:print_any_exception.
exception_print and exception_fprintf call print_flush, which does all the
same flushing and annotation things that print_any_exception does, and more.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (print_any_exception): Delete.
(catch_exceptions_with_msg): Use exception_print instead of
print_any_exception.
(catch_errors): Use exception_fprintf instead of
print_any_exception.
(catch_command_errors, catch_command_errors_const): Use
exception_print instead of print_any_exception.
Pedro Alves [Mon, 14 Jul 2014 18:55:30 +0000 (19:55 +0100)]
Put the inferior's terminal settings in effect while running (fg) infcalls
The "call" and "print" commands presently always run synchronously, in
the foreground, but GDB currently forgets to put the inferior's
terminal settings into effect while running them, on async-capable
targets, resulting in:
(gdb) print func ()
hello world
Program received signal SIGTTOU, Stopped (tty output).
0x000000373bceb8d0 in __libc_tcdrain (fd=1) at ../sysdeps/unix/sysv/linux/tcdrain.c:29
29 return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1);
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(func) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)
That's because target_terminal_inferior skips actually doing anything
if running in the background, and, nothing is setting sync_execution
while running infcalls:
void
target_terminal_inferior (void)
{
/* A background resume (``run&'') should leave GDB in control of the
terminal. Use target_can_async_p, not target_is_async_p, since at
this point the target is not async yet. However, if sync_execution
is not set, we know it will become async prior to resume. */
if (target_can_async_p () && !sync_execution)
return;
This would best be all cleaned up by making GDB not even call
target_terminal_inferior and try to pass the terminal to the inferior
if running in the background, but that's a more invasive fix that is
better done post-7.8.
This was originally caught by a patch later in this series that makes
catch_command_errors use exception_print instead of
print_any_exception. Note that print_flush calls serial_drain_output
while print_any_exception doesnt't have that bit. And,
gdb.gdb/python-selftest.exp does:
gdb_test "call catch_command_errors(execute_command, \"python print 5\", 0, RETURN_MASK_ALL)" \
"Python not initialized.* = 0"
which without this fix results in SIGTTOU...
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* infcall.c (run_inferior_call): Set 'sync_execution' while
running the inferior call.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/execution-termios.c: New file.
* gdb.base/execution-termios.exp: New file.
Pedro Alves [Mon, 14 Jul 2014 17:48:09 +0000 (18:48 +0100)]
Garbage collect value_contents_equal.
Hasn't been used in years.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* value.c (value_contents_equal): Delete function.
* value.h (value_contents_equal): Delete declaration.
Tom Tromey [Wed, 2 Jul 2014 21:53:31 +0000 (15:53 -0600)]
fix PR 17106
This fixes PR 17106, a regression in printing.
The bug is that resolve_dynamic_type follows struct members and
references, but doesn't consider the possibility of infinite
recursion.
This patch fixes the problem by limiting reference following to the
topmost layer of calls -- that is, reference-typed struct members are
never considered as being VLAs.
Built and regtested on x86-64 Fedora 20.
New test case included.
2014-07-14 Tom Tromey <tromey@redhat.com>
PR exp/17106:
* gdbtypes.c (is_dynamic_type_internal): New function, from
is_dynamic_type.
(is_dynamic_type): Rewrite.
(resolve_dynamic_union): Use resolve_dynamic_type_internal.
(resolve_dynamic_struct): Likewise.
(resolve_dynamic_type_internal): New function, from
resolve_dynamic_type.
(resolve_dynamic_type): Rewrite.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/vla-cxx.cc: New file.
* gdb.cp/vla-cxx.exp: New file.
Tom Tromey [Tue, 1 Jul 2014 17:43:00 +0000 (11:43 -0600)]
fix record "run" regression
This fixes the record "run" regression pointed out by Marc Khouzam:
https://sourceware.org/ml/gdb/2014-06/msg00096.html
The bug is that target_require_runnable must agree with the handling
of the "run" target, but currently it is out of sync. This patch
fixes the problem by changing target_require_runnable to also ignore
the record_stratum.
Built and regtested on x86-64 Fedora 20.
New test case included.
2014-07-14 Tom Tromey <tromey@redhat.com>
* target.c (target_require_runnable): Also check record_stratum.
Update comment.
2014-07-14 Tom Tromey <tromey@redhat.com>
* gdb.reverse/rerun-prec.c: New file.
* gdb.reverse/rerun-prec.exp: New file.
Alan Modra [Mon, 14 Jul 2014 00:00:59 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 13 Jul 2014 00:00:58 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 12 Jul 2014 07:35:35 +0000 (17:05 +0930)]
Don't force "set" symbols local for PE
gas/
* read.c (assign_symbol): Don't force "set" symbols local for PE.
gas/testsuite/
* gas/pe/set.s, * gas/pe/set.d: New test.
* gas/pe/pe.exp: Run it.
Maciej W. Rozycki [Sat, 12 Jul 2014 00:22:25 +0000 (01:22 +0100)]
gdb/testsuite: Add a way to send multiple init commands
Right now we provide a board info entry, `gdb_init_command', that allows
one to send a single command to GDB before the program to be debugged is
started. This is useful e.g. for slow remote targets to change the
default "remotetimeout" setting. Occasionally I found a need to send
multiple commands instead, however this cannot be achieved with
`gdb_init_command'.
This change therefore extends the mechanism by adding a TCL list of GDB
commands to send, via a board info entry called `gdb_init_commands'.
There is no limit as to the number of commands put there. The old
`gdb_init_command' mechanism remains supported for compatibility with
existing people's environments.
* lib/gdb-utils.exp: New file.
* lib/gdb.exp (gdb_run_cmd): Call gdb_init_commands, replacing
inline `gdb_init_command' processing.
(gdb_start_cmd): Likewise.
* lib/mi-support.exp (mi_run_cmd): Likewise.
* README: Document `gdb_init_command' and `gdb_init_commands'.
Alan Modra [Sat, 12 Jul 2014 00:01:38 +0000 (09:31 +0930)]
daily update
Jan Kratochvil [Fri, 11 Jul 2014 15:26:42 +0000 (17:26 +0200)]
Fix false argv0-symlink.exp FAIL running under a very long directory name
Starting program: /home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink ^M
[...]
(gdb) print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-", 'f' <repeats 169 times>...^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
after "set print repeats 10000":
print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"...^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
after "set print elements 10000":
print argv[0]^M
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink"^M
(gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name
gdb/testsuite/
2014-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix false FAIL running under a very long directory name.
* gdb.base/argv0-symlink.exp: Add "set print repeats 10000"
and "set print elements 10000". Twice.
Maks Naumov [Fri, 11 Jul 2014 14:25:30 +0000 (23:55 +0930)]
Fix typo in _bfd_elf_strtab_add
PR 17141
* elf.c (_bfd_elf_strtab_add): Check strtab name for failure.
Yao Qi [Wed, 2 Jul 2014 07:16:26 +0000 (15:16 +0800)]
Stop prologue analysis when past the epilogue
We see a fail in gdb.trace/entry-values.exp on armv4t thumb,
bt^M
#0 0x000086fc in foo (i=0, i@entry=<optimized out>, j=2, j@entry=<optimized out>)^M
#1 0x00000002 in ?? ()^M
Backtrace stopped: previous frame identical to this frame (corrupt stack?)^M
(gdb) FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1)
The fail is caused by incorrect prologue analysis, which can be illustrated by
setting a breakpoint on function foo,
(gdb) disassemble foo
Dump of assembler code for function foo:
0x000086e8 <+0>: push {r7, lr}
0x000086ea <+2>: sub sp, #8
0x000086ec <+4>: add r7, sp, #0
0x000086ee <+6>: str r0, [r7, #4]
0x000086f0 <+8>: str r1, [r7, #0]
0x000086f2 <+10>: movs r3, #0
0x000086f4 <+12>: adds r0, r3, #0
0x000086f6 <+14>: mov sp, r7
0x000086f8 <+16>: add sp, #8
0x000086fa <+18>: pop {r7}
0x000086fc <+20>: pop {r1}
0x000086fe <+22>: bx r1
End of assembler dump.
(gdb) b foo
Breakpoint 1 at 0x86fc
As we can see, GDB analyzes the prologue and skip the prologue to the last
instruction but one. The breakpoint is set within the epilogue, and GDB
skips too many instruction for prologue. This patch teaches GDB to stop
prologue analysis when goes into the epilogue. With this patch applied,
GDB is able to unwind correctly,
(gdb) bt
#0 0x000086f6 in foo (i=0, i@entry=2, j=2, j@entry=3)
#1 0x00008718 in bar (i=<optimized out>)
#2 0x00008758 in main ()
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Break the loop if
thumb_instruction_restores_sp return true.
Yao Qi [Wed, 2 Jul 2014 06:45:12 +0000 (14:45 +0800)]
Match instruction adjusts SP in thumb
This is a refactor patch, that moves matching instructions adjusting
SP into a new function, thumb_instruction_restores_sp. The second
call to thumb_instruction_restores_sp in thumb_in_function_epilogue_p
is a little different from the original. The original code matches
'POP <registers> without PC', but thumb_in_function_epilogue_p matches
'POP <registers> (with and without PC)'. However, GDB found one
instruction about return and is scanning the previous instruction,
which should be an instruction about return too, so the code change
doesn't affect the functionality.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_instruction_restores_sp): New function.
(thumb_in_function_epilogue_p): Call
thumb_instruction_restores_sp.
Yao Qi [Tue, 1 Jul 2014 07:36:44 +0000 (15:36 +0800)]
Restrict matching add/sub sp, #imm
Currently, GDB matches both add/sub sp, #imm in prologue and epilogue,
which is not very precise. On the instruction level, the immediate
number in both instruction can't be negative, so 'sub sp, #imm' only
appears in prologue while 'add sp, #imm' only appears in epilogue.
Note that on assembly level, we can write 'add sp, -8', but gas will
translate to 'sub sp, 8' instruction.
This patch is to only match 'sub sp, #imm' in prologue and match
'add sp, #immm' in epilogue. It paves the way for the following
patch.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Don't match instruction
'add sp, #imm'.
(thumb_in_function_epilogue_p): Don't match 'sub sp, #imm'.
Gary Benson [Fri, 27 Jun 2014 08:52:29 +0000 (09:52 +0100)]
Tidy #include lists
This commit tidies up the #include lists in {i386,amd64}-linux-nat.c,
removing headers that are no longer required and reordering some lines
so that both files roughly match. Additionally, an unused definition
was removed from the middle of the #include list in i386-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (gdbcore.h): Remove include.
(regset.h): Likewise.
(nat/linux-btrace.h): Likewise.
(btrace.h): Likewise.
(gdb_assert.h): Likewise.
(string.h): Likewise.
(sys/uio.h): Likewise.
(sys/debugreg.h): Likewise.
(sys/syscall.h): Likewise.
(sys/procfs.h): Likewise.
(sys/user.h): Likewise.
(asm/ptrace.h): Likewise.
(i386-nat.h): Likewise.
* i386-linux-nat.c (i386-nat.h): Likewise.
(regset.h): Likewise.
(target.h): Likewise.
(linux-nat.h): Likewise.
(nat/linux-btrace.h): Likewise.
(btrace.h): Likewise.
(gdb_assert.h): Likewise.
(string.h): Likewise.
(sys/uio.h): Likewise.
(sys/user.h): Likewise.
(sys/procfs.h): Likewise.
(sys/reg.h): Likewise.
(sys/debugreg.h): Likewise.
(ORIG_EAX): Remove definition.
Gary Benson [Thu, 10 Jul 2014 14:43:56 +0000 (15:43 +0100)]
Move duplicated code into new files
This commit moves the duplicated code in {i386,amd64}-linux-nat.c
into the new files x86-linux-nat.[ch]. Additionally, a new
file i386-linux-nat.h was required to expose a value required
by the 32-bit code in x86-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* i386-linux-nat.h: New file.
* x86-linux-nat.h: Likewise.
* x86-linux-nat.c: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Add the above new headers.
* config/i386/linux.mh (NATDEPFILES): Add x86-linux-nat.o.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* amd64-linux-nat.c (x86-linux-nat.h): New include.
(PTRACE_GETREGSET): Now in x86-linux-nat.h.
(PTRACE_SETREGSET): Likewise.
(arch_lwp_info): Now in x86-linux-nat.c.
(have_ptrace_getregset): Now in x86-linux-nat.h.
(x86_linux_dr_get): Now in x86-linux-nat.c.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_prepare_to_resume): Likewise.
(x86_linux_new_thread): Likewise.
(x86_linux_new_fork): Likewise.
(x86_linux_get_thread_area): Likewise.
(super_post_startup_inferior): Likewise.
(x86_linux_child_post_startup_inferior): Likewise.
(AMD64_LINUX_USER64_CS): Likewise.
(AMD64_LINUX_X32_DS): Likewise.
(x86_linux_read_description): Likewise.
(x86_linux_enable_btrace): Likewise.
(x86_linux_disable_btrace): Likewise.
(x86_linux_teardown_btrace): Likewise.
(x86_linux_read_btrace): Likewise.
(x86_linux_create_target): Likewise.
(x86_linux_add_target): Likewise.
* i386-linux-nat.c (x86-linux-nat.h): New include.
(PTRACE_GETREGSET): Now in x86-linux-nat.h.
(PTRACE_SETREGSET): Likewise.
(arch_lwp_info): Now in x86-linux-nat.c.
(have_ptrace_getregset): Now in x86-linux-nat.h.
(x86_linux_dr_get): Now in x86-linux-nat.c.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_prepare_to_resume): Likewise.
(x86_linux_new_thread): Likewise.
(x86_linux_new_fork): Likewise.
(x86_linux_get_thread_area): Likewise.
(super_post_startup_inferior): Likewise.
(x86_linux_child_post_startup_inferior): Likewise.
(AMD64_LINUX_USER64_CS): Likewise.
(AMD64_LINUX_X32_DS): Likewise.
(x86_linux_read_description): Likewise.
(x86_linux_enable_btrace): Likewise.
(x86_linux_disable_btrace): Likewise.
(x86_linux_teardown_btrace): Likewise.
(x86_linux_read_btrace): Likewise.
(x86_linux_create_target): Likewise.
(x86_linux_add_target): Likewise.
Gary Benson [Wed, 25 Jun 2014 13:57:42 +0000 (14:57 +0100)]
Comment and whitespace changes
This commit merges the comments and whitespace in the common
parts of i386-linux-nat.c and amd64-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c: Comment and whitespace changes.
* i386-linux-nat.c: Comment and whitespace changes.
Gary Benson [Tue, 24 Jun 2014 12:43:30 +0000 (13:43 +0100)]
Pull out common parts of _initialize_{i386,amd64}_linux_nat
This commit adds two new helpers, x86_linux_create_target and
x86_linux_add_target, to hold the parts of _initialize_i386_linux_nat
and _initialize_amd64_linux_nat which are common.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (x86_linux_create_target): New function.
(x86_linux_add_target): Likewise.
(_initialize_amd64_linux_nat): Delegate to the above new functions.
* i386-linux-nat.c (x86_linux_create_target): New function.
(x86_linux_add_target): Likewise.
(_initialize_i386_linux_nat): Delegate to the above new functions.
Gary Benson [Wed, 25 Jun 2014 10:49:55 +0000 (11:49 +0100)]
Merge ps_get_thread_area
This commit adds a new helper, x86_linux_get_thread_area, to
hold the common parts of the ps_get_thread_area functions in
i386-linux-nat.c and amd64-linux-nat.c.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (x86_linux_get_thread_area): New function.
(ps_get_thread_area): Delegate to the above in 32-bit mode.
* i386-linux-nat.c (x86_linux_get_thread_area): New function.
(ps_get_thread_area): Delegate to the above.
Gary Benson [Fri, 27 Jun 2014 08:29:06 +0000 (09:29 +0100)]
Merge {i386,amd64}_linux_read_description
This commit merges i386_ and amd64_linux_read_description, renaming
both to x86_linux_read_description.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (amd64_linux_read_description): Renamed to
x86_linux_read_description. All uses updated. amd64-specific
code conditionalized. Conditionalized i386-specific code added.
Redundant cast removed.
* i386-linux-nat.c (i386_linux_read_description): Renamed to
x86_linux_read_description. All uses updated. i386-specific
code conditionalized. Conditionalized amd64-specific code added.
One sizeof replaced with the actual type it is describing.
Gary Benson [Tue, 24 Jun 2014 09:07:12 +0000 (10:07 +0100)]
Rename identical functions
amd64-linux-nat.c and i386-linux-nat.c contain a number of functions
which are identical but for prefix on their names. This commit
renames all such functions to have the prefix x86_ instead of the
prefixes amd64_ or i386_ and updates all uses of those functions.
The now-identical x86_ functions will be pulled out to a separate
shared file in a later commit.
gdb/
2014-07-11 Gary Benson <gbenson@redhat.com>
* amd64-linux-nat.c (amd64_linux_dr_get): Renamed to
x86_linux_dr_get. All uses updated.
(amd64_linux_dr_set): Renamed to
x86_linux_dr_set. All uses updated.
(amd64_linux_dr_get_addr): Renamed to
x86_linux_dr_get_addr. All uses updated.
(amd64_linux_dr_get_control): Renamed to
x86_linux_dr_get_control. All uses updated.
(amd64_linux_dr_get_status): Renamed to
x86_linux_dr_get_status. All uses updated.
(amd64_linux_dr_set_control): Renamed to
x86_linux_dr_set_control. All uses updated.
(amd64_linux_dr_set_addr): Renamed to
x86_linux_dr_set_addr. All uses updated.
(amd64_linux_prepare_to_resume): Renamed to
x86_linux_prepare_to_resume. All uses updated.
(amd64_linux_new_thread): Renamed to
x86_linux_new_thread. All uses updated.
(amd64_linux_new_fork): Renamed to
x86_linux_new_fork. All uses updated.
(amd64_linux_child_post_startup_inferior): Renamed to
x86_linux_child_post_startup_inferior. All uses updated.
(amd64_linux_enable_btrace): Renamed to
x86_linux_enable_btrace. All uses updated.
(amd64_linux_disable_btrace): Renamed to
x86_linux_disable_btrace. All uses updated.
(amd64_linux_teardown_btrace): Renamed to
x86_linux_teardown_btrace. All uses updated.
(amd64_linux_read_btrace): Renamed to
x86_linux_read_btrace. All uses updated.
* i386-linux-nat.c (i386_linux_dr_get): Renamed to
x86_linux_dr_get. All uses updated.
(i386_linux_dr_set): Renamed to
x86_linux_dr_set. All uses updated.
(i386_linux_dr_get_addr): Renamed to
x86_linux_dr_get_addr. All uses updated.
(i386_linux_dr_get_control): Renamed to
x86_linux_dr_get_control. All uses updated.
(i386_linux_dr_get_status): Renamed to
x86_linux_dr_get_status. All uses updated.
(i386_linux_dr_set_control): Renamed to
x86_linux_dr_set_control. All uses updated.
(i386_linux_dr_set_addr): Renamed to
x86_linux_dr_set_addr. All uses updated.
(i386_linux_prepare_to_resume): Renamed to
x86_linux_prepare_to_resume. All uses updated.
(i386_linux_new_thread): Renamed to
x86_linux_new_thread. All uses updated.
(i386_linux_new_fork): Renamed to
x86_linux_new_fork. All uses updated.
(i386_linux_child_post_startup_inferior): Renamed to
x86_linux_child_post_startup_inferior. All uses updated.
(i386_linux_enable_btrace): Renamed to
x86_linux_enable_btrace. All uses updated.
(i386_linux_disable_btrace): Renamed to
x86_linux_disable_btrace. All uses updated.
(i386_linux_teardown_btrace): Renamed to
x86_linux_teardown_btrace. All uses updated.
(i386_linux_read_btrace): Renamed to
x86_linux_read_btrace. All uses updated.
Yao Qi [Fri, 11 Jul 2014 10:46:33 +0000 (18:46 +0800)]
Don't print symbol on address 0x0
We see the following fails on arm-none-eabi target,
print (void*)v_signed_char^M
$190 = (void *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.base/exprs.exp: print (void*)v_signed_char (print
(void*)v_signed_char)
GDB behaves correctly but the test assumes there is no symbol on
address 0x0. This patch is set print symbol off, so that tests below
can match the address only.
gdb/testsuite:
2014-07-11 Yao Qi <yao@codesourcery.com>
* gdb.base/exprs.exp: "set print symbol off".
Pedro Alves [Fri, 11 Jul 2014 10:07:13 +0000 (11:07 +0100)]
GDBserver crashes when killing a multi-thread process
Here's an example, with the new test:
gdbserver :9999 gdb.threads/kill
gdb gdb.threads/kill
(gdb) b 52
Breakpoint 1 at 0x4007f4: file kill.c, line 52.
Continuing.
Breakpoint 1, main () at kill.c:52
52 return 0; /* set break here */
(gdb) k
Kill the program being debugged? (y or n) y
gdbserver :9999 gdb.threads/kill
Process gdb.base/watch_thread_num created; pid = 9719
Listening on port 1234
Remote debugging from host 127.0.0.1
Killing all inferiors
Segmentation fault (core dumped)
Backtrace:
(gdb) bt
#0 0x00000000004068a0 in find_inferior (list=0x66b060 <all_threads>, func=0x427637 <kill_one_lwp_callback>, arg=0x7fffffffd3fc) at src/gdb/gdbserver/inferiors.c:199
#1 0x00000000004277b6 in linux_kill (pid=15708) at src/gdb/gdbserver/linux-low.c:966
#2 0x000000000041354d in kill_inferior (pid=15708) at src/gdb/gdbserver/target.c:163
#3 0x00000000004107e9 in kill_inferior_callback (entry=0x6704f0) at src/gdb/gdbserver/server.c:2934
#4 0x0000000000406522 in for_each_inferior (list=0x66b050 <all_processes>, action=0x4107a6 <kill_inferior_callback>) at src/gdb/gdbserver/inferiors.c:57
#5 0x0000000000412377 in process_serial_event () at src/gdb/gdbserver/server.c:3767
#6 0x000000000041267c in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:3880
#7 0x00000000004189ff in handle_file_event (event_file_desc=4) at src/gdb/gdbserver/event-loop.c:434
#8 0x00000000004181c6 in process_event () at src/gdb/gdbserver/event-loop.c:189
#9 0x0000000000418f45 in start_event_loop () at src/gdb/gdbserver/event-loop.c:552
#10 0x0000000000411272 in main (argc=3, argv=0x7fffffffd8d8) at src/gdb/gdbserver/server.c:3283
The problem is that linux_wait_for_event deletes lwps that have exited
(even those not passed in as lwps of interest), while the lwp/thread
list is being walked on with find_inferior. find_inferior can handle
the current iterated inferior being deleted, but not others.
When killing lwps, we don't really care about any of the pending
status handling of linux_wait_for_event. We can just waitpid the lwps
directly, which is also what GDB does (see
linux-nat.c:kill_wait_callback). This way the lwps are not deleted
while we're walking the list. They'll be deleted by linux_mourn
afterwards.
This crash triggers several times when running the testsuite against
GDBserver with the native-gdbserver board (target remote), but as GDB
can't distinguish between GDBserver crashing and "kill" being
sucessful, as in both cases the connection is closed (the 'k' packet
doesn't require a reply), and the inferior is gone, that results in no
FAIL.
The patch adds a generic test that catches the issue with
extended-remote mode (and works fine with native testing too). Here's
how it fails with the native-extended-gdbserver board without the fix:
(gdb) info threads
Id Target Id Frame
6 Thread 15367.15374 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
5 Thread 15367.15373 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
4 Thread 15367.15372 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
3 Thread 15367.15371 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
2 Thread 15367.15370 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
* 1 Thread 15367.15367 main () at .../gdb.threads/kill.c:52
(gdb) kill
Kill the program being debugged? (y or n) y
Remote connection closed
^^^^^^^^^^^^^^^^^^^^^^^^
(gdb) FAIL: gdb.threads/kill.exp: kill
Extended remote should remain connected after the kill.
gdb/gdbserver/
2014-07-11 Pedro Alves <palves@redhat.com>
* linux-low.c (kill_wait_lwp): New function, based on
kill_one_lwp_callback, but use my_waitpid directly.
(kill_one_lwp_callback, linux_kill): Use it.
gdb/testsuite/
2014-07-11 Pedro Alves <palves@redhat.com>
* gdb.threads/kill.c: New file.
* gdb.threads/kill.exp: New file.
Adrian Sendroiu [Fri, 11 Jul 2014 09:51:48 +0000 (10:51 +0100)]
remote: call remote_check_symbols after attaching
When debugging a remote bare-metal target with "target
extended-remote" + attach, GDB won't send a qSymbol packet to initiate
symbol lookup. This happens because all the previous places in which
GDB might have done this are guarded by conditions that don't hold in
the said scenario: there are no shared libraries, no vsyscall page and
the binary file didn't change in the time passed between the "file"
and the "attach" commands.
To solve this problem remote_check_symbols is called in the
target_post_attach hook.
gdb/
2014-07-11 Adrian Sendroiu <adrian.sendroiu@freescale.com>
* remote.c (extended_remote_post_attach): New function.
(init_extended_remote_ops): Install it as to_post_attach method.
Alan Modra [Fri, 11 Jul 2014 00:01:14 +0000 (09:31 +0930)]
daily update
Doug Evans [Thu, 10 Jul 2014 19:30:05 +0000 (12:30 -0700)]
Revert gdbthread.h (any_running): Declare.
Not properly marked as 1/2.
This reverts commit
1a76d598884a052dacd8feb49f1999e1a0d537f1.
Doug Evans [Thu, 10 Jul 2014 18:15:32 +0000 (11:15 -0700)]
* gdbthread.h (any_running): Declare.
* thread.c (any_running): New function.
Max Filippov [Wed, 9 Jul 2014 21:47:33 +0000 (01:47 +0400)]
Fix xtensa ld segfault when linking linux modules
is_inconsistent_linkonce_section makes an assumption that section name
that starts with ".gnu.linkonce.prop." has one more dot in its suffix.
However gas generates such section name by insertion of "prop." right
after ".gnu.linkonce." part of the name of the original section. So, for
section named ".gnu.linkonce.this_module" corresponding property section
name does not satisfy the assumption. Such section names are common in
linux modules. This bug was exposed by the patch "a35d5e8 Fix alignment
for the first section frag on xtensa", that makes gas produce property
section for each section that has ".align" directive in it.
Use suffix that immediately follows ".gnu.linkonce.prop." when there are
no more dots following it.
2014-07-10 Max Filippov <jcmvbkbc@gmail.com>
ld/
* emultempl/xtensaelf.em (is_inconsistent_linkonce_section):
correctly handle missing dot in section name after
".gnu.linkonce.prop.".