deliverable/binutils-gdb.git
10 years ago[varobj] false type-changed status for reference to Ada array
Joel Brobecker [Thu, 20 Mar 2014 14:43:08 +0000 (07:43 -0700)] 
[varobj] false type-changed status for reference to Ada array

Given the following variable...

   BT : Bounded := New_Bounded (Low => 1, High => 3);

... where type Bounded is defined as a simple unconstrained array:

   type Bounded is array (Integer range <>) of Integer;

Creating a varobj for that variable, and immediately asking for
varobj updates, GDB says that our varobj changed types!

    (gdb)
    -var-create bt * bt
    ^done,name="bt",numchild="3",value="[3]",type="<ref> array (1 .. 3) of integer",has_more="0"
    (gdb)
    -var-update 1 *
    ^done,changelist=[{name="bt",value="[3]",in_scope="true",type_changed="true",new_type="<ref> array (1 .. 3) of integer",new_num_children="3",has_more="0"}]

The expected output for the -var-update command is, in this case:

    (gdb)
    -var-update 1 *
    ^done,changelist=[]

The problem occurs because the ada-varobj module does not handle
references, and while the references gets stripped when the varobj
gets created, it doesn't when computing varobj updates.

More specifically, when creating the varobj, varobj_create creates
a new value which is a reference to a TYPE_CODE_ARRAY. It then calls
install_new_value which calls coerce_ref with the following comment:

    /* We are not interested in the address of references, and given
       that in C++ a reference is not rebindable, it cannot
       meaningfully change.  So, get hold of the real value.  */
    if (value)
      value = coerce_ref (value);

This leaves the varobj's type component still a ref, while
the varobj's value is now our array, without the ref. This explains
why the "value" field in the varobj indicates an array with 3 elements
"[3]" while the "type" field shows a ref to an array. Generally
speaking, most users have said that showing the ref was a useful
piece of information, so this patch is not touching this part.

Next, when the user issues the -var-update request, varobj_update
calls value_of_root to compute the varobj's new value as well as
determine whether the value's type has changed or not. What happens
in a nutshell is that it calls value_of_root_1 (which re-evaluates
the expression and returns the corresponding new value), finds that
the new value is not NULL, and thus asks whether it has mutated:

    else if (varobj_value_has_mutated (var, value, value_type (value)))

This then indirectly delegates the determination to the language-specific
callback, which fails, because it does not handle references.

This patch fixes the issue by adjusting varobj_value_has_mutated to
expect references, and strip them when seen. This allows the various
language-specific implementations to remain unaware of references.

gdb/ChangeLog:

        * varobj.c (varobj_value_has_mutated): If NEW_VALUE is
        a reference, strip the reference layer before calling
        the lang_ops value_has_mutated callback.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_dyn_arr: New testcase.

10 years agodaily update
Alan Modra [Thu, 27 Mar 2014 23:00:54 +0000 (09:30 +1030)] 
daily update

10 years agoRemove `expout*' globals from parser-defs.h
Sergio Durigan Junior [Thu, 27 Mar 2014 22:10:40 +0000 (19:10 -0300)] 
Remove `expout*' globals from parser-defs.h

This commit removes the "expout*" globals from our parser code, turning
them into a structure that is passed when an expression needs to be
evaluated.  This is the initial step to make our parser less
"globalized".

This is mostly a mechanical patch, which creates a structure containing
the "expout*" globals and then modify all the functions that handle them
in order to take the structure as argument.  It is big, and has been
reviewed at least 4 times, so I think everything is covered.

Below you can see the message links from the discussions:

- First attempt:

<https://sourceware.org/ml/gdb-patches/2012-01/msg00522.html>
Message-ID: <m3k44s7qej.fsf@gmail.com>

- Second attempt:

<https://sourceware.org/ml/gdb-patches/2012-06/msg00054.html>
Message-Id: <1338665528-5932-1-git-send-email-sergiodj@redhat.com>

- Third attempt:

<https://sourceware.org/ml/gdb-patches/2014-01/msg00949.html>
Message-Id: <1390629467-27139-1-git-send-email-sergiodj@redhat.com>

- Fourth (last) attempt:

<https://sourceware.org/ml/gdb-patches/2014-03/msg00546.html>
Message-Id: <1395463432-29750-1-git-send-email-sergiodj@redhat.com>

gdb/
2014-03-27  Sergio Durigan Junior  <sergiodj@redhat.com>

Remove some globals from our parser.
* language.c (unk_lang_parser): Add "struct parser_state"
argument.
* language.h (struct language_defn) <la_parser>: Likewise.
* parse.c (expout, expout_size, expout_ptr): Remove variables.
(initialize_expout): Add "struct parser_state" argument.
Rewrite function to use the parser state.
(reallocate_expout, write_exp_elt, write_exp_elt_opcode,
write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile,
write_exp_elt_longcst, write_exp_elt_dblcst,
write_exp_elt_decfloatcst, write_exp_elt_type,
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
write_exp_bitstring, write_exp_msymbol, mark_struct_expression,
write_dollar_variable): Likewise.
(parse_exp_in_context_1): Use parser state.
(insert_type_address_space): Add "struct parser_state" argument.
Use parser state.
(increase_expout_size): New function.
* parser-defs.h: Forward declare "struct language_defn" and
"struct parser_state".
(expout, expout_size, expout_ptr): Remove extern declarations.
(parse_gdbarch, parse_language): Rewrite macro declarations to
accept the parser state.
(struct parser_state): New struct.
(initialize_expout, reallocate_expout, write_exp_elt_opcode,
write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst,
write_exp_elt_decfloatcst, write_exp_elt_type,
write_exp_elt_intern, write_exp_string, write_exp_string_vector,
write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile,
write_exp_msymbol, write_dollar_variable,
mark_struct_expression, insert_type_address_space): Add "struct
parser_state" argument.
(increase_expout_size): New function.
* utils.c (do_clear_parser_state): New function.
(make_cleanup_clear_parser_state): Likewise.
* utils.h (make_cleanup_clear_parser_state): New function
prototype.
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token):
Update calls to write_exp* in order to pass the parser state.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
(stap_parse_single_operand): Likewise.
(stap_parse_argument_1): Likewise.
(stap_parse_argument): Use parser state.
* stap-probe.h: Include "parser-defs.h".
(struct stap_parse_info) <pstate>: New field.
* c-exp.y (parse_type): Rewrite to use parser state.
(yyparse): Redefine to c_parse_internal.
(pstate): New global variable.
(parse_number): Add "struct parser_state" argument.
(write_destructor_name): Likewise.
(type_exp): Update calls to write_exp* and similars in order to
use parser state.
(exp1, exp, variable, qualified_name, space_identifier,
typename, typebase): Likewise.
(write_destructor_name, parse_number, lex_one_token,
classify_name, classify_inner_name, c_parse): Add "struct
parser_state" argument.  Update function to use parser state.
* c-lang.h: Forward declare "struct parser_state".
(c_parse): Add "struct parser_state" argument.
* ada-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to ada_parse_internal.
(pstate): New variable.
(write_int, write_object_renaming, write_var_or_type,
write_name_assoc, write_exp_op_with_string, write_ambiguous_var,
type_int, type_long, type_long_long, type_float, type_double,
type_long_double, type_char, type_boolean, type_system_address):
Add "struct parser_state" argument.
(exp1, primary, simple_exp, relation, and_exp, and_then_exp,
or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix,
var_or_type, aggregate, aggregate_component_list,
positional_list, others, component_group,
component_associations): Update calls to write_exp* and similar
functions in order to use parser state.
(ada_parse, write_var_from_sym, write_int,
write_exp_op_with_string, write_object_renaming,
find_primitive_type, write_selectors, write_ambiguous_var,
write_var_or_type, write_name_assoc, type_int, type_long,
type_long_long, type_float, type_double, type_long_double,
type_char, type_boolean, type_system_address): Add "struct
parser_state" argument.  Adjust function to use parser state.
* ada-lang.c (parse): Likewise.
* ada-lang.h: Forward declare "struct parser_state".
(ada_parse): Add "struct parser_state" argument.
* ada-lex.l (processInt, processReal): Likewise.  Adjust all
calls to both functions.
* f-exp.y (parse_type, parse_f_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro to f_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp, subrange, typebase): Update calls to write_exp*
and similars in order to use parser state.
(parse_number): Adjust code to use parser state.
(yylex): Likewise.
(f_parse): New function.
* f-lang.h: Forward declare "struct parser_state".
(f_parse): Add "struct parser_state" argument.
* jv-exp.y (parse_type, parse_java_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro for java_parse_internal.
(pstate): New variable.
(push_expression_name, push_expression_name, insert_exp): Add
"struct parser_state" argument.
(type_exp, StringLiteral, Literal, PrimitiveType, IntegralType,
FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess,
FuncStart, MethodInvocation, ArrayAccess, PostfixExpression,
PostIncrementExpression, PostDecrementExpression,
UnaryExpression, PreIncrementExpression, PreDecrementExpression,
UnaryExpressionNotPlusMinus, CastExpression,
MultiplicativeExpression, AdditiveExpression, ShiftExpression,
RelationalExpression, EqualityExpression, AndExpression,
ExclusiveOrExpression, InclusiveOrExpression,
ConditionalAndExpression, ConditionalOrExpression,
ConditionalExpression, Assignment, LeftHandSide): Update
calls to write_exp* and similars in order to use parser state.
(parse_number): Ajust code to use parser state.
(yylex): Likewise.
(java_parse): New function.
(push_variable): Add "struct parser_state" argument.  Adjust
code to user parser state.
(push_fieldnames, push_qualified_expression_name,
push_expression_name, insert_exp): Likewise.
* jv-lang.h: Forward declare "struct parser_state".
(java_parse): Add "struct parser_state" argument.
* m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use
parser state.
(yyparse): Redefine macro to m2_parse_internal.
(pstate): New variable.
(type_exp, exp, fblock, variable, type): Update calls to
write_exp* and similars to use parser state.
(yylex): Likewise.
(m2_parse): New function.
* m2-lang.h: Forward declare "struct parser_state".
(m2_parse): Add "struct parser_state" argument.
* objc-lang.c (end_msglist): Add "struct parser_state" argument.
* objc-lang.h: Forward declare "struct parser_state".
(end_msglist): Add "struct parser_state" argument.
* p-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to pascal_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp1, exp, qualified_name, variable): Update calls to
write_exp* and similars in order to use parser state.
(parse_number, yylex): Adjust code to use parser state.
(pascal_parse): New function.
* p-lang.h: Forward declare "struct parser_state".
(pascal_parse): Add "struct parser_state" argument.
* go-exp.y (parse_type): Rewrite macro to use parser state.
(yyparse): Redefine macro to go_parse_internal.
(pstate): New variable.
(parse_number): Add "struct parser_state" argument.
(type_exp, exp1, exp, variable, type): Update calls to
write_exp* and similars in order to use parser state.
(parse_number, lex_one_token, classify_name, yylex): Adjust code
to use parser state.
(go_parse): Likewise.
* go-lang.h: Forward declare "struct parser_state".
(go_parse): Add "struct parser_state" argument.

10 years ago * dwarf2read.c (read_str_index): Delete arg cu. All callers updated.
Doug Evans [Thu, 27 Mar 2014 19:42:50 +0000 (12:42 -0700)] 
* dwarf2read.c (read_str_index): Delete arg cu.  All callers updated.

10 years ago * dwarf2read.c (init_cutu_and_read_dies_no_follow): Fix comments.
Doug Evans [Thu, 27 Mar 2014 19:03:34 +0000 (12:03 -0700)] 
* dwarf2read.c (init_cutu_and_read_dies_no_follow): Fix comments.
Remove argument abbrev_section.  All callers updated.

10 years ago * dwarf2read.c (struct dwarf2_cu): Improve comments for members
Doug Evans [Thu, 27 Mar 2014 18:43:47 +0000 (11:43 -0700)] 
* dwarf2read.c (struct dwarf2_cu): Improve comments for members
addr_base, ranges_base.

10 years ago * gdb.dwarf2/dw2-abs-hi-pc.exp: Build tests with "nodebug".
Doug Evans [Thu, 27 Mar 2014 18:38:30 +0000 (11:38 -0700)] 
* gdb.dwarf2/dw2-abs-hi-pc.exp: Build tests with "nodebug".

10 years agoScan all input files for symbol reference warning
H.J. Lu [Wed, 26 Mar 2014 19:18:59 +0000 (12:18 -0700)] 
Scan all input files for symbol reference warning

This patch scans all input files for symbol reference warning if the
symbol reference doesn't exist in the current input file.

ld/

PR ld/16756
* ldmain.c (symbol_warning): New function.
(warning_callback): Use it.  Scan all input files for a reference
to SYMBOL.

ld/testsuite/

PR ld/16756
* ld-plugin/lto.exp: Expect filename and line number for PR
ld/12760 test.

10 years agoAdd support for limited pretty-printing of ARM PLT entries on eabi and nacl targets.
Yury Gribov [Thu, 27 Mar 2014 13:54:03 +0000 (13:54 +0000)] 
Add support for limited pretty-printing of ARM PLT entries on eabi and nacl targets.

     * elf32-arm.c (elf32_arm_get_synthetic_symtab): Add new callback.
     (elf32_arm_nacl_plt_sym_val): Likewise.
     (elf32_arm_plt0_size): Add helper function.
     (elf32_arm_plt_size): Likewise.

     * ld-arm/arm-app-abs32.d: Updated test.
     * ld-arm/arm-app.d: Likewise.
     * ld-arm/arm-lib-plt32.d: Likewise.
     * ld-arm/arm-lib.d: Likewise.
     * ld-arm/armthumb-lib.d: Likewise.
     * ld-arm/cortex-a8-fix-b-plt.d: Likewise.
     * ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
     * ld-arm/cortex-a8-fix-bl-plt.d: Likewise.
     * ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise.
     * ld-arm/cortex-a8-fix-blx-plt.d: Likewise.
     * ld-arm/farcall-mixed-app-v5.d: Likewise.
     * ld-arm/farcall-mixed-app.d: Likewise.
     * ld-arm/farcall-mixed-lib-v4t.d: Likewise.
     * ld-arm/farcall-mixed-lib.d: Likewise.
     * ld-arm/ifunc-10.dd: Likewise.
     * ld-arm/ifunc-14.dd: Likewise.
     * ld-arm/ifunc-15.dd: Likewise.
     * ld-arm/ifunc-3.dd: Likewise.
     * ld-arm/ifunc-4.dd: Likewise.
     * ld-arm/ifunc-7.dd: Likewise.
     * ld-arm/ifunc-8.dd: Likewise.
     * ld-arm/ifunc-9.dd: Likewise.
     * ld-arm/long-plt-format.d: Likewise.
     * ld-arm/mixed-app-v5.d: Likewise.
     * ld-arm/mixed-app.d: Likewise.
     * ld-arm/mixed-lib.d: Likewise.
     * ld-arm/thumb2-bl-undefweak.d: Likewise.
     * ld-arm/thumb2-bl-undefweak1.d: Likewise.

10 years agoThis is a fix for PR ld/16761 - the linker now has a dependence upon the binutils
Yaakov Selkowitz [Thu, 27 Mar 2014 13:36:36 +0000 (13:36 +0000)] 
This is a fix for PR ld/16761 - the linker now has a dependence upon the binutils
because it needs to windres tool (for some targets).

* Makefile.def (dependencies): Make all-ld depend on all-binutils
for WINDRES_FOR_TARGET in default-manifest.o rule.
* Makefile.in: Regenerate.

10 years agoMach-O: disp dyld environment command in objdump -P load.
Tristan Gingold [Wed, 26 Mar 2014 09:40:49 +0000 (10:40 +0100)] 
Mach-O: disp dyld environment command in objdump -P load.

bfd/
* mach-o.c (bfd_mach_o_read_dylinker): Remove assert.
(bfd_mach_o_read_command): Handle BFD_MACH_O_LC_DYLD_ENVIRONMENT.
binutils/
* od-macho.c (dump_load_command): Display value for
BFD_MACH_O_LC_DYLD_ENVIRONMENT.  Handle BFD_MACH_O_LC_DATA_IN_CODE
and BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS.

10 years agoThis fixes a compile time error triggered by -Werror=format-security because
Nick Clifton [Thu, 27 Mar 2014 09:41:06 +0000 (09:41 +0000)] 
This fixes a compile time error triggered by -Werror=format-security because
a call to sprintf was being made with a non-constant formatting string.

* config/tc-score.c (s3_parse_pce_inst): Add "%s" parameter to
sprintf in order to avoid a compile time warning.

10 years agoMach-O: add objdump -P function_starts to display function starts.
Tristan Gingold [Tue, 25 Mar 2014 14:51:54 +0000 (15:51 +0100)] 
Mach-O: add objdump -P function_starts to display function starts.

bfd/
* mach-o.h (bfd_mach_o_get_base_address): New prototype.
* mach-o.c (bfd_mach_o_write_symtab)
(bfd_mach_o_write_contents)
(bfd_mach_o_set_section_flags_from_bfd)
(bfd_mach_o_build_seg_command): Fix indentation.
(bfd_mach_o_get_base_address): New function.

binutils/
* od-macho.c (OPT_FUNCTION_STARTS): New macro.
(options): Add entry for function_starts.
(mach_o_help): Ditto.
(disp_segment_prot): New function.
(dump_section_map): Call disp_segment_prot.
(dump_function_starts): New function.
(dump_obj_compact_unwind): Fix ouput indentation.
(dump_exe_compact_unwind): Fix ouput indentation.
(mach_o_dump): Handle function_starts.

10 years agoReturn zero in can_single_step_to_signal_handler for nios2-*-* target
Yao Qi [Wed, 26 Mar 2014 09:44:14 +0000 (17:44 +0800)] 
Return zero in can_single_step_to_signal_handler for nios2-*-* target

nios2 uses software single step, so GDB is unable to single step to
the signal handler.  In order to reflect this, teach
can_single_step_to_signal_handler to return zero for nios2 target.

gdb/testsuite:

2014-03-27  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (can_single_step_to_signal_handler): Return zero
if target is nios2-*-*.

10 years agoobjdump: set address of debug sections.
Tristan Gingold [Mon, 24 Mar 2014 11:37:32 +0000 (12:37 +0100)] 
objdump: set address of debug sections.

This patche fixes the values of FDE pc in output of objdump -Wf. They now
match readelf ones.

binutils/
* objdump.c (load_specific_debug_section): Set address of section.

10 years agodaily update
Alan Modra [Wed, 26 Mar 2014 23:00:50 +0000 (09:30 +1030)] 
daily update

10 years ago[AArch64 disassembler] Add missing checks of undefine encodings on
Yufeng Zhang [Wed, 26 Mar 2014 18:44:27 +0000 (18:44 +0000)] 
[AArch64 disassembler] Add missing checks of undefine encodings on
st1/st2/st3/st4 instructions.

opcodes/

* aarch64-dis.c (aarch64_ext_ldst_elemlist): Check H/S undefined
instructions.

binutils/testsuite/

* binutils-all/aarch64/aarch64.exp: New test driver for AArch64.
* binutils-all/aarch64/unallocated-encoding.s: New testcase.
* binutils-all/aarch64/unallocated-encoding.d: Ditto.

10 years agoAdd support for %hi8, %hi16 and %lo16 being used when relocation are necessary.
Nick Clifton [Wed, 26 Mar 2014 16:34:04 +0000 (16:34 +0000)] 
Add support for %hi8, %hi16 and %lo16 being used when relocation are necessary.

* config/tc-rl78.c (rl78_op): Issue an error message if a 16-bit
relocation is used on an 8-bit operand or vice versa.
(tc_gen_reloc): Use the RL78_16U relocation for RL78_CODE.
(md_apply_fix): Add support for RL78_HI8, RL78_HI16 and RL78_LO16.

10 years agoThis fixes a problem for 64-bit Cygwin, where building some packages can
Nick Clifton [Wed, 26 Mar 2014 16:16:20 +0000 (16:16 +0000)] 
This fixes a problem for 64-bit Cygwin, where building some packages can
produce spurious errors about truncated relocations.  The relocations are
only truncated because they are being made against sections which are going
to be discarded so that base address is zero instead of the expected 64-bit
base value.

* cofflink.c (_bfd_coff_generic_relocate_section): Skip
relocations in discarded sections.

10 years agoRemove VAR_DOMAIN/STRUCT_DOMAIN ambiguity from ada-tasks.c.
Keith Seitz [Wed, 26 Mar 2014 15:25:03 +0000 (08:25 -0700)] 
Remove VAR_DOMAIN/STRUCT_DOMAIN ambiguity from ada-tasks.c.

2014-03-26  Keith Seitz  <keiths@redhat.com>

* ada-tasks.c (get_tcb_types_info): Search STRUCT_DOMAIN for
types, not VAR_DOMAIN.

10 years agoMach-O: Add BFD_MACH_O_CPU_TYPE_ARM64.
Tristan Gingold [Wed, 26 Mar 2014 09:40:06 +0000 (10:40 +0100)] 
Mach-O: Add BFD_MACH_O_CPU_TYPE_ARM64.

include/mach-o/
        * loader.h (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_ARM64.

bfd/
        * mach-o.c (bfd_mach_o_convert_architecture): Add
        BFD_MACH_O_CPU_TYPE_ARM64.

binutils/
        * od-macho.c (bfd_mach_o_cpu_name): Add BFD_MACH_O_CPU_TYPE_ARM64.

10 years agoReferencing a function's address on PowerPC64 ELFv2
Alan Modra [Tue, 25 Mar 2014 04:42:48 +0000 (15:12 +1030)] 
Referencing a function's address on PowerPC64 ELFv2

ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object.  It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data.  Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.

bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here.  Renamed from
ppc64_elf_process_dot_syms.  Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.

10 years agoSkip tests on completion and readline when readline lib isn't used
Yao Qi [Wed, 19 Mar 2014 02:16:35 +0000 (10:16 +0800)] 
Skip tests on completion and readline when readline lib isn't used

The completion feature and other features on readline depend on the
readline library.  However, readline library is not always used, for
example, running testsuite like

  make check RUNTESTFLAGS="--host_board=local-remote-host"

the input stream is not a tty, and GDB doesn't use readline library
as a result.

This patch is to skip tests on completion and readline if
'show editing' is off, which means readline isn't used.  Note that
some tests in gdb.base/completion.exp test command complete, which
isn't related to readline, so these tests aren't affected by readline
library.  This patch also moves these tests up, run them
unconditionally, and run the rest if readline library is used.

gdb/testsuite:

2014-03-26  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (readline_is_used): New proc.
* gdb.base/completion.exp: Move tests on command complete up.
Skip the rest of tests if readline is not used.
* gdb.ada/complete.exp: Skp the test if readline is not
used.
* gdb.base/filesym.exp: Likewise.
* gdb.base/macscp.exp: Likewise.
* gdb.base/readline-ask.exp: Likewise.
* gdb.base/readline.exp: Likewise.
* gdb.python/py-cmd.exp: Likewise.
* gdb.trace/tfile.exp: Likewise.

10 years agoFix code format issues gdb.base/macscp.exp
Yao Qi [Tue, 18 Mar 2014 12:26:58 +0000 (20:26 +0800)] 
Fix code format issues gdb.base/macscp.exp

When I do something else, I find code format in gdb.base/macscp.exp is
messy.  This patch is to fix various code format issues in it.

Pushed as it is obvious.

gdb/testsuite:

2014-03-26  Yao Qi  <yao@codesourcery.com>

* gdb.base/macscp.exp: Fix code format issues.

10 years agoFix type of "fp" and other registers for Nios II.
Sandra Loosemore [Wed, 26 Mar 2014 04:00:17 +0000 (21:00 -0700)] 
Fix type of "fp" and other registers for Nios II.

2014-03-25  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* features/nios2-cpu.xml: Correct types of "gp", "fp", "ea", and
"ra" registers.
* features/nios2-linux.c: Regenerated.
* features/nios2.c: Regenerated.

10 years agodaily update
Alan Modra [Tue, 25 Mar 2014 23:00:48 +0000 (09:30 +1030)] 
daily update

10 years agoThis patch adds a new pseudo-op - .seh_code - to structured exception handling
Nick Clifton [Tue, 25 Mar 2014 16:50:10 +0000 (16:50 +0000)] 
This patch adds a new pseudo-op - .seh_code - to structured exception handling
suite of ops.  It changes the current section back to the code section of the
current function.  This is helpful because the code section may not be .text.

* config/obj-coff-seh.c (obj_coff_seh_code): New function -
switches the current segment back to the code segment recorded
when seh_proc was last invoked.
* config/obj-coff-seh.h (SEH_CMDS): Add seh_code.

10 years agoSupport gdb.asm/asm-source.exp on powerpc64le
Ulrich Weigand [Tue, 25 Mar 2014 14:39:32 +0000 (15:39 +0100)] 
Support gdb.asm/asm-source.exp on powerpc64le

Add new powerpc64le.inc file appropriate for the ELFv2 ABI and
use it to support the asm-source.exp test case on powerpc64le.

gdb/testsuite/
2014-03-25  Ulrich Weigand  <uweigand@de.ibm.com>

* gdb.asm/asm-source.exp: Handle powerpc64le-* targets.
* gdb.asm/powerpc64le.inc: New file.

10 years ago"source", foreground execution commands, and target-async
Pedro Alves [Tue, 25 Mar 2014 11:45:53 +0000 (11:45 +0000)] 
"source", foreground execution commands, and target-async

Sourcing a GDB script that runs foreground execution commands in
succession fails if the target can async:

 Breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.base/source-execution.c:36
 36        func1 ();
 (gdb) source ../../../src/gdb/testsuite/gdb.base/source-execution.gdb
 ../../../src/gdb/testsuite/gdb.base/source-execution.gdb:21: Error in sourced command file:
 Cannot execute this command while the selected thread is running.
 (gdb) FAIL: gdb.base/source-execution.exp: source source-execution.gdb

That is, after a foreground execution command, GDB moves on to the
following command immediately before waiting for the previous command
to complete.

https://sourceware.org/ml/gdb-patches/2011-09/msg00037.html (b4a14fd0)
addressed this for command lists, Python's gdb.execute, etc., but
missed "source".  Fixed now in the same way.

gdb/
2014-03-25  Pedro Alves  <palves@redhat.com>

* cli/cli-script.c (script_from_file): Force the interpreter to
sync mode.

gdb/testsuite/
2014-03-25  Pedro Alves  <palves@redhat.com>
    Doug Evans  <dje@google.com>

* gdb.base/source-execution.c: New file.
* gdb.base/source-execution.exp: New file.
* gdb.base/source-execution.gdb: New file.

10 years agobfd/elfnn-aarch64.c: Fix calculation of DT_RELASZ
Will Newton [Fri, 14 Mar 2014 11:45:32 +0000 (11:45 +0000)] 
bfd/elfnn-aarch64.c: Fix calculation of DT_RELASZ

The current code subtracts the size of the output section containing
relplt from RELASZ. In some cases this will be the same output
section as the dynamic relocs causing a value of zero to be output.
Calculating the size from input sections seems to make more sense.

bfd/ChangeLog:

2014-03-25  Will Newton  <will.newton@linaro.org>

 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections):
 Set value of DT_PLTRELSZ and DT_RELASZ based on the size
 of input sections rather than output sections.

ld/testsuite/ChangeLog:

2014-03-25  Will Newton  <will.newton@linaro.org>

 * ld-aarch64/aarch64-elf.exp: Add relasz dump test.
 * ld-aarch64/relasz.d: New file.
 * ld-aarch64/relasz.s: Likewise.

10 years agoRevert "Remove magic treatment of toc symbols for powerpc ELF"
Alan Modra [Tue, 25 Mar 2014 01:31:09 +0000 (12:01 +1030)] 
Revert "Remove magic treatment of toc symbols for powerpc ELF"

It turns out that glibc's sysdeps/powerpc/powerpc64/start.S uses this
feature.  :-(

* config/tc-ppc.c (ppc_is_toc_sym): Revert 2014-03-05.
(md_assemble): Likewise.  Warn.

10 years agogdb.linespec/macro-relative.exp: Mark the test as unsupported if using fission.
Doug Evans [Mon, 24 Mar 2014 23:03:20 +0000 (16:03 -0700)] 
gdb.linespec/macro-relative.exp: Mark the test as unsupported if using fission.

10 years agodaily update
Alan Modra [Mon, 24 Mar 2014 23:00:39 +0000 (09:30 +1030)] 
daily update

10 years agoFix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf failures with non-Z0...
Hui Zhu [Mon, 24 Mar 2014 19:30:50 +0000 (19:30 +0000)] 
Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers

After a previous patch that was committed by Pedro (0000e5cc), trying
to set a dprintf with with a GDBserver that doesn't support agent
commands at all now throws an error.  But the dprintf tests still fail
with some GDBserver targets because they doesn't try to handle the
case of the server reporting support for breakpoint commands, but not
be able to use those in combination with Z0 (because Z0 isn't actually
supported, for example):

 FAIL: gdb.base/dprintf.exp: 1st dprintf, agent
 FAIL: gdb.base/dprintf.exp: 2nd dprintf, agent
 FAIL: gdb.base/dprintf.exp: dprintf info 2 (pattern 4)

Similarly for the MI test.

This patch makes the tests handle this scenario.

Tested with native, and native gdbserver on x86_64 Fedora 17.

Also tested with the native-gdbserver.exp board hacked with:

 set GDBFLAGS "${GDBFLAGS} -ex \"set remote breakpoint-commands off\""

(actually, "set remote breakpoint-commands off" is presently broken,
so this was on top of a fix for that command.)

which results in:
 (gdb) PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb
 set dprintf-style agent
 warning: Target cannot run dprintf commands, falling back to GDB printf
 warning: Target cannot run dprintf commands, falling back to GDB printf
 (gdb) UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent

gdb.sum:
 Running target native-gdbserver
 Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ...
 PASS: gdb.base/dprintf.exp: dprintf
 PASS: gdb.base/dprintf.exp: dprintf foo
 PASS: gdb.base/dprintf.exp: dprintf 29
 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n"
 PASS: gdb.base/dprintf.exp: ignore $bpnum 1
 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g
 PASS: gdb.base/dprintf.exp: dprintf info 1
 PASS: gdb.base/dprintf.exp: break 27
 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb
 PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb
 UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent
 PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type

And also with the native-gdbserver.exp board hacked with:

 set GDBFLAGS "${GDBFLAGS} -ex \"set remote Z-packet off\""

which results in:
 (gdb) continue
 Continuing.
 Warning:
 Cannot insert breakpoint 3: Target doesn't support breakpoints that have target side commands.
 Cannot insert breakpoint 4: Target doesn't support breakpoints that have target side commands.

 (gdb) UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent

gdb.sum:
 Running target native-gdbserver
 Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ...
 PASS: gdb.base/dprintf.exp: dprintf
 PASS: gdb.base/dprintf.exp: dprintf foo
 PASS: gdb.base/dprintf.exp: dprintf 29
 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n"
 PASS: gdb.base/dprintf.exp: ignore $bpnum 1
 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g
 PASS: gdb.base/dprintf.exp: dprintf info 1
 PASS: gdb.base/dprintf.exp: break 27
 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb
 PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb
 PASS: gdb.base/dprintf.exp: set dprintf style to agent
 UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent
 PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type

(One of the new comments mentions breakpoint always-inserted mode.
Actually testing with breakpoint always-inserted mode fails these
dprintf tests, due to the way they are written.  But that'll take a
more substancial rewrite of the tests, so I'm leaving that for another
day.)

gdb/testsuite/
2014-03-24  Hui Zhu  <hui@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

PR breakpoints/16101
* gdb.base/dprintf.exp: Use unsupported rather than changing the
test pass/fail messages.  Detect missing support for dprintf when
breakpoints are actually inserted.
* gdb.base/mi-dprintf.exp: Detect missing support for dprintf when
breakpoints are actually inserted.
* lib/mi-support.exp (mi_run_cmd_full): Return -1 if continue
fails.

10 years agotestsuite: Remove needless linux-nat requirement in gdb-sigterm.exp.
Jan Kratochvil [Mon, 24 Mar 2014 16:37:32 +0000 (17:37 +0100)] 
testsuite: Remove needless linux-nat requirement in gdb-sigterm.exp.

That "set debug lin-lwp 1" command even is not needed for the functionality of
this testcase.

This patch does fix a testcase error on aarch64-none-elf.

gdb/testsuite/
2014-03-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.base/gdb-sigterm.exp (do_test): Remove "set debug lin-lwp 1".

Message-ID: <20140323165745.GA23830@host2.jankratochvil.net>

10 years agoFix PR/16720
Pierre Langlois [Tue, 18 Mar 2014 13:50:54 +0000 (13:50 +0000)] 
Fix PR/16720

2014-03-24  Pierre Langlois  <pierre.langlois@embecosm.com>

  * avr-tdep.c (avr_scan_prologue): Accept push r1 instruction for
  small stack allocation.

10 years agodarwin-nat.c: fix dump of messages on x86_64.
Tristan Gingold [Fri, 21 Mar 2014 08:26:05 +0000 (09:26 +0100)] 
darwin-nat.c: fix dump of messages on x86_64.

gdb/
* darwin-nat.c (exc_server): Remove unused prototype.
(darwin_dump_message): Correctly display data on x86_64.
(darwin_encode_reply): Fix style.
Add comments and fix indentation.

10 years agoFix stack offset in Mach-O output for -P compact_unwind.
Tristan Gingold [Fri, 21 Mar 2014 08:25:05 +0000 (09:25 +0100)] 
Fix stack offset in Mach-O output for -P compact_unwind.

Minor fix in compact unwind output: to be more readable, the stack offset
for indirect compact unwind entries are mutiplied by its factor (4 or 8).

binutils/
* od-macho.c (dump_unwind_encoding_x86): Set the factor.
(dump_exe_compact_unwind): Change the condition.  Improve
indentation.

10 years agoFix typo in previous entry.
Pierre Langlois [Mon, 24 Mar 2014 09:10:07 +0000 (09:10 +0000)] 
Fix typo in previous entry.

10 years agoAdd myself as a write-after-approval mainainer.
Pierre Langlois [Fri, 21 Mar 2014 19:46:07 +0000 (19:46 +0000)] 
Add myself as a write-after-approval mainainer.

2014-03-21  Pierre Langlois  <pierre.langlois@embecosm.com>

* MAINTAINERS (Write After Approval): Add "Pierre Langlois".

10 years agodaily update
Alan Modra [Sun, 23 Mar 2014 23:00:47 +0000 (09:30 +1030)] 
daily update

10 years ago* infcmd.c: Whitespace fixes.
Doug Evans [Sat, 22 Mar 2014 12:22:29 +0000 (08:22 -0400)] 
* infcmd.c: Whitespace fixes.
(interrupt_command): Merge two function comments into one.

10 years ago* infcmd.c (interrupt_command): Renamed from interrupt_target_command.
Doug Evans [Sat, 22 Mar 2014 11:48:33 +0000 (07:48 -0400)] 
* infcmd.c (interrupt_command): Renamed from interrupt_target_command.

10 years agodaily update
Alan Modra [Sat, 22 Mar 2014 23:00:40 +0000 (09:30 +1030)] 
daily update

10 years agoRemove target_read_live_memory
Yao Qi [Tue, 11 Mar 2014 03:37:10 +0000 (11:37 +0800)] 
Remove target_read_live_memory

As we move code on reading unavailable memory to target side, GDB core
side doesn't need the "switching momentarily out of tfind mode" dance.
The target remote knows how to read live memory (through remote_ops).

Remove set_traceframe_number and
make_cleanup_restore_traceframe_number, since they are no longer used.

gdb:

2014-03-22  Yao Qi  <yao@codesourcery.com>

* remote.c (target_read_live_memory): Remove.
(memory_xfer_live_readonly_partial): Rename it to
remote_xfer_live_readonly_partial.  Remove argument 'object'.
All callers updated.  Call remote_read_bytes_1
instead of target_read_live_memory.
* tracepoint.c (set_traceframe_number): Remove.
(make_cleanup_restore_traceframe_number): Likewise .
* tracepoint.h (set_traceframe_number): Remove declaration.
(make_cleanup_restore_traceframe_number): Likewise.

10 years agoFactor remote_read_bytes.
Yao Qi [Tue, 11 Mar 2014 03:19:12 +0000 (11:19 +0800)] 
Factor remote_read_bytes.

This patch moves code in remote_read_bytes on reading from the remote
stub to a new function remote_read_bytes_1.

gdb:

2014-03-22  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_read_bytes): Move code on reading from the
remote stub to ...
(remote_read_bytes_1): ... here.  New function.

10 years agoMove the traceframe_available_memory code from memory_xfer_partial_1 down to the...
Yao Qi [Tue, 11 Mar 2014 02:47:48 +0000 (10:47 +0800)] 
Move the traceframe_available_memory code from memory_xfer_partial_1 down to the targets

As a follow-up to

  [PATCH 7/8] Adjust read_value_memory to use to_xfer_partial
  https://sourceware.org/ml/gdb-patches/2014-02/msg00384.html

this patch moves traceframe_available_memory down to the target side.
After this patch, the gdb core code is cleaner, and code on handling
unavailable memory is moved to remote/tfile/ctf targets.

In details, this patch moves traceframe_available_memory code from
memory_xfer_partial_1 to remote target only, so remote target still
uses traceframe_info mechanism to check unavailable memory, and use
remote_ops to read them from read-only sections.  We don't use
traceframe_info mechanism for tfile and ctf target, because it is
fast to iterate all traceframes from trace file, so the summary
information got from traceframe_info is not necessary.

This patch also moves two functions to remote.c from target.c,
because they are only used in remote.c.  I'll clean them up in another
patch.

gdb:

2014-03-22  Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_xfer_partial): Check the return value of
exec_read_partial_read_only, if it is not TARGET_XFER_OK,
return TARGET_XFER_UNAVAILABLE.
* tracefile-tfile.c (tfile_xfer_partial): Likewise.
* target.c (target_read_live_memory): Move it to remote.c.
(memory_xfer_live_readonly_partial): Likewise.
(memory_xfer_partial_1): Move some code to remote_read_bytes.
* remote.c (target_read_live_memory): Moved from target.c.
(memory_xfer_live_readonly_partial): Likewise.
(remote_read_bytes): New, factored out from
memory_xfer_partial_1.

10 years agoFix typo in previous entry.
Doug Evans [Sat, 22 Mar 2014 06:59:04 +0000 (02:59 -0400)] 
Fix typo in previous entry.

10 years ago * gdb.guile/guile.exp (guile not supported): Verify multi-line
Doug Evans [Sat, 22 Mar 2014 06:57:08 +0000 (02:57 -0400)] 
* gdb.guile/guile.exp (guile not supported): Verify multi-line
guile command issues an error.

10 years ago * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing
Doug Evans [Sat, 22 Mar 2014 06:44:39 +0000 (02:44 -0400)] 
* extension.c (eval_ext_lang_from_control_command): Avoid dereferencing
NULL pointer.

testsuite/
* gdb.python/python.exp (python not supported): Verify multi-line
python command issues an error.

10 years agogdb.threads/thread-specific.exp: Fix uninitialized variable references
Maciej W. Rozycki [Fri, 21 Mar 2014 23:51:16 +0000 (23:51 +0000)] 
gdb.threads/thread-specific.exp: Fix uninitialized variable references

This fixes:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
ERROR: can't read "this_breakpoint": no such variable
    while executing
"gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" {
    -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" {
        set this_thread $expe..."
    (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 108)
    invoked from within
"source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

and then:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
UNTESTED: gdb.threads/thread-specific.exp: info on bp
ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
ERROR: can't read "this_thread": no such variable
    while executing
"gdb_test {print $_thread} ".* = $this_thread" "thread var at break""
    (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 119)
    invoked from within
"source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

Final results:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
UNTESTED: gdb.threads/thread-specific.exp: info on bp
UNTESTED: gdb.threads/thread-specific.exp: thread var at break

Of course the first failure best wasn't there, but failing that the script
shouldn't crash.

* gdb.threads/thread-specific.exp: Handle the lack of usable
$this_breakpoint and $this_thread.

10 years agodaily update
Alan Modra [Fri, 21 Mar 2014 23:00:43 +0000 (09:30 +1030)] 
daily update

10 years ago2014-03-21 Christopher Faylor <me.binutils2014@cgf.cx>
Chris Faylor [Fri, 21 Mar 2014 17:33:43 +0000 (13:33 -0400)] 
2014-03-21  Christopher Faylor  <me.binutils2014@cgf.cx>

* ld.texinfo: Document change in handling of --enable-auto-image-base.
* emultempl/pe.em (pe_auto_image_base): Set to default base.
(gld_${EMULATION_NAME}_list_options): Change usage message to reflect
optional --enable-auto-image-base argument.
(gld${EMULATION_NAME}_handle_option): Handle optional
--enable-auto-image-base argument.
(compute_dll_image_base): Eliminate constant.  Use pe_auto_image_base.

10 years agoAdd support to the Xtensa target for creating trampolines for out-of-range branches.
David Weatherford [Fri, 21 Mar 2014 11:53:42 +0000 (11:53 +0000)] 
Add support to the Xtensa target for creating trampolines for out-of-range branches.

    * tc-xtensa.c (xtensa_check_frag_count, xtensa_create_trampoline_frag)
    (xtensa_maybe_create_trampoline_frag, init_trampoline_frag)
    (find_trampoline_seg, search_trampolines, get_best_trampoline)
    (check_and_update_trampolines, add_jump_to_trampoline)
    (dump_trampolines): New function.
    (md_parse_option): Add cases for --[no-]trampolines options.
    (md_assemble, finish_vinsn, xtensa_end): Add call to
    xtensa_check_frag_count.
    (xg_assemble_vliw_tokens): Add call to
    xtensa_maybe_create_trampoline_frag.
    (xtensa_relax_frag): Relax fragments with RELAX_TRAMPOLINE state.
    (relax_frag_immed): Relax jump instructions that cannot reach its
    target.
    * tc-xtensa.h (xtensa_relax_statesE::RELAX_TRAMPOLINE): New relax
    state.

    * as.texinfo: Document --[no-]trampolines command-line options.
    * c-xtensa.texi: Document trampolines relaxation and command line
    options.

    * frags.c (get_frag_count, clear_frag_count): New function.
    (frag_alloc): Increment totalfrags counter.
    * frags.h (get_frag_count, clear_frag_count): New function.

    * all.exp: Add test for trampoline relaxation.
    * trampoline.d: Trampoline relaxation expected dump.
    * trampoline.s: Trampoline relaxation test source.

10 years agonormal_stop: Extend and clarify comment.
Pedro Alves [Fri, 21 Mar 2014 11:08:44 +0000 (11:08 +0000)] 
normal_stop: Extend and clarify comment.

Explain better why we skip saying "Switching to ..." in non-stop mode.

gdb/
2014-03-21  Pedro Alves  <palves@redhat.com>

* infrun.c (normal_stop): Extend comment.

10 years agoRemove fixme of packet "k" from doc
Hui Zhu [Fri, 21 Mar 2014 08:46:15 +0000 (16:46 +0800)] 
Remove fixme of packet "k" from doc
https://sourceware.org/ml/gdb-patches/2014-03/msg00324.html

2014-03-21  Pedro Alves  <palves@redhat.com>
    Stan Shebs  <stan@codesourcery.com>
    Hui Zhu  <hui@codesourcery.com>

* gdb.texinfo (Packets): Add anchor to "? packet".
Remove fixme and update introduction of "k packet".
Add anchor to "vKill packet".

10 years agoFix internal warning when "gdb -p xxx"
Hui Zhu [Fri, 21 Mar 2014 03:11:51 +0000 (11:11 +0800)] 
Fix internal warning when "gdb -p xxx"

The issue that was fixed by b4ab256ded5020a82ff7ce8dc485e7882fc5b6a7
can not be found in regression test.
Update attach.exp to test it.

https://sourceware.org/ml/gdb-patches/2014-03/msg00438.html

2014-03-21  Hui Zhu  <hui@codesourcery.com>

* gdb.base/attach.exp (do_command_attach_tests): New.

10 years agoFix internal warning when "gdb -p xxx"
Hui Zhu [Fri, 21 Mar 2014 02:25:41 +0000 (10:25 +0800)] 
Fix internal warning when "gdb -p xxx"

ps -e | grep a.out
28886 pts/12   00:00:00 a.out
gdb -p 28886
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x0000003b0ccbc970 in __nanosleep_nocancel () from /lib64/libc.so.6
../../binutils-gdb/gdb/cleanups.c:265: internal-warning: restore_my_cleanups has found a stale cleanup
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

The backtrace of this issue:
(gdb) bt
    file=0x8b0c10 "s' failed.", line=265, fmt=0x8b0c38 "nutils-gdb/gdb/cleanups.c",
    ap=0x7fff803e3ed8) at ../../binutils-gdb/gdb/utils.c:748
    fmt=0x8b0c38 "nutils-gdb/gdb/cleanups.c", ap=0x7fff803e3ed8)
    at ../../binutils-gdb/gdb/utils.c:799
    string=0x8b0c38 "nutils-gdb/gdb/cleanups.c") at ../../binutils-gdb/gdb/utils.c:809
    at ../../binutils-gdb/gdb/cleanups.c:265
    at ../../binutils-gdb/gdb/cleanups.c:276
    at ../../binutils-gdb/gdb/exceptions.c:142
    at ../../binutils-gdb/gdb/exceptions.c:203
    command=0x5d5fb8 <attach_command_continuation_free_args+18>, arg=0x7fff803e525b "2914",
    from_tty=1, mask=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:549
---Type <return> to continue, or q <return> to quit---
    func_args=0x7fff803e4280, errstring=0x8cf2e4 "/local/bin", mask=RETURN_MASK_ALL)
    at ../../binutils-gdb/gdb/exceptions.c:522

This is a new issue.  It is introduced by commit https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=8bc2fe488957946d2cdccda3ce8d4f39e4003ea0
It removed the discard_cleanups (back_to) inside attach_command.
Then restore_my_cleanups will throw a internal_warning.

https://sourceware.org/ml/gdb-patches/2014-03/msg00374.html

2014-03-21  Hui Zhu  <hui@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_pid_to_exec_file): Change xmalloc to
static buffer.
* fbsd-nat.c (fbsd_pid_to_exec_file): Ditto.
* linux-nat.c (linux_child_pid_to_exec_file): Ditto.
* nbsd-nat.c (nbsd_pid_to_exec_file): Ditto.

10 years agodaily update
Alan Modra [Thu, 20 Mar 2014 23:00:49 +0000 (09:30 +1030)] 
daily update

10 years agoAdd opcode relaxation for rl78-elf
DJ Delorie [Thu, 20 Mar 2014 21:50:49 +0000 (17:50 -0400)] 
Add opcode relaxation for rl78-elf

This patch adds initial in-gas opcode relaxation for the rl78
backend.  Specifically, it checks for conditional branches that
are too far and replaces them with inverted branches around longer
fixed branches.

10 years agoAvoid using the ISO C99 `z' formatted output modifier
Maciej W. Rozycki [Thu, 20 Mar 2014 21:41:56 +0000 (21:41 +0000)] 
Avoid using the ISO C99 `z' formatted output modifier

* mi/mi-interp.c (mi_memory_changed): Avoid using the ISO C99
`z' formatted output modifier.

10 years agogas/
Richard Sandiford [Thu, 20 Mar 2014 21:18:43 +0000 (21:18 +0000)] 
gas/
* config/tc-mips.h (DIFF_EXPR_OK, CFI_DIFF_EXPR_OK): Define.
* config/tc-mips.c (md_pcrel_from): Remove error message.
(md_apply_fix): Convert PC-relative BFD_RELOC_32s to
BFD_RELOC_32_PCREL.  Report a specific error message for unhandled
PC-relative expressions.  Handle BFD_RELOC_8.

gas/testsuite/
* gas/all/gas.exp: Remove XFAIL of forward.d for MIPS.
* gas/mips/pcrel-1.s, gas/mips/pcrel-1.d, gas/mips/pcrel-2.s,
gas/mips/pcrel-2.d, gas/mips/pcrel-3.s, gas/mips/pcrel-3.l,
gas/mips/pcrel-4.s, gas/mips/pcrel-4-32.d, gas/mips/pcrel-4-n32.d,
gas/mips/pcrel-4-64.d: New tests.
* gas/mips/mips.exp: Run them.
* gas/mips/lui-2.l: Tweak error message for line 7.

ld/testsuite/
* ld-elf/merge.d: Remove MIPS XFAIL.

10 years agoFix probe-related internal error on AIX
Sergio Durigan Junior [Thu, 20 Mar 2014 21:08:31 +0000 (18:08 -0300)] 
Fix probe-related internal error on AIX

-- Initial message by Tom Tromey:

While testing on AIX, I happened to notice an internal error coming
from parse_probes.  This happens because there are no probes defined
on this platform.  This patch fixes the problem by changing an assert
into an ordinary error, and then changing the relevant caller to cope.

This fixes a few tests on AIX; also regtested on x86-64 Fedora 18.

-- Followup by Sergio Durigan Junior:

By reading the patch (and the original code), I found it a little bit
obscure, so I took the liberty to try to improve it.  Here's the patch.
Could you please take a look and see if it works on AIX (and also if you
like the approach)?

gdb/
2014-03-20  Tom Tromey  <tromey@redhat.com>
    Sergio Durigan Junior  <sergiodj@redhat.com>

* probe.c (parse_probes): Turn assert into an ordinary error.
* break-catch-throw.c (re_set_exception_catchpoint): Ignore
exceptions when parsing probes.  Rearrange the code for clarity.

10 years agoFix py-finish-breakpoint.exp with target async.
Tom Tromey [Tue, 4 Mar 2014 18:32:52 +0000 (11:32 -0700)] 
Fix py-finish-breakpoint.exp with target async.

With target async enabled, py-finish-breakpoint.exp triggers an
assertion failure.

The failure occurs because execute_command re-enters the event loop in
some circumstances, and in this case resets the sync_execution flag.
Then later GDB reaches this assertion in normal_stop:

      gdb_assert (sync_execution || !target_can_async_p ());

In detail:

#1 - A synchronous execution command is run.  sync_execution is set.

#2 - A python breakpoint is hit (TARGET_WAITKIND_STOPPED), and the
     corresponding Python breakpoint's stop method is executed.  When
     and while python commands are executed, interpreter_async is
     forced to 0.

#3 - The Python stop method happens to execute a not-execution-related
     gdb command.  In this case, "where 1".

#4 - Seeing that sync_execution is set, execute_command nests a new
     event loop (although that wasn't necessary; this is the problem).

#5 - The linux-nat target's pipe in the event loop happens to be
     marked.  That's normal, due to this in linux_nat_wait:

     /* If we requested any event, and something came out, assume there
        may be more.  If we requested a specific lwp or process, also
        assume there may be more.  */

     The nested event loop thus immediately wakes up and calls
     target_wait.  No thread is actually executing in the inferior, so
     the target returns TARGET_WAITKIND_NO_RESUMED.

#6 - normal_stop is reached.  GDB prints "No unwaited-for children
     left.", and resets the sync_execution flag (IOW, there are no
     resumed threads left, so the synchronous command is considered
     completed.)  This is already bogus.  We were handling a
     breakpoint!

#7 - the nested event loop unwinds/ends.  GDB is now back to handling
     the python stop method (TARGET_WAITKIND_STOPPED), which decides
     the breakpoint should stop.  normal_stop is called for this
     event.  However, normal_stop actually works with the _last_
     reported target status:

   void
   normal_stop (void)
   {
    struct target_waitstatus last;
    ptid_t last_ptid;
    struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);

    ...
    get_last_target_status (&last_ptid, &last);

    ...
    if (last.kind == TARGET_WAITKIND_NO_RESUMED)
      {
        gdb_assert (sync_execution || !target_can_async_p ());

        target_terminal_ours_for_output ();
        printf_filtered (_("No unwaited-for children left.\n"));
      }

   And due to the nesting in execute command, the last event is now
   TARGET_WAITKIND_NO_RESUMED, not the actual breakpoint event being
   handled.  This could be seen to be broken in itself, but we can
   leave fixing that for another pass.  The assertion is reached, and
   fails.

execute_command has a comment explaining when it should synchronously
wait for events:

      /* If the interpreter is in sync mode (we're running a user
 command's list, running command hooks or similars), and we
 just ran a synchronous command that started the target, wait
 for that command to end.  */

However, the code did not follow this comment -- it didn't check to
see if the command actually started the target, just whether the
target was executing a sync command at this point.

This patch fixes the problem by noting whether the target was
executing in sync_execution mode before running the command, and then
augmenting the condition to test this as well.

2014-03-20  Tom Tromey  <tromey@redhat.com>

PR gdb/14135
* top.c (execute_command): Only dispatch events if the command
started the target.

10 years agomake dprintf.exp pass in target async mode
Pedro Alves [Thu, 20 Mar 2014 17:03:43 +0000 (17:03 +0000)] 
make dprintf.exp pass in target async mode

When target-async is enabled, dprintf.exp fails:

 Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ...
 FAIL: gdb.base/dprintf.exp: 1st dprintf, call
 FAIL: gdb.base/dprintf.exp: 2nd dprintf, call
 FAIL: gdb.base/dprintf.exp: Set dprintf function
 FAIL: gdb.base/dprintf.exp: 1st dprintf, fprintf
 FAIL: gdb.base/dprintf.exp: 2nd dprintf, fprintf

 Breakpoint 2, main (argc=1, argv=0x7fffffffd3f8) at ../../../src/gdb/testsuite/gdb.base/dprintf.c:33
 33        int loc = 1234;
 (gdb) continue
 Continuing.
 kickoff 1234
 also to stderr 1234
 At foo entry
 (gdb) FAIL: gdb.base/dprintf.exp: 1st dprintf, call

The problem is that GDB gave the prompt back to the user too early.

This happens when calling functions while handling an event that
doesn't cause a user visible stop.  dprintf with "set dprintf-style
gdb" is one such case.  This patch adds a test case that has a
breakpoint with a condition that calls a function that returns false,
so that regression testing isn't dependent on the implementation of
dprintf.

The problem happens because run_inferior_call causes GDB to forget
that it is running in sync_execution mode, so any event that runs an
inferior call causes fetch_inferior_event to display the prompt, even
if the event should not result in a user visible stop (that is, gdb
resumes the inferior and waits for the next event).

This patch fixes the issue by noticing when GDB was in sync_execution
mode in run_inferior_call, and taking care to restore this state
afterward.

gdb/
2014-03-20  Tom Tromey  <tromey@redhat.com>

PR cli/15718
* infcall.c: Include event-top.h.
(run_inferior_call): Call async_disable_stdin if needed.

gdb/testsuite/
2014-03-20  Tom Tromey  <tromey@redhat.com>
    Pedro Alves  <palves@redhat.com>

PR cli/15718
* gdb.base/condbreak-call-false.c: New file.
* gdb.base/condbreak-call-false.exp: New file.

10 years agoFix memory size for gather/scatter instructions
Ilya Tocar [Thu, 20 Mar 2014 09:12:16 +0000 (13:12 +0400)] 
Fix memory size for gather/scatter instructions

For gathers with indices larger than elements (e. g.)

vpgatherqd      ymm6{k1}, ZMMWORD PTR [ebp+zmm7*8-123]

We currently treat memory size as a size of index register, while it is
actually should be size of destination register:

vpgatherqd      ymm6{k1}, YMMWORD PTR [ebp+zmm7*8-123]

This patch fixes it.

opcodes/

        * i386-opc.tbl: Change memory size for vgatherpf0qps, vgatherpf1qps,
        vscatterpf0qps, vscatterpf1qps, vgatherqps, vpgatherqd, vpscatterqd,
        vscatterqps.
        * i386-tbl.h: Regenerate.

gas/testsuite/

        * gas/i386/avx512pf-intel.d: Change memory size for vgatherpf0qps,
        vgatherpf1qps, vscatterpf0qps, vscatterpf1qps.
        * gas/i386/avx512pf.s: Ditto.
        * gas/i386/x86-64-avx512pf-intel.d: Ditto.
        * gas/i386/x86-64-avx512pf.s: Ditto.
        * gas/i386/avx512f-intel.d: Change memory size for vgatherqps,
        vpgatherqd, vpscatterqd, vscatterqps.
        * gas/i386/avx512f.s: Ditto.
        * gas/i386/x86-64-avx512f-intel.d: Ditto.
        * gas/i386/x86-64-avx512f.s: Ditto.

10 years agoFurther cleanup of signal-while-stepping-over-bp-other-thread.c.
Pedro Alves [Thu, 20 Mar 2014 14:09:53 +0000 (14:09 +0000)] 
Further cleanup of signal-while-stepping-over-bp-other-thread.c.

This test now uses pthread_kill instead of the host's kill command, so
no longer need to block signals, or store the the inferior's PID.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

* gdb.threads/signal-while-stepping-over-bp-other-thread.c (pid):
Delete.
(block_signals, unblock_signals): Delete.
(child_function_2, main): Remove references to deleted variable
and functions.

10 years agoMake signal-while-stepping-over-bp-other-thread.exp run against remote targets too.
Pedro Alves [Thu, 20 Mar 2014 13:26:33 +0000 (13:26 +0000)] 
Make signal-while-stepping-over-bp-other-thread.exp run against remote targets too.

Use pthread_kill instead of the host's "kill".  The reason the test
wasn't written that way to begin with, is that done this way, before
the previous fixes to make GDB step-over all other threads before the
stepping thread, the test would fail...

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

* gdb.threads/signal-while-stepping-over-bp-other-thread.c (main):
Use pthread_kill to signal thread 2.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust to make the test send itself a signal rather than using the
host's "kill" command.

10 years agoHandle multiple step-overs.
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)] 
Handle multiple step-overs.

This test fails with current mainline.

If the program stopped for a breakpoint in thread 1, and then the user
switches to thread 2, and resumes the program, GDB first switches back
to thread 1 to step it over the breakpoint, in order to make progress.

However, that logic only considers the last reported event, assuming
only one thread needs that stepping over dance.

That's actually not true when we play with scheduler-locking.  The
patch adds an example to the testsuite of multiple threads needing a
step-over before the stepping thread can be resumed.  With current
mainline, the program re-traps the same breakpoint it had already
trapped before.

E.g.:

 Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
 99   wait_threads (); /* set wait-threads breakpoint here */
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint
 info threads
   Id   Target Id         Frame
   3    Thread 0x7ffff77c9700 (LWP 4310) "multiple-step-o" 0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43
   2    Thread 0x7ffff7fca700 (LWP 4309) "multiple-step-o" 0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60
 * 1    Thread 0x7ffff7fcb740 (LWP 4305) "multiple-step-o" main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: info threads shows all threads
 set scheduler-locking on
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking on
 break 44
 Breakpoint 3 at 0x4007d3: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 44.
 (gdb) break 61
 Breakpoint 4 at 0x40082d: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 61.
 (gdb) thread 3
 [Switching to thread 3 (Thread 0x7ffff77c9700 (LWP 4310))]
 #0  0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43
 43       (*myp) ++;
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 3
 continue
 Continuing.

 Breakpoint 3, child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:44
 44       callme (); /* set breakpoint thread 3 here */
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 3
 p *myp = 0
 $1 = 0
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 3
 thread 2
 [Switching to thread 2 (Thread 0x7ffff7fca700 (LWP 4309))]
 #0  0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60
 60       (*myp) ++;
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 2
 continue
 Continuing.

 Breakpoint 4, child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:61
 61       callme (); /* set breakpoint thread 2 here */
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 2
 p *myp = 0
 $2 = 0
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 2
 thread 1
 [Switching to thread 1 (Thread 0x7ffff7fcb740 (LWP 4305))]
 #0  main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
 99   wait_threads (); /* set wait-threads breakpoint here */
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 1
 set scheduler-locking off
 (gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking off

At this point all thread are stopped for a breakpoint that needs stepping over.

 (gdb) step

 Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
 99   wait_threads (); /* set wait-threads breakpoint here */
 (gdb) FAIL: gdb.threads/multiple-step-overs.exp: step

But that "step" retriggers the same breakpoint instead of making
progress.

The patch teaches GDB to step over all breakpoints of all threads
before resuming the stepping thread.

Tested on x86_64 Fedora 17, against pristine mainline, and also my
branch that implements software single-stepping on x86.

gdb/
2014-03-20  Pedro Alves  <palves@redhat.com>

* infrun.c (prepare_to_proceed): Delete.
(thread_still_needs_step_over): New function.
(find_thread_needs_step_over): New function.
(proceed): If the current thread needs a step-over, set its
steping_over_breakpoint flag.  Adjust to use
find_thread_needs_step_over instead of prepare_to_proceed.
(process_event_stop_test): For BPSTAT_WHAT_STOP_NOISY and
BPSTAT_WHAT_STOP_SILENT, assume the thread stopped for a
breakpoint.
(switch_back_to_stepped_thread): Step over breakpoints of all
threads not the stepping thread, before switching back to the
stepping thread.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

* gdb.threads/multiple-step-overs.c: New file.
* gdb.threads/multiple-step-overs.exp: New file.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust expected infrun debug output.

10 years agoFix for even more missed events; eliminate thread-hop code.
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)] 
Fix for even more missed events; eliminate thread-hop code.

Even with deferred_step_ptid out of the way, GDB can still lose
watchpoints.

If a watchpoint triggers and the PC points to an address where a
thread-specific breakpoint for another thread is set, the thread-hop
code triggers, and we lose the watchpoint:

  if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
    {
      int thread_hop_needed = 0;
      struct address_space *aspace =
get_regcache_aspace (get_thread_regcache (ecs->ptid));

      /* Check if a regular breakpoint has been hit before checking
         for a potential single step breakpoint.  Otherwise, GDB will
         not see this breakpoint hit when stepping onto breakpoints.  */
      if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
{
  if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid))
    thread_hop_needed = 1;
    ^^^^^^^^^^^^^^^^^^^^^
}

And on software single-step targets, even without a thread-specific
breakpoint in the way, here in the thread-hop code:

      else if (singlestep_breakpoints_inserted_p)
{
...
  if (!ptid_equal (singlestep_ptid, ecs->ptid)
      && in_thread_list (singlestep_ptid))
    {
      /* If the PC of the thread we were trying to single-step
 has changed, discard this event (which we were going
 to ignore anyway), and pretend we saw that thread
 trap.  This prevents us continuously moving the
 single-step breakpoint forward, one instruction at a
 time.  If the PC has changed, then the thread we were
 trying to single-step has trapped or been signalled,
 but the event has not been reported to GDB yet.

 There might be some cases where this loses signal
 information, if a signal has arrived at exactly the
 same time that the PC changed, but this is the best
 we can do with the information available.  Perhaps we
 should arrange to report all events for all threads
 when they stop, or to re-poll the remote looking for
 this particular thread (i.e. temporarily enable
 schedlock).  */

     CORE_ADDR new_singlestep_pc
       = regcache_read_pc (get_thread_regcache (singlestep_ptid));

     if (new_singlestep_pc != singlestep_pc)
       {
 enum gdb_signal stop_signal;

 if (debug_infrun)
   fprintf_unfiltered (gdb_stdlog, "infrun: unexpected thread,"
       " but expected thread advanced also\n");

 /* The current context still belongs to
    singlestep_ptid.  Don't swap here, since that's
    the context we want to use.  Just fudge our
    state and continue.  */
                 stop_signal = ecs->event_thread->suspend.stop_signal;
                 ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
                 ecs->ptid = singlestep_ptid;
                 ecs->event_thread = find_thread_ptid (ecs->ptid);
                 ecs->event_thread->suspend.stop_signal = stop_signal;
                 stop_pc = new_singlestep_pc;
               }
             else
       {
 if (debug_infrun)
   fprintf_unfiltered (gdb_stdlog,
       "infrun: unexpected thread\n");

 thread_hop_needed = 1;
 stepping_past_singlestep_breakpoint = 1;
 saved_singlestep_ptid = singlestep_ptid;
       }
    }
}

we either end up with thread_hop_needed, ignoring the watchpoint
SIGTRAP, or switch to the stepping thread, again ignoring that the
SIGTRAP could be for some other event.

The new test added by this patch exercises both paths.

So the fix is similar to the deferred_step_ptid fix -- defer the
thread hop to _after_ the SIGTRAP had a change of passing through the
regular bpstat handling.  If the wrong thread hits a breakpoint, we'll
just end up with BPSTAT_WHAT_SINGLE, and if nothing causes a stop,
keep_going starts a step-over.

Most of the stepping_past_singlestep_breakpoint mechanism is really
not necessary -- setting the thread to step over a breakpoint with
thread->trap_expected is sufficient to keep all other threads locked.
It's best to still keep the flag in some form though, because when we
get to keep_going, the software single-step breakpoint we need to step
over is already gone -- an optimization done by a follow up patch will
check whether a step-over is still be necessary by looking to see
whether the breakpoint is still there, and would find the thread no
longer needs a step-over, while we still want it.

Special care is still needed to handle the case of PC of the thread we
were trying to single-step having changed, like in the old code.  We
can't just keep_going and re-step it, as in that case we can over-step
the thread (if it was already done with the step, but hasn't reported
it yet, we'd ask it to step even further).  That's now handled in
switch_back_to_stepped_thread.  As bonus, we're now using a technique
that doesn't lose signals, unlike the old code -- we now insert a
breakpoint at PC, and resume, which either reports the breakpoint
immediately, or any pending signal.

Tested on x86_64 Fedora 17, against pristine mainline, and against a
branch that implements software single-step on x86.

gdb/
2014-03-20  Pedro Alves  <palves@redhat.com>

* breakpoint.c (single_step_breakpoint_inserted_here_p): Make
extern.
* breakpoint.h (single_step_breakpoint_inserted_here_p): Declare.
* infrun.c (saved_singlestep_ptid)
(stepping_past_singlestep_breakpoint): Delete.
(resume): Remove stepping_past_singlestep_breakpoint handling.
(proceed): Store the prev_pc of the stepping thread too.
(init_wait_for_inferior): Adjust.  Clear singlestep_ptid and
singlestep_pc.
(enum infwait_states): Delete infwait_thread_hop_state.
(struct execution_control_state) <hit_singlestep_breakpoint>: New
field.
(handle_inferior_event): Adjust.
(handle_signal_stop): Delete stepping_past_singlestep_breakpoint
handling and the thread-hop code.  Before removing single-step
breakpoints, check whether the thread hit a single-step breakpoint
of another thread.  If it did, the trap is not a random signal.
(switch_back_to_stepped_thread): If the event thread hit a
single-step breakpoint, unblock it before switching to the
stepping thread.  Handle the case of the stepped thread having
advanced already.
(keep_going): Handle the case of the current thread moving past a
single-step breakpoint.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

* gdb.threads/step-over-trips-on-watchpoint.c: New file.
* gdb.threads/step-over-trips-on-watchpoint.exp: New file.

10 years agoPR breakpoints/7143 - Watchpoint does not trigger when first set
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)] 
PR breakpoints/7143 - Watchpoint does not trigger when first set

Say the program is stopped at a breakpoint, and the user sets a
watchpoint.  When the program is next resumed, GDB will first step
over the breakpoint, as explained in the manual:

  @value {GDBN} normally ignores breakpoints when it resumes
  execution, until at least one instruction has been executed.  If it
  it did not do this, you would be unable to proceed past a breakpoint
  without first disabling the breakpoint.  This rule applies whether
  or not the breakpoint already existed when your program stopped.

However, GDB currently also removes watchpoints, catchpoints, etc.,
and that means that the first instruction off the breakpoint does not
trigger the watchpoint, catchpoint, etc.

testsuite/gdb.base/watchpoint.exp has a kfail for this.

The PR proposes installing watchpoints only when stepping over a
breakpoint, but that misses catchpoints, etc.

A better fix would instead work from the opposite direction -- remove
only real breakpoints, leaving all other kinds of breakpoints
inserted.

But, going further, it's really a waste to constantly remove/insert
all breakpoints when stepping over a single breakpoint (generating a
pair of RSP z/Z packets for each breakpoint), so the fix goes a step
further and makes GDB remove _only_ the breakpoint being stepped over,
leaving all others installed.  This then has the added benefit of
reducing breakpoint-related RSP traffic substancialy when there are
many breakpoints set.

gdb/
2014-03-20  Pedro Alves  <palves@redhat.com>

PR breakpoints/7143
* breakpoint.c (should_be_inserted): Don't insert breakpoints that
are being stepped over.
(breakpoint_address_match): Make extern.
* breakpoint.h (breakpoint_address_match): New declaration.
* inferior.h (stepping_past_instruction_at): New declaration.
* infrun.c (struct step_over_info): New type.
(step_over_info): New global.
(set_step_over_info, clear_step_over_info)
(stepping_past_instruction_at): New functions.
(handle_inferior_event): Clear the step-over info when
trap_expected is cleared.
(resume): Remove now stale comment.
(clear_proceed_status): Clear step-over info.
(proceed): Adjust step-over handling to set or clear the step-over
info instead of removing all breakpoints.
(handle_signal_stop): When setting up a thread-hop, don't remove
breakpoints here.
(stop_stepping): Clear step-over info.
(keep_going): Adjust step-over handling to set or clear step-over
info and then always inserting breakpoints, instead of removing
all breakpoints when stepping over one.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

PR breakpoints/7143
* gdb.base/watchpoint.exp: Mention bugzilla bug number instead of
old gnats gdb/38.  Remove kfail.  Adjust to use gdb_test instead
of gdb_test_multiple.
* gdb.cp/annota2.exp: Remove kfail for gdb/38.
* gdb.cp/annota3.exp: Remove kfail for gdb/38.

10 years agoFix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid.
Pedro Alves [Thu, 20 Mar 2014 13:26:31 +0000 (13:26 +0000)] 
Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid.

Consider the case of the user doing "step" in thread 2, while thread 1
had previously stopped for a breakpoint.  In order to make progress,
GDB makes thread 1 step over its breakpoint first (with all other
threads stopped), and once that is over, thread 2 then starts stepping
(with thread 1 and all others running free, by default).  If GDB
didn't do that, thread 1 would just trip on the same breakpoint
immediately again.  This is what the prepare_to_proceed /
deferred_step_ptid code is all about.

However, deferred_step_ptid code resumes the target with:

  resume (1, GDB_SIGNAL_0);
  prepare_to_wait (ecs);
  return;

Recall we were just stepping over a breakpoint when we get here.  That
means that _nothing_ had installed breakpoints yet!  If there's
another breakpoint just after the breakpoint that was just stepped,
we'll miss it.  The fix for that would be to use keep_going instead.

However, there are more problems.  What if the instruction that was
just single-stepped triggers a watchpoint?  Currently, GDB just
happily resumes the thread, losing that too...

Missed watchpoints will need yet further fixes, but we should keep
those in mind.

So the fix must be to let the trap fall through the regular bpstat
handling, and only if no breakpoint, watchpoint, etc. claims the trap,
shall we switch back to the stepped thread.

Now, nowadays, we have code at the tail end of trap handling that does
exactly that -- switch back to the stepped thread
(switch_back_to_the_stepped_thread).

So the deferred_step_ptid code is just standing in the way, and can
simply be eliminated, fixing bugs in the process.  Sweet.

The comment about spurious "Switching to ..." made me pause, but is
actually stale nowadays.  That isn't needed anymore.
previous_inferior_ptid used to be re-set at each (internal) event, but
now it's only touched in proceed and normal stop.

The two tests added by this patch fail without the fix.

Tested on x86_64 Fedora 17 (also against my software single-stepping
on x86 branch).

gdb/
2014-03-20  Pedro Alves  <palves@redhat.com>

* infrun.c (previous_inferior_ptid): Adjust comment.
(deferred_step_ptid): Delete.
(infrun_thread_ptid_changed, prepare_to_proceed)
(init_wait_for_inferior): Adjust.
(handle_signal_stop): Delete deferred_step_ptid handling.

gdb/testsuite/
2014-03-20  Pedro Alves  <palves@redhat.com>

* gdb.threads/step-over-lands-on-breakpoint.c: New file.
* gdb.threads/step-over-lands-on-breakpoint.exp: New file.

10 years agoAn off-by-one error in the code to catch bogus vn_next fields meant that
Nick Clifton [Thu, 20 Mar 2014 13:15:12 +0000 (13:15 +0000)] 
An off-by-one error in the code to catch bogus vn_next fields meant that
linker testsuite failures were showing up for the cris target.  Fixed by
this patch.

* readelf.c (process_version_sections): Fix off-by-one error in
previous delta.

10 years agobfd/elf32-arm.c: Set st_value to zero for undefined symbols
Will Newton [Fri, 10 Jan 2014 14:38:58 +0000 (14:38 +0000)] 
bfd/elf32-arm.c: Set st_value to zero for undefined symbols

Unless pointer_equality_needed is set then set st_value to be zero
for undefined symbols.

bfd/ChangeLog:

2014-03-20  Will Newton  <will.newton@linaro.org>

PR ld/16715
* elf32-arm.c (elf32_arm_check_relocs): Set
pointer_equality_needed for absolute references within
executable links.
(elf32_arm_finish_dynamic_symbol): Set st_value to zero
unless pointer_equality_needed is set.

ld/testsuite/ChangeLog:

2014-03-20  Will Newton  <will.newton@linaro.org>

* ld-arm/ifunc-14.rd: Update symbol values.

10 years agodaily update
Alan Modra [Wed, 19 Mar 2014 23:02:15 +0000 (09:32 +1030)] 
daily update

10 years agoThis is a fix for PR binutils/16723, where a corrupt .gnu.version_r section could
Nick Clifton [Wed, 19 Mar 2014 16:48:02 +0000 (16:48 +0000)] 
This is a fix for PR binutils/16723, where a corrupt .gnu.version_r section could
send readelf into an infinite loop.

* readelf.c (process_version_sections): Prevent an infinite loop
when the vn_next field is zero but there are still entries to be
processed.

10 years agoThis patch adds support for the hyperprivileged registers %hstick_offset
Jose E. Marchesi [Wed, 19 Mar 2014 16:43:41 +0000 (16:43 +0000)] 
This patch adds support for the hyperprivileged registers %hstick_offset
and %hstick_enable to the Sparc assembler.

* config/tc-sparc.c (hpriv_reg_table): Added entries for
%hstick_offset and %hstick_enable.
* doc/c-sparc.texi (Sparc-Regs): Document the %hstick_offset and
%hstick_enable hyperprivileged registers.

* sparc-dis.c (v9_hpriv_reg_names): Names for %hstick_offset and
%hstick_enable added.

* gas/sparc/rdhpr.s: Test rd %hstick_offset and %hstick_enable.
* gas/sparc/rdhpr.d: Likewise.

* gas/sparc/wrhpr.s: Test wr %hstick_offset and %hstick_enable.
* gas/sparc/wrhpr.d: Likewise.

10 years agoFix Sparc test which was failing in the presence of new v9 opcodes.
Jose E. Marchesi [Wed, 19 Mar 2014 16:22:31 +0000 (16:22 +0000)] 
Fix Sparc test which was failing in the presence of new v9 opcodes.

* gas/sparc/ldd_std.d: Fix objdump invocation in order to get
the old opcodes for the ldtw, ldtwa, stw and stwa instructions.

10 years agogdb.base/async.exp: Enable it.
Pedro Alves [Wed, 19 Mar 2014 13:05:43 +0000 (13:05 +0000)] 
gdb.base/async.exp: Enable it.

There's no reason not to enable this test anymore.

Even if the current output isn't ideal (we mess up the prompt), it's what
we have today.  We can adjust the test if the output improves.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp: Remove early return.

10 years agogdb.base/async.exp: Make test messages unique.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)] 
gdb.base/async.exp: Make test messages unique.

 $ cat gdb.sum| grep PASS| sort | uniq -c |sort -n
       1 PASS: gdb.base/async.exp: finish&
       1 PASS: gdb.base/async.exp: jump&
       1 PASS: gdb.base/async.exp: next&
       1 PASS: gdb.base/async.exp: nexti&
       1 PASS: gdb.base/async.exp: set exec-done-display off
       1 PASS: gdb.base/async.exp: set exec-done-display on
       1 PASS: gdb.base/async.exp: set target-async on
       1 PASS: gdb.base/async.exp: stepi&
       1 PASS: gdb.base/async.exp: until&
       2 PASS: gdb.base/async.exp: step&

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp (step& tests): Pass explicit test messages.

10 years agogdb.base/async.exp: Fix races.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)] 
gdb.base/async.exp: Fix races.

This test is currently racy:

 PASS: gdb.base/async.exp: step&
 stepi&
 (gdb) 0x0000000000400547        14       x = 5; x = 5;
 completed.
 PASS: gdb.base/async.exp: stepi&
 nexti&
 (gdb) 15         y = 3;
 completed.FAIL: gdb.base/async.exp: nexti&

The problem is here:

  -re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
      pass "$command"
  }
-re "$gdb_prompt.*completed\.$" {
      fail "$command"
}

Note how the fail pattern is a subset of the pass pattern.  If the
expect buffer happens to end up with:

  "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\."

that is, the final "\r\n" has't reached the expect buffer yet, but
"completed." has, then the fail pattern matches...

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp (test_background): Expect \r\n after
"completed." in the fail pattern.

10 years agogdb.base/async.exp: Factor out test pattern to a procedure.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)] 
gdb.base/async.exp: Factor out test pattern to a procedure.

All the tests here follow the same pattern (and they all have the same
problem, not fixed here yet).  Add a new procedure, factoring out the
pattern to a simple place.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp (test_background): New procedure.
Use it for all background execution command tests.

10 years agogdb.base/async.exp: Use prepare_for_testing.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)] 
gdb.base/async.exp: Use prepare_for_testing.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp: Use prepare_for_testing.

10 years agogdb.base/async.exp: Fix stepi& test.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)] 
gdb.base/async.exp: Fix stepi& test.

Currently the test assumes that "stepi" over:

 13       x = 5;

end up somewhere midline.  But, (at least) on x86, that assignment
ends up compiled as just one movl instruction, so a stepi stops at the
next line already:

 completed.
 PASS: gdb.base/async.exp: step &
 step&
 (gdb) foo () at ../../../src/gdb/testsuite/gdb.base/async.c:13
 13       x = 5;
 completed.
 PASS: gdb.base/async.exp: step &
 stepi&
 (gdb) 14         y = 3;
 completed.
 FAIL: gdb.base/async.exp: (timeout) stepi &
 nexti&
 (gdb) 16         return x + y;
 completed.
 FAIL: gdb.base/async.exp: (timeout) nexti &
 finish&
 Run till exit from #0  foo () at ../../../src/gdb/testsuite/gdb.base/async.c:16

This patch fixes it, by making sure there's more than one instruction
in that line.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.c (foo): Make 'x' volatile.  Write to it twice in
the same line.

10 years agogdb.base/async.exp: Don't hardcode line numbers.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)] 
gdb.base/async.exp: Don't hardcode line numbers.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.c (main): Add "jump here" and "until here" line
marker comments.
* gdb.base/async.exp (jump_here): New global.
(jump& test): Use it.
(until_here): New global.
(until& test): Use it.

10 years agogdb.base/async.exp: Leave gdb_protocol alone.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)] 
gdb.base/async.exp: Leave gdb_protocol alone.

Many eons ago, async was only implemented in the remote target, and
you'd activate it by doing "target async" rather than "target remote".
That's long gone now, replaced by "set target-async on".

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

* gdb.base/async.exp: Don't frob gdb_protocol.

10 years agoImprove .rsrc section merging again. This time with an algorithm that
Nick Clifton [Wed, 19 Mar 2014 14:46:15 +0000 (14:46 +0000)] 
Improve .rsrc section merging again.  This time with an algorithm that
should work for all types of input .rsrc section.

* peXXigen.c (rsrc_process_section): Add code to scan input
sections and record their lengths.  Use these lengths to find the
start of each merged .rsrc section.

* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
(.rsrc): Add SUBALIGN(4).  Remove SORT.
* scripttempl/pep.sc: Likewise.

10 years agoRemove spurious character.
Nick Clifton [Wed, 19 Mar 2014 14:43:00 +0000 (14:43 +0000)] 
Remove spurious character.

10 years agoAdd support for ARM assembler produced by CodeCompositor Studio.
Daniel Gutson [Wed, 19 Mar 2014 14:31:25 +0000 (14:31 +0000)] 
Add support for ARM assembler produced by CodeCompositor Studio.

* config/tc-arm.c (codecomposer_syntax): New flag that states whether the
CCS syntax compatibility mode is on or off.
(asmfunc_states): New enum to represent the asmfunc directive state.
(asmfunc_state): New variable holding the asmfunc directive state.
(comment_chars): Rename to arm_comment_chars.
(line_separator_chars): Rename to arm_line_separator_chars.
(s_ccs_ref): New function that handles the .ref directive.
(asmfunc_debug): New function.
(s_ccs_asmfunc): New function that handles the .asmfunc directive.
(s_ccs_endasmfunc): New function that handles the .endasmfunc directive.
(s_ccs_def): New function that handles the .def directive.
(tc_start_label_without_colon): New function.
(md_pseudo_table): Added new CCS directives.
(arm_ccs_mode): New function that handles the -mccs command line option.
(arm_long_opts): Added new -mccs command line option.
* config/tc-arm.h (LABELS_WITHOUT_COLONS): New macro.
(TC_START_LABEL_WITHOUT_COLON): New macro.
(tc_start_label_without_colon): Added extern function declaration.
(tc_comment_chars): Define.
(tc_line_separator_chars): Define.
* app.c (do_scrub_begin): Use tc_line_separator_chars, if defined.
* read.c (read_begin): Likewise.
* doc/as.texinfo: Add documentation for the -mccs command line
option.
* doc/c-arm.texi: Likewise.
* doc/internals.texi: Document tc_line_separator_chars.
* NEWS: Mention the new feature.

* gas/arm/ccs.s: New test case.
* gas/arm/ccs.d: New expected disassembly.

10 years agoFix RX linker testsuite failures by making the assembler use conventional section...
Nick Clifton [Wed, 19 Mar 2014 12:21:39 +0000 (12:21 +0000)] 
Fix RX linker testsuite failures by making the assembler use conventional section names.

* config/default.exp (ASFLAGS): For the RX target add:
-muse-conventional-section-names.

10 years agoFix typo in changelog entry.
Nick Clifton [Wed, 19 Mar 2014 09:40:21 +0000 (09:40 +0000)] 
Fix typo in changelog entry.

10 years agoFix RX gas testsuite failures by accounting for new variations in the disassembler...
Nick Clifton [Wed, 19 Mar 2014 09:38:25 +0000 (09:38 +0000)] 
Fix RX gas testsuite failures by accounting for new variations in the disassembler's output.

* rx-decode.opc (bwl): Allow for bogus instructions with a size
field of 3.
(sbwl, ubwl, SCALE): Likewise.
* rx-decode.c: Regenerate.

* gas/rx/mov.d: Update expected disassembly.

10 years agoImprove .rsrc section merging with better handling of the alignment adjustments
Nick Clifton [Wed, 19 Mar 2014 08:51:20 +0000 (08:51 +0000)] 
Improve .rsrc section merging with better handling of the alignment adjustments
made between merged .rsrc sections.

* peXXigen.c (rsrc_align): New function.  Attempts to cope with
alignment variances when .rsrc sections are merged.
(rsrc_process_section): Use rsrc_align.

* Makefile.am (default-manifest.o): Use WINDRES_FOR_TARGET.
* Makefile.in: Regenerate.
* emultempl/default-manifest.rc: Fix typo.
* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
(.rsrc): Add SUBALIGN(4).
* scripttempl/pep.sc: Likewise.

10 years ago * gdb.base/async.exp: Whitespace fixes. Turn on target-async.
Doug Evans [Tue, 18 Mar 2014 23:19:51 +0000 (19:19 -0400)] 
* gdb.base/async.exp: Whitespace fixes.  Turn on target-async.
Fix spelling of exec-done-display.

10 years agodaily update
Alan Modra [Tue, 18 Mar 2014 23:00:42 +0000 (09:30 +1030)] 
daily update

10 years agoFix SIGTERM signal safety (PR gdb/15358).
Jan Kratochvil [Tue, 18 Mar 2014 21:48:06 +0000 (22:48 +0100)] 
Fix SIGTERM signal safety (PR gdb/15358).

gdb/
2014-03-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/15358
* defs.h (sync_quit_force_run): New declaration.
(QUIT): Check also SYNC_QUIT_FORCE_RUN.
* event-top.c (async_sigterm_handler): New declaration.
(async_sigterm_token): New variable.
(async_init_signals): Create also async_sigterm_token.
(async_sigterm_handler): New function.
(sync_quit_force_run): New variable.
(handle_sigterm): Replace quit_force call by other calls.
* utils.c (quit): Call quit_force if SYNC_QUIT_FORCE_RUN.

gdb/testsuite/
2014-03-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/15358
* gdb.base/gdb-sigterm.c: New file.
* gdb.base/gdb-sigterm.exp: New file.

Message-ID: <20140316135334.GA30698@host2.jankratochvil.net>

10 years agoPower: Correct little-endian e500v2 GPR frame offsets
Maciej W. Rozycki [Tue, 18 Mar 2014 19:39:41 +0000 (19:39 +0000)] 
Power: Correct little-endian e500v2 GPR frame offsets

This change corrects GPR frame offset calculation for the e500v2
processor.  On this target, featuring the SPE APU, GPRs are 64-bit and
are held in stack frames whole with the use of `evstdd' and `evldd'
instructions.  Their integer 32-bit part occupies the low-order word and
therefore its offset varies between the two endiannesses possible.

* rs6000-tdep.c (rs6000_frame_cache): Correct little-endian GPR
offset into SPE pseudo registers.

10 years agoPR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output.
Pedro Alves [Tue, 18 Mar 2014 17:50:28 +0000 (17:50 +0000)] 
PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output.

Part of PR gdb/13860 is about the mi-solib.exp test's output being
different in sync vs async modes.

sync:

  >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi
  =thread-group-added,id="i1"
  ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
  ~"done.\n"
  (gdb)
  &"start\n"
  ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
  =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
  ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
  =thread-group-started,id="i1",pid="17724"
  =thread-created,id="1",group-id="i1"
  ^running
  *running,thread-id="all"
  (gdb)
  =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
  ~"Stopped due to shared library event (no libraries added or removed)\n"
  *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
  (gdb)

async:

  >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async on" -i=mi
  =thread-group-added,id="i1"
  ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
  ~"done.\n"
  (gdb)
  start
  &"start\n"
  ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
  =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
  ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
  =thread-group-started,id="i1",pid="17729"
  =thread-created,id="1",group-id="i1"
  ^running
  *running,thread-id="all"
  =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
  (gdb)
  *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1"

For now, let's focus only on the *stopped event.  We see that the
async output is missing frame info.  And this causes a test failure in
async mode, as "mi_expect_stop solib-event" wants to see the frame
info.

However, if we compare the event output when a real MI execution
command is used, compared to a CLI command (e.g., run vs -exec-run,
next vs -exec-next, etc.), we see:

  >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi
  =thread-group-added,id="i1"
  ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
  ~"done.\n"
  (gdb)
  r
  &"r\n"
  ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
  =thread-group-started,id="i1",pid="17751"
  =thread-created,id="1",group-id="i1"
  ^running
  *running,thread-id="all"
  (gdb)
  =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
  ~"Stopped due to shared library event (no libraries added or removed)\n"
  *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
  (gdb)
  -exec-run
  =thread-exited,id="1",group-id="i1"
  =thread-group-exited,id="i1"
  =library-unloaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",thread-group="i1"
  =thread-group-started,id="i1",pid="17754"
  =thread-created,id="1",group-id="i1"
  ^running
  *running,thread-id="all"
  (gdb)
  =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
  *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1"
  =thread-selected,id="1"
  (gdb)

As seen above, with MI commands, the *stopped event _doesn't_ have
frame info.  This is because normal_stop, as commanded by the result
of bpstat_print, skips printing frame info in this case (it's an
"event", not a "breakpoint"), and when the interpreter is MI,
mi_on_normal_stop skips calling print_stack_frame, as the normal_stop
call was already done with the MI uiout.  This explains why the async
output is different even with a CLI command.  Its because in async
mode, the mi_on_normal_stop path is always taken; it is always reached
with the MI uiout, because the stop is handled from the event loop,
instead of from within `proceed -> wait_for_inferior -> normal_stop'
with the interpreter overridden, as in sync mode.

This patch fixes the issue by making all cases output the same
*stopped event, by factoring out the print code from normal_stop, and
using it from mi_on_normal_stop as well.  I chose the *stopped output
without a frame, mainly because that is what you already get if you
use MI execution commands, the commands frontends are supposed to use
(except when implementing a console).  This patch makes it simpler to
tweak the MI output differently if desired, as we only have to change
the centralized print_stop_event (taking into account whether the
uiout is MI-like), and all different modes will change accordingly.

Tested on x86_64 Fedora 17, no regressions.  The mi-solib.exp test no
longer fails in async mode with this patch, so the patch removes the
kfail.

2014-03-18  Pedro Alves  <palves@redhat.com>

PR gdb/13860
* inferior.h (print_stop_event): Declare.
* infrun.c (print_stop_event): New, factored out from ...
(normal_stop): ... this.
* mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead
of bpstat_print/print_stack_frame.

2014-03-18  Pedro Alves  <palves@redhat.com>

PR gdb/13860
* gdb.mi/mi-solib.exp: Remove gdb/13860 kfail.
* lib/mi-support.exp (mi_expect_stop): Add special handling for
solib-event.

10 years agoEnable verbose error messages by default for AArch64 gas.
Yufeng Zhang [Tue, 18 Mar 2014 17:41:43 +0000 (17:41 +0000)] 
Enable verbose error messages by default for AArch64 gas.

gas/

* config/tc-aarch64.c (aarch64_opts): Add new option
"mno-verbose-error".
(verbose_error_p): Initialize to 1.
* doc/c-aarch64.texi (AArch64 Options): Document -mverbose-error
and -mno-verbose-error.

gas/testsuite/

* gas/aarch64/illegal.d: Pass -mno-verbose-error.
* gas/aarch64/verbose-error.s: Add more verbose message testcases.
* gas/aarch64/verbose-error.l: Ditto.

10 years agoConvert function declarations to ISO C format. Remove redundant code.
Nick Clifton [Tue, 18 Mar 2014 14:16:54 +0000 (14:16 +0000)] 
Convert function declarations to ISO C format.  Remove redundant code.

* wrapper.c: Convert function declarations to ISO C format.
(sim_open): Delete code for handling t,d and z command line
options.

This page took 0.089151 seconds and 4 git commands to generate.