Sergio Durigan Junior [Wed, 3 Sep 2014 20:30:28 +0000 (16:30 -0400)]
PR python/16699: GDB Python command completion with overriden complete vs. completer class
This PR came from a Red Hat bug that was filed recently. I checked and
it still exists on HEAD, so here's a proposed fix. Although this is
marked as a Python backend bug, this is really about the completion
mechanism used by GDB. Since this code reminds me of my first attempt
to make a good noodle, it took me quite some time to fix it in a
non-intrusive way.
The problem is triggered when one registers a completion method inside a
class in a Python script, rather than registering the command using a
completer class directly. For example, consider the following script:
class MyFirstCommand(gdb.Command):
def __init__(self):
gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)
def invoke(self,argument,from_tty):
raise gdb.GdbError('not implemented')
class MySecondCommand(gdb.Command):
def __init__(self):
gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER)
def invoke(self,argument,from_tty):
raise gdb.GdbError('not implemented')
def complete(self,text,word):
return gdb.COMPLETE_FILENAME
MyFirstCommand ()
MySecondCommand ()
When one loads this into GDB and tries to complete filenames for both
myfirstcommand and mysecondcommand, she gets:
(gdb) myfirstcommand /hom<TAB>
(gdb) myfirstcommand /home/
^
...
(gdb) mysecondcommand /hom<TAB>
(gdb) mysecondcommand /home
^
(The "^" marks the final position of the cursor after the TAB).
So we see that myfirstcommand honors the COMPLETE_FILENAME class (as
specified in the command creation), but mysecondcommand does not. After
some investigation, I found that the problem lies with the set of word
break characters that is used for each case. The set should be the same
for both commands, but it is not.
During the process of deciding which type of completion should be used,
the code in gdb/completer.c:complete_line_internal analyses the command
that requested the completion and tries to determine the type of
completion wanted by checking which completion function will be called
(e.g., filename_completer for filenames, location_completer for
locations, etc.).
This all works fine for myfirstcommand, because immediately after the
command registration the Python backend already sets its completion
function to filename_completer (which then causes the
complete_line_internal function to choose the right set of word break
chars). However, for mysecondcommand, this decision is postponed to
when the completer function is evaluated, and the Python backend uses an
internal completer (called cmdpy_completer). complete_line_internal
doesn't know about this internal completer, and can't choose the right
set of word break chars in time, which then leads to a bad decision when
completing the "/hom" word.
So, after a few attempts, I decided to create another callback in
"struct cmd_list_element" that will be responsible for handling the case
when there is an unknown completer function for complete_line_internal
to work with. So far, only the Python backend uses this callback, and
only when the user provides a completer method instead of registering
the command directly with a completer class. I think this is the best
option because it not very intrusive (all the other commands will still
work normally), but especially because the whole completion code is so
messy that it would be hard to fix this without having to redesign
things.
I have regtested this on Fedora 18 x86_64, without regressions. I also
included a testcase.
gdb/ChangeLog:
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
* cli/cli-decode.c (set_cmd_completer_handle_brkchars): New
function.
(add_cmd): Set "completer_handle_brkchars" to NULL.
* cli/cli-decode.h (struct cmd_list_element)
<completer_handle_brkchars>: New field.
* command.h (completer_ftype_void): New typedef.
(set_cmd_completer_handle_brkchars): New prototype.
* completer.c (set_gdb_completion_word_break_characters): New
function.
(complete_line_internal): Call "completer_handle_brkchars"
callback from command.
* completer.h: Include "command.h".
(set_gdb_completion_word_break_characters): New prototype.
* python/py-cmd.c (cmdpy_completer_helper): New function.
(cmdpy_completer_handle_brkchars): New function.
(cmdpy_completer): Adjust to use cmdpy_completer_helper.
(cmdpy_init): Set completer_handle_brkchars to
cmdpy_completer_handle_brkchars.
gdb/testsuite/ChangeLog:
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
* gdb.python/py-completion.exp: New file.
* gdb.python/py-completion.py: Likewise.
Sasa Stankovic [Wed, 3 Sep 2014 16:44:11 +0000 (09:44 -0700)]
Add NaCl (NativeClient) specific classes Target_mips_nacl and
Target_selector_mips_nacl.
gold/
* mips.cc (Target_mips_nacl): New class.
(Target_selector_mips_nacl): New class.
(target_selector_mips32): Rename from target_selector_mips32be and use
Target_selector_mips_nacl instead of Target_selector_mips.
(target_selector_mips32el): Rename from target_selector_mips32 and use
Target_selector_mips_nacl instead of Target_selector_mips.
(target_selector_mips64): Rename from target_selector_mips64be and use
Target_selector_mips_nacl instead of Target_selector_mips.
(target_selector_mips64el): Rename from target_selector_mips64 and use
Target_selector_mips_nacl instead of Target_selector_mips.
(Target_mips::mips_info): Add const attribute.
Jiong Wang [Wed, 3 Sep 2014 13:45:26 +0000 (14:45 +0100)]
[PATCH/AArch64] Generic support for all system registers using mrs and msr
2014-09-03 Jiong Wang <jiong.wang@arm.com>
opcode/
* aarch64-tbl.h (aarch64_opcode_table): Update encoding for mrs/msr.
* aarch64-dis-2.c: Update auto-generated file.
gas/
* config/tc-aarch64.c (parse_sys_reg): Remove the restriction on op0 field.
gas/testsuite/
* gas/aarch64/illegal.s: Update testcase.
* gas/aarch64/illegal.d: Likewise.
* gas/aarch64/sysreg-1.s: Likewise.
* gas/aarch64/sysreg-1.d: Likewise.
Jiong Wang [Wed, 3 Sep 2014 13:40:41 +0000 (14:40 +0100)]
[PATCH/AArch64] Implement LSE feature
2014-09-03 Jiong Wang <jiong.wang@arm.com>
gas/
* config/tc-aarch64.c (parse_operands): Recognize PAIRREG.
(aarch64_features): Add entry for lse extension.
include/opcode/
* aarch64.h (AARCH64_FEATURE_LSE): New feature added.
(aarch64_opnd): Add AARCH64_OPND_PAIRREG.
(aarch64_insn_class): Add lse_atomic.
(F_LSE_SZ): New field added.
(opcode_has_special_coder): Recognize F_LSE_SZ.
opcode/
* aarch64-tbl.h (QL_R4NIL): New qualifiers.
(aarch64_feature_lse): New feature added.
(LSE): New Added.
(aarch64_opcode_table): New LSE instructions added. Improve
descriptions for ldarb/ldarh/ldar.
(aarch64_opcode_table): Describe PAIRREG.
* aarch64-opc.h (aarch64_field_kind): Add FLD_lse_sz.
* aarch64-opc.c (fields): Add entry for F_LSE_SZ.
(aarch64_print_operand): Recognize PAIRREG.
(operand_general_constraint_met_p): Check reg pair constraints for CASP
instructions.
* aarch64-dis.c (aarch64_ext_regno_pair): New extractor for paired reg.
(do_special_decoding): Recognize F_LSE_SZ.
* aarch64-asm.c (do_special_encoding): Recognize F_LSE_SZ.
gas/testsuite/
* gas/aarch64/lse-atomic.d: New.
* gas/aarch64/lse-atomic.s: Likewise.
* gas/aarch64/illegal-lse.d: Likewise.
* gas/aarch64/illegal-lse.l: Likewise.
* gas/aarch64/illegal-lse.s: Likewise.
* gas/aarch64/diagnostic.s: Check processor feature detect for lse
instruction.
* gas/aarch64/diagnostic.l: Likewise.
Gary Benson [Wed, 3 Sep 2014 11:05:50 +0000 (12:05 +0100)]
x86 debug address register clarifications
The loop macro ALL_DEBUG_REGISTERS does not iterate over the status or
control registers, so its name is misleading. This commit renames it
as ALL_DEBUG_ADDRESS_REGISTERS and updates all uses. This commit also
updates its loop conditions to an equivalent but better form, and
makes two functions use it that had previously hardwired the loop.
A comment on a related field in the x86_debug_reg_state structure is
also updated to reflect that the field refers specifically to address
registers only.
gdb/ChangeLog:
* nat/x86-dregs.h (ALL_DEBUG_REGISTERS): Renamed as...
(ALL_DEBUG_ADDRESS_REGISTERS): New macro. All uses updated.
Loop conditions changed to equivalent form.
(struct x86_debug_reg_state): Updated dr_ref_count comment.
* x86-linux-nat.c (x86_linux_prepare_to_resume): Use
ALL_DEBUG_ADDRESS_REGISTERS.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_prepare_to_resume): Use
ALL_DEBUG_ADDRESS_REGISTERS.
Joel Brobecker [Wed, 3 Sep 2014 08:07:46 +0000 (10:07 +0200)]
Fix dwarf2loc.h::dwarf2_evaluate_property function description.
gdb/ChangeLog:
* dwarf2loc.h (dwarf2_evaluate_property): Minor function
description fix.
Alan Modra [Wed, 3 Sep 2014 00:00:52 +0000 (09:30 +0930)]
daily update
Doug Evans [Tue, 2 Sep 2014 23:29:16 +0000 (16:29 -0700)]
typeprint.c (find_global_typedef): Fix comment.
gdb/ChangeLog:
* typeprint.c (find_global_typedef): Fix comment.
Cary Coutant [Wed, 2 Jul 2014 23:12:51 +0000 (16:12 -0700)]
Make Elf_file::section_name() a const function, so that it can be used in
places where we have only a const Elf_file*.
elfcpp/
* elfcpp_file.h (Elf_file::shnum): New const function.
(Elf_file::shstrndx): New const function.
(Elf_file::large_shndx_offset): New const function.
(Elf_file::section_name): Add const attribute.
(Elf_file::section_header_offset): Likewise.
gold/
* dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
* dynobj.h (Sized_dynobj::do_section_name): Likewise.
* incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
(Sized_incr_dynobj::do_section_name): Likewise.
* incremental.h (Sized_relobj_incr::do_section_name): Likewise.
(Sized_incr_dynobj::do_section_name): Likewise.
* object.h (Object::section_name): Likewise.
(Object::do_section_name): Likewise.
(Sized_relobj_file::do_section_name): Likewise.
* plugin.cc (Sized_pluginobj::do_section_name): Likewise.
* plugin.h (Sized_pluginobj::do_section_name): Likewise.
Cary Coutant [Wed, 2 Jul 2014 16:39:41 +0000 (09:39 -0700)]
Fix problem with optimization of .eh_frame section and --sort-section option.
When --sort-section=name is used, gold will sort the linker-generated contents
of .eh_frame (after optimization) after the endcap provided by crtendS.o.
This causes two problems: the .eh_frame_hdr section is generated assuming that
the optimized .eh_frame contents will be placed at the very beginning of the
section, and the endcap no longer appears at the end of the section.
This patch fixes the first problem by adjusting FDE offsets to take into account
the actual starting offset within the output section, and fixes the second
problem by sorting linker-generated (Output_section_data) sections based on the
name of the output section.
gold/
PR gold/17005
* ehframe.cc (Fde::write): Add output_offset parameter.
(Cie::write): Likewise.
(Eh_frame::set_final_data_size): Account for offset within output
section.
(Eh_frame::do_sized_write): Likewise.
* ehframe.h (Fde::write): Add output_offset parameter.
(Cie::write): Likewise.
* output.cc (Output_section::Input_section_sort_entry): Remove
section_has_name_; add output_section_name parameter. Use
output section name for non-input sections.
(Output_section::Input_section_sort_entry::section_has_name): Remove.
(Output_section::Input_section_sort_entry::section_has_name_): Remove.
(Output_section::Input_section_sort_compare): Remove logic for
sections without names.
(Output_section::Input_section_sort_init_fini_compare): Likewise.
(Output_section::Input_section_sort_section_prefix_special_ordering_compare):
Likewise.
(Output_section::Input_section_sort_section_name_compare): Likewise.
Gary Benson [Tue, 19 Aug 2014 14:16:11 +0000 (15:16 +0100)]
Rename 32- and 64-bit Intel files from "i386" to "x86"
This commit renames nine files that contain code used by both 32- and
64-bit Intel ports such that their names are prefixed with "x86"
rather than "i386". All types, functions and variables within these
files are likewise renamed such that their names are prefixed with
"x86" rather than "i386". This makes GDB follow the convention used
by gdbserver such that 32-bit Intel code lives in files called
"i386-*", 64-bit Intel code lives in files called "amd64-*", and code
for both 32- and 64-bit Intel lives in files called "x86-*".
This commit only renames OS-independent files. The Linux ports of
both GDB and gdbserver now follow the i386/amd64/x86 convention fully.
Some ports still use the old convention where "i386" in file/function/
type/variable names can mean "32-bit only" or "32- and 64-bit" but I
don't want to touch ports I can't fully test except where absolutely
necessary.
gdb/ChangeLog:
* i386-nat.h: Renamed as...
* x86-nat.h: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
* i386-nat.c: Renamed as...
* x86-nat.c: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
* common/i386-xstate.h: Renamed as...
* common/x86-xstate.h: New file. All type, function and variable
name prefixes changed from "i386_" to "x86_". All references
updated.
* nat/i386-cpuid.h: Renamed as...
* nat/x86-cpuid.h: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
* nat/i386-gcc-cpuid.h: Renamed as...
* nat/x86-gcc-cpuid.h: New file. All type, function and variable
name prefixes changed from "i386_" to "x86_". All references
updated.
* nat/i386-dregs.h: Renamed as...
* nat/x86-dregs.h: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
* nat/i386-dregs.c: Renamed as...
* nat/x86-dregs.c: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
gdb/gdbserver/ChangeLog:
* i386-low.h: Renamed as...
* x86-low.h: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
* i386-low.c: Renamed as...
* x86-low.c: New file. All type, function and variable name
prefixes changed from "i386_" to "x86_". All references updated.
Gary Benson [Tue, 2 Sep 2014 15:28:54 +0000 (16:28 +0100)]
Use XCNEW rather than xcalloc (1, ...) in linux-x86-low.c
This commit replaces two uses of xcalloc (1, ...) with XCNEW.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_new_process): Use XCNEW.
(x86_linux_new_thread): Likewise.
Alan Modra [Tue, 2 Sep 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Maciej W. Rozycki [Mon, 1 Sep 2014 14:09:59 +0000 (15:09 +0100)]
Move `_initialize_varobj' to the end of varobj.c
* varobj.c (_initialize_varobj): Move to the end of file.
Alan Modra [Mon, 1 Sep 2014 00:00:42 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 31 Aug 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Han Shen [Sat, 30 Aug 2014 00:53:03 +0000 (17:53 -0700)]
The 3rd patch for aarch64 gold.
This enables -
1. static linking hello world
2. limited support for TLSIE and TLSLE
3. limited support for linking shared library, linking executable against shared
library.
gold/ChangeLog
2014-08-29 Han Shen <shenhan@google.com>
Jing Yu <jingyu@google.com>
* aarch64-reloc-property.cc
(AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
reference reloc property in the table.
* aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
3 other entries.
* aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2 new overloaded methods.
(Output_data_got_aarch64::do_write): Add code to write out
static relocs.
(class Output_data_got_aarch64::Static_reloc): New class to wrap
static relocs.
(Output_data_got_aarch64::static_relocs): New vector to
hold static relocs.
(Target_aarch64::TCB_SIZE): New const static memeber.
(Target_aarch64::tcb_size): New method.
(Target_aarch64::Relocate::relocate): Add code handling new reloc types.
(Target_aarch64::Relocate::relocate_tls): New method.
(Target_aarch64::Scan::local): Add code handling new reloc types.
(Target_aarch64::Scan::global): Add code handling new reloc types.
Alan Modra [Sat, 30 Aug 2014 00:14:47 +0000 (09:44 +0930)]
ppc476 patch area size miscalculation
ppc476 sections that end exactly on a page boundary need the
workaround applied when a function ends in "bctr", or when pasting
together code from multiple sections. The space allocated for the
patch area didn't allow for this case, while the code in
relocate_section performing the patches did, leading to an assertion
failure.
* elf32-ppc.c (ppc_elf_relax_section): Fix off by one error.
Alan Modra [Sat, 30 Aug 2014 00:00:43 +0000 (09:30 +0930)]
daily update
Gary Benson [Fri, 8 Aug 2014 14:37:41 +0000 (15:37 +0100)]
Use exceptions and cleanups in gdbserver
This commit replaces the hacky "exception" system in gdbserver with
the exceptions and cleanups subsystem from GDB.
Only the catch/cleanup code in what was "main" has been updated to
use the new system. Other parts of gdbserver can now be converted
to use TRY_CATCH and cleanups on an as-needed basis.
A side-effect of this commit is that some error messages will change
slightly, and in cases with multiple errors the error messages will
be printed in a different order.
gdb/gdbserver/ChangeLog:
* server.h (setjmp.h): Do not include.
(toplevel): Do not declare.
(common-exceptions.h): Include.
(cleanups.h): Likewise.
* server.c (toplevel): Do not define.
(exit_code): New static global.
(detach_or_kill_for_exit_cleanup): New function.
(main): New function. Original main renamed to...
(captured_main): New function.
* utils.c (verror) [!IN_PROCESS_AGENT]: Use throw_verror.
Gary Benson [Thu, 7 Aug 2014 15:29:19 +0000 (16:29 +0100)]
Introduce common/common-exceptions.[ch]
This commit moves the exception throwing and catching code
into gdb/common/. All exception printing code remains in
gdb/exceptions.[ch].
gdb/ChangeLog:
* common/common-exceptions.h: New file.
* common/common-exceptions.c: Likewise.
* Makefile.in (SFILES): Add common/common-exceptions.c.
(HFILES_NO_SRCDIR): Add common/common-exceptions.h.
(COMMON_OBS): Add common-exceptions.o.
(common-exceptions.o): New rule.
* exceptions.h (common-exceptions.h): Include.
(gdb_setjmp.h): Do not include.
(return_reason): Moved to common-exceptions.h.
(enum return_reason): Likewise.
(RETURN_MASK): Likewise.
(typedef return_mask): Likewise.
(enum errors): Likewise.
(struct gdb_exception): Likewise.
(exceptions_state_mc_init): Likewise.
(exceptions_state_mc_action_iter): Likewise.
(exceptions_state_mc_action_iter_1): Likewise.
(TRY_CATCH): Likewise.
(throw_exception): Likewise.
(throw_verror): Likewise.
(throw_vquit): Likewise.
(throw_error): Likewise.
(throw_quit): Likewise.
* exceptions.c (enum catcher_state): Moved to common-exceptions.c.
(enum catcher_action): Likewise.
(struct catcher): Likewise.
(current_catcher): Likewise.
(catcher_list_size): Likewise.
(exceptions_state_mc_init): Likewise.
(catcher_pop): Likewise.
(exceptions_state_mc): Likewise.
(exceptions_state_mc_action_iter): Likewise.
(exceptions_state_mc_action_iter_1): Likewise.
(throw_exception): Likewise.
(exception_messages): Likewise.
(exception_messages_size): Likewise.
(throw_it): Likewise.
(throw_verror): Likewise.
(throw_vquit): Likewise.
(throw_error): Likewise.
(throw_quit): Likewise.
(prepare_to_throw_exception): New function.
gdb/gdbserver/ChangeLog:
* Makefile.in (SFILES): Add common/common-exceptions.c.
(OBS): Add common-exceptions.o.
(common-exceptions.o): New rule.
* utils.c (prepare_to_throw_exception): New function.
Gary Benson [Thu, 7 Aug 2014 14:53:21 +0000 (15:53 +0100)]
Introduce common/gdb_setjmp.h
This commit creates a new file, common/gdb_setjmp.h, to hold some
portability macros for setjmp/longjmp et al. that are used by the
exceptions subsystem and by the demangler crash catcher.
gdb/ChangeLog:
* common/gdb_setjmp.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_setjmp.h.
* configure.ac: Move sigsetjmp check...
* common/common.m4: ...here.
* configure: Regenerate.
* cp-support.c (SIGJMP_BUF): Delete.
(SIGSETJMP): Likewise.
(SIGLONGJMP): Likewise.
* exceptions.h (gdb_setjmp.h): Include.
(setjmp.h): Do not include.
(EXCEPTIONS_SIGJMP_BUF): Delete.
(EXCEPTIONS_SIGSETJMP): Likewise.
(EXCEPTIONS_SIGLONGJMP): Likewise.
Replace all uses of EXCEPTIONS_SIG* macros with SIG* macros
from gdb_setjmp.h.
* exceptions.c: Likewise.
gdb/gdbserver/ChangeLog:
* config.in: Regenerate.
* configure: Likewise.
Gary Benson [Mon, 4 Aug 2014 10:37:44 +0000 (11:37 +0100)]
Move cleanups.[ch] to common
This commit moves cleanups.[ch] into gdb/common/. The only change to
the content of the files is that cleanups.c's include list was altered
to match its new location.
gdb/ChangeLog:
* cleanups.h: Moved to...
* common/cleanups.h: New file.
* cleanups.c: Moved to...
* common/cleanups.c: New file. Include common-defs.h and
cleanups.h. Do not include defs.h.
* Makefile.in (SFILES): Replace cleanups.c with common/cleanups.c.
(HFILES_NO_SRCDIR): Replace cleanups.h with common/cleanups.h.
(cleanups.o): New rule.
gdb/gdbserver/ChangeLog:
* Makefile.in (SFILES): Add common/cleanups.c.
(OBS): cleanups.o.
(cleanups.o): New rule.
Gary Benson [Mon, 4 Aug 2014 11:04:02 +0000 (12:04 +0100)]
Move internal_{,v}warning to common/errors.[ch]
This commit moves internal_warning and internal_vwarning into
common/errors.[ch].
gdb/ChangeLog:
* common/errors.h (internal_warning): New declaration.
(internal_vwarning): Likewise.
* common/errors.c (internal_warning): New function.
* utils.h (internal_warning): Don't declare.
(internal_vwarning): Likewise.
* utils.c (internal_warning): Removed.
gdb/gdbserver/ChangeLog:
* utils.c (internal_vwarning): New function.
Gary Benson [Tue, 5 Aug 2014 15:18:51 +0000 (16:18 +0100)]
Unify startup and option-parsing warnings
Various warnings are emitted during startup and option-parsing using
fprintf_unfiltered. One warning is prefixed with the command name,
the others are not. This commit replaces these hardwired warnings
with calls to warning. It also sets warning_pre_print to prefix all
warnings with the command name until option parsing is complete.
gdb/ChangeLog:
* main.c (captured_main): Use warning during startup.
Prefix startup warning messages with command name.
Gary Benson [Tue, 5 Aug 2014 15:12:01 +0000 (16:12 +0100)]
Replace all usage errors with calls to error
This commit replaces the hardwired fprintf/exit error handlers
for usage errors with calls to error.
gdb/ChangeLog:
* main.c (captured_main): Handle usage errors with error.
Gary Benson [Mon, 4 Aug 2014 13:44:56 +0000 (14:44 +0100)]
Replace hardwired error handler in go32_create_inferior
go32_create_inferior invokes a hardwired fprintf/exit error handler
if v2loadimage fails. I could find no reason for this other than that
the block seems to have been copy-and-pasted from v2loadimage's
manpage. This commit replaces the hardwired handler with a call to
error.
gdb/ChangeLog:
* go32-nat.c (go32_create_inferior): Replace a fprintf/
exit pair with a call to error. Wrap the message with _().
Gary Benson [Mon, 4 Aug 2014 13:08:46 +0000 (14:08 +0100)]
Replace hardwired error handler in captured_main
If the requested interpreter cannot be set captured_main reports the
error with a hardwired fprintf/exit pair. A fprintf/exit pair on the
previous line was replaced with a call to error in March 2003
(https://sourceware.org/ml/gdb-patches/2003-03/msg00444.html) but I
found no documentation as to why this particular hardwired handler
was left untouched. I was also unable to come up with a situation
where error would not be suitable, so I have replaced it with a call
to error.
gdb/ChangeLog:
* main.c (captured_main): Replace a fprintf/exit
pair with a call to error. Wrap the message with _().
Gary Benson [Mon, 4 Aug 2014 13:03:21 +0000 (14:03 +0100)]
Replace hardwired error handlers in tui_initialize_io
tui_initialize_io contains a pair of hardwired fprintf/exit error
handlers. I was unable to find any documentation as to why they're
hardwired (the code appeared in a monolithic block back in 2001:
https://sourceware.org/ml/gdb-patches/2001-07/msg00490.html) and I
was also unable to come up with a situation where error would not
be suitable, so I have replaced both handlers with calls to error.
gdb/ChangeLog:
* tui/tui-io.c (tui_initialize_io): Replace two fprintf/exit
pairs with calls to error. Wrap the message with _().
Gary Benson [Tue, 5 Aug 2014 12:27:49 +0000 (13:27 +0100)]
Make warning usable earlier
warning will crash if called before the first call to set_width. This
commit makes the warning usable from the moment gdb_stderr is set up.
gdb/ChangeLog:
* utils.c (vwarning): Protect calls to target_terminal_ours
and wrap_here.
Gary Benson [Tue, 5 Aug 2014 12:25:48 +0000 (13:25 +0100)]
Make error usable earlier
error (and other exception-throwing functions) are callable from the
first line of captured_main, but the exception printing code will
crash if called before the first call to set_width. This commit makes
the exception printing code usable from the moment gdb_stderr is set
up.
gdb/ChangeLog:
* exceptions.c (print_flush): Protect calls to
target_terminal_ours and wrap_here.
Gary Benson [Tue, 5 Aug 2014 10:42:21 +0000 (11:42 +0100)]
Make internal_vproblem always work
internal_vproblem can be called (via malloc_failure) from almost the
first line of captured_main, but it will crash if called before the
first call to set_width. This commit makes internal_vproblem work
at any time.
There are two parts to this. If called before gdb_stderr is set up,
internal_vproblem will fall back to printing the message on regular
stderr and aborting. If called after gdb_stderr is set up but before
filtered printing is set up, internal_vproblem will operate as usual
except that it can not query whether to quit and/or dump core so it
defaults to doing both.
gdb/ChangeLog:
* utils.h (filtered_printing_initialized): New declaration.
* utils.c (abort_with_message): New function.
(internal_vproblem): Use abort_with_message for first level
recursive internal problems, and if gdb_stderr is not set up.
Protect calls to target_terminal_ours, begin_line and query.
Alan Modra [Fri, 29 Aug 2014 01:22:50 +0000 (10:52 +0930)]
PowerPC64 call lacks nop error
* elf64-ppc.c (ppc64_elf_relocate_section): Report a different
error for calls via a toc adjusting stub without a nop.
Alan Modra [Fri, 29 Aug 2014 01:07:52 +0000 (10:37 +0930)]
Prevent alpha_vms_object_p stopping bfd_check_format_matches scan
Any error other than bfd_error_wrong_format returned from object_p()
is effectively a fatal error.
* vms-alpha.c (alpha_vma_object_p): Don't return file_truncated
error. Remove redundant bfd_set_error.
Alan Modra [Fri, 29 Aug 2014 01:06:29 +0000 (10:36 +0930)]
Report an error for S-records with less than the miniumum size
* srec.c (srec_scan): Revert last change. Report an error for
S-records with less than the miniumum byte count.
Alan Modra [Fri, 29 Aug 2014 00:57:44 +0000 (10:27 +0930)]
Fix testsuite ld_simple_link_defsyms for windows targets
* lib/ld-lib.exp (ld_simple_link_defsyms): Provide both __main
and ___main for windows targets.
Alan Modra [Fri, 29 Aug 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Doug Evans [Thu, 28 Aug 2014 23:15:23 +0000 (16:15 -0700)]
Move definition of some prologue-related functions to a better location.
gdb/ChangeLog:
* symtab.c (in_prologue): Move definition to better spot.
(skip_prologue_using_sal): Ditto.
Doug Evans [Thu, 28 Aug 2014 23:09:50 +0000 (16:09 -0700)]
symtab.c (find_function_start_sal): Move definition to better spot.
gdb/ChangeLog:
* symtab.c (find_function_start_sal): Move definition to better spot.
Doug Evans [Thu, 28 Aug 2014 18:38:22 +0000 (11:38 -0700)]
Rewrite {amd64,i386}-pseudo.c to better specify register liveness.
clang was using eax to construct %0 here:
asm ("mov %%eax, 0(%0)\n\t"
"mov %%ebx, 4(%0)\n\t"
"mov %%ecx, 8(%0)\n\t"
"mov %%edx, 12(%0)\n\t"
"mov %%esi, 16(%0)\n\t"
"mov %%edi, 20(%0)\n\t"
: /* no output operands */
: "r" (data)
: "eax", "ebx", "ecx", "edx", "esi", "edi");
which caused amd64-word.exp (and others similarly) to fail.
It's a perfectly legit thing for clang to do given the available data.
The patch fixes this by marking the registers as live from the
time of the preceding breakpoint.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-pseudo.c (main): Rewrite to better specify when
eax,etc. are live with values set by gdb and thus the compiler can't
use them.
* gdb.arch/i386-pseudo.c (main): Ditto.
H.J. Lu [Thu, 28 Aug 2014 15:22:42 +0000 (08:22 -0700)]
Check S-record with 0 size
* srec.c (srec_scan): Return error for 0 size.
Gary Benson [Wed, 6 Aug 2014 12:23:59 +0000 (13:23 +0100)]
Remove fatal function and prototype
This commit removes the now-unused fatal function and prototype.
gdb/gdbserver/ChangeLog:
* utils.h (fatal): Remove declaration.
* utils.c (fatal): Remove function.
Gary Benson [Wed, 6 Aug 2014 13:43:17 +0000 (14:43 +0100)]
Convert fatal to perror_with_name in IPA code
This commit converts four calls to fatal into calls to
perror_with_name. perror_with_name calls error, which
in IPA terminates with exit (1) rather than longjmp, so
there is no functional change here.
gdb/gdbserver/ChangeLog:
* tracepoint.c (gdb_agent_init): Replace fatal with
perror_with_name.
(initialize_tracepoint): Likewise.
Gary Benson [Wed, 6 Aug 2014 12:47:55 +0000 (13:47 +0100)]
Convert fatal to error in remote_prepare
This commit converts a call to fatal in remote_prepare with a call to
error. remote_prepare is called precisely once, from main, at a point
where jumping to toplevel will call exit (1), so error and fatal are
functionally equivalent at this point. Note that remote_prepare calls
perror_with_name (which calls error) so callers of remote_prepare must
already handle the fact that it may exit via longjmp.
gdb/gdbserver/ChangeLog:
* remote-utils.c (remote_prepare): Replace fatal with error.
Gary Benson [Wed, 6 Aug 2014 10:57:14 +0000 (11:57 +0100)]
Downgrade fatal to warning in linux_async
This commit downgrades a fatal error to a warning in linux_async.
linux_async is called from two different places in gdbserver:
Via target_async from handle_accept_event. The argument
is always zero, so the warning will never be printed here.
Via start_non_stop from handle_general_set. This prints
its own error message to stderr on failure, which will
be preceded by the warning if it is emitted.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_async): Replace fatal with warning.
Tidy up and return.
(linux_start_non_stop): Return -1 if linux_async failed.
Gary Benson [Wed, 6 Aug 2014 13:00:14 +0000 (14:00 +0100)]
Convert fatal to gdb_assert in both i386_dr_low_set_addr
This commit converts if..fatal checks in both i386_dr_low_set_addr
implementations to gdb_asserts. It's not obvious from the context,
but the conditional in both cases is changed to match the equivalent
conditional in the i386_dr_low_get_addr implementations. Nothing
fundamental has changed because DR_FIRSTADDR is zero. This commit
also removes a vague comment in Linux i386_dr_low_get_addr. I could
have reworded the comment (and replicated it three times for the other
identical assertions) but I think the existence of specific functions
for the status and control registers makes it fairly obvious what is
going on.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (i386_dr_low_set_addr): Replace check with
gdb_assert.
(i386_dr_low_get_addr): Remove vague comment.
* win32-i386-low.c (i386_dr_low_set_addr): Replace check with
gdb_assert.
Gary Benson [Wed, 6 Aug 2014 10:56:25 +0000 (11:56 +0100)]
Straightforward fatal to internal_error conversions
This commit replaces most of the calls to fatal that represent
internal errors with calls to internal_error, either directly
or via gdb_assert and gdb_assert_not_reached.
gdb/gdbserver/ChangeLog:
* inferiors.c (get_thread_process): Replace check with gdb_assert.
* linux-low.c (linux_wait_for_event_filtered): Replace fatal with
internal_error.
(linux_resume_one_lwp): Likewise.
* linux-x86-low.c (x86_siginfo_fixup): Replace checks with
gdb_assert.
* mem-break.c (raw_bkpt_type_to_target_hw_bp_type): Replace fatal
with internal_error.
* regcache.c (get_thread_regcache): Replace check with gdb_assert.
(init_register_cache): Replace fatal with gdb_assert_not_reached.
(find_register_by_name): Replace fatal with internal_error.
(find_regno): Likewise.
* tdesc.c (init_target_desc): Replace check with gdb_assert.
* thread-db.c (thread_db_create_event): Likewise.
(thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (get_jump_space_head): Replace fatal with
internal_error.
(claim_trampoline_space): Likewise.
(have_fast_tracepoint_trampoline_buffer): Likewise.
(cmd_qtstart): Likewise.
(stop_tracing): Likewise.
(fast_tracepoint_collecting): Likewise.
(target_malloc): Likewise.
(download_tracepoint): Likewise.
(download_trace_state_variables): Replace check with gdb_assert.
(upload_fast_traceframes): Replace fatal with internal_error.
Gary Benson [Thu, 28 Aug 2014 10:59:09 +0000 (11:59 +0100)]
Shadow SIM's debug_printf function
GDB and SIM both have functions called "debug_printf", which conflicts
at link time. This commit shadows SIM's debug_printf with a macro so
that SIM's symbol ends up being called "sim_debug_printf".
sim/common/ChangeLog:
* sim-trace.h (debug_printf): New define.
Yao Qi [Fri, 1 Aug 2014 03:26:16 +0000 (11:26 +0800)]
arm software watchpoint: return to epilogue
Hi,
This patch is to handle a software watchpoint case that program returns
to caller's epilogue, and it causes the fail in thumb mode,
finish^M
Run till exit from #0 func () at gdb/testsuite/gdb.base/watchpoint-cond-gone.c:26^M
0x000001f6 in jumper ()^M
(gdb) FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint
In the test, jumper calls func, and programs returns from func to
jumper's epilogue, IOW, the branch instruction is the last instruction
of jumper's function body.
jumper:
.....
0x000001f2 <+10>: bl 0x200 [1] <---- indirect call to func
0x000001f6 <+14>: mov sp, r7 [2] <---- start of the epilogue
0x000001f8 <+16>: add sp, #8
0x000001fa <+18>: pop {r7}
0x000001fc <+20>: pop {r0}
0x000001fe <+22>: bx r0
When the inferior returns from func back to jumper, it is expected
that an expression of a software watchpoint becomes out-of-scope.
GDB validates the expression by checking the corresponding frame,
but this check is guarded by gdbarch_in_function_epilogue_p. See
breakpoint.c:watchpoint_check.
It doesn't work in this case, because program returns from func's
epilogue back to jumper's epilogue [2], GDB thinks the program is
still within the epilogue, but in fact it goes to a different one.
When PC points at [2], the sp-restore instruction is to be
executed, so the stack frame isn't destroyed yet and we can still
use the frame mechanism reliably.
Note that when PC points to the first instruction of restoring SP,
it is part of epilogue, but we still return zero. When goes to
the next instruction, the backward scan will still match the
epilogue sequence correctly. The reason for doing this is to
handle the "return-to-epilogue" case.
What this patch does is to restrict the epilogue matching that let
GDB think the first SP restore instruction isn't part of the epilogue,
and fall back to use frame mechanism. We set 'found_stack_adjust'
zero before backward scan, and we've done this for arm mode
counterpart (arm_in_function_epilogue_p) too.
The patch is tested in arm-none-eabi and arm-none-linux-gnueabi with
various multilibs. OK to apply?
gdb:
2014-08-28 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_in_function_epilogue_p): Don't set
found_stack_adjust in forward scan. Remove condition check
on found_stack_adjust which is always true. Indent the code.
Yao Qi [Tue, 26 Aug 2014 13:02:49 +0000 (21:02 +0800)]
Remove dwarf_decode_lines argumewant_line_info
Hi,
dwarf_decode_lines is called in two functions,
dwarf2_build_include_psymtabs and handle_DW_AT_stmt_list, in which, 1
is passed to argument 'want_line_info' and 'want_line_info' is a
conditional variable in dwarf_decode_lines. We can simplify it by
removing 'want_line_info' and propagating the constant 1 into
dwarf_decode_lines. This is what this patch does. This patch also
remove one line comment about WANT_LINE_INFO in
handle_DW_AT_stmt_list, as handle_DW_AT_stmt_list doesn't have such
argument.
gdb:
2014-08-28 Yao Qi <yao@codesourcery.com>
* dwarf2read.c (dwarf_decode_lines): Update declaration.
(handle_DW_AT_stmt_list): Remove comment about WANT_LINE_INFO.
(dwarf_decode_lines): Remove argument
want_line_info. Remove condition check on want_line_info.
Callers update.
Alan Modra [Thu, 28 Aug 2014 00:00:36 +0000 (09:30 +0930)]
daily update
Joel Sherrill [Thu, 14 Aug 2014 22:18:53 +0000 (17:18 -0500)]
psim: Correct spelling in comments.
2014-08-27 Joel Sherrill <joel.sherrill@oarcorp.com>
* basics.h, device.c, device.h, hw_htab.c, hw_memory.c:
Correct spelling in comments.
Doug Evans [Wed, 27 Aug 2014 17:13:09 +0000 (10:13 -0700)]
dwarf2read.c (dwarf_record_line): Fix typo.
gdb/ChangeLog:
* dwarf2read.c (dwarf_record_line): Fix typo.
Sergio Durigan Junior [Wed, 27 Aug 2014 17:01:01 +0000 (13:01 -0400)]
Adding last commit's ChangeLog entry.
Patrick Palka [Mon, 25 Aug 2014 14:40:32 +0000 (10:40 -0400)]
Fix terminal state corruption when starting a program from within TUI
The TUI terminal state becomes corrupted (e.g. key sequences such as
Alt_F and Alt_B no longer work) when one attaches to an inferior process
(via "run" or "attach") from within TUI. This terminal corruption
remains until you switch out of TUI mode.
This happens because the terminal state is not properly saved when
switching to and out from TUI mode. Although the functions tui_enable()
and tui_disable() both call the function target_terminal_save_ours() to
save the terminal state, this function is a no-op unless GDB has already
attached to an inferior process. This is because only the "native"
target has a useful implementation of target_terminal_save_ours()
(namely child_terminal_save_ours()) and we only have the "native" target
in our target vector if GDB has already attached to an inferior process.
So without an inferior process, switching to and from TUI mode does not
actually save the terminal state. Therefore when you attach to an
inferior process from within TUI mode, the proper terminal state is not
restored (after swapping from the inferior's terminal back to the GDB
terminal).
To fix this we just have to ensure that the terminal state is always
being properly saved when switching from and to TUI mode. To achieve
this, this patch removes the polymorphic function
target_terminal_save_ours() and replaces it with a regular function
gdb_save_tty_state() that always saves the terminal state.
Tested on x86_64-unknown-linux-gnu by running "make check", no new
regressions.
gdb/ChangeLog:
* target.h (struct target_ops::to_terminal_save_ours): Remove
declaration.
(target_terminal_save_ours): Remove macro.
* target-delegates.c: Regenerate.
* inf-child.c (inf_child_target): Don't set the nonexistent
field to_terminal_save_ours.
* inferior.h (child_terminal_save_ours): Remove declaration.
* terminal.h (gdb_save_tty_state): New declaration.
* inflow.c (child_terminal_save_ours): Rename to ...
(gdb_save_tty_state): ... this.
* tui/tui.c: Include terminal.h.
(tui_enable): Use gdb_save_tty_state instead of
target_terminal_save_ours.
(tui_disable): Likewise.
Doug Evans [Wed, 27 Aug 2014 16:40:21 +0000 (09:40 -0700)]
lib/gdb.exp (gdb_compile_shlib): Add support for clang.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_compile_shlib): Add support for clang.
H.J. Lu [Wed, 27 Aug 2014 14:59:48 +0000 (07:59 -0700)]
Use bfd_is_abs_section to check discarded input section
bfd/
PR ld/17306
* elf32-i386.c (elf_i386_convert_mov_to_lea): Use bfd_is_abs_section
to check discarded input section.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
ld/testsuite/
PR ld/17306
* ld-i386/i386.exp (i386tests): Add tests for PR ld/17306.
* ld-x86-64/x86-64.exp (x86_64tests): Likewise.
* ld-i386/pr17306a.s: New file.
* ld-i386/pr17306b.s: Likewise.
* ld-x86-64/pr17306a.s: Likewise.
* ld-x86-64/pr17306b.s: Likewise.
H.J. Lu [Wed, 27 Aug 2014 14:39:48 +0000 (07:39 -0700)]
Don't attach dynamic sections to input from ld --just-symbols
bfd/
PR ld/17313
* elflink.c (elf_link_add_object_symbols): Don't attach dynamic
sections to input from ld --just-symbols.
2014-08-27 H.J. Lu <hongjiu.lu@intel.com>
PR ld/17313
* ld-i386/i386.exp (i386tests): Add tests for PR ld/17313.
* ld-x86-64/x86-64.exp (x86_64tests): Likewise.
Will Newton [Thu, 7 Aug 2014 13:38:55 +0000 (14:38 +0100)]
src-release.sh: Convert src-release to a shell script
This began as an attempt to make a few small changes to src-release
but heeding the comments at the top of the file it seemed it might be
wise to convert it to a shell script instead which should hopefully
be more maintainable.
This shell script contains most of the functionality of the Makefile
version. It can be run like this:
# This will build gdb and compress with bzip2, gzip and xz
./src-release.sh -bgx gdb
The functionality that has been removed is building tarballs for insight
and gnats, which were broken in the current repository layout and
gas+binutils which amounted to basically the same thing as binutils so
didn't seem worth keeping. The script always builds a tar file,
compression is optional, so no need for specific commands to build tar
files rather than compressed tar files.
The build of gas releases has been fixed, as has extraction of version
numbers which had been broken since the switch to configure.ac files
and AC_INIT.
I also removed the code for distcleaning the intl sub-directory as it
seems like that issue has been fixed.
The script is capable of compressing with bzip2, gzip and xz which
should cover all formats available on gnu.org.
I tested it by producing release tarballs which are substantially
identical to the ones produced by the src-release script.
ChangeLog:
2014-08-27 Will Newton <will.newton@linaro.org>
* src-release.sh: New file.
* src-release: Remove file.
Alan Modra [Wed, 27 Aug 2014 00:01:12 +0000 (09:31 +0930)]
daily update
DJ Delorie [Tue, 26 Aug 2014 21:01:04 +0000 (17:01 -0400)]
rl78.h (RL78_RELAXA_MASK): New. Relax types are enums, not bits
DJ Delorie [Tue, 26 Aug 2014 18:03:29 +0000 (14:03 -0400)]
Disambiguate test for relaxation type.
* elf32-rl78.c (rl78_elf_relax_section): Disambiguate test for
relaxation type.
Jiong Wang [Tue, 26 Aug 2014 15:18:36 +0000 (16:18 +0100)]
[ARM] Update selected_cpu based on info got during parsing
gas/
* config/tc-arm.c (aeabi_set_public_attributes): Update intended_arch based
on the info we got during parsing.
(arm_handle_align): Make sure the p2align expanding logic under thumb
unchanged.
gas/testsuite/
* gas/arm/blx-bl-convert.d: New testcase.
* gas/arm/blx-bl-convert.l: Warning expectation.
* gas/arm/blx-bl-convert.s: Source file.
Jiong Wang [Tue, 26 Aug 2014 14:48:47 +0000 (15:48 +0100)]
[AArch64] Improve copy relocation support on four absolute relocation types
2014-08-26 Jiong Wang <jiong.wang@arm.com>
bfd/
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Initialize non_got_ref
properly for MOVW_G0/1/2_NC and MOVW_G3. Reject them when linking
shared library.
(elfNN_aarch64_gc_sweep_hook): Add check on these relocs.
ld/testsuite/
* ld-aarch64/copy-relocs-so.s: New test file.
* ld-aarch64/copy-relocs-exe.s: Likewise.
* ld-aarch64/copy-relocs.d: New expectation file.
* ld-aarch64/emit-relocs-264-bad.d: New test file.
* ld-aarch64/emit-relocs-266-bad.d: Likewise.
* ld-aarch64/emit-relocs-268-bad.d: Likewise.
* ld-aarch64/emit-relocs-269-bad.d: Likewise.
* ld-aarch64/aarch64-elf.exp: Run new added test.
Nick Clifton [Tue, 26 Aug 2014 14:06:49 +0000 (15:06 +0100)]
Fix linker testsuite failures for Aarch64.
Resolves PR 17312
* ld-aarch64/eh-frame-foo.s: Use 8-byte offset for X30.
* ld-aarch64/eh-frame-bar.s: Likewise.
* ld-aarch64/eh-frame.d: Updated to match current readelf output.
* ld-elf/eh5.d: Allow any register names.
Maciej W. Rozycki [Tue, 26 Aug 2014 12:44:34 +0000 (13:44 +0100)]
MIPS: Make the CODE10 operand code consistent between ISAs
This change moves the microMIPS 10-bit uninterpreted immediate code
embedded at bits 25..16 in the SYSCALL, WAIT, SDBBP and HYPCALL
instructions from `B' over to `+J' which is the operand code used in
the standard MIPS instruction set for a similar code embedded at bits
20..11, currently used by HYPCALL only in that set.
opcodes/
* micromips-opc.c (decode_micromips_operand): Rename `B' to `+J'.
(micromips_opcodes): Use "+J" in place of "B" for "hypcall",
"sdbbp", "syscall" and "wait".
include/opcode/
* mips.h: Document the move of `MICROMIPSOP_*_CODE10' from `B'
over to `+J'.
Maciej W. Rozycki [Tue, 26 Aug 2014 12:18:30 +0000 (13:18 +0100)]
MIPS/gas: SAA/SAAD macro clean-ups
This change removes code duplication for the SAA macro in line with other
such macros and also adds a !microMIPS internal consistency guard as
there's no microMIPS encoding of the underlying SAA/SAAD instructions.
* config/tc-mips.c (macro) <M_SAA_AB>: Remove duplicate code and
jump to...
<M_SAAD_AB>: ... here. Assert that !microMIPS.
Maciej W. Rozycki [Tue, 26 Aug 2014 11:57:42 +0000 (12:57 +0100)]
MIPS/gas/testsuite: Remove ECOFF offset alternatives
This complements commit
16e5e222b6eae6f110ea72bf627585c095a453a8,
removing offset values embedded in dump patterns that served ECOFF
binaries.
* gas/mips/l_d.d: Remove ECOFF offset alternatives.
* gas/mips/mips1@l_d.d: Likewise.
* gas/mips/ld.d: Likewise.
* gas/mips/mips1@ld.d: Likewise.
* gas/mips/mips1@ld-forward.d: Likewise.
* gas/mips/s_d.d: Likewise.
* gas/mips/mips1@s_d.d: Likewise.
* gas/mips/sd.d: Likewise.
Nick Clifton [Tue, 26 Aug 2014 09:22:38 +0000 (10:22 +0100)]
Fix a typo in the selection pattern for the or1knd cpu.
* config.bfd: Fix typo in or1knd selection.
Jan-Benedict Glaw [Tue, 26 Aug 2014 08:36:09 +0000 (10:36 +0200)]
2014-08-26 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* config/tc-moxie.h (md_convert_frag): Silence warning.
Alan Modra [Tue, 26 Aug 2014 00:00:37 +0000 (09:30 +0930)]
daily update
Doug Evans [Mon, 25 Aug 2014 19:40:54 +0000 (12:40 -0700)]
Fix clang compilation errors in gdb.mi/basics.c.
gdb/testsuite/ChangeLog:
* gdb.mi/basics.c (callee3, callee2, callee1): Specify result type.
(main): Ditto.
Doug Evans [Mon, 25 Aug 2014 19:23:50 +0000 (12:23 -0700)]
gdb.threads/thread-execl.exp: #include <stdio.h>.
gdb/testsuite/ChangeLog:
* gdb.threads/thread-execl.exp: #include <stdio.h>.
Doug Evans [Mon, 25 Aug 2014 19:19:01 +0000 (12:19 -0700)]
linux-nat.c (linux_nat_close): Don't pass NULL for "this".
gdb/ChangeLog:
* linux-nat.c (linux_nat_close): Don't pass NULL for "this".
Pass NULL instead of 0 for context pointer.
Yao Qi [Mon, 25 Aug 2014 12:01:45 +0000 (20:01 +0800)]
Fix grammatical error in comments
gdb:
2014-08-25 Yao Qi <yao@codesourcery.com>
* dwarf2read.c: Fix grammatical error.
Jose E. Marchesi [Mon, 25 Aug 2014 11:08:31 +0000 (13:08 +0200)]
gas tests for the sparc instructions ldfsr, stfsr, ldx, ldxa, stx, stxa, ldxfsr, stxfsr, ldxefsr.
- V8 instructions: ldfsr, stfsr
- V9 instructions: ldx, ldxa, stx, stxa, ldxfsr, stxfsr
- V9b instructions: ldxefsr
Tested on sparc64-*-linux-gnu.
[gas/testsuite/Changelog]
2014-08-25 Jose E. Marchesi <jose.marchesi@oracle.com>
* gas/sparc/ldx_stx.s: New file.
* gas/sparc/ldx_stx.d: Likewise.
* gas/sparc/ldx_efsr.s: New file.
* gas/sparc/ldx_efsr.d: Likewise.
* gas/sparc/ld_st_fsr.s: New file.
* gas/sparc/ld_st_fsr.d: Likewise.
* gas/sparc/sparc.exp: Run the tests ldx_stx, ldx_efsr and
ld_st_fsr.
Alan Modra [Mon, 25 Aug 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Yao Qi [Fri, 15 Aug 2014 11:06:02 +0000 (19:06 +0800)]
Update comments in scan_partial_symbols and add_partial_subprogram
I read comment of scan_partial_symbols about NEED_PC and how *LOWPC
and *HIGHPC are updated:
DW_AT_ranges). If NEED_PC is set, then this function will set
*LOWPC and *HIGHPC to the lowest and highest PC values found in CU
and record the covered ranges in the addrmap.
NEED_PC is only used in the callee of scan_partial_symbols,
add_partial_subprogram,
if (pdi->tag == DW_TAG_subprogram)
{
if (pdi->has_pc_info)
{
if (pdi->lowpc < *lowpc)
*lowpc = pdi->lowpc;
if (pdi->highpc > *highpc)
*highpc = pdi->highpc;
if (need_pc)
*LOWPC and *HIGHPC is updated regardless of NEED_PC. When NEED_PC is
true, addrmap is updated. It would be clear to rename NEED_PC to
SET_ADDRMAP. That is what this patch does. Beside this, this patch
also adjust comments in related functions.
gdb:
2014-08-24 Yao Qi <yao@codesourcery.com>
* dwarf2read.c (scan_partial_symbols): Update comments.
Rename argument 'need_pc' with 'set_addrmap'.
(add_partial_namespace): Rename argument 'need_pc' with
'set_addrmap'.
(add_partial_module): Likewise.
(add_partial_subprogram): Likewise. Update comments.
(dwarf2_name): Fix typo.
Yao Qi [Thu, 7 Aug 2014 08:10:51 +0000 (16:10 +0800)]
set print symbol off in py-value.exp and scm-value.exp
I see the following fails on arm-none-eabi target,
print sn^M
$14 = 0x0 <_ftext>^M
(gdb) FAIL: gdb.python/py-value.exp: print sn
print sn^M
$14 = 0x0 <_ftext>^M
(gdb) FAIL: gdb.guile/scm-value.exp: print sn
as <_ftext> is unexpected. This patch is to set print symbol off to
avoid printing this.
gdb/testsuite:
2014-08-24 Yao Qi <yao@codesourcery.com>
* gdb.guile/scm-value.exp (test_lazy_strings): Set print
symbol off.
* gdb.python/py-value.exp (test_lazy_strings): Likewise.
Alan Modra [Sun, 24 Aug 2014 00:01:13 +0000 (09:31 +0930)]
daily update
Hans-Peter Nilsson [Sat, 23 Aug 2014 02:53:28 +0000 (04:53 +0200)]
Fix m32r-elf sim, default hardware to off.
The situation here is similar to that of the other nearby (previous)
sims fixed; it fails at the dv_sockser_install declaration in
sim/m32r/tconfig.in. But, as opposed to e.g. frv, this *does* have a
definition of UART_INCHAR_ADDR et al. It's somewhat tempting to keep
sim-hardware enabled here but, I'm disabling it for the same reasons
as for frv. Unsurprisingly (as m32r seems to be the template), the
same confusing lines are in sim/m32r/Makefile.in as in
sim/frv/Makefile.in at that time, deleted in
73e76d20. Again, commit
73e76d20 (for m32r as well as for frv) attempted to move the
non-existing dv-sockser.o use to $(m32r_extra_objs) but missed that
AC_SUBST would only affect @m32r_extra_objs@ and not
$(m32r_extra_objs) per se so nothing happened. As for frv, I'm
removing the $(m32r_extra_objs) too, to avoid confusion. Make
check-sim for m32r-elf shows no regressions (5 failures; 100 expected
passes) compared to
bf3d9781ec049 (before the recent config.in regen,
after sim-hardware mostly-enabled) and
eed23bb4a1 (before the
sim-hardware mostly-enabled; 2013-03-23).
sim/m32r:
* configure.ac: Default simulator hardware to off again. Remove
dead m32r_extra_objs substitution.
* configure: Regenerate.
* Makefile.in: Remove unused frv_extra_objs.
Hans-Peter Nilsson [Sat, 23 Aug 2014 02:40:36 +0000 (04:40 +0200)]
Fix sh64-elf sim, default hardware to off.
See nearby (previous) commit for the iq2000 sim; this similarly fails
at the dv_sockser_install declaration in sim/sh64/tconfig.in. I'm
disabling simulator hardware to be consistent with the state before
94c63d78f (2013-03-23) and with the actions for the frv sim and the
iq2000 sim. Make check-sim for sh64-elf shows no regressions (25
failures; 357 expected passes) compared to
bf3d9781ec049 (before the
recent config.in regen, after sim-hardware mostly-enabled) and
eed23bb4a1 (before the sim-hardware mostly-enabled; 2013-03-23).
sim/sh64:
* configure.ac: Default simulator hardware to off again
without emitting errors when off or dv-sockser.o unavailable.
* configure: Regenerate.
Hans-Peter Nilsson [Sat, 23 Aug 2014 02:27:26 +0000 (04:27 +0200)]
Fix iq2000-elf sim, default hardware to off.
See nearby (previous) commit for the frv sim; this similarly fails at
the dv_sockser_install declaration in sim/iq2000/tconfig.in. There's
no HAVE_DV_SOCKSER conditionals here and no other dv-sockser.o
artefacts so maybe there is no further fallout, but I'm going to
disable sim-hardware just be consistent with the state before
94c63d78f (2013-03-23) and with the actions for the frv sim. Make
check-sim for iq2000-elf shows no failures but that's in no small part
because it has no test-suite.
sim/iq2000:
* configure.ac: Default simulator hardware to off again
without emitting errors when off or dv-sockser.o unavailable.
* configure: Regenerate.
Hans-Peter Nilsson [Sat, 23 Aug 2014 02:16:58 +0000 (04:16 +0200)]
Fix frv-elf sim, default hardware to off.
At
2974be626, frv-elf fails at the dv_sockser_install declaration in
sim/frv/tconfig.in. But, with the trivial #include's added (see other
sims tconfig.in, like cris or mn10300), it *still* fails building
sim/frv/devices.c because of a missing UART_INCHAR_ADDR. I have no
insight into what'd be a valid value, except that there's a definition
in m32r, which was probably used as a template with frv not finished.
Simulated hardware should not have been be enabled, and was indeed not
enabled by default before
94c63d78f (2013-03-23), where it seems to
have been enabled for no simulator-specific reason. Except
dv-sockser.o wasn't enabled even then: sim/frv/config.in wasn't
regenerated, so HAVE_DV_SOCKSER was never defined. Maybe people were
fooled by this in sim/frv/Makefile.in at that time (these two lines
were later deleted, in
73e76d20):
CONFIG_DEVICES = dv-sockser.o
CONFIG_DEVICES =
(As it seems people have missed it before: the second line overrides
the first...) I'm guessing these lines were part of the
never-completed hardware-support. Commit
73e76d20 attempted to move
the imagined dv-sockser.o from $(CONFIG_DEVICES) to $(frv_extra_objs)
but missed that AC_SUBST would only affect @frv_extra_objs@ (not
$(frv_extra_objs) per se) so nothing happened regarding sockser:
dv-sockser.o was not compiled and HAVE_DV_SOCKSER was not defined.
I'm removing the $(frv_extra_objs) too, to avoid confusion. The best
action seems to be disabling all hardware support by default again
until a specific sim maintainer finishes the work.
Make check-sim for frv-elf shows no failures after this.
sim/frv:
* configure.ac: Default simulator hardware to off again. Remove
dead frv_extra_objs substitution.
* configure: Regenerate.
* Makefile.in: Remove unused frv_extra_objs.
Doug Evans [Sat, 23 Aug 2014 00:25:59 +0000 (17:25 -0700)]
Fix pr 17276.
See the description here:
https://sourceware.org/ml/gdb-patches/2014-08/msg00283.html
This patch keeps track of whether the current line has seen a
non-zero discriminator, and if so coalesces consecutive entries
for the same line (by ignoring all entries after the first).
gdb/ChangeLog:
PR 17276
* dwarf2read.c (dwarf_record_line_p): New function.
(dwarf_decode_lines_1): Ignore subsequent line number entries
for the same line if any entry had a non-zero discriminator.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-single-line-discriminators.S: New file.
* gdb.dwarf2/dw2-single-line-discriminators.c: New file.
* gdb.dwarf2/dw2-single-line-discriminators.exp: New file.
Alan Modra [Sat, 23 Aug 2014 00:12:52 +0000 (09:42 +0930)]
daily update
Doug Evans [Fri, 22 Aug 2014 23:20:05 +0000 (16:20 -0700)]
Create a typedef for record_line: record_line_ftype.
gdb/ChangeLog:
* buildsym.h (record_line_ftype): New typedef.
(record_line): Use it.
* dwarf2read.c (dwarf_record_line, dwarf_finish_line): New functions.
(dwarf_decode_lines_1): Call them.
Richard Henderson [Fri, 22 Aug 2014 21:42:39 +0000 (14:42 -0700)]
aarch64: Adjust dwarf2 encoding factors
* config/tc-aarch64.h (DWARF2_LINE_MIN_INSN_LENGTH): Set to 4.
(DWARF2_CIE_DATA_ALIGNMENT): Set to -8.
Richard Henderson [Fri, 22 Aug 2014 21:41:43 +0000 (14:41 -0700)]
aarch64: Fix CFA encoding of vector registers
* config/tc-aarch64.c (tc_aarch64_regname_to_dw2regnum): Fix
register number for vector register types.
Richard Henderson [Fri, 22 Aug 2014 21:40:10 +0000 (14:40 -0700)]
aarch64: Decode dwarf2 register numbers
* dwarf.h (init_dwarf_regnames_aarch64): Declare.
* dwarf.c (dwarf_regnames_aarch64): New.
(init_dwarf_regnames_aarch64): New.
(init_dwarf_regnames): Call it.
* objdump.c (dump_dwarf): Likewise.
Maciej W. Rozycki [Fri, 22 Aug 2014 15:52:20 +0000 (16:52 +0100)]
Power/GAS: Don't set VLE annotation for non-VLE processors/instructions
Only set the VLE flag if the instruction has been pulled via the VLE
instruction set. This way the flag is guaranteed to be set for VLE-only
instructions or for VLE-only processors, however it'll remain clear for
dual-mode instructions on dual-mode and, more importantly, standard-mode
processors.
gas/
* config/tc-ppc.c (md_assemble): Only set the PPC_APUINFO_VLE
flag if both the processor and opcode flags match.
ld/testsuite/
* ld-powerpc/apuinfo-vle.rd: New test.
* ld-powerpc/apuinfo-vle.s: New test source.
* ld-powerpc/apuinfo.rd: Adjust according to GAS PPC_APUINFO_VLE
handling change.
* ld-powerpc/powerpc.exp: Run the new test.
Maciej W. Rozycki [Fri, 22 Aug 2014 15:42:12 +0000 (16:42 +0100)]
ARM/opcodes: Fix negative hexadecimal offset disassembly
2014-08-21 Nathan Sidwell <nathan@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
opcodes/
* arm-dis.c (print_arm_address): Negate the GPR-relative offset
returned if the U bit is set.
2014-08-21 Paul Brook <paul@codesourcery.com>
gas/testsuite/
* gas/arm/arch7a-mp.d: Adjust according to `print_arm_address'
offset fix.
* gas/arm/arch7r-mp.d: Likewise.
Maciej W. Rozycki [Fri, 22 Aug 2014 15:30:36 +0000 (16:30 +0100)]
ARM/gas: Fix a build failure with GCC 4.3.3
cc1: warnings being treated as errors
.../gas/config/tc-arm.c: In function 'add_to_lit_pool':
.../gas/config/tc-arm.c:3193: error: 'imm1' may be used uninitialized in this function
* config/tc-arm.c (add_to_lit_pool): Preinitialize `imm1'.
Kai Tietz [Wed, 20 Aug 2014 15:39:21 +0000 (17:39 +0200)]
Fix file-alignment for objcopy for pe-coff
2014-08-22 Kai Tietz <ktietz@redhat.com>
PR binutils/11822
* coffcode.h (coff_compute_section_file_positions): Keep
FileAlignment valid as set.
Yao Qi [Thu, 14 Aug 2014 06:16:56 +0000 (14:16 +0800)]
Copy .py files to remote host
Some gdb.python/*.exp tests fail because the .py files aren't copied
to the (remote) host. This patch is to copy needed .py files to host.
Most of gdb.python/*.exp tests do this.
As it is still controversial to delete *.py files on host, we don't do
that in this patch.
gdb/testsuite:
2014-08-22 Yao Qi <yao@codesourcery.com>
* gdb.python/py-finish-breakpoint.exp: Copy .py file to host.
* gdb.python/py-finish-breakpoint2.exp: Likewise.
* gdb.python/python.exp: Likewise. Use .py file on the host
instead of the build.
Andreas Tobler [Fri, 22 Aug 2014 04:33:45 +0000 (06:33 +0200)]
* emulparams/armelf_fbsd.sh (TEXT_START_ADDR): Increase alignment to 64kB boundary like in armelf_linux.sh
Yao Qi [Thu, 21 Aug 2014 02:48:33 +0000 (10:48 +0800)]
Remove workaround to libbabeltrace 1.1.0 issue
When GDB uses recent version of babeltrace, such as 1.2.x, we'll see
such error emitted from babeltrace library,
(gdb) target ctf .../gdb/testsuite/gdb.trace/actions.ctf
[error] Invalid CTF stream: content size is smaller than packet headers.
[error] Stream index creation error.
[error] Open file stream error.
The problem can be reproduce out of GDB too, using babeltrace,
$ babeltrace ./fake-packet.ctf/
[error] Invalid CTF stream: content size is smaller than packet headers.
[error] Stream index creation error.
[error] Open file stream error.
Recent babeltrace library becomes more strict on CTF, and complains
about one "faked packet" GDB adds, when saving trace data in ctf
format from GDB. babeltrace 1.1.0 has a bug that it can't read trace
data smaller than a certain size (see https://bugs.lttng.org/issues/450).
We workaround it in GDB to append some meaningless data in a faked
packet to make sure trace file is large enough (see ctf.c:ctf_end).
The babeltrace issue was fixed in 1.1.1 release. However, babeltrace
recent release (since 1.1.2) starts to complain about such faked
packet. Here is a table shows that whether faked packet or no faked
packet is "supported" by various babeltrace releases,
faked packet no faked packet
1.1.0 Yes No
1.1.1 Yes Yes
1.1.2 No Yes
1.2.0 No Yes
We decide to get rid of this workaround in GDB, and people can build GDB
with libbabeltrace >= 1.1.1. In this way, both configure and ctf.c is
simpler.
Run gdb.trace/* tests in the following combinations:
wo/ this pattch 1.1.0
w/ this patch 1.1.1
w/ this patch 1.1.2
w/ this patch 1.2.0
No test results change.
gdb:
2014-08-22 Yao Qi <yao@codesourcery.com>
* ctf.c (CTF_FILE_MIN_SIZE): Remove.
(ctf_end): Remove code.
Alan Modra [Thu, 21 Aug 2014 23:42:09 +0000 (09:12 +0930)]
Delete redundant struct cie field
cie->output_sec is used to when merging CIEs to ensure that only CIEs
from the same output section are merged. I noticed an assignment to
this field in _bfd_elf_parse_eh_frame, and thought "That's wrong,
output_section isn't set properly when _bfd_elf_parse_eh_frame is
called from gc-sections code". It turns out that this assignment is
premature, and in fact a dead store. find_merged_cie overwrites with
the correct value before the field is ever used. On looking a little
more it becomes apparent that cie->cie_inf.u.cie.u.sec->output_section
holds the same value, so cie->output_sec is redundant.
* elf-eh-frame.c (struct cie): Delete "output_sec" field.
(cie_eq, cie_compute_hash): Use output_section from cie_inf instead.
Alan Modra [Thu, 21 Aug 2014 23:37:35 +0000 (09:07 +0930)]
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr
I noticed recently that .eh_frame FDEs generated by the linker for
call stubs and .glink weren't being indexed in .eh_frame_hdr, due to
bfd_elf_discard_info being run before the linker generated .eh_frame
sections were available for parsing. This patch moves code around in
elf64-ppc.c and ppc64elf.em to avoid that problem.
Another problem fixed here is that --gc-sections parses .eh_frame
early, and the existing machinery allows only one go at parsing the
.eh_frame sections. That resulted in the linker generated .eh_frame
CIEs not being merged and no .eh_frame_hdr index entries for those
FDEs. It turns out that all the info from parsing .eh_frame is
attached to the section, so order of parsing isn't important, and
after parsing sec_info_type being set will prevent a section being
parsed again. At least, when parsing doesn't hit an error. So there
isn't really any need for "parsed_eh_frame". "merge_cies" is also
redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also
disappear.
bfd/
* elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and
parsed_eh_frames.
(_bfd_elf_begin_eh_frame_parsing): Delete.
(_bfd_elf_end_eh_frame_parsing): Delete.
* elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete.
(_bfd_elf_end_eh_frame_parsing): Delete.
(_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test
!info->relocatable in place of merge_cies.
* elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust.
* elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8.
(ppc64_elf_size_stubs): Likewise pad stub FDE.
(ppc64_elf_build_stubs): Move code setting glink .eh_frame to..
(ppc64_elf_size_stubs): ..here and..
(ppc64_elf_finish_dynamic_sections): ..here.
ld/
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call
bfd_elf_discard_info after generating glink .eh_frame. Delete
redundant test on ppc64_elf_setup_section_lists status.
Alan Modra [Fri, 22 Aug 2014 00:32:05 +0000 (10:02 +0930)]
daily update