Maciej W. Rozycki [Wed, 10 Aug 2016 19:44:03 +0000 (20:44 +0100)]
MIPS/BFD: Actually produce short microMIPS LA25 stubs
For the case where a function which requires an LA25 stub is at the
beginning of a section we use a short sequence comprised of a LUI/ADDIU
instruction pair only and prepended to the associated function rather
than using a trailing jump to reach the function. This works by
checking for the offset into section of the function symbol being 0.
This is however never the case for microMIPS function symbols, which
have the ISA bit set. Consequently the short LA25 sequence is never
produced for microMIPS functions, like with the following example:
$ cat la25a.s
.abicalls
.global f1
.ent f1
f1:
.set noreorder
.cpload $25
.set reorder
.option pic0
jal f2
.option pic2
jr $31
.end f1
.global f2
.ent f2
f2:
jr $31
.end f2
$ cat la25b.s
.abicalls
.option pic0
.global __start
.ent __start
__start:
jal f1
jal f2
.end __start
$ as -mmicromips -32 -EB -o la25a.o la25a.s
$ as -mmicromips -32 -EB -o la25b.o la25b.s
$ ld -melf32btsmip -o la25 la25a.o la25b.o
$ objdump -d la25
la25: file format elf32-tradbigmips
Disassembly of section .text:
004000d0 <.pic.f2>:
4000d0: 41b9 0040 lui t9,0x40
4000d4: d420 0083 j 400106 <f2>
4000d8: 3339 0107 addiu t9,t9,263
4000dc: 0000 0000 nop
004000e0 <.pic.f1>:
4000e0: 41b9 0040 lui t9,0x40
4000e4: d420 0078 j 4000f0 <f1>
4000e8: 3339 00f1 addiu t9,t9,241
4000ec: 0000 0000 nop
004000f0 <f1>:
4000f0: 41bc 0002 lui gp,0x2
4000f4: 339c 801f addiu gp,gp,-32737
4000f8: 033c e150 addu gp,gp,t9
4000fc: f420 0083 jal 400106 <f2>
400100: 0000 0000 nop
400104: 45bf jrc ra
00400106 <f2>:
400106: 45bf jrc ra
...
00400110 <__start>:
400110: f420 0070 jal 4000e0 <.pic.f1>
400114: 0000 0000 nop
400118: f420 0068 jal 4000d0 <.pic.f2>
40011c: 0000 0000 nop
$
where `.pic.f1' could omit the trailing jump and the filler NOP and just
fall through to `f1'.
Correct the problem by masking out the ISA bit from microMIPS functions,
which fixes the earlier example:
$ objdump -d la25
la25: file format elf32-tradbigmips
Disassembly of section .text:
004000d0 <.pic.f2>:
4000d0: 41b9 0040 lui t9,0x40
4000d4: d420 0083 j 400106 <f2>
4000d8: 3339 0107 addiu t9,t9,263
...
004000e8 <.pic.f1>:
4000e8: 41b9 0040 lui t9,0x40
4000ec: 3339 00f1 addiu t9,t9,241
004000f0 <f1>:
4000f0: 41bc 0002 lui gp,0x2
4000f4: 339c 801f addiu gp,gp,-32737
4000f8: 033c e150 addu gp,gp,t9
4000fc: f420 0083 jal 400106 <f2>
400100: 0000 0000 nop
400104: 45bf jrc ra
00400106 <f2>:
400106: 45bf jrc ra
...
00400110 <__start>:
400110: f420 0074 jal 4000e8 <.pic.f1>
400114: 0000 0000 nop
400118: f420 0068 jal 4000d0 <.pic.f2>
40011c: 0000 0000 nop
$
There is no need to do anything for MIPS16 functions, because if any
LA25 stub has been generated for such a function, then it is only
required for an associated call thunk only, which is regular MIPS code
and the address of which, with the ISA bit clear, is returned by
`mips_elf_get_la25_target'.
This problem has been there since the beginning of microMIPS support:
commit
df58fc944dbc6d5efd8d3826241b64b6af22f447
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sun Jul 24 14:20:15 2011 +0000
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS:
microMIPS ASE support").
bfd/
* elfxx-mips.c (mips_elf_add_la25_stub): Clear the ISA bit of
the stub address retrieved if associated with a microMIPS
function.
Maciej W. Rozycki [Wed, 10 Aug 2016 19:03:02 +0000 (20:03 +0100)]
MIPS/BFD: Add microMIPS annotation to LA25 stub symbols
Fix a problem with missing microMIPS symbol annotation with microMIPS
LA25 stub symbols. The consequence of the issue is these symbols appear
in the symbol table as regular MIPS symbols with the ISA bit set, as
shown with the example below:
$ cat la25a.s
.abicalls
.global f1
.ent f1
f1:
.set noreorder
.cpload $25
.set reorder
.option pic0
jal f2
.option pic2
jr $31
.end f1
.global f2
.ent f2
f2:
jr $31
.end f2
$ cat la25b.s
.abicalls
.option pic0
.global __start
.ent __start
__start:
jal f1
jal f2
.end __start
$ as -mmicromips -32 -EB -o la25a.o la25a.s
$ as -mmicromips -32 -EB -o la25b.o la25b.s
$ ld -melf32btsmip -o la25 la25a.o la25b.o
$ readelf -s la25
Symbol table '.symtab' contains 18 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00400098 0 SECTION LOCAL DEFAULT 1
2:
004000b0 0 SECTION LOCAL DEFAULT 2
3:
004000d0 0 SECTION LOCAL DEFAULT 3
4:
00000000 0 SECTION LOCAL DEFAULT 4
5:
00000000 0 SECTION LOCAL DEFAULT 5
6:
00418110 0 NOTYPE LOCAL DEFAULT 3 _gp
7:
004000e1 16 FUNC LOCAL DEFAULT 3 .pic.f1
8:
004000d1 16 FUNC LOCAL DEFAULT 3 .pic.f2
9:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata
10:
00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start
11:
00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2
12:
004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext
13:
00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start
14:
004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1
15:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata
16:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _end
17:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss
$
where microMIPS annotation is missing for `.pic.f1' and `.pic.f2' even
though these stubs are associated with microMIPS functions `f1' and `f2'
respectively.
Add the missing annotation then, by copying it from the function symbol
an LA25 stub is associated with, correcting the example above:
$ readelf -s la25
Symbol table '.symtab' contains 18 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00400098 0 SECTION LOCAL DEFAULT 1
2:
004000b0 0 SECTION LOCAL DEFAULT 2
3:
004000d0 0 SECTION LOCAL DEFAULT 3
4:
00000000 0 SECTION LOCAL DEFAULT 4
5:
00000000 0 SECTION LOCAL DEFAULT 5
6:
00418110 0 NOTYPE LOCAL DEFAULT 3 _gp
7:
004000e0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f1
8:
004000d0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f2
9:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata
10:
00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start
11:
00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2
12:
004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext
13:
00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start
14:
004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1
15:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata
16:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _end
17:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss
$
This problem has been there since the beginning of microMIPS support:
commit
df58fc944dbc6d5efd8d3826241b64b6af22f447
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sun Jul 24 14:20:15 2011 +0000
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS:
microMIPS ASE support").
bfd/
* elfxx-mips.c (mips_elf_create_stub_symbol): For a microMIPS
stub also add STO_MICROMIPS annotation.
Maciej W. Rozycki [Wed, 10 Aug 2016 11:43:18 +0000 (12:43 +0100)]
MIPS/BFD: Set the ISA bit in microMIPS LA25 stub references
Fix a linker regression introduced with commit
9d862524f6ae ("MIPS:
Verify the ISA mode and alignment of branch and jump targets") causing a
build failure in microMIPS glibc where the `zdump' tool fails to link:
.../timezone/zdump.o: In function `yeartot':
.../timezone/zdump.c:758:(.text+0x62): Jump to a non-instruction-aligned address
.../timezone/zdump.c:758:(.text+0x76): Jump to a non-instruction-aligned address
.../timezone/zdump.c:768:(.text+0x112): Jump to a non-instruction-aligned address
.../timezone/zdump.c:774:(.text+0x1b8): Jump to a non-instruction-aligned address
.../timezone/zdump.c:774:(.text+0x1cc): Jump to a non-instruction-aligned address
collect2: error: ld returned 1 exit status
make[2]: *** [.../timezone/zdump] Error 1
The cause of the failure is the stricter check introduced with the said
change for jump and branch targets tripping on the address of microMIPS
LA25 stubs. Despite being microMIPS code these stubs do not have the
ISA bit set throughout the relocation calculation process, because they
have their address set to the memory offset into the stub section they
are placed in.
The `mips_elf_la25_stub' structure does not carry ISA mode information,
but there is no need to extend it, because the ISA mode can be inferred
from the original symbol, which will have STO_MICROMIPS annotation, so
use that instead to set the ISA bit appropriately. Also only LA25 stubs
associated with microMIPS symbols need to have the ISA bit set, because
other LA25 stubs are made with regular MIPS code, even if associated
with a MIPS16 symbol (in which case they are needed by a call thunk only
rather than the MIPS16 function proper).
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Set the ISA bit
in microMIPS LA25 stub references.
Руслан Ижбулатов [Wed, 10 Aug 2016 18:22:45 +0000 (19:22 +0100)]
Support setting thread names (MS-Windows)
This is done by catching an exception number 0x406d1388 (it has no
documented name, though MSDN dubs it "MS_VC_EXCEPTION" in one code
example), which is thrown by the program. The exception record
contains an ID of a thread and a name to give it.
This requires rolling back some changes in handle_exception(), which
now again returns more than two distinct values. The new
HANDLE_EXCEPTION_IGNORED value means that gdb should just continue,
without returning the thread ID up the stack (which would result in
further handling of the exception, which is not what we want).
gdb/ChangeLog:
2016-08-10 Руслан Ижбулатов <lrn1986@gmail.com>
Pedro Alves <palves@redhat.com>
* windows-nat.c (MS_VC_EXCEPTION): New define.
(handle_exception_result): New enum.
(windows_delete_thread): Free the thread's name.
(handle_exception): Handle MS_VC_EXCEPTION.
(get_windows_debug_event): Handle HANDLE_EXCEPTION_IGNORED.
(windows_thread_name): New function.
(windows_target): Install it as to_thread_name method.
* NEWS: Mention the thread naming support on MS-Windows.
Cary Coutant [Wed, 10 Aug 2016 17:57:42 +0000 (10:57 -0700)]
Fix extraneous complaints about missing expected TLS relocation.
With some versions of gas, the call to tls_get_addr uses a GOTPCREL
relocation instead of a GOTPCRELX relocation. We should allow for that
when skip_call_tls_get_addr_ is true. We should also build the test
objects with the in-tree assembler.
This patch also fixes some cascading error messages caused by not
resetting the skip_call_tls_get_addr_ flag after printing the error.
gold/
PR gold/20216
* x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
(pr20216_ld.o): Likewise.
* testsuite/Makefile.in: Regenerate.
James Clarke [Wed, 10 Aug 2016 16:58:01 +0000 (09:58 -0700)]
Fix potential crashes when Target::make_symbol() returns NULL.
2016-08-10 James Clarke <jrtc27@jrtc27.com>
gold/
PR gold/20443
* symtab.cc (Symbol_table::add_from_relobj): Handle NULL symbols,
which will be present for STT_SPARC_REGISTER.
(Symbol_table::add_from_pluginobj): Likewise.
(Symbol_table::add_from_dynobj): Likewise.
(Symbol_table::add_from_incrobj): Removed dead code.
James Clarke [Wed, 10 Aug 2016 16:47:45 +0000 (09:47 -0700)]
Fix improper handling of R_SPARC_GOTDATA_OP_LOX10 relocation.
The fall-through in Target_sparc::Relocate::relocate for
R_SPARC_GOTDATA_OP_LOX10 is currently R_SPARC_GOT13, but should
clearly be R_SPARC_GOT10. GCC has been seen to emit a sethi/xor
rather than a sethi/or sequence to load a 32-bit immediate, but
if R_SPARC_GOT13 is used then bits 10-12 get zeroed out as both
the sethi and xor immediates contain them.
gold/
PR gold/20442
* sparc.cc (Target_sparc::Relocate::relocate): R_SPARC_GOTDATA_OP_LOX10
should fall back on R_SPARC_GOT10, not R_SPARC_GOT13.
James Clarke [Wed, 10 Aug 2016 16:42:39 +0000 (09:42 -0700)]
Add support for R_SPARC_32 relocation.
gold/
PR gold/20441
* sparc.cc (Target_sparc::Scan::check_non_pic): Allow R_SPARC_32 on
sparc64.
Pedro Alves [Wed, 10 Aug 2016 15:06:57 +0000 (16:06 +0100)]
Quiet ARI gettext checks
The ARI complains about this new file:
common/signals-state-save-restore.c:46: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:59: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:87: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:92: warning: gettext: All messages should be marked up with _.
Since these are untranslatable strings, use () instead of _().
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
* common/signals-state-save-restore.c
(save_original_signals_state, restore_original_signals_state):
Wrap perror_with_name arguments with '()'.
GDB Administrator [Wed, 10 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 9 Aug 2016 23:41:12 +0000 (16:41 -0700)]
Skip LTO tests for --disable-plugin
Don't run LTO tests if compiler is configured with --disable-plugin.
PR ld/20436
* testsuite/lib/ld-lib.exp (check_gcc_plugin_enabled): New
proc.
(check_lto_available): Return 0 if check_gcc_plugin_enabled
returns 0.
(check_lto_fat_available): Likewise.
(check_lto_shared_available): Likewise.
Pedro Alves [Tue, 9 Aug 2016 21:45:40 +0000 (22:45 +0100)]
Fix PR gdb/20418 - Problems with synchronous commands and new-ui
When executing commands on a secondary UI running the MI interpreter,
some commands that should be synchronous are not. MI incorrectly
continues processing input right after the synchronous command is
sent, before the target stops.
The problem happens when we emit MI async events (=library-loaded,
etc.), and we go about restoring the previous terminal state, we end
up calling target_terminal_ours, which incorrectly always installs the
current UI's input_fd in the event loop... That is, code like this:
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "library-loaded");
...
do_cleanups (old_chain);
The fix is to move the add_file_handler/delete_file_handler calls out
of target_terminal_$foo, making these completely no-ops unless called
with the main UI as current UI.
gdb/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/20418
* event-top.c (ui_register_input_event_handler)
(ui_unregister_input_event_handler): New functions.
(async_enable_stdin): Register input in the event loop.
(async_disable_stdin): Unregister input from the event loop.
(gdb_setup_readline): Register input in the event loop.
* infrun.c (check_curr_ui_sync_execution_done): Register input in
the event loop.
* target.c (target_terminal_inferior): Don't unregister input from
the event loop.
(target_terminal_ours): Don't register input in the event loop.
* target.h (target_terminal_inferior)
(target_terminal_ours_for_output, target_terminal_ours): Update
comments.
* top.h (ui_register_input_event_handler)
(ui_unregister_input_event_handler): New declarations.
* utils.c (ui_unregister_input_event_handler_cleanup)
(prepare_to_handle_input): New functions.
(defaulted_query, prompt_for_continue): Use
prepare_to_handle_input.
gdb/testsuite/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
Simon Marchi <simon.marchi@ericsson.com>
PR gdb/20418
* gdb.mi/new-ui-mi-sync.c, gdb.mi/new-ui-mi-sync.exp: New files.
* lib/mi-support.exp (mi_expect_interrupt): Remove anchors.
Pedro Alves [Tue, 9 Aug 2016 21:45:39 +0000 (22:45 +0100)]
Fix PR mi/20431 - Missing MI prompts after sync execution MI command (-exec-continue, etc.) errors
gdb 7.11 introduced an MI regression: a failing MI sync execution
command misses printing the MI prompt, and then all subsequent command
miss it too:
$ gdb-7.11.1 -i=mi
[...]
p 1
&"p 1\n"
~"$1 = 1"
~"\n"
^done
(gdb) <<< prompted ok
-exec-continue
^error,msg="The program is not being run." <<< missing prompt after this
print 1
&"print 1\n"
~"$2 = 1"
~"\n"
^done <<< missing prompt after this
gdb 7.10.1 behaved correctly, even with "set mi-async on":
-exec-continue
^error,msg="The program is not being run."
(gdb) <<< prompted ok
etc.
Bisecting points at:
commit
0b333c5e7d6c
Author: Pedro Alves <palves@redhat.com>
Date: Wed Sep 9 18:23:23 2015 +0100
Merge async and sync code paths some more
[...]
The problem is that when an exception is thrown, we leave the prompt
state set to PROMPT_BLOCKED, and then mi_execute_command_input_handler
doesn't print the prompt. It used to work because before that patch,
we happened to skip disabling stdin if the current target didn't do
async (which it never does before execution).
I was surprised to find that this bug isn't caught by the testsuite,
so I made a thorough test that tests all combinations of pairs of:
- a failing synchronous execution command
- a failing non-execution command
- a non-failing command
gdb/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR mi/20431
* mi/mi-main.c (mi_execute_command): Enable input and set prompt
state to PROMPT_NEEDED.
gdb/testsuite/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR mi/20431
* gdb.mi/mi-cmd-error.exp: New file.
Pedro Alves [Tue, 9 Aug 2016 19:16:20 +0000 (20:16 +0100)]
Fix PR gdb/18653: gdb disturbs inferior's inherited signal dispositions
gdb's (or gdbserver's) own signal handling should not interfere with
the signal dispositions their spawned children inherit. However, it
currently does. For example, some paths in gdb cause SIGPIPE to be
set to SIG_IGN, and as consequence, the child starts with SIGPIPE to
set to SIG_IGN too, even though gdb was started with SIGPIPE set to
SIG_DFL.
This is because the exec family of functions does not reset the signal
disposition of signals that are set to SIG_IGN:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html
Signals set to the default action (SIG_DFL) in the calling process
image are set to the default action in the new process
image. Signals set to be ignored (SIG_IGN) by the calling process
image are set to be ignored by the new process image. Signals set to
be caught by the calling process image are set to the default action
in the new process image (see <signal.h>).
And neither does it reset signal masks or flags.
In order to be transparent, when spawning new child processes to debug
(with "run", etc.), reset signal actions and mask back to what was
originally inherited from gdb/gdbserver's parent, just before execing
the target program to debug.
gdb/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* Makefile.in (SFILES): Add
common/signals-state-save-restore.c.
(HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h.
(COMMON_OBS): Add signals-state-save-restore.o.
(signals-state-save-restore.o): New rule.
* configure: Regenerate.
* fork-child.c: Include "signals-state-save-restore.h".
(fork_inferior): Call restore_original_signals_state.
* main.c: Include "signals-state-save-restore.h".
(captured_main): Call save_original_signals_state.
* common/common.m4: Add sigaction to AC_CHECK_FUNCS checks.
* common/signals-state-save-restore.c: New file.
* common/signals-state-save-restore.h: New file.
gdb/gdbserver/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* Makefile.in (OBS): Add signals-state-save-restore.o.
(signals-state-save-restore.o): New rule.
* config.in: Regenerate.
* configure: Regenerate.
* linux-low.c: Include "signals-state-save-restore.h".
(linux_create_inferior): Call
restore_original_signals_state.
* server.c: Include "dispositions-save-restore.h".
(captured_main): Call save_original_signals_state.
gdb/testsuite/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* gdb.base/signals-state-child.c: New file.
* gdb.base/signals-state-child.exp: New file.
* gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern.
Roland McGrath [Tue, 9 Aug 2016 19:09:17 +0000 (12:09 -0700)]
Support -pie for arm*-eabi targets.
ld/
* emulparams/armelf.sh (GENERATE_PIE_SCRIPT): Set to yes.
Jiaming Wei [Tue, 9 Aug 2016 15:18:42 +0000 (16:18 +0100)]
Correct the calculation of the use_counts of merged .got entries.
* elf64-alpha.c (elf64_alpha_copy_indirect_symbol): Fix thinko
adjusting the use_count of merged .got entries.
Pedro Alves [Tue, 9 Aug 2016 11:04:48 +0000 (12:04 +0100)]
Fix PR gdb/20295: GDB segfaults printing bitfield member of optimized out value
With something like:
struct A { int bitfield:4; } var;
If 'var' ends up wholly-optimized out, printing 'var.bitfield' crashes
gdb here:
(top-gdb) bt
#0 0x000000000058b89f in extract_unsigned_integer (addr=0x2 <error: Cannot access memory at address 0x2>, len=2, byte_order=BFD_ENDIAN_LITTLE)
at /home/pedro/gdb/mygit/src/gdb/findvar.c:109
#1 0x00000000005a187a in unpack_bits_as_long (field_type=0x16cff70, valaddr=0x0, bitpos=16, bitsize=12) at /home/pedro/gdb/mygit/src/gdb/value.c:3347
#2 0x00000000005a1b9d in unpack_value_bitfield (dest_val=0x1b5d9d0, bitpos=16, bitsize=12, valaddr=0x0, embedded_offset=0, val=0x1b5d8d0)
at /home/pedro/gdb/mygit/src/gdb/value.c:3441
#3 0x00000000005a2a5f in value_fetch_lazy (val=0x1b5d9d0) at /home/pedro/gdb/mygit/src/gdb/value.c:3958
#4 0x00000000005a10a7 in value_primitive_field (arg1=0x1b5d8d0, offset=0, fieldno=0, arg_type=0x16d04c0) at /home/pedro/gdb/mygit/src/gdb/value.c:3161
#5 0x00000000005b01e5 in do_search_struct_field (name=0x1727c60 "bitfield", arg1=0x1b5d8d0, offset=0, type=0x16d04c0, looking_for_baseclass=0, result_ptr=0x7fffffffcaf8,
[...]
unpack_value_bitfield is already optimized-out/unavailable -aware:
(...) VALADDR points to the contents of VAL. If the VAL's contents
required to extract the bitfield from are unavailable/optimized
out, DEST_VAL is correspondingly marked unavailable/optimized out.
however, it is not considering the case of the value having no
contents buffer at all, as can happen through
allocate_optimized_out_value.
gdb/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
* value.c (unpack_value_bitfield): Skip unpacking if the parent
has no contents buffer to begin with.
gdb/testsuite/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
* gdb.dwarf2/bitfield-parent-optimized-out.exp: New file.
GDB Administrator [Tue, 9 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 8 Aug 2016 14:09:46 +0000 (15:09 +0100)]
Regenerate some target description files
I regenerated all target description .c files from scratch, and got
this spurious diff.
It's a simple mid-air collision - these files were clearly generated
before commit
73b4f516a037 ("maint_print_c_tdesc_cmd: Use type for
TYPE_CODE_FLAGS instead of field_type."), which did the global
s/field_type/type/, and pushed to master afterwards.
gdb/features/ChangeLog:
2016-08-08 Pedro Alves <palves@redhat.com>
* features/i386/amd64-avx-mpx-linux.c: Regenerate.
* features/i386/amd64-avx-mpx.c: Regenerate.
* features/i386/i386-avx-mpx-linux.c: Regenerate.
* features/i386/i386-avx-mpx.c: Regenerate.
Nick Clifton [Mon, 8 Aug 2016 12:20:04 +0000 (13:20 +0100)]
Fix seg-faults when running readelf on fuzzed binaries.
PR binutils/20440
* dwarf.c (display_debug_lines_decoded): Add checks for running
off the end of the section when populating the directory table and
file table.
(frame_display_row): Set max_regs equal to ncols.
(load_specific_debug_section): If the section is compressed, but
it is not big enough to hold a compression header then warn and
return 0.
Nick Clifton [Mon, 8 Aug 2016 11:19:29 +0000 (12:19 +0100)]
Fix memory leaks in chew program.
* doc/chew.c (delete_string): Only free the string buffer if it is
there. Mark the buffer as NULL after freeing.
(drop): Free the dropped string.
(free_words): New function: Frees the memory allocated to the
dictionary.
(add_instrinsic): Duplicate the name string, so that it can be
freed later on.
(compile): Free unused words.
(main): Free the dictionary and top level string buffers at the
end.
Nick Clifton [Mon, 8 Aug 2016 08:34:32 +0000 (09:34 +0100)]
Fix seg-fault in DWARF dumper when given a corrupt binary containing illegal directory and file table indicies.
PR binutils/20439
* dwarf.c (display_debug_lines_decoded): Check directory and file
indicies before using them to access directory and file tables.
GDB Administrator [Mon, 8 Aug 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 7 Aug 2016 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 6 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 5 Aug 2016 20:26:18 +0000 (16:26 -0400)]
Remove unused cli_command_loop declaration
This declaration is not used anymore.
gdb/ChangeLog:
* event-top.h (cli_command_loop): Remove.
H.J. Lu [Fri, 5 Aug 2016 20:15:16 +0000 (13:15 -0700)]
Add missing ChangLog enrtry
Pedro Alves [Fri, 5 Aug 2016 18:54:11 +0000 (19:54 +0100)]
Fix PR remote/20398: File-IO write always outputs "Quit"
Commit
bb7c96deb1a1 ("gdb/remote-fileio.c: Eliminate custom SIGINT
signal handler") regressed the File-IO support.
Failed output:
(gdb) target remote :8888
Remote debugging using :8888
0x00008098 in _start ()
(gdb) c
Continuing.
Quit
Quit
Quit
Quit
Quit
Quit
Quit
Quit
Quit
Quit
Quit
[Inferior 1 (Remote target) exited normally]
Expected output:
(gdb) target remote :8888
Remote debugging using :8888
0x00008098 in _start ()
(gdb) c
Continuing.
i: 0
i: 1
i: 2
i: 3
i: 4
i: 5
i: 6
i: 7
i: 8
i: 9
[Inferior 1 (Remote target) exited normally]
The problem that the new File-IO quit handler forgets to check the
quit flag before calling throwing a quit.
gdb/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
PR remote/20398
* remote-fileio.c (remote_fileio_quit_handler): Check the quit
flag before calling quit.
Pedro Alves [Fri, 5 Aug 2016 16:09:31 +0000 (17:09 +0100)]
gdb/NEWS: Mention that C++ is now the default
gdb/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
* NEWS: Mention that GDB and GDBserver build with a C++ compiler
by default.
Pedro Alves [Fri, 5 Aug 2016 15:54:29 +0000 (16:54 +0100)]
gdb/configure --help: suggest --disable-build-with-cxx instead of --enable...
We build by default with a C++ compiler, but "configure --help" still
says "--enable-build-with-cxx", which hints that it is by default
disabled. Update the --help text.
gdb/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
* build-with-cxx.m4: Change help string to be in terms of
--disable-build-with-cxx.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
* configure: Regenerate.
Nick Clifton [Fri, 5 Aug 2016 10:26:13 +0000 (11:26 +0100)]
Ensure ARM VPUSH and VPOP instructions do not affect more than 16 registers.
PR gas/20429
* config/tc-arm.c (do_vfp_nsyn_push): Check that no more than 16
registers are pushed.
(do_vfp_nsyn_pop): Check that no more than 16 registers are
popped.
* testsuite/gas/arm/pr20429.s: New test.
* testsuite/gas/arm/pr20429.d: New test driver.
* testsuite/gas/arm/pr20429.1: Expected error output.
Nick Clifton [Fri, 5 Aug 2016 09:37:57 +0000 (10:37 +0100)]
Fix the generation of alignment frags in code sections for AArch64.
PR gas/20364
* config/tc-aarch64.c (s_ltorg): Change the mapping state after
aligning the frag.
(aarch64_init): Treat rs_align frags in code sections as
containing code, not data.
* testsuite/gas/aarch64/pr20364.s: New test.
* testsuite/gas/aarch64/pr20364.d: New test driver.
GDB Administrator [Fri, 5 Aug 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Thomas Preud'homme [Thu, 4 Aug 2016 14:54:57 +0000 (15:54 +0100)]
2016-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add one parameter.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf32_arm_link_hash_table): Declare new
cmse_implib field.
(bfd_elf32_arm_set_target_relocs): Add new parameter to initialize
cmse_implib field in struct elf32_arm_link_hash_table.
(elf32_arm_filter_cmse_symbols): New function.
(elf32_arm_filter_implib_symbols): Likewise.
(elf_backend_filter_implib_symbols): Define to
elf32_arm_filter_implib_symbols.
ld/
* emultempl/armelf.em (cmse_implib): Declare and define this new
static variable.
(arm_elf_create_output_section_statements): Add new cmse_implib
parameter.
(OPTION_CMSE_IMPLIB): Define macro.
(PARSE_AND_LIST_LONGOPTS): Add entry for new --cmse-implib switch.
(PARSE_AND_LIST_OPTIONS): Likewise.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_CMSE_IMPLIB case.
* ld.texinfo (--cmse-implib): Document new option.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway import library generation): New test.
(Secure gateway import library generation: errors): Likewise.
* testsuite/ld-arm/cmse-implib.s: New file.
* testsuite/ld-arm/cmse-implib-errors.out: Likewise.
* testsuite/ld-arm/cmse-implib.rd: Likewise.
Thomas Preud'homme [Thu, 4 Aug 2016 14:36:52 +0000 (15:36 +0100)]
2016-08-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* elf32-arm.c (CMSE_PREFIX): Define macro.
(elf32_arm_stub_cmse_branch_thumb_only): Define stub sequence.
(cmse_branch_thumb_only): Declare stub.
(struct elf32_arm_link_hash_table): Define cmse_stub_sec field.
(elf32_arm_get_plt_info): Add globals parameter. Use it to return
FALSE if there is no PLT.
(arm_type_of_stub): Adapt to new elf32_arm_get_plt_info signature.
(elf32_arm_final_link_relocate): Likewise.
(elf32_arm_gc_sweep_hook): Likewise.
(elf32_arm_gc_mark_extra_sections): Mark sections holding ARMv8-M
secure entry functions.
(arm_stub_is_thumb): Add case for arm_stub_cmse_branch_thumb_only.
(arm_dedicated_stub_output_section_required): Change to a switch case
and add a case for arm_stub_cmse_branch_thumb_only.
(arm_dedicated_stub_output_section_required_alignment): Likewise.
(arm_stub_dedicated_output_section_name): Likewise.
(arm_stub_dedicated_input_section_ptr): Likewise and remove
ATTRIBUTE_UNUSED for htab parameter.
(arm_stub_required_alignment): Likewise.
(arm_stub_sym_claimed): Likewise.
(arm_dedicated_stub_section_padding): Likewise.
(cmse_scan): New function.
(elf32_arm_size_stubs): Call cmse_scan for ARM M profile targets.
Set stub_changed to TRUE if such veneers were created.
(elf32_arm_swap_symbol_in): Add detection code for CMSE special
symbols.
include/
* arm.h (ARM_GET_SYM_CMSE_SPCL): Define macro.
(ARM_SET_SYM_CMSE_SPCL): Likewise.
ld/
* ld.texinfo (Placement of SG veneers): New concept entry.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway veneers: no .gnu.sgstubs section): New test.
(Secure gateway veneers: wrong entry functions): Likewise.
(Secure gateway veneers (ARMv8-M Baseline)): Likewise.
(Secure gateway veneers (ARMv8-M Mainline)): Likewise.
* testsuite/ld-arm/cmse-veneers.s: New file.
* testsuite/ld-arm/cmse-veneers.d: Likewise.
* testsuite/ld-arm/cmse-veneers.rd: Likewise.
* testsuite/ld-arm/cmse-veneers.sd: Likewise.
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out: Likewise.
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out: Likewise.
Stefan Trleman [Thu, 4 Aug 2016 13:57:23 +0000 (14:57 +0100)]
Fix generation of relocs for 32-bit Sparc Solaris targets.
PR gas/20427
* config/tc-sparc.c (cons_fix_new_sparc): Prevent the generation
of 64-bit relocation types when assembling for a 32-bit Solaris
target.
Yao Qi [Thu, 4 Aug 2016 10:37:57 +0000 (11:37 +0100)]
Determine target description for native aarch64
I find the following test fail when I test native aarch64 gdb with
arm program,
(gdb) PASS: gdb.base/attach-pie-noexec.exp: attach
set architecture arm^M
warning: Selected architecture arm is not compatible with reported target architecture aarch64^M
Architecture `arm' not recognized.^M
The target architecture is set automatically (currently aarch64)^M
(gdb) FAIL: gdb.base/attach-pie-noexec.exp: set architecture arm
GDB thinks the target is aarch64, but it isn't. Nowadays, we are
using some entries AT_PHENT and AT_HWCAP in auxv to determine whether
the process is a 32-bit arm one or 64-bit aarch64 one, and get the
right gdbarch. However, in the process of parsing auxv (in
inf_ptrace_auxv_parse), the size of int and data pointer of
target_gdbarch is used. If debug program exists (in most of cases),
target_gdbarch is already set according to the debug program, which
is arm in my case. Then, GDB can parse auxv successfully. However,
in gdb.base/attach-pie-noexec.exp, the debug program is removed,
target_gdbarch is aarch64 when GDB parse auxv, so GDB can't parse
it successfully.
Instead of using auxv, we check the return value of ptrace NT_ARM_VFP.
If the program is an arm process, NT_ARM_VFP is OK, otherwise, error
is returned.
Additionally, we only return tdesc_arm_with_neon for arm process,
because neon is mandatory on ARMv8.
gdb:
2016-08-04 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (tdesc_arm_with_vfpv3): Remove the
declaration.
(aarch64_linux_read_description): Remove code on getting
auxv and select target description on it. Select target
description by the result of NT_ARM_VFP ptrace request.
Yao Qi [Thu, 4 Aug 2016 09:44:18 +0000 (10:44 +0100)]
Quiet ptrace error ESRCH in regsets_fetch_inferior_registers
When I run process-dies-while-detaching.exp with GDBserver, I see many
warnings printed by GDBserver,
ptrace(regsets_fetch_inferior_registers) PID=26183: No such process
ptrace(regsets_fetch_inferior_registers) PID=26183: No such process
ptrace(regsets_fetch_inferior_registers) PID=26184: No such process
ptrace(regsets_fetch_inferior_registers) PID=26184: No such process
regsets_fetch_inferior_registers is called when GDBserver resumes each
lwp.
#2 0x0000000000428260 in regsets_fetch_inferior_registers (regsets_info=0x4690d0 <aarch64_regsets_info>, regcache=0x31832020)
at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:5412
#3 0x00000000004070e8 in get_thread_regcache (thread=0x31832940, fetch=fetch@entry=1) at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/regcache.c:58
#4 0x0000000000429c40 in linux_resume_one_lwp_throw (info=<optimized out>, signal=0, step=0, lwp=0x31832830)
at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4463
#5 linux_resume_one_lwp (lwp=0x31832830, step=<optimized out>, signal=<optimized out>, info=<optimized out>)
at /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:4573
The is the case that threads are disappeared when GDB/GDBserver resumes
them. We check errno for ESRCH, and don't print error messages, like
what we are doing in regsets_store_inferior_registers.
gdb/gdbserver:
2016-08-04 Yao Qi <yao.qi@linaro.org>
* linux-low.c (regsets_fetch_inferior_registers): Check
errno is ESRCH or not.
GDB Administrator [Thu, 4 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 13 Jun 2016 02:45:29 +0000 (20:45 -0600)]
PR python/18565 - make Frame.function work for inline frames
PR python/18565 notes that calling frame filters don't work properly for
inlined functions. This happens because Frame.function on an inline
frame will yield the wrong result. This patch changes this code to use
find_frame_funname instead, which handles inline frames properly.
Built and regtested on x86-64 Fedora 24.
2016-08-03 Tom Tromey <tom@tromey.com>
PR python/18565:
* python/py-frame.c (frapy_function): Use find_frame_funname.
2016-08-03 Tom Tromey <tom@tromey.com>
PR python/18565:
* gdb.python/py-frame-inline.exp: Add Frame.function test.
Tom Tromey [Wed, 3 Aug 2016 14:27:56 +0000 (08:27 -0600)]
Avoid potential memory leak in find_frame_funname
The PR 18565 thread pointed out that, if cp_remove_params can throw
(we aren't quite sure), then find_frame_funname could leak some
memory. This patch avoids any potential issue by rearranging some
code in find_frame_funname.
Built and regtested on x86-64 Fedora 24.
2016-08-03 Tom Tromey <tom@tromey.com>
* stack.c (find_frame_funname): Avoid any possible leak in case
cp_remove_params can throw.
Tom Tromey [Tue, 2 Aug 2016 22:52:59 +0000 (16:52 -0600)]
Update NEWS to mention Python breakpoint events
An earlier patch added three new breakpoint-related events to the
Python API. However, at that time, I forgot to update NEWS. This
patch supplies the missing entry.
2016-08-03 Tom Tromey <tom@tromey.com>
* NEWS: Mention new Python breakpoint events.
GDB Administrator [Wed, 3 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 2 Aug 2016 22:58:37 +0000 (16:58 -0600)]
Add myself as Rust maintainer
A while ago, Pedro announced that I would be the Rust maintainer for
gdb. However, I neglected to update the MAINTAINERS file until now.
2016-08-02 Tom Tromey <tom@tromey.com>
* MAINTAINERS (Core): Add self as Rust maintainer.
Yao Qi [Tue, 2 Aug 2016 15:04:09 +0000 (16:04 +0100)]
[GDBserver] Remove td_ta_event_addr td_ta_set_event and td_ta_event_getmsg
As a result of this commit,
9b4c5f878ff39e04127a1ad95f6b3832afe6d278
(Remove support for thread events without PTRACE_EVENT_CLONE in GDBServer.)
the last usage of td_ta_event_addr td_ta_set_event and
td_ta_event_getmsg were removed. They are no longer used. This patch
is to remove them.
gdb/gdbserver:
2016-08-02 Yao Qi <yao.qi@linaro.org>
* thread-db.c (struct thread_db) <td_ta_event_getmsg_p>: Remove.
<td_ta_set_event_p, td_ta_event_addr_p>: Remove.
(thread_db_load_search): Update.
(try_thread_db_load_1): Don't look for td_ta_event_addr,
td_ta_set_event and td_ta_event_getmsg.
Alan Modra [Tue, 2 Aug 2016 13:58:47 +0000 (23:28 +0930)]
PowerPC64 ld segfault with code in non-executable sections
PR ld/20428
* elf64-ppc.c (ppc_get_stub_entry): Don't segfault on NULL group.
Nick Clifton [Tue, 2 Aug 2016 12:26:28 +0000 (13:26 +0100)]
Synchronize libiberty sources with FSF GCC mainline version.
include * libiberty.h (MAX_ALLOCA_SIZE): New macro.
libiberty * make-relative-prefix.c (make_relative_prefix_1): Fall back to
malloc if alloca argument is greater than MAX_ALLOCA_SIZE.
* cp-demangle.c (cplus_demangle_operators): Add f[lrLR].
(d_expression_1): Handle them.
(d_maybe_print_fold_expression): New.
(d_print_comp_inner): Use it.
(d_index_template_argument): Handle negative index.
* cp-demangle.c (cplus_demangle_operators): Add sP and sZ.
(d_print_comp_inner): Handle them.
(d_template_args_1): Split out from d_template_args.
(d_args_length): New.
PR c++/70926
* cplus-dem.c: Handle large values and overflow when demangling
length variables.
(demangle_template_value_parm): Read only until end of mangled string.
(do_hpacc_template_literal): Likewise.
(do_type): Handle overflow when demangling array indices.
* cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length
VLAs.
PR c++/70498
* cp-demangle.c (d_expression_1): Formatting fix.
* cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference
constant.
(demangle_template_value_parm): Handle tk_rvalue_reference
type kind.
(do_type): Support 'O' type id (rvalue references).
* testsuite/demangle-expected: Add tests.
PR c++/70498
* cp-demangle.c: Parse numbers as integer instead of long to avoid
overflow after sanity checks. Include <limits.h> if available.
(INT_MAX): Define if necessary.
(d_make_template_param): Takes integer argument instead of long.
(d_make_function_param): Likewise.
(d_append_num): Likewise.
(d_identifier): Likewise.
(d_number): Parse as and return integer.
(d_compact_number): Handle overflow.
(d_source_name): Change variable type to integer for parsed number.
(d_java_resource): Likewise.
(d_special_name): Likewise.
(d_discriminator): Likewise.
(d_unnamed_type): Likewise.
* testsuite/demangle-expected: Add regression test cases.
* configure: Remove SH5 support.
PR c++/69687
* cplus-dem.c: Include <limits.h> if available.
(INT_MAX): Define if necessary.
(remember_type, remember_Ktype, register_Btype, string_need):
Abort if we detect cases where we the size of the allocation would
overflow.
PR c++/70492
* cplus-dem.c (gnu_special): Handle case where consume_count returns
-1.
PR c++/67394
PR c++/70481
* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing
btypevec/ktypevec.
* testsuite/demangle-expected: Add coverage tests.
Nick Clifton [Tue, 2 Aug 2016 10:56:55 +0000 (11:56 +0100)]
Fix SH GOT allocation in the presence of linker garbage collection.
PR ld/17739
ld * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Define with
valye 'yes'.
* emulparams/shelf32.sh: Likewise.
* emulparams/shelf32.sh: Likewise.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shelf_vxworks.sh: Likewise.
* emulparams/shelf_vxworks.sh: Likewise.
* emulparams/shlelf32_linux.sh: Likewise.
* emulparams/shlelf32_linux.sh: Likewise.
* emulparams/shlelf_linux.sh: Likewise.
* emulparams/shlelf_linux.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
bfd * elf32-sh.c (sh_elf_gc_sweep_hook): Delete.
(elf_backend_sweep_hook): Delete.
Nick Clifton [Tue, 2 Aug 2016 10:06:28 +0000 (11:06 +0100)]
Avoid compile time warning when building on 32-bit host.
PR binutils/17512
* resbin.c (bin_to_res_version): Cast variables to correct type
for printing in error message.
GDB Administrator [Tue, 2 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Jenner [Mon, 1 Aug 2016 16:42:31 +0000 (09:42 -0700)]
Fix some PowerPC VLE BFD issues and add some PowerPC VLE instructions.
bfd/
* elf32-ppc.c (is_branch_reloc): Recognise VLE branch relocations.
(ppc_elf_howto_raw): Fix dst_mask of R_PPC_VLE_REL15.
(ppc_elf_vle_split16): Clear field before inserting.
opcodes/
* ppc-opc.c (vle_opcodes): Alias 'e_cmpwi' to 'e_cmpi' and
'e_cmplwi' to 'e_cmpli' instead.
(OPVUPRT, OPVUPRT_MASK): Define.
(powerpc_opcodes): Add E200Z4 insns.
(vle_opcodes): Add context save/restore insns.
include/
* opcode/ppc.h (PPC_OPCODE_E200Z4): New define.
Joel Brobecker [Mon, 1 Aug 2016 15:28:26 +0000 (08:28 -0700)]
Update NEWS post GDB 7.12 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Mon, 1 Aug 2016 15:23:20 +0000 (08:23 -0700)]
Bump version to 7.12.50.DATE-git.
Now that the GDB 7.12 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 7.12 branch created (
41bfcd638a4e0e48b96ce4de2845372dea481322):
* version.in: Bump version to 7.12.50.DATE-git.
Yao Qi [Thu, 28 Jul 2016 13:37:02 +0000 (14:37 +0100)]
Swap "single-process" and "multi-process" in process-dies-while-detaching.exp
"single-process" and "multi-process" are used in the test message of
process-dies-while-detaching.exp, but they are misplaced due to
set mode [expr {$multi_process ? "single-process" : "multi-process"}]
This patch is to swap them.
gdb/testsuite:
2016-08-01 Yao Qi <yao.qi@linaro.org>
* gdb.threads/process-dies-while-detaching.exp (do_test): Set
variable mode to "multi-process" if $multi_process is 1, otherwise
set it to "single-process".
Nick Clifton [Mon, 1 Aug 2016 08:59:04 +0000 (09:59 +0100)]
Update Swedish translation in bfd directory.
Yao Qi [Mon, 1 Aug 2016 08:18:02 +0000 (09:18 +0100)]
Tweak gdb.cp tests for aarch32
There are some gdb.cp/ tests fails if the program is compiled for arm
32-bit but GDB/GDBserver is aarch64 64-bit program, because target triplet
doesn't match "arm*-*-*". Instead, we can use is_aarch32_target.
gdb/testsuite:
2016-08-01 Yao Qi <yao.qi@linaro.org>
* gdb.cp/anon-struct.exp: Check is_aarch32_target.
* gdb.cp/cpexprs.exp: Likewise.
* gdb.cp/m-static.exp: Likewise.
GDB Administrator [Mon, 1 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 31 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 30 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Jose E. Marchesi [Wed, 27 Jul 2016 13:59:16 +0000 (06:59 -0700)]
gas: avoid spurious failures in non-ELF targets in the SPARC testsuite.
Many of the existing sparc tests fail in non-ELF targets (coff and
a.out) due to spurious differences in the expected results:
- Unlike ELF, a.out text sections are aligned to 2**3 and padded
accordingly. The padding instruction is a `nop' (01 00 00 00).
- Likewise, coff text sections are also aligned to 2**3 and padded
accordingly. However, the padding instruction in these targets is an
`illtrap 0' (00 00 00 00).
- Unlike ELF, a.out and coff binaries don't contain hardware
capabilities bits that could be used by BFD to determine the opcodes
architecture corresponding to the instructions encoded in the
objects (v9, v9a, v9b, v9c, etc). Consequently, in both a.out and
coff tests we would need to pass proper `-m sparc:vXXX' options when
invoking objdump before comparing results.
In order to fix these issues, the most obvious solution would be to have
three variants of .d files per impacted test. For example, for save.d
we would have: save-elf.d, save-aout.d and save-coff.d. Using the
`#source' directive, a single save.s file would provide the input for
all of them. However, this approach has the following problems:
- The #target and #notarget .d directives are very limited: they use
globs instead of regular expressions, and thus it is not possible (or
too messy) to use them to discriminate between elf, coff and a.out
sparc targets.
- It adds little or no value to have variants of all these tests for all
the target types, and it would be a burden to maintain them. Actually
the features tested in the spuriously failing tests (relatively modern
sparc instructions, registers and asis) are not really found in
running coff or a.out sparc systems.
This patch changes sparc.exp so it will run these tests only in
ELF-targets, using the more standard `is_elf_format' from
binutils-common.exp instead of the ad-hoc (and less convenient, as it
must be called before _every_ single elf-only test) sparc_elf_setup.
Incidentally, the patch also fixes the #name entry for save-args.d.
Tested in sparc*-*-linux-gnu, sparc-aout and sparc-coff targets.
gas/ChangeLog:
2016-07-27 Jose E. Marchesi <jose.marchesi@oracle.com>
* testsuite/gas/sparc/sparc.exp: Use is_elf_format to discriminate
ELF targets.
Run natural, natural-32, pr4587, ticc-imm-reg, v8-movwr-imm,
pause, save-args, cbcond, cfr, crypto edge, flush, hpcvis3, ima,
ld_st_fsr, ldtw_sttw, ldd_std, ldx_stx, ldx_efsr, mwait, mcdper,
sparc5vis4, xcrypto, v9branch1 and imm-plus-rreg only in ELF
targets.
(sparc_elf_setup): Delete.
* testsuite/gas/sparc/save-args.d: Fix a copy-paste typo in the
test's #name entry.
GDB Administrator [Fri, 29 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Thu, 28 Jul 2016 14:37:16 +0000 (15:37 +0100)]
Fix decoding of Windows resources.
PR binutils/17512
* rescoff.c (read_coff_res_dir): Fix detection of buffer overrun.
* resbin.c (bin_to_res_version): Allow for the padded length of a
version block to be longer than the recorded length. Skip padding
bytes.
GDB Administrator [Thu, 28 Jul 2016 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 27 Jul 2016 16:27:55 +0000 (17:27 +0100)]
MIPS/GAS: Implement microMIPS branch/jump compaction
Convert microMIPS branches and jumps whose delay slot would be filled by
a generated NOP instruction to the corresponding compact form where one
exists, in a manner similar to MIPS16 JR->JRC and JALR->JALRC swap.
Do so even where the transformation switches from a 16-bit to a 32-bit
branch encoding for no benefit in code size reduction, as this is still
advantageous. This is because a branch/NOP pair takes 2 pipeline slots
or a 2-cycle completion latency except in superscalar implementations.
Whereas a compact branch may or may not stall on its target fetch, so it
will at most have a 2-cycle completion latency and may have only 1 even
in scalar implementations, and in superscalar implementations it is
expected to have no worse latency as a branch/NOP pair has. Also it
won't stall and therefore take the extra latency cycle in the not-taken
case.
Technically this is the same as MIPS16 compaction: for the qualifying
instruction encodings the APPEND_ADD_COMPACT machine code generation
method is selected where APPEND_ADD_WITH_NOP otherwise would and tells
the code generator in `append_insn' to convert the regular form of an
instruction to its corresponding compact form. For this the opcode is
tweaked as necessary and the microMIPS opcode table is scanned for the
matching updated instruction. A non-$0 `rt' operand to BEQ and BNE
instructions is moved to the `rs' operand field of BEQZC and BNEZC
encodings as required.
Unlike with MIPS16 compaction however we need to handle out-of-distance
branch relaxation as well. We do this by deferring the generation of
any delay-slot NOP required to relaxation made in `md_convert_frag', by
converting the APPEND_ADD_WITH_NOP machine code generation to APPEND_ADD
where a relaxed instruction is recorded. Relaxation then, depending on
actual code produced, chooses between either using a compact branch or
jump encoding and emitting the NOP outstanding if no compact encoding is
possible.
For code simplicity's sake the relaxation pass is retained even if the
principle of preferring a compact encoding to a 16-bit branch/NOP pair
means, in the absence of out-of-range branch relaxation, that a single
compact branch machine code instruction will eventually be produced from
a given assembly source instruction.
gas/
* config/tc-mips.c (RELAX_MICROMIPS_ENCODE): Add `nods' flag.
(RELAX_MICROMIPS_RELAX32, RELAX_MICROMIPS_TOOFAR16)
(RELAX_MICROMIPS_MARK_TOOFAR16, RELAX_MICROMIPS_CLEAR_TOOFAR16)
(RELAX_MICROMIPS_TOOFAR32, RELAX_MICROMIPS_MARK_TOOFAR32)
(RELAX_MICROMIPS_CLEAR_TOOFAR32): Shift bits.
(get_append_method): Also return APPEND_ADD_COMPACT for
microMIPS instructions.
(find_altered_mips16_opcode): Exclude macros from matching.
Factor code out...
(find_altered_opcode): ... to this new function.
(find_altered_micromips_opcode): New function.
(frag_branch_delay_slot_size): Likewise.
(append_insn): Handle microMIPS branch/jump compaction.
(macro_start): Likewise.
(relaxed_micromips_32bit_branch_length): Likewise.
(md_convert_frag): Likewise.
* testsuite/gas/mips/micromips.s: Add conditional explicit NOPs
for delay slot filling.
* testsuite/gas/mips/micromips-b16.s: Add explicit NOPs for
delay slot filling.
* testsuite/gas/mips/micromips-size-1.s: Likewise.
* testsuite/gas/mips/micromips.l: Adjust line numbers.
* testsuite/gas/mips/micromips-warn.l: Likewise.
* testsuite/gas/mips/micromips-size-1.l: Likewise.
* testsuite/gas/mips/micromips.d: Adjust padding.
* testsuite/gas/mips/micromips-trap.d: Likewise.
* testsuite/gas/mips/micromips-insn32.d: Likewise.
* testsuite/gas/mips/micromips-noinsn32.d: Likewise.
* testsuite/gas/mips/micromips@beq.d: Update patterns for
branch/jump compaction.
* testsuite/gas/mips/micromips@bge.d: Likewise.
* testsuite/gas/mips/micromips@bgeu.d: Likewise.
* testsuite/gas/mips/micromips@blt.d: Likewise.
* testsuite/gas/mips/micromips@bltu.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-4.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-4-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5pic.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5-64.d: Likewise.
* testsuite/gas/mips/micromips@branch-misc-5pic-64.d: Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local.d: Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local-n32.d:
Likewise.
* testsuite/gas/mips/micromips@jal-svr4pic-local-n64.d:
Likewise.
* testsuite/gas/mips/micromips@loc-swap.d: Likewise.
* testsuite/gas/mips/micromips@loc-swap-dis.d: Likewise.
* testsuite/gas/mips/micromips@relax.d: Likewise.
* testsuite/gas/mips/micromips@relax-at.d: Likewise.
* testsuite/gas/mips/micromips@relax-swap3.d: Likewise.
* testsuite/gas/mips/branch-extern-2.d: Likewise.
* testsuite/gas/mips/branch-extern-4.d: Likewise.
* testsuite/gas/mips/branch-section-2.d: Likewise.
* testsuite/gas/mips/branch-section-4.d: Likewise.
* testsuite/gas/mips/branch-weak-2.d: Likewise.
* testsuite/gas/mips/branch-weak-5.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-n32.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-n64.d: Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend.d:
Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend-n32.d:
Likewise.
* testsuite/gas/mips/micromips-branch-absolute-addend-n64.d:
Likewise.
* testsuite/gas/mips/micromips-compact.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.
ld/
* testsuite/ld-mips-elf/micromips-branch-absolute.d: Update
patterns for branch compaction.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend.d:
Likewise.
opcodes/
* micromips-opc.c (micromips_opcodes): Reorder "bc" next to "b",
"beqzc" next to "beq", "bnezc" next to "bne" and "jrc" next to
"j".
Graham Markall [Wed, 27 Jul 2016 14:57:18 +0000 (15:57 +0100)]
Begin implementing ARC NPS-400 Accelerator instructions
opcodes * arc-nps400-tbl.h: Change block comments to GNU format.
* arc-dis.c: Add new globals addrtypenames,
addrtypenames_max, and addtypeunknown.
(get_addrtype): New function.
(print_insn_arc): Print colons and address types when
required.
* arc-opc.c: Add MAKE_INSERT_NPS_ADDRTYPE macro and use to
define insert and extract functions for all address types.
(arc_operands): Add operands for colon and all address
types.
* arc-nps-400-tbl.h: Add NPS-400 BMU instructions to opcode table.
* arc-opc.c: Add NPS_BD_TYPE and NPS_BMU_NUM operands,
insert_nps_bd_num_buff and extract_nps_bd_num_buff functions.
* arc-nps-400-tbl.h: Add NPS-400 PMU instructions to opcode table.
* arc-opc.c: Add NPS_PMU_NXT_DST and NPS_PMU_NUM_JOB operands,
insert_nps_pmu_num_job and extract_nps_pmu_num_job functions.
include * opcode/arc.h: Add ARC_OPERAND_ADDRTYPE,
ARC_OPERAND_COLON. Add the arc_nps_address_type enum and
ARC_NUM_ADDRTYPES.
* opcode/arc.h: Add BMU to insn_class_t enum.
* opcode/arc.h: Add PMU to insn_class_t enum.
gas * config/tc-arc.c: Add new global arc_addrtype_hash.
Define O_colon and O_addrtype.
(debug_exp): Add O_colon and O_addrtype.
(tokenize_arguments): Handle colon and address type
tokens.
(declare_addrtype): New function.
(md_begin): Initialise arc_addrtype_hash.
(arc_parse_name): Add lookup of address types.
(assemble_insn): Handle colons and address types by
ignoring them.
* testsuite/gas/arc/nps400-8.s: New file.
* testsuite/gas/arc/nps400-8.d: New file.
* testsuite/gas/arc/nps400-8.s: Add PMU instruction tests.
* testsuite/gas/arc/nps400-8.d: Add expected PMU
instruction output.
Nick Clifton [Wed, 27 Jul 2016 11:01:09 +0000 (12:01 +0100)]
Restrict linker garbage collection personality test to cfi enabled targets.
* testsuite/ld-gc/personality.d: Use "target cfi" to restrict the
test to targets which support cfi.
Nick Clifton [Wed, 27 Jul 2016 09:49:32 +0000 (10:49 +0100)]
Fix seg-fault when running garbage collection on coff binaries.
PR ld/20401
* coffgen.c (fini_reloc_cookie_rels): Check for the extistence
of the coff_section_data before using it.
Igor Kudrin [Wed, 27 Jul 2016 09:31:34 +0000 (19:01 +0930)]
Fix warning in ldbuildid.c mingw32 code
* ldbuildid.c (generate_build_id): Warning fix.
Alan Modra [Wed, 27 Jul 2016 06:55:29 +0000 (16:25 +0930)]
Fix aarch64_relocs.sh file mode
GDB Administrator [Wed, 27 Jul 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Tue, 26 Jul 2016 23:30:03 +0000 (09:00 +0930)]
Wean gdb and sim off private libbfd.h header
The major reason this header was needed, bfd_default_set_arch_mach,
has now moved to bfd.h.
gdb/
* amd64-darwin-tdep.c: Don't include libbfd.h.
* i386-darwin-tdep.c: Likewise.
* rs6000-nat.c: Likewise.
* rs6000-tdep.c: Likewise.
sim/aarch64/
* memory.c: Don't include libbfd.h.
sim/rl78/
* load.c: Don't include libbfd.h.
(rl78_load): Don't use private iovec seek or read.
sim/rx/
* load.c: Don't include libbfd.h.
(rx_load): Don't use private iovec seek or read.
Pedro Alves [Tue, 26 Jul 2016 21:21:27 +0000 (22:21 +0100)]
Fix PR server/20414 - x32 gdbserver always crashes inferior
Debugging an x32 process with an x32 gdbserver always results in:
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0xf7de9600 in _dl_debug_state () from target:/libx32/ld-linux-x32.so.2
(gdb)
Looking at the remote debug logs reveals the problem, here:
Packet received: T05swbreak:;06:
a0d4ffff00000000;07:
b8d3ffff00000000;10:
0096def701000000;thread:p7d7a.7d7a;core:1;
^^^^^^^^^^^^^^^^
The underlined value is the expedited value of RIP (in little endian).
But notice that 01 in 0x01f7de9600, while gdb says the program stopped
at 0xf7de9600. 0x01ffffffff is over 32 bits, which indicates that
something wen't wrong somewhere in gdbserver.
The problem turns out to be in gdbserver's x86_get_pc / x86_set_pc
routines, where "unsigned long" is used assuming that it can fit a
64-bit value, while unsigned long is actually 32-bit on x32. The
result is that collect_register_by_name / supply_register_by_name end
up reading/writing random bytes off the stack.
Fix this by using explicit uint64_t instead of unsigned long.
For consistency, use uint32_t instead of unsigned int in the 32-bit
paths.
gdb/gdbserver/ChangeLog:
2016-07-26 Pedro Alves <palves@redhat.com>
PR server/20414
* linux-x86-low.c (x86_get_pc, x86_set_pc): Use uint64_t instead
of unsigned long for 64-bit registers and use uint32_t instead of
unsigned int for 32-bit registers.
Tom Tromey [Fri, 3 Jun 2016 20:11:08 +0000 (14:11 -0600)]
PR python/20190 - compute TLS symbol without a frame
PR python/20190 arose from an exception I noticed when trying to use
the Python unwinder for Spider Monkey in Firefox.
The problem is that the unwinder wants to examine the value of a
thread-local variable. However, sympy_value rejects this because
symbol_read_needs_frame returns true for a TLS variable.
This problem arose once before, though in a different context:
https://sourceware.org/bugzilla/show_bug.cgi?id=11803
At the time Pedro and Daniel pointed out a simpler way to fix that bug
(see links in 20190 if you are interested); but for this new bug I
couldn't think of a similar fix and ended up implementing Daniel's
other suggestion:
https://sourceware.org/ml/gdb-patches/2010-07/msg00393.html
That is, this patch makes it possible to detect whether a symbol needs
a specific frame, or whether it just needs the inferior to have
registers.
Built and regtested on x86-64 Fedora 24.
2016-07-26 Tom Tromey <tom@tromey.com>
* symtab.c (register_symbol_computed_impl): Update.
PR python/20190:
* value.h (symbol_read_needs): Declare.
(symbol_read_needs_frame): Add comment.
* symtab.h (struct symbol_computed_ops) <read_variable>: Update
comment.
<get_symbol_read_needs>: Rename. Change return type.
* findvar.c (symbol_read_needs): New function.
(symbol_read_needs_frame): Rewrite.
(default_read_var_value): Use symbol_read_needs.
* dwarf2loc.c (struct symbol_needs_baton): Rename.
<needs>: Renamed from needs_frame. Changed type.
(needs_frame_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): Rename.
(needs_dwarf_reg_entry_value): Update.
(symbol_needs_ctx_funcs, dwarf2_loc_desc_get_symbol_read_needs):
Rename and update.
(locexpr_get_symbol_read_needs, loclist_symbol_needs): Likewise.
(dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update.
* defs.h (enum symbol_needs_kind): New.
2016-07-26 Tom Tromey <tom@tromey.com>
PR python/20190:
* gdb.threads/tls.exp (check_thread_local): Add python symbol
test.
Maciej W. Rozycki [Tue, 26 Jul 2016 16:50:55 +0000 (17:50 +0100)]
MIPS/GAS: Respect the `insn32' mode in branch relaxation
Complement:
commit
833794fc12d98139fc33f6b0b85feb03471007b7
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date: Tue Jun 25 18:02:34 2013 +0000
<https://sourceware.org/ml/binutils/2013-06/msg00104.html>, ("microMIPS
insn32 mode support"), and fix an issue with microMIPS branch relaxation
producing 16-bit instructions in the `insn32' mode. Use equivalent
32-bit instruction sequences.
gas/
* config/tc-mips.c (RELAX_MICROMIPS_ENCODE): Add `insn32' flag.
(RELAX_MICROMIPS_INSN32): New macro.
(RELAX_MICROMIPS_UNCOND, RELAX_MICROMIPS_COMPACT)
(RELAX_MICROMIPS_LINK, RELAX_MICROMIPS_RELAX32)
(RELAX_MICROMIPS_TOOFAR16, RELAX_MICROMIPS_MARK_TOOFAR16)
(RELAX_MICROMIPS_CLEAR_TOOFAR16, RELAX_MICROMIPS_TOOFAR32)
(RELAX_MICROMIPS_MARK_TOOFAR32, RELAX_MICROMIPS_CLEAR_TOOFAR32):
Shift bits.
(append_insn): Record `mips_opts.insn32' with relaxed microMIPS
branches.
(relaxed_micromips_32bit_branch_length): Handle the `insn32'
mode.
(md_convert_frag): Likewise.
* testsuite/gas/mips/micromips-branch-relax.s: Add `insn32'
conditionals.
* testsuite/gas/mips/micromips-branch-relax.l: Update line
numbers accordingly.
* testsuite/gas/mips/micromips-branch-relax-pic.l: Likewise.
* testsuite/gas/mips/micromips-branch-relax-insn32.d: New test.
* testsuite/gas/mips/micromips-branch-relax-insn32-pic.d: New
test.
* testsuite/gas/mips/micromips-branch-relax-insn32.l: New
stderr output.
* testsuite/gas/mips/micromips-branch-relax-insn32-pic.l: New
stderr output.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Tue, 26 Jul 2016 16:45:00 +0000 (17:45 +0100)]
MIPS/BFD: Handle branches in PLT compression selection
Complement:
commit
1bbce132647e6d72aaa065cce5c1d5dd6585c2b2
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date: Mon Jun 24 23:55:46 2013 +0000
<https://sourceware.org/ml/binutils/2013-06/msg00077.html>, ("MIPS:
Compressed PLT/stubs support"), and also choose between regular and
compressed PLT entries as appropriate for any branches referring.
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Handle branches
in PLT compression selection.
(_bfd_mips_elf_check_relocs): Likewise.
ld/
* testsuite/ld-mips-elf/compressed-plt-1.s: Add branch support.
* testsuite/ld-mips-elf/compressed-plt-1a.s: Likewise.
* testsuite/ld-mips-elf/compressed-plt-1b.s: Likewise.
* testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od: New
test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd: New
test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od:
New test.
* testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd:
New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Pedro Alves [Tue, 26 Jul 2016 18:35:40 +0000 (19:35 +0100)]
Fix PR gdb/20413 - x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER
An x32 gdb always issues this warning:
(gdb) start
Temporary breakpoint 1 at 0x4043e9: file foo.c, line 25.
Starting program: a.out
warning: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER: Input/output error
Temporary breakpoint 1, main (argc=1, argv=0xffffd544) at foo.c:25
25 {
(gdb)
As described in Linux commit
55283e253771 (x32: Add ptrace for x32):
[...] PTRACE_PEEKUSR and PTRACE_POKEUSR are only allowed to access
segment and debug registers. [...]
The fix is to use PTRACE_GETREGS instead.
gdb/ChangeLog:
2016-07-26 Pedro Alves <palves@redhat.com>
* nat/linux-ptrace.c: Include "gregset.h".
(linux_ptrace_test_ret_to_nx): Use PTRACE_GETREGS instead of
PTRACE_PEEKUSER.
Pedro Alves [Tue, 26 Jul 2016 18:35:40 +0000 (19:35 +0100)]
Fix PR gdb/20287 - x32 and "gdb_static_assert (sizeof (nat_siginfo_t) == sizeof (siginfo_t))"
Building an x32 gdb trips on a static assertion:
In file included from .../src/gdb/common/common-defs.h:71:0,
from .../src/gdb/nat/amd64-linux-siginfo.c:21:
.../src/gdb/common/gdb_assert.h:26:66: error: size of array ‘never_defined_just_used_for_checking’ is negative
extern int never_defined_just_used_for_checking[(expr) ? 1 : -1]
^
.../src/gdb/nat/amd64-linux-siginfo.c:113:1: note: in expansion of macro ‘gdb_static_assert’
gdb_static_assert (sizeof (nat_siginfo_t) == sizeof (siginfo_t));
^
The problem is that the way nat_siginfo_t is defined, it can only
match the host's siginfo_t object when gdb is built as a 64-bit
program.
Several bits of nat_siginfo_t are off:
- nat_siginfo_t's _pad field's definition is:
int _pad[((128 / sizeof (int)) - 4)];
while /usr/include/bits/siginfo.h has:
# define __SI_MAX_SIZE 128
# if __WORDSIZE == 64
# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
# else
# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
# endif
and __WORDSIZE == 32 for x32. This is what causes the size of
nat_siginfo_t to be wrong and the assertion to fail.
- the nat_clock_t type is incorrect for 64-bit. We have this:
/* For native 64-bit, clock_t in _sigchld is 64bit aligned at 4 bytes. */
typedef long __attribute__ ((__aligned__ (4))) nat_clock_t;
however, /usr/include/bits/siginfo.h has:
# if defined __x86_64__ && __WORDSIZE == 32
/* si_utime and si_stime must be 4 byte aligned for x32 to match the
kernel. We align siginfo_t to 8 bytes so that si_utime and si_stime
are actually aligned to 8 bytes since their offsets are multiple of
8 bytes. */
typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
# define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
# else
typedef __clock_t __sigchld_clock_t;
# define __SI_ALIGNMENT
# endif
So we're currently forcing 4-byte alignment on clock_t, when it
should only be so for x32, not 64-bit.
The fix:
- Leaves nat_siginfo_t strictly for the 64-bit ABI.
- Adds a new typedef for the siginfo type that ptrace uses
(ptrace_siginfo_t). An x32 gdb always gets/sets an x32 siginfo_t
type with PTRACE_GETSIGINFO/PTRACE_SETSIGINFO.
- Uses this new ptrace_siginfo_t type instead of nat_siginfo_t as the
intermediate conversion type.
gdb/ChangeLog:
2016-07-26 Pedro Alves <palves@redhat.com>
* amd64-linux-nat.c (amd64_linux_siginfo_fixup): Rename 'native'
parameter to 'ptrace'.
* nat/amd64-linux-siginfo.c (GDB_SI_SIZE): New define.
(nat_uptr_t): New an unsigned long.
(nat_clock_t): Remove attribute __aligned__.
(struct nat_timeval): Delete.
(nat_siginfo_t): Remove attribute __aligned__.
(ptrace_siginfo_t): Define.
(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
(compat_x32_siginfo_from_siginfo)
(siginfo_from_compat_x32_siginfo): Make 'from' parameter const.
Convert through a ptrace_siginfo_t instead of a nat_siginfo_t.
Remove casts.
(amd64_linux_siginfo_fixup_common): Rename 'native' parameter to
'ptrace'. Remove static assertions.
(top level): New static assertions.
gdb/gdbserver/ChangeLog:
2016-07-26 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (x86_siginfo_fixup): Rename 'native' parameter
to 'ptrace'.
Igor Kudrin [Tue, 26 Jul 2016 16:01:06 +0000 (17:01 +0100)]
Add support for creating uuid based build-id's in a MinGW32 environment.
ld * ldbuildid.c: Changes for MinGW32:
Include windows.h and rpcdce.h.
(validate_build_id_style): Allow "uuid" style.
(generate_build_id): Fill in id_bits using UuidCreate().
Han Shen [Tue, 26 Jul 2016 15:49:12 +0000 (08:49 -0700)]
[Gold, aarch64] Implement some AArch64 relocs.
This CL implemented the following relocs for AArch64 target.
- R_AARCH64_MOVW_UABS_G*
- R_AARCH64_MOVW_SABS_G* relocations
gold/ChangeLog
2016-07-26 Igor Kudrin <ikudrin@accesssoftek.com>
* aarch64-reloc-property.cc (Rvalue_bit_select_impl): New class.
(rvalue_bit_select): Use Rvalue_bit_select_impl.
* aarch64-reloc.def (MOVW_UABS_G0, MOVW_UABS_G0_NC,
MOVW_UABS_G1,
MOVW_UABS_G1_NC, MOVW_UABS_G2, MOVW_UABS_G2_NC, MOVW_UABS_G3,
MOVW_SABS_G0, MOVW_SABS_G1, MOVW_SABS_G2): New relocations.
* aarch64.cc (Target_aarch64::Scan::local): Add cases for new
MOVW_UABS_* and MOVW_SABS_* relocations.
(Target_aarch64::Scan::global): Likewise.
(Target_aarch64::Relocate::relocate): Add cases and handlings
for new MOVW_UABS_* and MOVW_SABS_* relocations.
* testsuite/Makefile.am (aarch64_relocs): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/aarch64_globals.s: New test source file.
* testsuite/aarch64_relocs.s: Likewise.
* testsuite/aarch64_relocs.sh: New test script.
Markus Metzger [Fri, 22 Jul 2016 11:41:45 +0000 (13:41 +0200)]
btrace, testsuite: fix assembly source file selection
Some btrace tests use assembly source files. They use the target triplet to
distinguish between x86_64 and ia32 ISA. This does not work for -m32 tests
without setting the target triplet to i686-?-?.
Instead use is_amd64_regs_target to distinguish between x86_64 and ia32 ISA.
See also https://sourceware.org/ml/gdb-patches/2016-07/msg00256.html.
testsuite/
* gdb.btrace/record_goto.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/stepi.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall.exp: Use is_amd64_regs_target for selecting
assembly source files.
* gdb.btrace/tailcall-only.exp: Use is_amd64_regs_target for selecting
assembly source files.
GDB Administrator [Tue, 26 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 25 Jul 2016 15:01:54 +0000 (11:01 -0400)]
Handle correctly passing a bad interpreter name to new-ui
When a bad interpreter name is passed to new-ui, such as:
(gdb) new-ui bloop /dev/pts/10
A partially created UI is left in the UI list, with interp set to NULL.
Trying to do anything that will print on this UI (such as "start") will
cause a segmentation fault.
Changes in v2:
- Use with_test_prefix to namespace test procedures
- Give an explicit stable test name
- Add a "bad terminal path" test
- Remove useless runto_main
- Add missing intro comments
I did not factor out the pty spawn, as there is some magic involved I
don't quite understand. But it wouldn't bring that much anyway.
gdb/ChangeLog:
* top.h (make_delete_ui_cleanup): New declaration.
* top.c (delete_ui_cleanup): New function.
(make_delete_ui_cleanup): New function.
(new_ui_command): Create restore_ui cleanup earlier, create a
delete_ui cleanup and discard it on success.
gdb/testsuite/ChangeLog:
* gdb.base/new-ui.exp (do_test_invalid_args): New
procedure.
Pedro Alves [Mon, 25 Jul 2016 11:42:18 +0000 (12:42 +0100)]
linux-procfs: Handle lowercase "t (tracing stop)" state
Since Linux 2.6.33, /proc/PID/status shows "t (tracing stop)", with
lowercase 't'. Because GDB is only expecting "T (tracing stop)", GDB
can incorrectly suppress errors in check_ptrace_stopped_lwp_gone:
1578 if (!check_ptrace_stopped_lwp_gone (lp))
1579 throw_exception (ex);
Ref: https://sourceware.org/ml/gdb-patches/2016-06/msg00072.html
2016-07-25 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* nat/linux-procfs.c (parse_proc_status_state): Handle lowercase
't'.
Pedro Alves [Mon, 25 Jul 2016 11:42:17 +0000 (12:42 +0100)]
linux-procfs: Introduce enum proc_state
Parse the process's /proc/PID/status state into an enum instead of the
current scheme of passing state strings around.
gdb/ChangeLog:
2016-07-25 Pedro Alves <palves@redhat.com>
* nat/linux-procfs.c (enum proc_state): New enum.
(parse_proc_status_state): New function.
(linux_proc_pid_get_state): Replace output string buffer parameter
with an output proc_state parameter. Use parse_proc_status_state.
(linux_proc_pid_is_gone): Adjust to use proc_state values.
(linux_proc_pid_has_state): Change type of 'state' parameter; now
an enum proc_state. Adjust to linux_proc_pid_get_state interface
change.
(linux_proc_pid_is_stopped)
(linux_proc_pid_is_trace_stopped_nowarn)
(linux_proc_pid_is_zombie_maybe_warn): Adjust to
linux_proc_pid_get_state interface change.
Tim Wiederhake [Mon, 25 Jul 2016 09:12:01 +0000 (11:12 +0200)]
Add myself as a write-after-approval GDB maintainer.
Tim Wiederhake [Mon, 25 Jul 2016 08:57:06 +0000 (10:57 +0200)]
btrace: Resume recording after disconnect.
This patch allows gdbserver to continue recording after disconnect. On
reconnect, the recorded data is accessible to gdb as if no disconnect happened.
A possible application for this feature is remotely examine bugs that occur
at irregular intervals, where maintaining a gdb connection is inconvenient.
This also fixes the issue mentioned here:
https://sourceware.org/ml/gdb-patches/2015-11/msg00424.html
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* NEWS: Resume btrace on reconnect.
* record-btrace.c: Added record-btrace.h include.
(record_btrace_open): Split into this and ...
(record_btrace_push_target): ... this.
(record_btrace_disconnect): New function.
(init_record_btrace_ops): Use record_btrace_disconnect.
* record-btrace.h: New file.
* remote.c: Added record-btrace.h include.
(remote_start_remote): Check recording status.
(remote_btrace_maybe_reopen): New function.
gdb/doc/ChangeLog:
* gdb.texinfo: Resume btrace on reconnect.
gdb/testsuite/ChangeLog:
* gdb.btrace/reconnect.c: New file.
* gdb.btrace/reconnect.exp: New file.
Change-Id: I95e8b0ab8a89e58591aba0e63818cee82fd211bc
Alan Modra [Mon, 25 Jul 2016 05:49:20 +0000 (15:19 +0930)]
Revise targets able to run ELF 64k section test
* testsuite/ld-elf/sec64k.exp: Run test for arc, msp430, or1k
and m32r. Correct comment. Relax ld -r match to account for
msp increased number of default sections.
GDB Administrator [Mon, 25 Jul 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 24 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Gabriel Krisman Bertazi [Sat, 23 Jul 2016 21:38:24 +0000 (18:38 -0300)]
Implement catch syscall group
Implement support to add catchpoints for a group of related syscalls
using the syntax:
(gdb) catch syscall group:<group>
or
(gdb) catch syscall g:<group>
Several groups are predefined in the xml files for all architectures
supported by GDB over Linux. They are based on the groups defined by
strace.
gdb/
* xml-syscall.c (get_syscalls_by_group): New.
(get_syscall_group_names): New.
(struct syscall_group_desc): New structure to store group data.
(struct syscalls_info): Include field to store the group list.
(sysinfo_free_syscall_group_desc): New.
(free_syscalls_info): Free group list.
(syscall_group_create_syscall_group_desc): New.
(syscall_group_add_syscall): New.
(syscall_create_syscall_desc): Add syscall to its groups.
(syscall_start_syscall): Load group attribute.
(syscall_group_get_group_by_name): New.
(xml_list_syscalls_by_group): New.
(xml_list_of_groups): New.
* xml-syscall.h (get_syscalls_by_group): Export function
to retrieve a list of syscalls filtered by the group name.
(get_syscall_group_names): Export function to retrieve the list
of syscall groups.
* break-catch-syscall.c (catch_syscall_split_args): Verify if
argument is a syscall group and expand it to a list of syscalls
when creating catchpoints.
(catch_syscall_completer): Add word completion for system call
groups.
* configure.ac: Include dependency for xsltproc when building
in maintainer-mode.
* break-catch-syscall.c (_initialize_breakpoint): Update catch
syscall command documentation.
* NEWS: Include section about catching groups of syscalls.
* configure: Regenerate.
* data-directory/Makefile.in: Generate syscall xml when building
in maintainer mode.
* syscalls/gdb-syscalls.dtd: Include group attribute to the
syscall element.
* syscalls/apply-defaults.xsl: New.
* syscalls/linux-defaults.xml.in: New.
* syscalls/aarch64-linux.xml: Rename to aarch64-linux.xml.in.
* syscalls/amd64-linux.xml: Rename to amd64-linux.xml.in.
* syscalls/arm-linux.xml: Rename to arm-linux.xml.in.
* syscalls/bfin-linux.xml: Rename to bfin-linux.xml.in.
* syscalls/i386-linux.xml: Rename to i386-linux.xml.in.
* syscalls/mips-n32-linux.xml: Rename to mips-n32-linux.xml.in.
* syscalls/mips-n64-linux.xml: Rename to mips-n64-linux.xml.in.
* syscalls/mips-o32-linux.xml: Rename to mips-o32-linux.xml.in.
* syscalls/ppc-linux.xml: Rename to ppc-linux.xml.in.
* syscalls/ppc64-linux.xml: Rename to ppc64-linux.xml.in.
* syscalls/s390-linux.xml: Rename to s390-linux.xml.in.
* syscalls/s390x-linux.xml: Rename to s390x-linux.xml.in.
* syscalls/sparc-linux.xml: Rename to sparc-linux.xml.in.
* syscalls/sparc64-linux.xml: Rename to sparc64-linux.xml.in.
* syscalls/aarch64-linux.xml: Regenerate.
* syscalls/amd64-linux.xml: Regenerate.
* syscalls/arm-linux.xml: Regenerate.
* syscalls/i386-linux.xml: Regenerate.
* syscalls/mips-n32-linux.xml: Regenerate.
* syscalls/mips-n64-linux.xml: Regenerate.
* syscalls/mips-o32-linux.xml: Regenerate.
* syscalls/ppc-linux.xml: Regenerate.
* syscalls/ppc64-linux.xml: Regenerate.
* syscalls/s390-linux.xml: Regenerate.
* syscalls/s390x-linux.xml: Regenerate.
* syscalls/sparc-linux.xml: Regenerate.
* syscalls/sparc64-linux.xml: Regenerate.
gdb/testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Add call
to test_catch_syscall_group.
(test_catch_syscall_group): New.
gdb/doc/
* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
syscall.
Andrew Pinski [Sat, 23 Jul 2016 16:56:44 +0000 (09:56 -0700)]
Fix ARMv8.1/v8.2 for hw watchpoint and breakpoint
The problem here is ARMv8.1 (and ARMv8.2) define a
different debug version than ARMv8 (7 and 8 respectively).
This fixes hw watchpoints and breakpoints by checking
for those debug versions too.
Committed as obvious after a test on aarch64-linux-gnu
(on a ThunderX machine which has ARMv8.1 support enabled).
ChangeLog:
* nat/aarch64-linux-hw-point.c
(aarch64_linux_get_debug_reg_capacity): Handle
ARMv8.1 and ARMv8.2 debug versions.
* nat/aarch64-linux-hw-point.h
(AARCH64_DEBUG_ARCH_V8_1): New define.
(AARCH64_DEBUG_ARCH_V8_2): New define.
Signed-off-by: Andrew Pinski <apinski@cavium.com>
Руслан Ижбулатов [Sat, 23 Jul 2016 08:38:03 +0000 (11:38 +0300)]
Support JIT debugging on MS-Windows
gdb/ChangeLog:
2016-06-30 Руслан Ижбулатов <lrn1986@gmail.com>
PR gdb/14529
* windows-nat.c (signal_event_command): New command 'signal-event'
for W32 JIT debug support.
* NEWS: Add an entry about the new 'signal-event' command.
gdb/doc/ChangeLog:
2016-06-30 Руслан Ижбулатов <lrn1986@gmail.com>
* gdb.texinfo (Cygwin Native): Document the new 'signal-event'
command.
GDB Administrator [Sat, 23 Jul 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 26 Jun 2016 17:06:44 +0000 (11:06 -0600)]
PR rust/20162 - fix gdb regressions caused by rust 1.10
PR rust/20162 started life as a reminder to test gdb with versions of
rust after 1.8; but now concerns some gdb regressions seen with rust
1.10 ("beta") and 1.11 ("nightly").
The failures turn out to be a discrepancy between how rustc emits
DWARF and how gdb interprets it. In particular, rustc will emit DWARF
like:
<2><bc>: Abbrev Number: 9 (DW_TAG_structure_type)
<bd> DW_AT_name : (indirect string, offset: 0x46a): HasMethods
<c1> DW_AT_byte_size : 4
...
<3><cc>: Abbrev Number: 11 (DW_TAG_subprogram)
...
<df> DW_AT_name : (indirect string, offset: 0x514f): new
gdb wants to see a separate top-level DW_TAG_subprogram that refers to
this one via DW_AT_specification; but rustc doesn't emit one. By my
reading of DWARF 4 5.5.7, this is ok, and gdb is incorrect here.
Fixing this involved a new case in scan_partial_symbols, and then a
further change in process_structure_scope to account for the fact
that, in Rust, such functions are not methods and should not be
attached to the structure type.
Next, it turns out that rust is emitting bad values for
DW_AT_linkage_name, e.g.:
<db> DW_AT_linkage_name: (indirect string, offset: 0x422): _ZN7methods8{{impl}}3newE
The the "{{impl}}" stuff is apparently some side effect of a change to
the compiler's internal representation. Oops!
This also had a simple fix -- disregard these mangled names.
With these changes, there are no regressions in the gdb Rust tests
with either 1.10 or 1.11. 1.9, the stable release, is still pretty
broken, but I think there's nothing much to do about that.
These changes are a bit hackish, but no worse, I think, than other
kinds of quirk handling already done in the DWARF parser. I have
reported all the rustc bugs upstream. I plan to remove these hacks
from gdb some suitable time after they have been fixed in released
versions of Rust.
2016-07-22 Tom Tromey <tom@tromey.com>
PR rust/20162:
* dwarf2read.c (scan_partial_symbols) <DW_TAG_structure_type>:
Call scan_partial_symbols for children when reading a Rust CU.
(dwarf2_physname): Ignore invalid DW_AT_linkage_name generated by
rustc.
(process_structure_scope) <DW_TAG_subprogram>: Call
read_func_scope for Rust.
Yao Qi [Fri, 22 Jul 2016 15:31:41 +0000 (16:31 +0100)]
Get "num" as unsigned in ctf
I see the following fail due to the warning,
-trace-frame-collected^M
[warning] Extracting signed value from an unsigned int (num)^M
....
FAIL: gdb.trace/mi-trace-frame-collected.exp: ctf: -trace-frame-collected
In ctf metadata, "num" in "tsv" is defined as unint32_t,
ctf_save_write_metadata (&writer->tcs,
"event {\n\tname = \"tsv\";\n\tid = %u;\n"
"\tfields := struct { \n"
"\t\tuint64_t val;\n"
"\t\tuint32_t num;\n"
"\t};\n"
"};\n", CTF_EVENT_ID_TSV);
so we should read it as unsigned. The patch below fixes the fail by
changing to bt_ctf_get_uint64.
gdb:
2016-07-22 Yao Qi <yao.qi@linaro.org>
* ctf.c (ctf_traceframe_info): Call bt_ctf_get_uint64 rather than
bt_ctf_get_int64.
Cupertino Miranda [Fri, 22 Jul 2016 14:10:31 +0000 (15:10 +0100)]
Fix segfault in ARC linker when generating got entries for local symbols.
bfd * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case
where there's no elf_link_hash_entry while processing GOT_NORMAL got
entries.
ld * testsuite/ld-arc/got-01.d: New file.
* testsuite/ld-arc/got-01.s: New file.
GDB Administrator [Fri, 22 Jul 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 21 Jul 2016 22:22:13 +0000 (15:22 -0700)]
Set BFD_VERSION to 2.27.51
bfd/
* version.m4 (BFD_VERSION): Set to 2.27.51.
* configure: Regenerated.
binutils/
* configure: Regenerated.
gas/
* configure: Regenerated.
gprof/
* configure: Regenerated.
ld/
* configure: Regenerated.
opcodes/
* configure: Regenerated.
H.J. Lu [Thu, 21 Jul 2016 22:17:37 +0000 (15:17 -0700)]
Move ChangeLog entry for PR ld/20376
Tom Tromey [Mon, 11 Jul 2016 21:02:10 +0000 (15:02 -0600)]
Allow empty struct expressions in Rust
I learned recently that empty struct expressions, like "X{}", have been
promoted from experimental to stable in Rust. This patch changes the
Rust expression parser to allow this case.
New test case included.
Built and regtested on x86-64 Fedora 23, using Rust 1.11 beta.
2016-07-21 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_tuple_struct_type_p): Return false for empty
structs.
* rust-exp.y (struct_expr_list): Allow empty elements.
2016-07-21 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs (main): Use empty struct expression.
* gdb.rust/simple.exp: Add tests for empty struct expression.