Omair Javaid [Mon, 11 May 2015 11:10:46 +0000 (12:10 +0100)]
Implements aarch64 process record and reverse debugging support
This patch adds the support of aarch64-linux process record and reverse
debugging. The implementation is similar to ARM's counterpart.
2015-05-26 Omair Javaid <omair.javaid@linaro.org>
Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c: Include linux-record.h and
record-full.h.
(struct linux_record_tdep aarch64_linux_record_tdep): Declare.
(aarch64_syscall): New enum.
(aarch64_canonicalize_syscall): New function.
(aarch64_all_but_pc_registers_record): New function.
(aarch64_linux_syscall_record): New function.
(aarch64_linux_init_abi): Install AArch64 process record
handler. Update to handle syscall recording.
* aarch64-tdep.c: Include record.h and record-full.h.
(submask, bit, bits, REG_ALLOC, MEM_ALLOC): New macros.
(struct aarch64_mem_r): Define.
(aarch64_record_result): New enum.
(struct insn_decode_record): Define.
(insn_decode_record): New typedef.
(aarch64_record_data_proc_reg): New function.
(aarch64_record_data_proc_imm): New function.
(aarch64_record_branch_except_sys): New function.
(aarch64_record_load_store): New function.
(aarch64_record_data_proc_simd_fp): New function.
(aarch64_record_asimd_load_store): New function.
(aarch64_record_decode_insn_handler): New function.
(deallocate_reg_mem): New function.
(aarch64_process_record): New function.
* aarch64-tdep.h (struct gdbarch_tdep) <aarch64_syscall_record>:
New field.
(aarch64_process_record): New extern declaration.
* configure.tgt: Add linux-record.o to gdb_target_obs.
* linux-record.h (struct linux_record_tdep) <arg7>: New field.
Omair Javaid [Mon, 11 May 2015 11:10:43 +0000 (12:10 +0100)]
NEWS entry about aarch64-linux record/replay support
This patch adds the NEWS entry for aarch64-linux record replay
support.
It has been reviewed and approved.
gdb:
2015-05-26 Omair Javaid <omair.javaid@linaro.org>
* NEWS: Add a note on process record-replay support on aarch64*-linux*
targets.
Martin Galvan [Tue, 26 May 2015 10:59:17 +0000 (11:59 +0100)]
Rename in_function_epilogue_p to stack_frame_destroyed_p
We concluded that gdbarch_in_function_epilogue_p is misnamed, since it
returns true if the given PC is one instruction after the one that
destroyed the stack (which isn't necessarily inside an epilogue),
therefore it should be renamed to stack_frame_destroyed_p.
I also took the liberty of renaming the arch-specific implementations to
*_stack_frame_destroyed_p as well for consistency.
gdb:
2015-05-26 Martin Galvan <martin.galvan@tallertechnologies.com>
* amd64-tdep.c: Replace in_function_epilogue_p with
stack_frame_destroyed_p throughout.
* arch-utils.c: Ditto.
* arch-utils.h: Ditto.
* arm-tdep.c: Ditto.
* breakpoint.c: Ditto.
* gdbarch.sh: Ditto.
* hppa-tdep.c: Ditto.
* i386-tdep.c: Ditto.
* mips-tdep.c: Ditto.
* nios2-tdep.c: Ditto.
* rs6000-tdep.c: Ditto.
* s390-linux-tdep.c: Ditto.
* score-tdep.c: Ditto.
* sh-tdep.c: Ditto.
* sparc-tdep.c: Ditto.
* sparc-tdep.h: Ditto.
* sparc64-tdep.c: Ditto.
* spu-tdep.c: Ditto.
* tic6x-tdep.c: Ditto.
* tilegx-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
* gdbarch.c, gdbarch.h: Re-generated.
Max Filippov [Sun, 17 May 2015 03:46:15 +0000 (06:46 +0300)]
xtensa: fix gas segfault with --text-section-literals
When --text-section-literals is used and code in the .init or .fini
emits literal in the absence of .literal_position, xtensa_move_literals
segfaults.
Check that search_frag is non-NULL in the xtensa_move_literals and
report error otherwise.
2015-05-26 Max Filippov <jcmvbkbc@gmail.com>
gas/
* config/tc-xtensa.c (xtensa_move_literals): Check that
search_frag is non-NULL. Report error if literal frag is not
found.
GDB Administrator [Tue, 26 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 25 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 24 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 23 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Fri, 22 May 2015 13:27:36 +0000 (14:27 +0100)]
Fixes: "gas/read.c:5087:12: error: left shift of negative"
PR gas/18446
* read.c (output_big_sleb128): Use U suffix to prevent compile
time warning.
Andrew Burgess [Fri, 22 May 2015 08:07:42 +0000 (10:07 +0200)]
gdb: New 'tui enable' and 'tui disable' commands.
Add new commands to specifically enable and disable tui mode. This is
in addition to the readline bindings, but might be easier for a user to
discover if they accidentally end up in tui mode.
gdb/ChangeLog:
* NEWS: Mention 'tui enable' and 'tui disable'.
* tui/tui.c (tui_enable_command): New function.
(tui_disable_command): New function.
(_initialize_tui): New function.
gdb/doc/ChangeLog:
* gdb.texinfo (TUI): Include 'tui enable' in the introduction.
(TUI Commands): Add 'tui enable' and 'tui disable' details.
Patrick Palka [Thu, 21 May 2015 22:53:03 +0000 (18:53 -0400)]
Make sure test names are unique in gdb.base/gdbinit-history.exp
Use with_test_prefix to avoid duplicating test names when calling
the procedure test_gdbinit_history_setting multiple times.
gdb/testsuite/ChangeLog:
* gdb.base/gdbinit-history.exp (test_gdbinit_history_setting):
Use with_test_prefix.
GDB Administrator [Fri, 22 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 21 May 2015 19:21:40 +0000 (21:21 +0200)]
gdb: Use NULL not 0 in a tui function.
gdb/ChangeLog:
* tui/tui-regs.c (tui_reg_next_command): Use NULL not 0.
Andrew Burgess [Wed, 20 May 2015 22:51:23 +0000 (00:51 +0200)]
gdb: Add cleanup to avoid memory leak on error.
Use cleanup to avoid leaking memory if an error occurs during tui
start up.
gdb/ChangeLog:
* tui/tui-layout.c (tui_set_layout_for_display_command): Ensure
buf_ptr is freed.
Andrew Burgess [Wed, 20 May 2015 22:45:26 +0000 (00:45 +0200)]
gdb: Don't call tui_enable too early.
Calling tui_enable too early in tui_layout_command can leave the tui in
an enabled state if the user has entered an invalid layout name.
Instead postpone the call to tui_enable until later in
tui_set_layout_for_display_command just before the layout is changed.
gdb/ChangeLog:
* tui/tui-layout.c (tui_layout_command): Move call to tui_enable
into ...
(tui_set_layout_for_display_command): ...here, before calling
tui_set_layout. Only set the layout if gdb has not already
entered the TUI_FAILURE state.
Andrew Burgess [Thu, 26 Mar 2015 14:13:57 +0000 (14:13 +0000)]
gdb: Add completer for layout command.
Add layout name completion for the layout command.
gdb/ChangeLog:
* tui/tui-layout.c (layout_completer): New function.
(_initialize_tui_layout): Set completer on layout command.
gdb/testsuite/ChangeLog:
* gdb.base/completion.exp: Add test for completion of layout
names.
Andrew Burgess [Wed, 20 May 2015 21:35:07 +0000 (23:35 +0200)]
gdb: Remove register class specific layout names.
The layout command supports the layout names $FREGS, $GREGS, $SREGS,
and $REGS. The intention of these layout names was to display the tui
register window with a specific set of registers.
First, these layout names no longer work, and haven't for a while, using
any of them will just result in switching to the general register view.
Second there is already the command 'tui reg GROUP' command to set the
displayed register set to GROUP, so making the layout command also
control the register set feels like unnecessary overloading of the
layout command.
This commit removes all code relating to supporting the register set
specific names from the layout command. Afterwards the user can select
an available layout using the layout command, and control the choice of
register set using the 'tui reg GROUP' command.
gdb/ChangeLog:
* tui/tui-layout.c (tui_set_layout): Remove
tui_register_display_type parameter. Remove all checking of this
parameter, and reindent function. Update header comment.
(tui_set_layout_for_display_command): Rename to...
(tui_set_layout_by_name): ...this, and don't check for different
register class types, don't pass a tui_register_display_type to
tui_set_layout. Update header comment.
(layout_names): Remove register set specific names.
* tui/tui-layout.h (tui_set_layout): Remove
tui_register_display_type parameter.
* tui/tui.c (tui_rl_change_windows): Don't pass a
tui_register_display_type to tui_set_layout.
(tui_rl_delete_other_windows): Likewise.
(tui_enable): Likewise.
* tui/tui-data.h (TUI_FLOAT_REGS_NAME): Remove.
(TUI_FLOAT_REGS_NAME_LOWER): Remove.
(TUI_GENERAL_REGS_NAME): Remove.
(TUI_GENERAL_REGS_NAME_LOWER): Remove.
(TUI_SPECIAL_REGS_NAME): Remove.
(TUI_SPECIAL_REGS_NAME_LOWER): Remove.
(TUI_GENERAL_SPECIAL_REGS_NAME): Remove.
(TUI_GENERAL_SPECIAL_REGS_NAME_LOWER): Remove.
(enum tui_register_display_type): Remove.
(struct tui_layout_def): Remove regs_display_type and
float_regs_display_type fields.
(struct tui_data_info): Remove regs_display_type field.
(tui_layout_command): Use new name for
tui_set_layout_for_display_command.
* tui/tui-data.c (layout_def): Don't initialise removed fields.
(tui_clear_win_detail): Don't initialise removed fields of
win_info.
* tui/tui-regs.c (tui_show_registers): Use new name for
tui_set_layout_for_display_command.
* tui/tui.h (tui_set_layout_for_display_command): Rename
declaration to...
(tui_set_layout_by_name): ...this.
* printcmd.c (display_command): Remove tui related layout call,
and reindent.
GDB Administrator [Thu, 21 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 27 Mar 2015 22:52:31 +0000 (22:52 +0000)]
gdb/testsuite: New skip_tui_tests predicate.
Add a new predicate procedure to the gdb.exp library 'skip_tui_tests',
which returns true if the tui is not compiled into gdb.
Make use of this predicate in the gdb.base/tui-layout.exp test as an
example.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (skip_tui_tests): New proc.
* gdb.base/tui-layout.exp: Check skip_tui_tests.
H.J. Lu [Wed, 20 May 2015 14:55:45 +0000 (07:55 -0700)]
Skip extra relocations in .rel.plt/.rela.plt
Extra relocations may be added to the .rel.plt/.rela.plt section, which
are unrelated to PLT. We should skip them when retrieving PLT entry
symbol values.
PR binutils/18437
* elf32-i386.c (elf_i386_get_plt_sym_val): Skip extra relocations
in .rel.plt/.rela.plt.
* elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
Jiong Wang [Wed, 20 May 2015 09:58:43 +0000 (10:58 +0100)]
[AArch64/BFD] Sort relocation case labels alphabetically
2015-05-19 Jiong Wang <jiong.wang@arm.com>
bfd/
* elfnn-aarch64.c (aarch64_tls_transition_without_check): Sort
relocation case labels alphabetically.
(elfNN_aarch64_final_link_relocate): Ditto.
(elfNN_aarch64_tls_relax): Ditto.
(elfNN_aarch64_relocate_section): Ditto.
(elfNN_aarch64_gc_sweep_hook): Ditto.
(elfNN_aarch64_check_relocs): Ditto.
* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
(_bfd_aarch64_elf_resolve_relocation): Ditto.
Jiong Wang [Wed, 20 May 2015 09:44:24 +0000 (10:44 +0100)]
[AArch64] Sort relocation case labels alphabetically
2015-05-19 Jiong. Wang <jiong.wang@arm.com>
gas/
* config/tc-aarch64.c (process_movw_reloc_info): Sort relocation case labels
alphabetically.
(md_apply_fix): Ditto.
(aarch64_force_relocation): Ditto.
Joel Brobecker [Fri, 13 Feb 2015 10:57:29 +0000 (11:57 +0100)]
Memory leak reading frame register during inferior event handling
When using a conditional breakpoint where the condition evaluated
to false a large number of times before the program stopped,
a user reported that GDB's memory consumption was growing very
quickly until it ran out of memory.
The problem was tracked down to temporary struct values being created
each time the program stops and handles an inferior event. Because
the breakpoint condition usually evaluates to false, there can be
a fairly large number of such events to be handled before we eventually
return the prompt to the user (which is when we would normally purge
such values).
This patch fixes the issue by making sure that handle_inferior_event
releases all new values created during its execution.
gdb/ChangeLog:
* infrun.c (handle_inferior_event_1): Renames handle_inferior_event.
(handle_inferior_event): New function.
Joel Brobecker [Wed, 20 May 2015 07:14:30 +0000 (09:14 +0200)]
gdb/ada-lang.c: Rename local variable typename into type_name...
... to avoid a build failure when building with C++ compiler
(when configured with --enable-build-with-cxx). We cannot use
"typename" as it is a C++ reserved keyword.
gdb/ChangeLog:
* ada-lang.c (to_fixed_array_type): Rename local variable
typename into type_name.
GDB Administrator [Wed, 20 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Tue, 19 May 2015 14:12:30 +0000 (16:12 +0200)]
compile: Fix ASAN crash for gdb.compile/compile.exp
(gdb) PASS: gdb.compile/compile.exp: set unwindonsignal on
compile code *(volatile int *) 0 = 0;
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7fba426 in _gdb_expr (__regs=0x7ffff7fb8000) at gdb command line:1
1 gdb command line: No such file or directory.
=================================================================
==10462==ERROR: AddressSanitizer: heap-use-after-free on address 0x621000cf7a3d at pc 0x0000004e46b9 bp 0x7ffdeb0f7a40 sp 0x7ffdeb0f71b8
READ of size 10 at 0x621000cf7a3d thread T0
#0 0x4e46b8 in printf_common(void*, char const*, __va_list_tag*) [clone .isra.6] (/home/jkratoch/redhat/gdb-clean-asan/gdb/gdb+0x4e46
b8)
#1 0x4f645e in vasprintf (/home/jkratoch/redhat/gdb-clean-asan/gdb/gdb+0x4f645e)
#2 0xe5cf00 in xstrvprintf common/common-utils.c:120
#3 0xe74192 in throw_it common/common-exceptions.c:332
#4 0xe742f6 in throw_verror common/common-exceptions.c:361
#5 0xddc89e in verror /home/jkratoch/redhat/gdb-clean-asan/gdb/utils.c:541
#6 0xe734bd in error common/errors.c:43
#7 0xafa1d6 in call_function_by_hand_dummy /home/jkratoch/redhat/gdb-clean-asan/gdb/infcall.c:1031
#8 0xe81858 in compile_object_run compile/compile-object-run.c:119
#9 0xe7733c in eval_compile_command compile/compile.c:577
#10 0xe7541e in compile_code_command compile/compile.c:153
It is obvious why that happens, dummy_frame_pop() will call compile objfile
cleanup which will free that objfile and NAME then becomes a stale pointer.
> Is there any reason we release OBJFILE in the dummy frame dtor? Why
> don't we register a cleanup to release in OBJFILE in compile_object_run?
> together with releasing compile_module? 'struct compile_module' has a
> field objfile, which should be released together with
> 'struct compile_module' instead of dummy_frame.
(gdb) break puts
Breakpoint 2 at 0x3830c6fd30: file ioputs.c, line 34.
(gdb) compile code puts("hello")
Breakpoint 2, _IO_puts (str=0x7ffff7ff8000 "hello") at ioputs.c:34
34 {
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(_gdb_expr) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb) bt
(gdb) _
Now compile_object_run() called from line
(gdb) compile code puts("hello")
has finished for a long time. But we still need to have that injected code
OBJFILE valid when GDB is executing it. Therefore OBJFILE is freed only from
destructor of the frame #1.
At the patched line of call_function_by_hand_dummy() the dummy frame
destructor has not yet been run but it will be run before the fetched NAME
will get used.
gdb/ChangeLog
2015-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix ASAN crash for gdb.compile/compile.exp.
* infcall.c (call_function_by_hand_dummy): Use xstrdup for NAME.
Jan Kratochvil [Tue, 19 May 2015 12:27:06 +0000 (14:27 +0200)]
compile: gdb_stdout -> gdb_stdlog
Please send debug output to gdb_stdlog.
OK but gdb/compile/ is using now only gdb_stdout; the error above is due to
a copy-paste. So I will send a follow-up patch to change all the other
gdb/compile/ gdb_stdout strings to gdb_stdlog.
gdb/ChangeLog
2015-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-c-symbols.c (convert_symbol_sym, gcc_convert_symbol)
(gcc_symbol_address): Change gdb_stdout to gdb_stdlog.
* compile/compile-object-load.c (setup_sections, compile_object_load):
Likewise.
* compile/compile.c (compile_to_object): Likewise.
Pedro Alves [Tue, 19 May 2015 09:47:27 +0000 (10:47 +0100)]
Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment
Some buildslaves are showing that this test is failing. E.g.,:
https://sourceware.org/ml/gdb-testers/2015-q2/msg04164.html
The issue is that HISTSIZE is set to 1000 in the environment that runs
the tests (that's the default in Fedora, set in /etc/profile).
We can trivially reproduce it with:
$ HISTSIZE=1000 make check RUNTESTFLAGS="gdbinit-history.exp"
(...)
Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/gdbinit-history.exp ...
FAIL: gdb.base/gdbinit-history.exp: show history size
FAIL: gdb.base/gdbinit-history.exp: show history size
FAIL: gdb.base/gdbinit-history.exp: show commands
gdb.log shows:
...
(gdb) set height 0
(gdb) set width 0
(gdb) show history size
The size of the command history is 1000.
(gdb) FAIL: gdb.base/gdbinit-history.exp: show history size
gdb/testsuite/ChangeLog:
2015-05-19 Pedro Alves <palves@redhat.com>
* gdb.base/gdbinit-history.exp (test_gdbinit_history_setting):
Save the whole env array instead of just HOME. Unset HISTSIZE in
the environment while testing. Restore whole environment
afterwards.
GDB Administrator [Tue, 19 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Mon, 18 May 2015 14:58:46 +0000 (15:58 +0100)]
Fix seg-fault in readelf when decoding corrupt IA64 unwind information.
PR binutils/18420
* ia64-unwind.c (unw_decode): Add end parameter. Pass parameter
on to decode functions.
(unw_devode_p2_p5): Pass end paraemter to UNW_DEC_SPILL_MASK.
(UNW_DEC_SPILL_MASK): Add end parameter. Check that unw_rlen does
not take us beyond the end of the buffer.
* ia64-unwind.h (unw_decode): Update prototype.
* readelf.c (dump_ia64_unwind): Pass end pointer to unw_decode.
Nick Clifton [Mon, 18 May 2015 13:36:15 +0000 (14:36 +0100)]
Fix dw-2 test for 16-bit targets.
* binutils-all/dw2-3.S: Replace .int with .4byte.
H.J. Lu [Mon, 18 May 2015 11:17:12 +0000 (04:17 -0700)]
Remove Disp32 from AMD64 direct call/jmp
* i386-opc.tbl: Remove Disp32 from AMD64 direct call/jmp.
* i386-init.h: Regenerated.
Jiong Wang [Mon, 18 May 2015 09:43:43 +0000 (10:43 +0100)]
[AArch64] Remove X86-64 comments
bfd/
* elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Rewrite comments.
GDB Administrator [Mon, 18 May 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Sun, 17 May 2015 23:05:57 +0000 (02:05 +0300)]
Add myself to write-after-approval list
gdb/
* MAINTAINERS (Write After Approval): Add Max Filippov.
Mike Frysinger [Sun, 17 May 2015 09:11:17 +0000 (17:11 +0800)]
sim: erc32: restore attribution
Chung-Lin Tang [Thu, 14 May 2015 10:40:57 +0000 (18:40 +0800)]
ELF options may be missing from `ld --help' output
nios2-linux has an emulation named "nios2linux", and happens to not include
another extra emulation with a name matching *elf*. This makes nios2-linux
left out of the ELF options printing targets, which is unintended.
* configure.ac (AC_PROG_GREP): Check for grep program.
(elf_list_options,elf_shlib_list_options,elf_plt_unwind_list_options):
Enable ELF option printing for emulations containing
'TEMPLATE_NAME=elf32'.
* configure: Regenerate.
GDB Administrator [Sun, 17 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Sat, 16 May 2015 19:14:26 +0000 (12:14 -0700)]
Add support for unbuffered and zero sized Guile ports.
gdb/ChangeLog
* NEWS: Mention support for unbuffered Guile memory ports.
* scm-ports.c (ioscm_memory_port): Update comments on end, size.
(ioscm_lseek_address): Improve overflow calculation.
(gdbscm_memory_port_fill_input): Add assert.
(gdbscm_memory_port_write): Handle unbuffered ports.
Handle large writes identical to Guile's fport_write.
(gdbscm_memory_port_seek): Fix seeking past end check.
(gdbscm_memory_port_close): Handle closing unbuffered port.
(ioscm_parse_mode_bits): Recognize "0" for unbuffered ports.
(ioscm_init_memory_port): Handle unbuffered ports.
(ioscm_reinit_memory_port): Ditto.
(ioscm_init_memory_port): Update size calculation.
(gdbscm_open_memory): Support zero sized ports.
gdb/testsuite/ChangeLog
* gdb.guile/scm-ports.c: New file.
* gdb.guile/scm-ports.exp: Add memory port tests.
gdb/doc/ChangeLog
* guile.texi (Memory Ports in Guile): Document support for unbuffered
memory ports.
Jan Kratochvil [Sat, 16 May 2015 14:36:44 +0000 (16:36 +0200)]
compile: Fix uninitialized variable compiler warnings
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (get_out_value_type): Fix uninitialized
variable compiler warnings.
H.J. Lu [Sat, 16 May 2015 14:00:21 +0000 (07:00 -0700)]
Don't generate PLT relocations for now binding
There is no need for PLT relocations with -z now. We can use GOT
relocations, which take less space, instead and replace 16-byte .plt
entres with 8-byte .plt.got entries.
bfd/
* elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
for now binding.
(elf_i386_allocate_dynrelocs): Use .plt.got section for now
binding.
* elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
section for now binding.
(elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
binding.
ld/testsuite/
* ld-i386/i386.exp: Run PR ld/17689 tests with -z now.
* ld-x86-64/x86-64.exp: Likewise
* ld-i386/pr17689now.rd: New file.
* ld-x86-64/pr17689now.rd: Likewise
Jan Kratochvil [Sat, 16 May 2015 13:36:33 +0000 (15:36 +0200)]
compile: Fix detected inferior type
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (get_out_value_type): Fix returned type.
Alan Modra [Wed, 13 May 2015 04:42:38 +0000 (14:12 +0930)]
[GOLD] Add PowerPC64 -fsplit-stack support
PowerPC64 ELFv1 requires a tweak to find_functions in order to return
code addresses, rather than OPD entry addresses.
* reloc.cc (Sized_relobj_file::find_functions): Use function_location.
* powerpc.cc (Target_powerpc::do_calls_non_split): New function.
(addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
(lis_0): Rename from lis_0_0.
Jan Kratochvil [Sat, 16 May 2015 12:20:46 +0000 (14:20 +0200)]
compile: New 'compile print'
It is planned the existing GDB command 'print' will be able to evaluate its
expressions using the compiler. There will be some option to choose between
the existing GDB evaluation and the compiler evaluation. But as an
intermediate step this patch provides the expression printing feature as a new
command.
I can imagine it could be also called 'maintenance compile print' as in the
future one should be able to use its functionality by the normal 'print'
command.
There was a discussion with Eli about the command name:
https://sourceware.org/ml/gdb-patches/2015-03/msg00880.html
As there were no other comments yet I haven't renamed it yet, before there is
some confirmation about settlement on the final name.
Support for the GDB '@' operator to create arrays has been submitted for GCC:
[gcc patch] libcc1: '@' GDB array operator
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01451.html
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
* NEWS (Changes since GDB 7.9): Add compile print.
* compile/compile-c-support.c (add_code_header, add_code_footer)
(c_compute_program): Add COMPILE_I_PRINT_ADDRESS_SCOPE and
COMPILE_I_PRINT_VALUE_SCOPE.
* compile/compile-internal.h (COMPILE_I_PRINT_OUT_ARG_TYPE)
(COMPILE_I_PRINT_OUT_ARG, COMPILE_I_EXPR_VAL, COMPILE_I_EXPR_PTR_TYPE):
New.
* compile/compile-object-load.c: Include block.h.
(get_out_value_type): New function.
(compile_object_load): Handle COMPILE_I_PRINT_ADDRESS_SCOPE and
COMPILE_I_PRINT_VALUE_SCOPE. Set compile_module's OUT_VALUE_ADDR and
OUT_VALUE_TYPE.
* compile/compile-object-load.h (struct compile_module): Add fields
out_value_addr and out_value_type.
* compile/compile-object-run.c: Include valprint.h and compile.h.
(struct do_module_cleanup): Add fields out_value_addr and
out_value_type.
(do_module_cleanup): Handle COMPILE_I_PRINT_ADDRESS_SCOPE and
COMPILE_I_PRINT_VALUE_SCOPE.
(compile_object_run): Propagate out_value_addr and out_value_type.
Pass OUT_VALUE_ADDR.
* compile/compile.c: Include valprint.h.
(compile_print_value, compile_print_command): New functions.
(eval_compile_command): Handle failed COMPILE_I_PRINT_ADDRESS_SCOPE.
(_initialize_compile): Update compile code help text. Install
compile_print_command.
* compile/compile.h (compile_print_value): New prototype.
* defs.h (enum compile_i_scope_types): Add
COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE.
gdb/doc/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Compiling and Injecting Code): Add compile print.
gdb/testsuite/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.compile/compile-print.c: New file.
* gdb.compile/compile-print.exp: New file.
Jan Kratochvil [Sat, 16 May 2015 12:20:45 +0000 (14:20 +0200)]
Code cleanup: compile: func_addr -> func_sym
Currently the code fetches _gdb_expr address/types at multiple places, guessing
its parameters at multiple places etc.
Fetch it once, verify it has expected type and then rely on it.
While the patch tries to clean up the code it is still horrible due to the
missing C++ sub-classing.
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (get_regs_type): Add parameter func_sym.
Rely on its parameter count.
(compile_object_load): Replace lookup_minimal_symbol_text by
lookup_global_symbol_from_objfile. Verify FUNC_SYM. Set it in the
return value.
* compile/compile-object-load.h (struct compile_module): Replace
func_addr by func_sym.
* compile/compile-object-run.c: Include block.h.
(compile_object_run): Reset module variable after it is freed. Use
FUNC_SYM instead of FUNC_ADDR. Rely on it.
Jan Kratochvil [Sat, 16 May 2015 12:20:45 +0000 (14:20 +0200)]
compile: Use -Wall, not -w
For a reason unknown to me GDB was using -w instead of -Wall for 'compile code'.
The problem is later patch for 'compile printf' really needs some warnings to
be able to catch for example missing format string parameters:
(gdb) compile printf "%d\n"
GCC does not seem to be able to cancel -w (there is nothing like -no-w).
Besides that I think even 'compile code' can benefit from -Wall.
That #ifndef change in print_one_macro() is needed otherwise we get
macro-redefinition warnings for the GCC built-in macros (as -w is no
longer in effect). For example, without the #ifndef/#endif one gets:
compile -r -- void _gdb_expr(){int i = 5;}^M
/tmp/gdbobj-xpU1yB/out4.c:4:0: warning: "__FILE__" redefined [-Wbuiltin-macro-redefined]^M
/tmp/gdbobj-xpU1yB/out4.c:5:0: warning: "__LINE__" redefined^M
...
It makes more sense to pick the inferior's version of the macros, hence
#ifndef instead of #undef.
That new testsuite XFAIL is there as if one changes the struct definition to be
compliant with cv-qualifiers (to prevent the warnings):
struct struct_type {
- struct struct_type *selffield;
+ volatile struct struct_type *selffield;
only then GCC/GDB will hit the crash, described in that GDB PR 18202.
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-c-support.c (print_one_macro): Use #ifndef.
(generate_register_struct): Use __gdb_uintptr for TYPE_CODE_PTR.
(c_compute_program): Call generate_register_struct after typedefs.
* compile/compile-loc2c.c (push, pushf_register_address)
(pushf_register): Cast to GCC_UINTPTR.
(do_compile_dwarf_expr_to_c): Use unused attribute. Add space after
type. Use GCC_UINTPTR instead of void *. Remove excessive cast.
(compile_dwarf_expr_to_c): Use GCC_UINTPTR instead of void *.
* compile/compile.c (_initialize_compile): Enable warnings for
COMPILE_ARGS.
gdb/testsuite/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.compile/compile-ops.exp: Cast param to void.
* gdb.compile/compile.exp: Complete type for _gdb_expr.
(compile code struct_object.selffield = &struct_object): Add xfail.
Jan Kratochvil [Sat, 16 May 2015 12:27:47 +0000 (14:27 +0200)]
compile: Distribute scope, add scope_data
Provide a way to access current 'scope' during the do_module_cleanup stage and
associate more data with it.
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* cli/cli-script.c (execute_control_command): Update
eval_compile_command caller.
* compile/compile-object-load.c (compile_object_load): Add parameters
scope and scope_data. Set them.
* compile/compile-object-load.h (struct compile_module): Add fields
scope and scope_data.
(compile_object_load): Add parameters scope and scope_data.
* compile/compile-object-run.c (struct do_module_cleanup): Add fields
scope and scope_data.
(compile_object_run): Propagate the fields scope and scope_data.
* compile/compile.c (compile_file_command, compile_code_command):
Update eval_compile_command callers.
(eval_compile_command): Add parameter scope_data. Pass it plus scope.
* compile/compile.h (eval_compile_command): Add parameter scope_data.
* defs.h (struct command_line): Add field scope_data.
Jan Kratochvil [Sat, 16 May 2015 12:26:06 +0000 (14:26 +0200)]
Code cleanup: Make parts of print_command_1 public
The later 'compile print' command should share its behavior with the existing
'print' command. Make the needed existing parts of print_command_1 public.
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* printcmd.c (struct format_data): Move it to valprint.h.
(print_command_parse_format, print_value): New functions from ...
(print_command_1): ... here. Call them.
* valprint.h (struct format_data): Move it here from printcmd.c.
(print_command_parse_format, print_value): New declarations.
Jan Kratochvil [Sat, 16 May 2015 12:25:28 +0000 (14:25 +0200)]
Add forgotten ChangeLog entry for the previous commit.
Jan Kratochvil [Sat, 16 May 2015 12:14:10 +0000 (14:14 +0200)]
compile: Add one debug message
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (compile_object_load): Add
COMPILE_DEBUG message.
GDB Administrator [Sat, 16 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Jerome Guitton [Fri, 27 Mar 2015 13:45:08 +0000 (14:45 +0100)]
Array indexed by non-contiguous enumeration types
In Ada, index types of arrays can be enumeration types, and enumeration
types can be non-contiguous. In which case the address of elements is
not given by the value of the index, but by its position in the enumeration
type.
In other words, in this example:
type Color is (Blue, Red);
for Color use (Blue => 8, Red => 12, Green => 16);
type A is array (Color) of Integer;
type B is array (1 .. 3) of Integer;
Arrays of type A and B will have the same layout in memory, even if
the enumeration Color has a hole in its set of integer value.
Since recently support for such a feature was in ada-lang.c, where the
array was casted to a regular continuous index range. We were losing
the information of index type. And this was not quite working for
subranges in variable-length fields; their bounds are expressed using
the integer value of the bounds, not its position in the enumeration,
and there was some confusion all over ada-lang.c as to whether we had
the position or the integer value was used for indexes.
The idea behind this patch is to clean this up by keeping the real
representation of these array index types and bounds when representing
the value, and only use the position when accessing the elements or
computing the length. This first patch fixes the printing of such
an array.
To the best of my knowledge, this feature only exists in Ada so it
should only affect this language.
gdb/ChangeLog:
Jerome Guitton <guitton@adacore.com>:
* ada-lang.c (ada_value_ptr_subscript): Use enum position of
index to get element instead of enum value.
(ada_value_slice_from_ptr, ada_value_slice): Use enum position
of index to compute length, but enum values to compute bounds.
(ada_array_length): Use enum position of index instead of enum value.
(pos_atr): Move position computation to...
(ada_evaluate_subexp): Use enum values to compute bounds.
* gdbtypes.c (discrete_position): ...this new function.
* gdbtypes.h (discrete_position): New function declaration.
* valprint.c (val_print_array_elements): Call discrete_position
to handle array indexed by non-contiguous enumeration types.
gdb/testsuite/ChangeLog:
* gdb.ada/arr_enum_with_gap: New testcase.
Jerome Guitton [Thu, 26 Mar 2015 15:19:27 +0000 (16:19 +0100)]
Non bit-packed packed arrays as variable-length fields
In the case of non bit-packed arrays, GNAT does not generate its
traditional XP encoding; it is not needed. However, it still generates
the so-called "implementation type" with a P suffix. This
implementation type shall be skipped when looking for other
descriptive types such as XA encodings for variable-length
fields.
Note also that there may be an intermediate typedef between the
implementation type and its XA description. It shall be skipped
as well.
gdb/ChangeLog:
Jerome Guitton <guitton@adacore.com>
* ada-lang.c (find_parallel_type_by_descriptive_type):
Go through typedefs during lookup.
(to_fixed_array_type): Add support for non-bit packed arrays
as variable-length fields.
gdb/testsuite/ChangeLog:
* gdb.ada/byte_packed_arr: New testcase.
H.J. Lu [Fri, 15 May 2015 17:29:03 +0000 (10:29 -0700)]
Change pointers from char * to unsigned char *
GCC 4.2 complaints:
cc1: warnings being treated as errors
binutils/readelf.c:12057: warning: dereferencing type-punned pointer will break strict-aliasing rules
This patch silences this GCC warning.
* readelf.c (dump_section_as_strings): Change pointers from
char * to unsigned char *.
H.J. Lu [Fri, 15 May 2015 16:47:39 +0000 (09:47 -0700)]
Support AMD64/Intel ISAs in assembler/disassembler
AMD64 spec and Intel64 spec differ in direct unconditional branches in
64-bit mode. AMD64 supports direct unconditional branches with 16-bit
offset via the data size prefix, which truncates RIP to 16 bits, while
the data size prefix is ignored by Intel64.
This patch adds -mamd64/-mintel64 option to x86-64 assembler and
-Mamd64/-Mintel64 option to x86-64 disassembler. The most permissive
ISA, which is AMD64, is the default.
GDB can add an option, similar to
(gdb) help set disassembly-flavor
Set the disassembly flavor.
The valid values are "att" and "intel", and the default value is "att".
to select which ISA to disassemble.
binutils/
PR binutis/18386
* doc/binutils.texi: Document -Mamd64 and -Mintel64.
gas/
PR binutis/18386
* config/tc-i386.c (OPTION_MAMD64): New.
(OPTION_MINTEL64): Likewise.
(md_longopts): Add -mamd64 and -mintel64.
(md_parse_option): Handle OPTION_MAMD64 and OPTION_MINTEL64.
(md_show_usage): Add -mamd64 and -mintel64.
* doc/c-i386.texi: Document -mamd64 and -mintel64.
gas/testsuite/
PR binutis/18386
* gas/i386/i386.exp: Run x86-64-branch-2 and x86-64-branch-3.
* gas/i386/x86-64-branch.d: Also pass -Mintel64 to objdump.
* gas/i386/ilp32/x86-64-branch.d: Likewise.
* gas/i386/x86-64-branch-2.d: New file.
* gas/i386/x86-64-branch-2.s: Likewise.
* gas/i386/x86-64-branch-3.l: Likewise.
* gas/i386/x86-64-branch-3.s: Likewise.
ld/testsuite/
PR binutis/18386
* ld-x86-64/tlsgdesc.dd: Also pass -Mintel64 to objdump.
* ld-x86-64/tlspic.dd: Likewise.
* ld-x86-64/x86-64.exp (x86_64tests): Also pass -Mintel64 to
objdump for tlspic.dd and tlsgdesc.dd.
opcodes/
PR binutis/18386
* i386-dis.c: Add comments for '@'.
(x86_64_table): Use '@' on call/jmp for X86_64_E8/X86_64_E9.
(enum x86_64_isa): New.
(isa64): Likewise.
(print_i386_disassembler_options): Add amd64 and intel64.
(print_insn): Handle amd64 and intel64.
(putop): Handle '@'.
(OP_J): Don't ignore the operand size prefix for AMD64 in 64-bit.
* i386-gen.c (cpu_flags): Add CpuAMD64 and CpuIntel64.
* i386-opc.h (AMD64): New.
(CpuIntel64): Likewise.
(i386_cpu_flags): Add cpuamd64 and cpuintel64.
* i386-opc.tbl: Add direct call/jmp with Disp16|Disp32 for AMD64.
Mark direct call/jmp without Disp16|Disp32 as Intel64.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Nick Clifton [Fri, 15 May 2015 16:16:31 +0000 (17:16 +0100)]
Add --decompress option to readelf to decompress sections before they are dumped.
bin * readelf.c (options): Add "decompress".
(usage): Mention -z/--decompress.
(parse_args): Handle -z.
(uncompress_section_contents): Move to earlier in the file.
(dump_section_as_strings): If requested, decompress the section
before dumping.
(dump_section_as_bytes): Likewise.
* doc/binutils.texi: Document the new option.
tests * binutils-all/z.s: New test. Checks the --decompress option to
readelf.
* binutils-all/readelf.exp: Run the test.
* binutils-all/readelf.z: Expected output from readelf.
Pedro Alves [Fri, 15 May 2015 15:26:53 +0000 (16:26 +0100)]
Fix gdb.mi/mi-nsmoribund.exp timeouts
The PPC64 buildbot has been showing timeouts in mi-nsmoribund.exp,
like this:
(...)
-thread-info
FAIL: gdb.mi/mi-nsmoribund.exp: thread state: all running except the breakpoint thread (timeout)
... and I can reproduce this on gcc110 (PPC64) on the gcc compile
farm.
That is, the test sends "-thread-info" to GDB, but GDB never replies
back.
The problem is that these machines are too fast for gdb. :-)
That test has a few threads running the same tight loop, and
constantly hitting a thread-specific breakpoint that needs to be
stepped over. If threads trip on breakpoints fast enough that
linux-nat.c's event pipe associated with SIGCHLD is constantly being
written to, even if the stdin file descriptor also has an event to
handle, gdb never gets to it. because linux-nat.c's pipe comes first
in the set of descriptors served by the poll/select code in the event
loop.
Fix this by having the event loop serve file event sources in
round-robin-like fashion, similarly to how its done in
gdb_do_one_event.
Unfortunately, the poll and the select variants each need their own
fixing.
Tested on x86_64 Fedora 20 (poll and select variants), and PPC64
Fedora 18. Fixes the timeout in the PPC64 machine in the compile farm
that times out without this, and I won't be surprised if it fixes
other random timeouts in other tests.
(gdbserver's copy of the event-loop doesn't need this (yet), as it
still pushes all ready events to an event queue. That is, it hasn't
had
70b66289 merged yet. We should really merge both event-loop.c
copies into a single shared file, but that's for another day.)
gdb/ChangeLog:
2015-05-15 Pedro Alves <palves@redhat.com>
Simon Marchi <simon.marchi@ericsson.com>
* event-loop.c (gdb_notifier) <next_file_handler,
next_poll_fds_index>: New fields.
(get_next_file_handler_to_handle_and_advance): New function.
(delete_file_handler): If deleting the next file handler to
handle, advance to the next file handler.
(gdb_wait_for_event): Bail early if no event fired. Poll file
handlers in round-robin fashion.
Pedro Alves [Fri, 15 May 2015 15:00:42 +0000 (16:00 +0100)]
More C++ build fixing
Fixes:
In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
(*the_target->handle_new_gdb_connection) () : 0)
^
Reported by Yuanhui Zhang.
gdb/gdbserver/ChangeLog:
2015-05-15 Pedro Alves <palves@redhat.com>
* target.h (target_handle_new_gdb_connection): Rewrite using if
wrapped in do/while.
Pedro Alves [Fri, 15 May 2015 15:00:41 +0000 (16:00 +0100)]
Avoid using 'private' C++ keyword as symbol
gdb/ChangeLog:
2015-05-15 Pedro Alves <palves@redhat.com>
* linux-tdep.c (linux_find_memory_regions_full): Rename local
'private' to 'priv'.
Pedro Alves [Fri, 15 May 2015 15:00:40 +0000 (16:00 +0100)]
Include header for enum target_stop_reason
Building in C++ mode errors with:
~~~
g++ -fpermissive (...) /home/pedro/gdb/mygit/src/gdb/gdbserver/../nat/x86-linux.c
In file included from /home/pedro/gdb/mygit/src/gdb/gdbserver/../nat/x86-linux.h:23:0,
from /home/pedro/gdb/mygit/src/gdb/gdbserver/../nat/x86-linux.c:21:
/home/pedro/gdb/mygit/src/gdb/gdbserver/../nat/linux-nat.h:74:13: error: use of enum ‘target_stop_reason’ without previous declaration
extern enum target_stop_reason lwp_stop_reason (struct lwp_info *lwp);
^
/home/pedro/gdb/mygit/src/gdb/gdbserver/../nat/linux-nat.h:74:70: error: invalid type in declaration before ‘;’ token
extern enum target_stop_reason lwp_stop_reason (struct lwp_info *lwp);
^
~~~
gdb/ChangeLog:
2015-05-15 Pedro Alves <palves@redhat.com>
* nat/linux-nat.h: Include "target/waitstatus.h".
Yuanhui Zhang [Fri, 15 May 2015 15:00:40 +0000 (16:00 +0100)]
Fix a couple C++ build issues
Building mingw GDB with --enable-build-with-cxx shows:
../../binutils-gdb/gdb/python/py-unwind.c:500:45: error: cannot convert 'cached_frame_info::reg_info*' to 'pyuw_prev_register(frame_info*, void**, int)::reg_info*' in initialization
struct reg_info *reg_info = cached_frame->reg;
^
../../binutils-gdb/gdb/python/py-unwind.c:501:60: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
struct reg_info *reg_info_end = reg_info + cached_frame->reg_count;
^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
struct reg_info *reg_info = cached_frame->reg;
^
../../binutils-gdb/gdb/python/py-unwind.c:505:37: error: cannot increment a pointer to incomplete type 'pyuw_prev_register(frame_info*, void**, int)::reg_info'
for (; reg_info < reg_info_end; ++reg_info)
^
../../binutils-gdb/gdb/python/py-unwind.c:507:29: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
if (regnum == reg_info->number)
^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
struct reg_info *reg_info = cached_frame->reg;
^
../../binutils-gdb/gdb/python/py-unwind.c:508:68: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
struct reg_info *reg_info = cached_frame->reg;
^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'int pyuw_sniffer(const frame_unwind*, frame_info*, void**)':
../../binutils-gdb/gdb/python/py-unwind.c:574:70: warning: invalid conversion from 'void*' to 'cached_frame_info*' [-fpermissive]
reg_count * sizeof (cached_frame->reg[0]));
^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'void pyuw_on_new_gdbarch(gdbarch*)':
../../binutils-gdb/gdb/python/py-unwind.c:636:47: warning: invalid conversion from 'void*' to 'pyuw_gdbarch_data_type*' [-fpermissive]
gdbarch_data (newarch, pyuw_gdbarch_data);
^
../../binutils-gdb/gdb/python/py-unwind.c:647:29: warning: invalid conversion from 'void*' to 'const frame_data*' [-fpermissive]
unwinder->unwind_data = (void *) newarch;
^
../../binutils-gdb/gdb/python/py-unwind.c: At global scope:
../../binutils-gdb/gdb/python/py-unwind.c:699:21: error: redefinition of 'PyTypeObject pending_frame_object_type'
static PyTypeObject pending_frame_object_type =
^
../../binutils-gdb/gdb/python/py-unwind.c:96:21: error: 'PyTypeObject pending_frame_object_type' previously declared here
static PyTypeObject pending_frame_object_type
^
../../binutils-gdb/gdb/python/py-unwind.c:749:21: error: redefinition of 'PyTypeObject unwind_info_object_type'
static PyTypeObject unwind_info_object_type =
^
../../binutils-gdb/gdb/python/py-unwind.c:99:21: error: 'PyTypeObject unwind_info_object_type' previously declared here
static PyTypeObject unwind_info_object_type
^
The first kind of error is caused by the embedded struct definition,
so move it out of the parent struct.
The second kind of error is caused by forward declaring a static
global variable, which works in C, but not in C++ (or C with
-fno-common). Make it using extern instead, like done in other
similar cases.
gdb/ChangeLog:
2015-05-15 Yuanhui Zhang <asmwarrior@gmail.com>
* python/py-unwind.c (struct reg_info): Move out of ...
(struct cached_frame_info): ... this scope.
(pending_frame_object_type, unwind_info_object_type): Make extern.
Joel Brobecker [Sat, 9 May 2015 00:11:35 +0000 (17:11 -0700)]
[Ada] problem printing negative integer values in packed arrays.
Consider the following declarations:
type Signed_Small is new Integer range - (2 ** 5) .. (2 ** 5 - 1);
type Signed_Simple_Array is array (1 .. 4) of Signed_Small;
pragma Pack (Signed_Simple_Array);
SSA : Signed_Simple_Array := (-1, 2, -3, 4);
GDB currently print its value incorrectly for the elements that
are negative:
(gdb) print ssa
$1 = (65535, 2, 1048573, 4)
(gdb) print ssa(1)
$2 = 65535
(gdb) print ssa(2)
$3 = 2
(gdb) print ssa(3)
$4 = 1048573
(gdb) print ssa(4)
$5 = 4
What happens is that the sign-extension is not working because
we're trying to do left shift with a negative count. In
ada_value_primitive_packed_val, we have a loop which populates
the extra bits of the target (unpacked) value, after extraction
of the data from the original (packed) value:
while (ntarg > 0)
{
accum |= sign << accumSize;
unpacked[targ] = accum & ~(~0L << HOST_CHAR_BIT);
!!! -> accumSize -= HOST_CHAR_BIT;
accum >>= HOST_CHAR_BIT;
ntarg -= 1;
targ += delta;
}
At each iteration, accumSize gets decremented by HOST_CHAR_BIT,
which can easily cause it to become negative, particularly on
little endian targets, where accumSize is at most HOST_CHAR_BIT - 1.
This causes us to perform a left-shift operation with a negative
accumSize at the next loop iteration, which is undefined, and
acutally does not produce the effect we wanted (value left untouched)
when the code is compiled with GCC.
This patch fixes the issue by simply setting accumSize to zero
if negative.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_packed_val): Make sure
accumSize is never negative.
gdb/testsuite/ChangeLog:
* gdb.ada/pckd_neg: New testcase.
H.J. Lu [Fri, 15 May 2015 10:17:31 +0000 (03:17 -0700)]
Add -mshared option to x86 ELF assembler
This patch adds -mshared option to x86 ELF assembler. By default,
assembler will optimize out non-PLT relocations against defined non-weak
global branch targets with default visibility. The -mshared option tells
the assembler to generate code which may go into a shared library
where all non-weak global branch targets with default visibility can
be preempted. The resulting code is slightly bigger. This option
only affects the handling of branch instructions.
This Linux kernel patch is needed to create a working x86 Linux kernel if
it hasn't been applied:
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ae6588b..b91a00c 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -339,8 +339,8 @@ early_idt_handlers:
i = i + 1
.endr
-/* This is global to keep gas from relaxing the jumps */
-ENTRY(early_idt_handler)
+/* This is weak to keep gas from relaxing the jumps */
+WEAK(early_idt_handler)
cld
cmpl $2,(%rsp) # X86_TRAP_NMI
--
gas/
* config/tc-i386.c (shared): New.
(OPTION_MSHARED): Likewise.
(elf_symbol_resolved_in_segment_p): Add relocation argument.
Check PLT relocations and shared.
(md_estimate_size_before_relax): Pass fragP->fr_var to
elf_symbol_resolved_in_segment_p.
(md_longopts): Add -mshared.
(md_show_usage): Likewise.
(md_parse_option): Handle OPTION_MSHARED.
* doc/c-i386.texi: Document -mshared.
gas/testsuite/
* gas/i386/i386.exp: Don't run pcrel for ELF targets. Run
pcrel-elf, relax-4 and x86-64-relax-3 for ELF targets.
* gas/i386/pcrel-elf.d: New file.
* gas/i386/relax-4.d: Likewise.
* gas/i386/x86-64-relax-3.d: Likewise.
* gas/i386/relax-3.d: Pass -mshared to assembler. Updated.
* gas/i386/x86-64-relax-2.d: Likewise.
* gas/i386/relax-3.s: Add test for PLT relocation.
Nick Clifton [Fri, 15 May 2015 10:21:38 +0000 (11:21 +0100)]
Fix PR18374 by making readelf and objdump ignore end-of-list markers in the .debug_loc section if there are relocations against them.
PR binutils/18374
bin * dwarf.h (struct dwarf_section): Add reloc_info and num_relocs
fields.
(struct dwarf_section_display): Change bitfield to boolean.
(reloc_at): Add prototype.
* dwarf.c (display_loc_list): Ignore list terminators if there are
relocs against them.
(display_debug_loc): Issue a warning if there are relocs against
the .debug_loc section.
(display_displays): Initialise reloc_info and num_relocs fields.
* objdump.c (load_specific_debug_section): Initialise reloc_info
and num_relocs fields.
(reloc_at): New function.
* readelf.c (is_32bit_abs_reloc): Add IA64's R_IA64_DIS32LSB
reloc.
(reloc_at): New function.
(apply_relocations): Add relocs_return and num_relocs_return
parameters. Fill them in with the loaded relocs if non-NULL.
(dump_section_as_bytes): Update call to apply_relocations.
(load_specific_debug_section): Initialise reloc_info and
num_relocs fields.
tests * binutils-all/pr18374.s: New test file.
* binutils-all/readelf.exp: Assemble and run the new test.
* binutils-all/readelf.pr18374: Expected output from readelf.
Peter Bergner [Fri, 15 May 2015 01:57:50 +0000 (20:57 -0500)]
Fix some PPC assembler errors.
Remove the wait instructions for server processors, since they were never
implemented. Also add the extra operands added to the tlbie and slbia
instructions with ISA 2.06 and ISA 2.05 respectively.
binutils/
* MAINTAINERS: Add myself as PPC maintainer.
opcodes/
* ppc-opc.c (IH) New define.
(powerpc_opcodes) <wait>: Do not enable for POWER7.
<tlbie>: Add RS operand for POWER7.
<slbia>: Add IH operand for POWER6.
gas/testsuite/
* gas/ppc/power4.d: Add a slbia test.
* gas/ppc/power4.s: Likewise.
* gas/ppc/power6.d: Add slbia and tlbie tests.
* gas/ppc/power6.s: Likewise.
* gas/ppc/power7.d: Remove wait tests. Add a tlbie test.
* gas/ppc/power7.s: Likewise.
GDB Administrator [Fri, 15 May 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 14 May 2015 22:58:51 +0000 (15:58 -0700)]
Don't add the zlib header to SHF_COMPRESSED section
In a SHF_COMPRESSED compressed section, the raw compressed data should
begin immediately after the compression header. This patch removes the
extra zlib header from the SHF_COMPRESSED section.
bfd/
* bfd.c (bfd_update_compression_header): Also write the zlib
header if the SHF_COMPRESSED bit cleared..
(bfd_check_compression_header): Return the uncompressed size.
* compress.c (decompress_contents): Don't skip the zlib header.
(bfd_compress_section_contents): Properly handle ELFCOMPRESS_ZLIB,
which doesn't have the zlib header.
(bfd_init_section_decompress_status): Likewise.
(bfd_get_full_section_contents): Updated.
(bfd_is_section_compressed): Likewise.
(bfd_is_section_compressed_with_header): Return the uncompressed
size.
* elf.c (_bfd_elf_make_section_from_shdr): Updated.
* bfd-in2.h: Regenerated.
binutils/
* readelf.c (uncompress_section_contents): Add a parameter for
uncompressed size. Don't check the zlib header.
(load_specific_debug_section): Updated.
binutils/testsuite/
* binutils-all/compress.exp: Replace "$OBJDUMP -s -j .debug_info"
with "$OBJDUMP -W".
* binutils-all/libdw2-compressedgabi.out: Updated.
gas/
2015-05-14 H.J. Lu <hongjiu.lu@intel.com>
* write.c (compress_debug): Don't write the zlib header, which
is handled by bfd_update_compression_header.
Don Breazeal [Thu, 14 May 2015 20:11:41 +0000 (13:11 -0700)]
Fix build gdbserver build errors on arm, mips, aarch64.
Fix build errors introduced by
https://sourceware.org/ml/gdb-patches/2015-05/msg00281.html, which
didn't account for the change of the name of the struct process_info
field 'private' to 'priv' made in
https://sourceware.org/ml/gdb-patches/2015-02/msg00829.html.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_linux_new_fork): Change reference
to process_info.private to process_info.priv.
* linux-arm-low.c (arm_new_fork): Likewise.
* linux-mips-low.c (mips_linux_new_fork): Likewise.
Joel Brobecker [Tue, 24 Mar 2015 17:19:10 +0000 (13:19 -0400)]
Fix gdbserver build failure on arm-android.
The following patch...
| proc-service, extern "C"
|
| libthread_db.so calls symbols in the client (GDB), through the
| proc-service interface. These routines must have extern "C" linkage
| so their symbol names are not mangled when GDB is built as a C++
| program. On the GDBserver side, we were missing fallback declarations for
| all these symbols.
|
| gdb/ChangeLog:
|
| * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
|
| gdb/gdbserver/ChangeLog:
| 2015-02-27 Pedro Alves <palves@redhat.com>
|
| * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
| [!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
| [!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
| ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
| (ps_lsetfpregs, ps_getpid)
| (ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
| (ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
| (ps_lsetxregs, ps_plog): Declare.
... added a number of declarations which do not compile when cross-
compiling GDBserver on arm-android. The problem comes from type
prfpregset_t not being declared:
/[...]/gdbserver/gdb_proc_service.h:98:47:
error: unknown type name 'prfpregset_t'
After searching through the includes of the install we have,
I could not find that type being declared anywhere. So I did
the same as for prgregset_t, and created the typedef if the
type isn't declared.
gdb/gdbserver/ChangeLog:
* configure.ac: Add prfpregset_t BFD_HAVE_SYS_PROCFS_TYPE check.
* configure, config.in: Regenerate.
* gdb_proc_service.h [HAVE_PRFPREGSET_T] (prfpregset_t):
Declare typedef.
Patrick Palka [Wed, 13 May 2015 20:26:48 +0000 (16:26 -0400)]
Remove buggy xterm workaround in tui_dispatch_ctrl_char()
The function tui_dispatch_ctrl_char() has an old workaround (from 1999)
for buggy terminals and/or ncurses library that don't return page
up/down keys as single characters. Because the workaround is so old, I
think the bug it is targetting is no longer relevant anymore.
But more importantly, the workaround is itself buggy: it 1) performs a
blocking call to wgetch() and 2) if the key returned by wgetch() does
not make up a relevant key sequence it throws away the input instead of
pushing it back via ungetch(). And indeed the workaround breaks Alt-key
sequences under TERM=xterm because of bug #2.
So this patch removes the buggy workaround and tidies up the function
accordingly.
I personally tested this change on a recent xterm (with TERM=xterm) in
Fedora 20 and had no problems with having ncurses properly interpret
page up/down keys. And Alt-key sequences now work when TERM=xterm too.
gdb/ChangeLog:
* tui/tui-command.c: Remove include of <ctype.h>.
(tui_dispatch_ctrl_char): Remove workaround for xterm terminals.
Jiong Wang [Thu, 14 May 2015 11:46:31 +0000 (12:46 +0100)]
[AArch64] Remove BFD overflow check restrictions
bfd/
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Remove overflow
check restriction.
Nick Clifton [Thu, 14 May 2015 11:32:12 +0000 (12:32 +0100)]
Update description of the ASSERT linker script command to note its interation with PROVIDEd symbols.
* ld.texinfo (ASSERT): Describe the interaction with PROVIDEd
symbols.
Max Filippov [Thu, 14 May 2015 02:22:55 +0000 (05:22 +0300)]
xtensa: fix localized symbol refcounting with --gc-sections
elf_xtensa_gc_sweep_hook doesn't correctly unreference symbols that were
made local, that results in link failure with the following message:
BFD (GNU Binutils) 2.24 internal error, aborting at elf32-xtensa.c line
3372 in elf_xtensa_finish_dynamic_sections
elf_xtensa_gc_sweep_hook determines symbol reference type (PLT or GOT) by
relocation type. Relocation types are not changed when symbol becomes
local, but its PLT references are added to GOT references and
plt.refcount is set to 0. Such symbol cannot be unreferences in the
elf_xtensa_gc_sweep_hook and its extra references make calculated GOT
relocations section size not match number of GOT relocations.
Fix it by treating PLT reference as GOT reference when plt.refcount is
not positive.
2015-05-14 Max Filippov <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference
as GOT reference when plt.refcount is not positive.
GDB Administrator [Thu, 14 May 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Martin Galvan [Wed, 13 May 2015 21:09:19 +0000 (14:09 -0700)]
dwarf2read.c (die_needs_namespace): Return 1 for DW_TAG_inlined_subroutine.
gdb/ChangeLog:
* dwarf2read.c (die_needs_namespace): Return 1 for
DW_TAG_inlined_subroutine.
Doug Evans [Wed, 13 May 2015 21:07:03 +0000 (14:07 -0700)]
revert previous patch, author not set
Doug Evans [Wed, 13 May 2015 20:55:09 +0000 (13:55 -0700)]
dwarf2read.c (die_needs_namespace): Return 1 for DW_TAG_inlined_subroutine.
gdb/ChangeLog:
* dwarf2read.c (die_needs_namespace): Return 1 for
DW_TAG_inlined_subroutine.
Jan Kratochvil [Wed, 13 May 2015 18:47:33 +0000 (20:47 +0200)]
Make regcache_cpy_no_passthrough static
regcache_cpy_no_passthrough is no longer used for a standalone call.
gdb/ChangeLog
2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* regcache.c (regcache_cpy_no_passthrough): New declaration.
(regcache_cpy_no_passthrough): Make it static, add function comment.
* regcache.h (regcache_dup, regcache_cpy): Reduce/update their comment.
(regcache_cpy_no_passthrough): Remove declaration.
Jan Kratochvil [Wed, 13 May 2015 18:47:33 +0000 (20:47 +0200)]
Remove stop_registers
Now stop_registers are no longer used and it can be removed.
I am not much sure what 'proceed_to_finish' really means now so I make a wild
guess while updating comments about it.
gdb/ChangeLog
2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdbthread.h (struct thread_control_state): Update comment for
proceed_to_finish.
* infcall.c (run_inferior_call): Update comment about
proceed_to_finish.
* infcmd.c (get_return_value): Update comment about stop_registers.
(finish_forward): Update comment about proceed_to_finish.
* infrun.c (stop_registers): Remove.
(clear_proceed_status, normal_stop): Remove stop_registers handling.
* infrun.h (stop_registers): Remove.
Jan Kratochvil [Wed, 13 May 2015 18:47:32 +0000 (20:47 +0200)]
infcall: stop_registers -> register_dummy_frame_dtor
With dummy_frame destructors GDB no longer has to use global stop_registers.
dummy_frame's registers can be now stored associated with their specific
dummy_frame.
gdb/ChangeLog
2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* infcall.c (struct dummy_frame_context_saver)
(dummy_frame_context_saver_data_free, dummy_frame_context_saver_dtor)
(dummy_frame_context_saver_drop, dummy_frame_context_saver_cleanup)
(dummy_frame_context_saver_get_regs, dummy_frame_context_saver_setup):
New.
(call_function_by_hand_dummy): Move discard_cleanups of
inf_status_cleanup before dummy_frame_push. Call
dummy_frame_context_saver_setup and prepare context_saver_cleanup.
Use dummy_frame_context_saver_get_regs instead of stop_registers.
* infcall.h (struct dummy_frame_context_saver)
(dummy_frame_context_saver_drop, dummy_frame_context_saver_cleanup)
(dummy_frame_context_saver_get_regs, dummy_frame_context_saver_setup):
New declarations.
* infcmd.c: Include infcall.h.
(get_return_value): Add parameter ctx_saver, use it instead of
stop_registers.
(print_return_value): Add parameter ctx_saver, pass it.
(struct finish_command_continuation_args): Add field ctx_saver.
(finish_command_continuation): Update print_return_value caller.
(finish_command_continuation_free_arg): Free also ctx_saver.
(finish_forward): Call dummy_frame_context_saver_setup.
* inferior.h (struct dummy_frame_context_saver): New declaration.
(get_return_value): Add parameter ctx_saver.
* python/py-finishbreakpoint.c (bpfinishpy_pre_stop_hook): Update
get_return_value caller.
Jan Kratochvil [Wed, 13 May 2015 18:47:32 +0000 (20:47 +0200)]
register_dummy_frame_dtor: Permit multiple dtors
Later patch needs two independent destructors for the same dummy_frame.
Therefore the registrar has been extended to an arbitrary number of
destructors.
gdb/ChangeLog
2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* dummy-frame.c (struct dummy_frame_dtor_list): New.
(struct dummy_frame): Replace dtor and dtor_data by dtor_list.
(remove_dummy_frame): Process dtor_list.
(pop_dummy_frame): Process dtor_list.
(register_dummy_frame_dtor): Maintain dtor_list.
(find_dummy_frame_dtor): Handle dtor_list.
* dummy-frame.h (register_dummy_frame_dtor, find_dummy_frame_dtor):
Update comments.
Jan Kratochvil [Wed, 13 May 2015 18:47:32 +0000 (20:47 +0200)]
Call dummy_frame_dtor_ftype also from remove_dummy_frame
There was now a leak-like bug that if dummy_frame "disappeared" by
remove_dummy_frame then its destructor was not called. For example in the case
of 'compile code' dummy frames the injected objfile would never get freed after
some inferior longjmp out of the injected code.
gdb/ChangeLog
2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-run.c (do_module_cleanup): Add parameter
registers_valid.
(compile_object_run): Update do_module_cleanup caller.
* dummy-frame.c: Include infcall.h.
(struct dummy_frame): Update dtor comment.
(remove_dummy_frame): Call dtor.
(pop_dummy_frame): Update dtor caller.
* dummy-frame.h (dummy_frame_dtor_ftype): Add parameter
registers_valid.
Joel Brobecker [Wed, 13 May 2015 17:48:31 +0000 (10:48 -0700)]
Document the GDB 7.9.1 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 7.9.1 released.
Joel Brobecker [Wed, 13 May 2015 17:31:00 +0000 (10:31 -0700)]
gdb/NEWS: Move "Xmethods can now specify a result type" to GDB 7.9.1 section.
As this change was ported to GDB 7.9.1, the NEWS entry is moved to
a newly-created "Changes in GDB 7.9.1" section, matching the NEWS
file which is going to be distributed with the GDB 7.9.1 release.
gdb/ChangeLog:
* NEWS: Create "Changes in GDB 7.9.1" section. Move news about
Xmethods now being able to specify a result type to that new
section.
John David Anglin [Wed, 13 May 2015 16:32:01 +0000 (17:32 +0100)]
Disable the configuration of GDB for HPUX targets.
* configure.ac: Disable configuration of GDB for HPUX targets.
* configure: Regenerate.
Max Filippov [Sat, 9 May 2015 22:02:31 +0000 (01:02 +0300)]
xtensa: fix gas trampolines regression
Extra condition 'abs (addr - trampaddr) < J_RANGE / 2' for trampoline
selection results in regressions: when relaxable jump is little longer
than J_RANGE so that single trampoline makes two new jumps, one longer
than J_RANGE / 2 and one shorter, correct trampoline cannot be found.
Drop that condition.
2015-05-13 Max Filippov <jcmvbkbc@gmail.com>
gas/
* config/tc-xtensa.c (xtensa_relax_frag): Allow trampoline to be
closer than J_RANGE / 2 to jump frag.
gas/testsuite/
* gas/xtensa/trampoline.s: Add regression testcase.
Patrick Palka [Wed, 13 May 2015 15:57:06 +0000 (11:57 -0400)]
Add missing ChangeLog entry for previous commit
Patrick Palka [Tue, 28 Apr 2015 01:37:48 +0000 (21:37 -0400)]
Avoid race condition when handling a SIGWINCH signal
The control variable win_resized must be cleared before responding to
it.
Otherwise there is a small window where another SIGWINCH might occur in
between the handling of an earlier SIGWINCH and the clearing of
win_resized, at which point win_resized would be set (again) by the
signal handler. Shortly thereafter we would clear win_resized even
though we only handled the earlier SIGWINCH but not the latest one.
This chain of events is all avoided if we clear win_resized first.
gdb/ChangeLog:
* tui/tui-win.c (tui_async_resize_screen): Clear win_resized
first before resizing the window.
* tui.c (tui_enable): Likewise.
Jan Kratochvil [Wed, 13 May 2015 13:55:09 +0000 (15:55 +0200)]
dummy_frame_dtor_ftype vs. call_function_by_hand_dummy_dtor_ftype cleanup
Both dummy_frame_dtor_ftype and call_function_by_hand_dummy_dtor_ftype
represent the same type, there was some mistake/duplication during check-in.
gdb/ChangeLog
2015-05-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* dummy-frame.c (struct dummy_frame): Use proper typedef for dtor.
* dummy-frame.h (dummy_frame_dtor_ftype): Add its comment.
* infcall.c (call_function_by_hand_dummy): Use proper typedef for
dummy_dtor parameter.
* infcall.h: Include dummy-frame.h.
(call_function_by_hand_dummy_dtor_ftype): Remove.
(call_function_by_hand_dummy): Use proper typedef for dummy_dtor
parameter.
Patrick Palka [Sun, 26 Apr 2015 18:13:59 +0000 (14:13 -0400)]
Fix PR gdb/17820
This patch is a comprehensive fix for PR 17820 which reports that
using "set history size unlimited" inside one's gdbinit file doesn't
really work.
There are three small changes in this patch. The most important change
this patch makes is to decode the argument of the "size" subcommand
using add_setshow_zuinteger_unlimited_cmd() instead of using
add_setshow_uinteger_cmd(). The new decoder takes an int * and maps
unlimited to -1 whereas the old decoder takes an unsigned int * and maps
unlimited to UINT_MAX. Using the new decoder simplifies our handling of
unlimited and makes it easier to interface with readline which itself
expects a signed-int history size.
The second change is the factoring of the [stifle|unstifle]_history logic
into a common function which is now used by both init_history() and
set_history_size_command(). This is technically the change that fixes
the PR itself.
Thirdly, this patch initializes history_size_setshow_var to -2 to mean
that the variable has not been set yet. Now init_history() tests for -2
instead of 0 to determine whether to give the variable a default value.
This means that having "set history size 0" in one's gdbinit file will
actually keep the history size at 0 and not reset it to 256.
gdb/ChangeLog:
PR gdb/17820
* top.c (history_size_setshow_var): Change type to signed.
Initialize to -2. Update documentation.
(set_readline_history_size): Define.
(set_history_size_command): Use it. Remove logic for handling
out-of-range sizes.
(init_history): Use set_readline_history_size(). Test for a
value of -2 instead of 0 when determining whether to set a
default history size.
(init_main): Decode the argument of the "size" command as a
zuinteger_unlimited.
gdb/testsuite/ChangeLog:
PR gdb/17820
* gdb.base/gdbinit-history.exp: New test.
* gdb.base/gdbinit-history/unlimited/.gdbinit: New file.
* gdb.base/gdbinit-history/zero/.gdbinit: New file.
H.J. Lu [Wed, 13 May 2015 11:47:59 +0000 (04:47 -0700)]
Revert "Add -mno-shared to x86 assembler"
This reverts commit
573cc2e57db66165b390044338d3a4ad51f36bf8.
H.J. Lu [Wed, 13 May 2015 11:33:45 +0000 (04:33 -0700)]
Add missing ChangeLog entries for PR binutis/18386
H.J. Lu [Wed, 13 May 2015 10:57:46 +0000 (03:57 -0700)]
Return ELF_CLASS_BOTH by default
* elfedit.c (elf_class): Return ELF_CLASS_BOTH by default.
Andreas Krebbel [Wed, 13 May 2015 06:19:45 +0000 (08:19 +0200)]
MAINTAINERS: Add myself as s390 and s390x maintainer.
binutils/
* MAINTAINERS: Add myself as s390 and s390x maintainer.
GDB Administrator [Wed, 13 May 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 12 May 2015 20:11:48 +0000 (13:11 -0700)]
Allocate the first .plt entry space only if needed
Commit
dd7e64d45b317128f5fe813a8da0b13b4ad046ae may optimize out
i386/x86-64 JUMP_SLOT relocation. If there is no JUMP_SLOT relocation
left, we don't need to the first .plt entry. This patch allocates
space for the first .plt entry only if we also reserve space for a PLT
slot for JUMP_SLOT relocation.
bfd/
* elf32-i386.c (elf_i386_allocate_dynrelocs): Allocate space
for the first .plt entry only if needed.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
ld/testsuite/
* ld-i386/i386.exp: Run pltgot-1 for Linux targets.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pltgot-1.d: New file.
* ld-i386/pltgot-1.s: Likewise.
* ld-x86-64/pltgot-1.d: Likewise.
* ld-x86-64/pltgot-1.s: Likewise.
H.J. Lu [Tue, 12 May 2015 19:47:27 +0000 (12:47 -0700)]
Also skip x86_64-*-nacl*
* binutils-all/elfedit-1.d: Also skip x86_64-*-nacl*.
Doug Evans [Tue, 12 May 2015 17:42:49 +0000 (10:42 -0700)]
tweak some comments
gdb/ChangeLog:
* dwarf2read.c (struct file_entry): Tweak comments.
(get_debug_line_section): Tweak comments.
Don Breazeal [Tue, 12 May 2015 16:52:47 +0000 (09:52 -0700)]
Extended-remote fork event docs
This patch contains the accumulated documentation changes for the
rest of the extended-remote follow fork patchset.
gdb/ChangeLog:
* NEWS: Announce fork support in the RSP and support
for fork debugging in extended mode.
gdb/doc/ChangeLog:
* gdb.texinfo (Forks): Note that fork debugging is
supported in extended mode.
(Remote Configuration): Add fork event features to table
of packet settings.
(Stop Reply Packets): Add fork events to list of stop reasons.
(General Query Packets): Add fork events to tables of
'gdbfeatures' and 'stub features' supported in the qSupported
packet, as well as to the list containing stub feature
details.
Don Breazeal [Tue, 12 May 2015 16:52:46 +0000 (09:52 -0700)]
Extended-remote fork catch
This patch implements catchpoints for fork events on extended-remote
Linux targets.
Implementation appeared to be straightforward, requiring four new functions
in remote.c to implement insert/remove of fork/vfork catchpoints. These
functions are essentially stubs that just return 0 ('success') if the
required features are enabled. If the fork events are being reported, then
catchpoints are set and hit.
However, there are some extra issues that arise with catchpoints.
1) Thread creation reporting -- fork catchpoints are hit before the
follow_fork has been completed. When stopped at a fork catchpoint
in the native implementation, the new process is not 'reported'
until after the follow is done. It doesn't show up in the inferiors
list or the threads list. However, in the gdbserver case, an
'info threads' while stopped at a fork catchpoint will retrieve the
new thread info from the target and add it to GDB's data structures,
prior to the follow operations. Because of this premature report,
things on the GDB side eventually get very confused.
So in remote.c:remote_update_thread_list, we check to see if there
are any pending fork parent threads. If there are we remove the
related fork child thread from the thread list sent by the target.
2) Kill process before fork is followed -- on the native side in
linux-nat.c:linux_nat_kill, there is some code to handle the case where
a fork has occurred but follow_fork hasn't been called yet. It does
this by using the last status to determine if a follow is pending, and
if it is, to kill the child task. The use of last_status is fragile
in situations like non-stop mode where other events may have occurred
after the fork event. This patch identifies a fork parent
in remote.c:extended_remote_kill in a way similar to that used in
thread creation reporting above. If one is found, it kills the new
child as well.
Tested on x64 Ubuntu Lucid, native, remote, extended-remote. Tested the
case of killing the forking process before the fork has been followed
manually.
gdb/ChangeLog:
* remote.c (remote_insert_fork_catchpoint): New function.
(remote_remove_fork_catchpoint): New function.
(remote_insert_vfork_catchpoint): New function.
(remote_remove_vfork_catchpoint): New function.
(pending_fork_parent_callback): New function.
(remove_new_fork_child): New function.
(remote_update_thread_list): Call remote_notif_get_pending_events
and remove_new_fork_child.
(extended_remote_kill): Kill fork child when killing the
parent before follow_fork completes.
(init_extended_remote_ops): Initialize target vector with
new fork catchpoint functions.