2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class type_instance_operation): New.
|
|
|
|
|
* eval.c (type_instance_operation::evaluate): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class op_this_operation): New.
|
|
|
|
|
* ax-gdb.c (op_this_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class unop_memval_operation)
|
|
|
|
|
(class unop_memval_type_operation): New.
|
|
|
|
|
* eval.c (eval_op_memval): No longer static.
|
|
|
|
|
(unop_memval_operation::evaluate_for_address)
|
|
|
|
|
(unop_memval_type_operation::evaluate_for_address)
|
|
|
|
|
(unop_memval_operation::evaluate_for_sizeof)
|
|
|
|
|
(unop_memval_type_operation::evaluate_for_sizeof): New methods.
|
|
|
|
|
* ax-gdb.c (unop_memval_operation::do_generate_ax)
|
|
|
|
|
(unop_memval_type_operation::do_generate_ax): New methods.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class unop_alignof_operation): New.
|
|
|
|
|
* eval.c (eval_op_alignof): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class unop_sizeof_operation): New.
|
|
|
|
|
* ax-gdb.c (unop_sizeof_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class unop_addr_operation): New.
|
|
|
|
|
* ax-gdb.c (gen_expr_unop) <case UNOP_ADDR>: New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class typeid_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class decltype_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class typeof_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class type_operation): New.
|
|
|
|
|
* eval.c (eval_op_type): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class unop_ind_base_operation)
|
|
|
|
|
(class unop_ind_operation): New.
|
|
|
|
|
* eval.c (eval_op_ind): No longer static. Remove "op" parameter.
|
|
|
|
|
(unop_ind_base_operation::evaluate_for_address)
|
|
|
|
|
(unop_ind_base_operation::evaluate_for_sizeof): New method.
|
|
|
|
|
* ax-gdb.c (gen_expr_unop) <case UNOP_IND>: New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (unop_incr_operation): New template.
|
|
|
|
|
(preinc_operation, predec_operation, postinc_operation)
|
|
|
|
|
(postdec_operation): New typedefs.
|
|
|
|
|
* eval.c (eval_op_preinc, eval_op_predec, eval_op_postinc)
|
|
|
|
|
(eval_op_postdec): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (unary_ftype): New typedef.
|
|
|
|
|
(unop_operation, usual_ax_binop_operation): New templates.
|
|
|
|
|
(unary_plus_operation, unary_neg_operation)
|
|
|
|
|
(unary_complement_operation, unary_logical_not_operation): New
|
|
|
|
|
typedefs.
|
|
|
|
|
* eval.c (eval_op_plus, eval_op_neg, eval_op_complement)
|
|
|
|
|
(eval_op_lognot): No longer static.
|
|
|
|
|
* ax-gdb.c (gen_expr_unop): New function.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ax-gdb.c (comma_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class repeat_operation): New.
|
|
|
|
|
* eval.c (eval_op_repeat): No longer static. Remove "op"
|
|
|
|
|
parameter.
|
|
|
|
|
(evaluate_subexp_standard): Update.
|
|
|
|
|
* ax-gdb.c (repeat_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class comparison_operation): New.
|
|
|
|
|
(equal_operation, notequal_operation, less_operation)
|
|
|
|
|
(gtr_operation, geq_operation, leq_operation): New typedefs.
|
|
|
|
|
* eval.c (eval_op_equal, eval_op_notequal, eval_op_less)
|
|
|
|
|
(eval_op_gtr, eval_op_geq, eval_op_leq): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class subscript_operation): New.
|
|
|
|
|
* eval.c (eval_op_subscript): No longer static.
|
|
|
|
|
|
Introduce binop_operation
This adds two new template classes, binop_operation and
usual_ax_binop_operation, and then uses these to implement a number of
binary operations that follow similar patterns.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class binop_operation, class usual_ax_binop_operation):
New.
(exp_operation, intdiv_operation, mod_operation, mul_operation)
(div_operation, rem_operation, lsh_operation, rsh_operation)
(bitwise_and_operation, bitwise_ior_operation)
(bitwise_xor_operation): New typedefs.
* eval.c (eval_op_binary): No longer static.
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class binop_operation, class usual_ax_binop_operation):
|
|
|
|
|
New.
|
|
|
|
|
(exp_operation, intdiv_operation, mod_operation, mul_operation)
|
|
|
|
|
(div_operation, rem_operation, lsh_operation, rsh_operation)
|
|
|
|
|
(bitwise_and_operation, bitwise_ior_operation)
|
|
|
|
|
(bitwise_xor_operation): New typedefs.
|
|
|
|
|
* eval.c (eval_op_binary): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class sub_operation): New.
|
|
|
|
|
* eval.c (eval_op_sub): No longer static. Remove "op" parameter.
|
|
|
|
|
(evaluate_subexp_standard): Update.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class add_operation): New.
|
|
|
|
|
* eval.c (eval_op_add): No longer static. Remove "op" parameter.
|
|
|
|
|
(evaluate_subexp_standard): Update.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class concat_operation): New.
|
|
|
|
|
* eval.c (eval_op_concat): No longer static. Remove "op"
|
|
|
|
|
parameter.
|
|
|
|
|
(evaluate_subexp_standard): Update.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class structop_member_operation)
|
|
|
|
|
(class structop_mptr_operation): New.
|
|
|
|
|
* eval.c (eval_op_member): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class structop_ptr_operation): New.
|
|
|
|
|
* eval.c (eval_op_structop_ptr): No longer static. Remove "op"
|
|
|
|
|
parameter.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class structop_base_operation)
|
|
|
|
|
(class structop_operation): New.
|
|
|
|
|
* eval.c (eval_op_structop_struct): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class complex_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_objc_selector): No longer static.
|
|
|
|
|
* c-exp.h (class objc_selector_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c: Include c-exp.h.
|
|
|
|
|
* c-exp.h (class objc_nsstring_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* c-lang.c (c_string_operation::evaluate): New method.
|
|
|
|
|
* c-exp.h: New file.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class ternop_cond_operation): New.
|
|
|
|
|
* ax-gdb.c (ternop_cond_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class ternop_slice_operation): New.
|
|
|
|
|
* eval.c (eval_op_ternop): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class string_operation): New.
|
|
|
|
|
* eval.c (eval_op_string): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class internalvar_operation): New.
|
|
|
|
|
* ax-gdb.c (internalvar_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class bool_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class register_operation): New.
|
|
|
|
|
* eval.c (eval_op_register): No longer static.
|
|
|
|
|
* ax-gdb.c (register_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class last_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class func_static_var_operation): New.
|
|
|
|
|
* eval.c (eval_op_func_static_var): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class var_entry_value_operation): New.
|
|
|
|
|
* eval.c (eval_op_var_entry_value): No longer static.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expression.h (class operation) <set_outermost>: New method.
|
|
|
|
|
* expop.h (class var_msym_value_operation): New.
|
|
|
|
|
* eval.c (eval_op_var_msym_value): No longer static.
|
|
|
|
|
(var_msym_value_operation::evaluate_for_address)
|
|
|
|
|
(var_msym_value_operation::evaluate_for_sizeof)
|
|
|
|
|
(var_msym_value_operation::evaluate_for_cast): New methods.
|
|
|
|
|
* ax-gdb.c (var_msym_value_operation::do_generate_ax): New
|
|
|
|
|
method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class long_const_operation): New.
|
|
|
|
|
* ax-gdb.c (long_const_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (class scope_operation): New.
|
|
|
|
|
* eval.c (eval_op_scope): No longer static.
|
|
|
|
|
(scope_operation::evaluate_for_address): New method.
|
|
|
|
|
* ax-gdb.c (scope_operation::do_generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expprint.c (float_const_operation::dump): New method.
|
|
|
|
|
* expop.h (float_data): New typedef.
|
|
|
|
|
(class float_const_operation): New.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expop.h (gen_expr_binop, gen_expr_structop): Declare.
|
|
|
|
|
* ax-gdb.c (gen_expr_binop): New function.
|
|
|
|
|
(gen_expr_structop): Likewise.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expprint.c (expr::dump_for_expression): New functions.
|
|
|
|
|
* expop.h (dump_for_expression): New overloads.
|
|
|
|
|
(tuple_holding_operation::dump, tuple_holding_operation::do_dump):
|
|
|
|
|
Update.
|
|
|
|
|
|
Introduce class operation
This patch introduces class operation, the new base class for all
expression operations.
In the new approach, an operation is simply a class that presents a
certain interface. Operations own their operands, and management is
done via unique_ptr.
The operation interface is largely ad hoc, based on the evolution of
expression handling in GDB. Parts (for example,
evaluate_with_coercion) are probably redundant; however I took this
approach to try to avoid mixing different kinds of refactorings.
In some specific situations, rather than add a generic method across
the entire operation class hierarchy, I chose instead to use
dynamic_cast and specialized methods on certain concrete subclasses.
This will appear in some subsequent patches.
One goal of this work is to avoid the kinds of easy-to-make errors
that affected the old implementation. To this end, some helper
subclasses are also added here. These helpers automate the
implementation of the 'dump', 'uses_objfile', and 'constant_p'
methods. Nearly every concrete operation that is subsequently added
will use these facilities. (Note that the 'dump' implementation is
only outlined here, the body appears in the next patch.)
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expression.h (expr::operation): New class.
(expr::make_operation): New function.
(expr::operation_up): New typedef.
* expop.h: New file.
* eval.c (operation::evaluate_for_cast)
(operation::evaluate_for_address, operation::evaluate_for_sizeof):
New methods.
* ax-gdb.c (operation::generate_ax): New method.
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expression.h (expr::operation): New class.
|
|
|
|
|
(expr::make_operation): New function.
|
|
|
|
|
(expr::operation_up): New typedef.
|
|
|
|
|
* expop.h: New file.
|
|
|
|
|
* eval.c (operation::evaluate_for_cast)
|
|
|
|
|
(operation::evaluate_for_address, operation::evaluate_for_sizeof):
|
|
|
|
|
New methods.
|
|
|
|
|
* ax-gdb.c (operation::generate_ax): New method.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ax-gdb.c (gen_expr_binop_rest): Remove "pc" parameter.
|
|
|
|
|
(gen_expr_binop_rest): New overload.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_multi_subscript): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_binop_exp): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_val_atr): Rename from value_val_atr. Change
|
|
|
|
|
parameters.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_binop_minmax): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_unop_atr): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_binop_in_bounds): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_ternop_slice): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_equal_binop): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_mult_binop): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_abs): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_atr_size): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_atr_tag): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_unop_in_range): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_unop_neg): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (eval_ternop_in_range): New function.
|
|
|
|
|
(ada_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* opencl-lang.c (eval_opencl_assign): New function.
|
|
|
|
|
(evaluate_subexp_opencl): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_objc_msgcall): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_binop_assign_modify): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* m2-lang.c (eval_op_m2_subscript): New function.
|
|
|
|
|
(evaluate_subexp_modula2): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* m2-lang.c (eval_op_m2_high): New function.
|
|
|
|
|
(evaluate_subexp_modula2): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (evaluate_subexp_for_address_base): New function.
|
|
|
|
|
(evaluate_subexp_for_address): Use it.
|
|
|
|
|
(evaluate_subexp_for_sizeof_base): New function.
|
|
|
|
|
(evaluate_subexp_for_sizeof): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (eval_op_rust_structop): New function.
|
|
|
|
|
(rust_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (eval_op_rust_struct_anon): New function.
|
|
|
|
|
(rust_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (eval_op_rust_array): New function.
|
|
|
|
|
(rust_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (eval_op_rust_complement): New function.
|
|
|
|
|
(rust_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (eval_op_rust_ind): New function.
|
|
|
|
|
(rust_evaluate_subexp): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (rust_subscript): Change parameters.
|
|
|
|
|
(rust_evaluate_subexp): Update.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* rust-lang.c (rust_range): Change parameters.
|
|
|
|
|
(rust_evaluate_subexp): Update.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_allocated): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (fortran_require_array): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_kind): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_cmplx): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_modulo): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_floor): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_ceil): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_mod): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (eval_op_f_abs): New function.
|
|
|
|
|
(evaluate_subexp_f): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_type): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_postdec): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_postinc): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_predec): New file.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_preinc): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_memval): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_alignof): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_ind): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_lognot): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_complement): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_neg): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_plus): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_repeat): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_leq): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_geq): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_gtr): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_less): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_notequal): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_equal): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_subscript): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_binary): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_sub): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_add): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_member): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_structop_ptr): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_structop_struct): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_ternop): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_concat): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_objc_selector): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_string): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_register): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_func_static_var): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_var_msym_value): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_var_entry_value): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-08 22:27:57 +08:00
|
|
|
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (eval_op_scope): New function.
|
|
|
|
|
(evaluate_subexp_standard): Use it.
|
|
|
|
|
|
2021-03-07 00:38:26 +08:00
|
|
|
|
2021-03-06 Chernov Sergey <klen_s@mail.ru>
|
|
|
|
|
|
|
|
|
|
PR gdb/27528:
|
|
|
|
|
* ada-lang.c (ada_fold_name): Use gdb::to_string.
|
|
|
|
|
|
2021-03-07 00:26:39 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/sect-names.h (dwarf2_elf_names): Declare.
|
|
|
|
|
* dwarf2/read.h (dwarf2_get_dwz_file): Move to dwz.h.
|
|
|
|
|
* dwarf2/read.c (dwarf2_elf_names): No longer static.
|
|
|
|
|
(locate_dwz_sections, dwz_search_other_debugdirs)
|
|
|
|
|
(dwarf2_get_dwz_file): Move to dwz.c.
|
|
|
|
|
* dwarf2/dwz.h (dwarf2_get_dwz_file): Move declaration from
|
|
|
|
|
read.h.
|
|
|
|
|
* dwarf2/dwz.c (locate_dwz_sections, dwz_search_other_debugdirs)
|
|
|
|
|
(dwarf2_get_dwz_file): Move from read.c.
|
|
|
|
|
|
2021-03-07 00:26:39 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* debuginfod-support.h: Include scoped_fd.h.
|
|
|
|
|
|
2021-03-07 00:26:39 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.h (dwarf2_get_dwz_file): Add 'require' parameter.
|
|
|
|
|
* dwarf2/read.c (dwarf2_get_dwz_file): Add 'require' parameter.
|
|
|
|
|
(get_abbrev_section_for_cu, read_attribute_value)
|
|
|
|
|
(get_debug_line_section): Update.
|
|
|
|
|
* dwarf2/macro.c (dwarf_decode_macro_bytes): Update.
|
|
|
|
|
|
2021-03-07 00:26:39 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/sect-names.h (struct dwarf2_section_names) <matches>: New
|
|
|
|
|
method.
|
|
|
|
|
* dwarf2/read.c (section_is_p): Remove.
|
|
|
|
|
(dwarf2_per_bfd::locate_sections)
|
|
|
|
|
(dwarf2_per_bfd::locate_sections, locate_dwz_sections)
|
|
|
|
|
(locate_v1_virtual_dwo_sections, dwarf2_locate_dwo_sections)
|
|
|
|
|
(dwarf2_locate_common_dwp_sections)
|
|
|
|
|
(dwarf2_locate_v2_dwp_sections, dwarf2_locate_v5_dwp_sections):
|
|
|
|
|
Update.
|
|
|
|
|
|
2021-03-07 00:26:39 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* xcoffread.c: Include sect-names.h.
|
|
|
|
|
* symfile.h (struct dwarf2_section_names, struct
|
|
|
|
|
dwarf2_debug_sections): Move to dwarf2/sect-names.h.
|
|
|
|
|
* dwarf2/sect-names.h: New file, from symfile.h.
|
|
|
|
|
* dwarf2/read.c: Include sect-names.h.
|
|
|
|
|
|
2021-03-07 00:16:59 +08:00
|
|
|
|
2021-03-06 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_attribute): Make 'abbrev' const.
|
|
|
|
|
* dwarf2/abbrev.c (abbrev_table::alloc_abbrev): Remove.
|
|
|
|
|
(abbrev_table::read): Update.
|
|
|
|
|
* dwarf2/abbrev.h (struct attr_abbrev): Move earlier.
|
|
|
|
|
(struct abbrev_info): Reformat.
|
|
|
|
|
<attrs>: Now an array.
|
|
|
|
|
(struct abbrev_table) <alloc_abbrev>: Remove.
|
|
|
|
|
|
2021-03-06 08:17:00 +08:00
|
|
|
|
2021-03-06 Weimin Pan <weimin.pan@oracle.com>
|
|
|
|
|
|
|
|
|
|
* ctfread.c (ctf_psymtab_add_enums): New function.
|
|
|
|
|
(ctf_psymtab_type_cb): call ctf_psymtab_add_enums.
|
|
|
|
|
|
2021-03-06 07:31:26 +08:00
|
|
|
|
2021-03-06 Weimin Pan <weimin.pan@oracle.com>
|
|
|
|
|
|
|
|
|
|
* ctfread.c (read_func_kind_type): Set up function arguments.
|
|
|
|
|
|
2020-11-27 22:39:23 +08:00
|
|
|
|
2021-03-05 Craig Blackmore <craig.blackmore@embecosm.com>
|
|
|
|
|
Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* riscv-none-tdep.c: Add 'user-regs.h' and 'target-description.h'
|
|
|
|
|
includes.
|
|
|
|
|
(riscv_csrset): New static global.
|
|
|
|
|
(riscv_update_csrmap): New function.
|
|
|
|
|
(riscv_iterate_over_regset_sections): Process CSRs.
|
|
|
|
|
|
2021-02-16 00:07:48 +08:00
|
|
|
|
2021-03-05 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* riscv-tdep.c (riscv_feature_name_csr): Define.
|
|
|
|
|
(riscv_feature_name_cpu): Define.
|
|
|
|
|
(riscv_feature_name_fpu): Define.
|
|
|
|
|
(riscv_feature_name_virtual): Define.
|
|
|
|
|
(riscv_xreg_feature): Use riscv_feature_name_cpu.
|
|
|
|
|
(riscv_freg_feature): Use riscv_feature_name_fpu.
|
|
|
|
|
(riscv_virtual_feature): Use riscv_feature_name_virtual.
|
|
|
|
|
(riscv_csr_feature): Use riscv_feature_name_csr.
|
|
|
|
|
* riscv-tdep.h (riscv_feature_name_csr): Declare.
|
|
|
|
|
|
gdb/riscv: introduce bare metal core dump support
This commit adds the ability for bare metal RISC-V target to generate
core files from within GDB.
The intended use case is that a user will connect to a remote bare
metal target, debug up to some error condition, then generate a core
file in the normal way using:
(gdb) generate-core-file
This core file can then be used to revisit the state of the remote
target without having to reconnect to the remote target.
The core file creation code is split between two new files. In
elf-none-tdep.c is code for any architecture with the none
ABI (i.e. bare metal) when the BFD library is built with ELF support.
In riscv-none-tdep.c are the RISC-V specific parts. This is where the
regset and regcache_map_entry structures are defined that control how
registers are laid out in the core file. As this file could (in
theory at least) be used for a non-ELF bare metal RISC-V target, the
calls into elf-none-tdep.c are guarded with '#ifdef HAVE_ELF'.
Currently for RISC-V only the x-regs and f-regs (if present) are
written out. In future commits I plan to add support for writing out
the RISC-V CSRs.
The core dump format is based around generating an ELF containing
sections for the writable regions of memory that a user could be
using. Which regions are dumped rely on GDB's existing common core
dumping code, GDB will attempt to figure out the stack and heap as
well as copying out writable data sections as identified by the
original ELF.
Register information is added to the core dump using notes, just as it
is for Linux of FreeBSD core dumps. The note types used consist of
the 3 basic types you would expect in a OS based core dump,
NT_PRPSINFO, NT_PRSTATUS, NT_FPREGSET.
The layout of these notes differs slightly (due to field sizes)
between RV32 and RV64. Below I describe the data layout for each
note. In all cases, all padding fields should be set to zero.
Note NT_PRPSINFO is optional. Its data layout is:
struct prpsinfo32_t /* For RV32. */
{
uint8_t padding[32];
char fname[16];
char psargs[80];
}
struct prpsinfo64_t /* For RV64. */
{
uint8_t padding[40];
char fname[16];
char psargs[80];
}
Field 'fname' - null terminated string consisting of the basename of
(up to the fist 15 characters of) the executable. Any additional
space should be set to zero. If there's no executable name then
this field can be set to all zero.
Field 'psargs' - a null terminated string up to 80 characters in
length. Any additional space should be filled with zero. This
field contains the full executable path and any arguments passed
to the executable. If there's nothing sensible to write in this
field then fill it with zero.
Note NT_PRSTATUS is required, its data layout is:
struct prstatus32_t /* For RV32. */
{
uint8_t padding_1[12];
uint16_t sig;
uint8_t padding_2[10];
uint32_t thread_id;
uint8_t padding_3[44];
uint32_t x_regs[32];
uint8_t padding_4[4];
}
struct prstatus64_t /* For RV64. */
{
uint8_t padding_1[12];
uint16_t sig;
uint8_t padding_2[18];
uint32_t thread_id;
uint8_t padding_3[76];
uint64_t x_regs[32];
uint8_t padding_4[4];
}
Field 'sig' - the signal that stopped this thread. It's implementation
defined what this field actually means. Within GDB this will be
the signal number that the remote target reports as the stop
reason for this thread.
Field 'thread_is' - the thread id for this thread. It's implementation
defined what this field actually means. Within GDB this will be
thread thread-id that is assigned to each remote thread.
Field 'x_regs' - at index 0 we store the program counter, and at
indices 1 to 31 we store x-registers 1 to 31. x-register 0 is not
stored, its value is always zero anyway.
Note NT_FPREGSET is optional, its data layout is:
fpregset32_t /* For targets with 'F' extension. */
{
uint32_t f_regs[32];
uint32_t fcsr;
}
fpregset64_t /* For targets with 'D' extension . */
{
uint64_t f_regs[32];
uint32_t fcsr;
}
Field 'f_regs' - stores f-registers 0 to 31.
Field 'fcsr' - stores the fcsr CSR register, and is always 4-bytes.
The rules for ordering the notes is the same as for Linux. The
NT_PRSTATUS note must come before any other notes about additional
register sets. And for multi-threaded targets all registers for a
single thread should be grouped together. This is because only
NT_PRSTATUS includes a thread-id, all additional register notes after
a NT_PRSTATUS are assumed to belong to the same thread until a
different NT_PRSTATUS is seen.
gdb/ChangeLog:
* Makefile.in (ALL_TARGET_OBS): Add riscv-none-tdep.o.
(ALLDEPFILES): Add riscv-none-tdep.c.
* configure: Regenerate.
* configure.ac (CONFIG_OBS): Add elf-none-tdep.o when BFD has ELF
support.
* configure.tgt (riscv*-*-*): Include riscv-none-tdep.c.
* elf-none-tdep.c: New file.
* elf-none-tdep.h: New file.
* riscv-none-tdep.c: New file.
2020-11-30 20:15:08 +08:00
|
|
|
|
2021-03-05 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
Craig Blackmore <craig.blackmore@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (ALL_TARGET_OBS): Add riscv-none-tdep.o.
|
|
|
|
|
(ALLDEPFILES): Add riscv-none-tdep.c.
|
|
|
|
|
* configure: Regenerate.
|
|
|
|
|
* configure.ac (CONFIG_OBS): Add elf-none-tdep.o when BFD has ELF
|
|
|
|
|
support.
|
|
|
|
|
* configure.tgt (riscv*-*-*): Include riscv-none-tdep.c.
|
|
|
|
|
* elf-none-tdep.c: New file.
|
|
|
|
|
* elf-none-tdep.h: New file.
|
|
|
|
|
* riscv-none-tdep.c: New file.
|
|
|
|
|
|
gdb: write target description into core file
When a core file is created from within GDB add the target description
into a note within the core file.
When loading a core file, if the target description note is present
then load the target description from the core file.
The benefit of this is that we can be sure that, when analysing the
core file within GDB, that we are using the exact same target
description as was in use at the time the core file was created.
GDB already supports a mechanism for figuring out the target
description from a given corefile; gdbarch_core_read_description.
This new mechanism (GDB adding the target description) is not going to
replace the old mechanism. Core files generated outside of GDB will
not include a target description, and so GDB still needs to be able to
figure out a target description for these files.
My primary motivation for adding this feature is that, in a future
commit, I will be adding support for bare metal core dumps on some
targets. For RISC-V specifically, I want to be able to dump all the
available control status registers. As different targets will present
different sets of register in their target description, including
registers that are possibly not otherwise known to GDB I wanted a way
to capture these registers in the core dump.
I therefore need a mechanism to write out an arbitrary set of
registers, and to then derive a target description from this arbitrary
set when later loading the core file. The obvious approach (I think)
is to just reuse the target description.
Once I'd decided to add support for writing out the target description
I could either choose to make this RISC-V only, or make it generic. I
figure that having the target description in the core file doesn't
hurt, and _might_ be helpful. So that's how I got here, general
support for including the target description in GDB generated core
files.
In previous versions of this patch I added the target description from
generic code (in gcore.c). However, doing this creates a dependency
between GDB's common code and bfd ELF support. As ELF support in gdb
is optional (for example the target x86_64-apple-darwin20.3.0 does not
include ELF support) then having gcore.c require ELF support would
break the GDB build in some cases.
Instead, in this version of the patch, writing the target description
note is done from each specific targets make notes function. Each of
these now calls a common function in gcore-elf.c (which is only linked
in when bfd has ELF support). And so only targets that are ELF based
will call the new function and we can therefore avoid an unconditional
dependency on ELF support.
gdb/ChangeLog:
* corelow.c: Add 'xml-tdesc.h' include.
(core_target::read_description): Load the target description from
the core file when possible.
* fbsd-tdep.c (fbsd_make_corefile_notes): Add target description
note.
* gcore-elf.c: Add 'gdbsupport/tdesc.h' include.
(gcore_elf_make_tdesc_note): New function.
* gcore-elf.h (gcore_elf_make_tdesc_note): Declare.
* linux-tdep.c (linux_make_corefile_notes): Add target description
note.
2020-11-27 23:41:52 +08:00
|
|
|
|
2021-03-05 Craig Blackmore <craig.blackmore@embecosm.com>
|
|
|
|
|
Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* corelow.c: Add 'xml-tdesc.h' include.
|
|
|
|
|
(core_target::read_description): Load the target description from
|
|
|
|
|
the core file when possible.
|
|
|
|
|
* fbsd-tdep.c (fbsd_make_corefile_notes): Add target description
|
|
|
|
|
note.
|
|
|
|
|
* gcore-elf.c: Add 'gdbsupport/tdesc.h' include.
|
|
|
|
|
(gcore_elf_make_tdesc_note): New function.
|
|
|
|
|
* gcore-elf.h (gcore_elf_make_tdesc_note): Declare.
|
|
|
|
|
* linux-tdep.c (linux_make_corefile_notes): Add target description
|
|
|
|
|
note.
|
|
|
|
|
|
gdb: unify parts of the Linux and FreeBSD core dumping code
While reviewing the Linux and FreeBSD core dumping code within GDB for
another patch series, I noticed that the code that collects the
registers for each thread and writes these into ELF note format is
basically identical between Linux and FreeBSD.
This commit merges this code and moves it into a new file gcore-elf.c.
The function find_signalled_thread is moved from linux-tdep.c to
gcore.c despite not being shared. A later commit will make use of
this function.
I did merge, and then revert a previous version of this patch (commit
82a1fd3a4935 for the original patch and 03642b7189bc for the revert).
The problem with the original patch is that it introduced a
unconditional dependency between GDB and some ELF specific functions
in the BFD library, e.g. elfcore_write_prstatus and
elfcore_write_register_note. It was pointed out in this mailing list
post:
https://sourceware.org/pipermail/gdb-patches/2021-February/175750.html
that this change was breaking any build of GDB for non-ELF targets.
To confirm this breakage, and to test this new version of GDB I
configured and built for the target x86_64-apple-darwin20.3.0.
Where the previous version of this patch placed all of the common code
into gcore.c, which is included in all builds of GDB, this new patch
only places non-ELF specific generic code (i.e. find_signalled_thread)
into gcore.c, the ELF specific code is put into the new gcore-elf.c
file, which is only included in GDB if BFD has ELF support.
The contents of gcore-elf.c are referenced unconditionally from
linux-tdep.c and fbsd-tdep.c, this is fine, we previously always
assumed that these two targets required ELF support, and we continue
to make that assumption after this patch; nothing has changed there.
With my previous version of this patch the darwin target mentioned
above failed to build, but with the new version, the target builds
fine.
There are a couple of minor changes to the FreeBSD target after this
commit, but I believe that these are changes for the better:
(1) For FreeBSD we always used to record the thread-id in the core
file by using ptid_t.lwp (). In contrast the Linux code did this:
/* For remote targets the LWP may not be available, so use the TID. */
long lwp = ptid.lwp ();
if (lwp == 0)
lwp = ptid.tid ();
Both target now do this:
/* The LWP is often not available for bare metal target, in which case
use the tid instead. */
if (ptid.lwp_p ())
lwp = ptid.lwp ();
else
lwp = ptid.tid ();
Which is equivalent for Linux, but is a change for FreeBSD. I think
that all this means is that in some cases where GDB might have
previously recorded a thread-id of 0 for each thread, we might now get
something more useful.
(2) When collecting the registers for Linux we collected into a zero
initialised buffer. By contrast on FreeBSD the buffer is left
uninitialised. In the new code the buffer is always zero initialised.
I suspect once the registers are copied into the buffer there's
probably no gaps left so this makes no difference, but if it does then
using zeros rather than random bits of GDB's memory is probably a good
thing.
Otherwise, there should be no other user visible changes after this
commit.
Tested this on x86-64/GNU-Linux and x86-64/FreeBSD-12.2 with no
regressions.
gdb/ChangeLog:
* Makefile.in (SFILES): Add gcore-elf.c.
(HFILES_NO_SRCDIR): Add gcore-elf.h
* configure: Regenerate.
* configure.ac: Add gcore-elf.o to CONFIG_OBS if we have ELF
support.
* fbsd-tdep.c: Add 'gcore-elf.h' include.
(struct fbsd_collect_regset_section_cb_data): Delete.
(fbsd_collect_regset_section_cb): Delete.
(fbsd_collect_thread_registers): Delete.
(struct fbsd_corefile_thread_data): Delete.
(fbsd_corefile_thread): Delete.
(fbsd_make_corefile_notes): Call
gcore_elf_build_thread_register_notes instead of the now deleted
FreeBSD code.
* gcore-elf.c: New file, the content was moved here from
linux-tdep.c, functions were renamed and given minor cleanup.
* gcore-elf.h: New file.
* gcore.c (gcore_find_signalled_thread): Moved here from
linux-tdep.c and given a new name. Minor cleanups.
* gcore.h (gcore_find_signalled_thread): Declare.
* linux-tdep.c: Add 'gcore.h' and 'gcore-elf.h' includes.
(struct linux_collect_regset_section_cb_data): Delete.
(linux_collect_regset_section_cb): Delete.
(linux_collect_thread_registers): Delete.
(linux_corefile_thread): Call
gcore_elf_build_thread_register_notes.
(find_signalled_thread): Delete.
(linux_make_corefile_notes): Call gcore_find_signalled_thread.
2021-01-19 00:00:38 +08:00
|
|
|
|
2021-03-05 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (SFILES): Add gcore-elf.c.
|
|
|
|
|
(HFILES_NO_SRCDIR): Add gcore-elf.h
|
|
|
|
|
* configure: Regenerate.
|
|
|
|
|
* configure.ac: Add gcore-elf.o to CONFIG_OBS if we have ELF
|
|
|
|
|
support.
|
|
|
|
|
* fbsd-tdep.c: Add 'gcore-elf.h' include.
|
|
|
|
|
(struct fbsd_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(fbsd_collect_regset_section_cb): Delete.
|
|
|
|
|
(fbsd_collect_thread_registers): Delete.
|
|
|
|
|
(struct fbsd_corefile_thread_data): Delete.
|
|
|
|
|
(fbsd_corefile_thread): Delete.
|
|
|
|
|
(fbsd_make_corefile_notes): Call
|
|
|
|
|
gcore_elf_build_thread_register_notes instead of the now deleted
|
|
|
|
|
FreeBSD code.
|
|
|
|
|
* gcore-elf.c: New file, the content was moved here from
|
|
|
|
|
linux-tdep.c, functions were renamed and given minor cleanup.
|
|
|
|
|
* gcore-elf.h: New file.
|
|
|
|
|
* gcore.c (gcore_find_signalled_thread): Moved here from
|
|
|
|
|
linux-tdep.c and given a new name. Minor cleanups.
|
|
|
|
|
* gcore.h (gcore_find_signalled_thread): Declare.
|
|
|
|
|
* linux-tdep.c: Add 'gcore.h' and 'gcore-elf.h' includes.
|
|
|
|
|
(struct linux_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(linux_collect_regset_section_cb): Delete.
|
|
|
|
|
(linux_collect_thread_registers): Delete.
|
|
|
|
|
(linux_corefile_thread): Call
|
|
|
|
|
gcore_elf_build_thread_register_notes.
|
|
|
|
|
(find_signalled_thread): Delete.
|
|
|
|
|
(linux_make_corefile_notes): Call gcore_find_signalled_thread.
|
|
|
|
|
|
gdb: set current thread in sparc_{fetch,collect}_inferior_registers (PR gdb/27147)
PR 27147 shows that on sparc64, GDB is unable to properly unwind:
Expected result (from GDB 9.2):
#0 0x0000000000108de4 in puts ()
#1 0x0000000000100950 in hello () at gdb-test.c:4
#2 0x0000000000100968 in main () at gdb-test.c:8
Actual result (from GDB latest git):
#0 0x0000000000108de4 in puts ()
#1 0x0000000000100950 in hello () at gdb-test.c:4
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
The first failing commit is 5b6d1e4fa4fc ("Multi-target support"). The cause
of the change in behavior is due to (thanks for Andrew Burgess for finding
this):
- inferior_ptid is no longer set on entry of target_ops::wait, whereas
it was set to something valid previously
- deep down in linux_nat_target::wait (see stack trace below), we fetch
the registers of the event thread
- on sparc64, fetching registers involves reading memory (in
sparc_supply_rwindow, see stack trace below)
- reading memory (target_ops::xfer_partial) relies on inferior_ptid
being set to the thread from which we want to read memory
This is where things go wrong:
#0 linux_nat_target::xfer_partial (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x7feffe3b000 "", writebuf=0x0, offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3697
#1 0x00000100007f5b10 in raw_memory_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:912
#2 0x00000100007f60e8 in memory_xfer_partial_1 (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1043
#3 0x00000100007f61b4 in memory_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1072
#4 0x00000100007f6538 in target_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x7feffe3b000 "", writebuf=0x0, offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1129
#5 0x00000100007f7094 in target_read_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7feffe3b000 "", offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1375
#6 0x00000100007f721c in target_read (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7feffe3b000 "", offset=8791798050744, len=8) at /home/simark/src/binutils-gdb/gdb/target.c:1415
#7 0x00000100007f69d4 in target_read_memory (memaddr=8791798050744, myaddr=0x7feffe3b000 "", len=8) at /home/simark/src/binutils-gdb/gdb/target.c:1218
#8 0x0000010000758520 in sparc_supply_rwindow (regcache=0x10000fea4f0, sp=8791798050736, regnum=-1) at /home/simark/src/binutils-gdb/gdb/sparc-tdep.c:1960
#9 0x000001000076208c in sparc64_supply_gregset (gregmap=0x10000be3190 <sparc64_linux_ptrace_gregmap>, regcache=0x10000fea4f0, regnum=-1, gregs=0x7feffe3b230) at /home/simark/src/binutils-gdb/gdb/sparc64-tdep.c:1974
#10 0x0000010000751b64 in sparc_fetch_inferior_registers (regcache=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/sparc-nat.c:170
#11 0x0000010000759d68 in sparc64_linux_nat_target::fetch_registers (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, regcache=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/sparc64-linux-nat.c:38
#12 0x00000100008146ec in target_fetch_registers (regcache=0x10000fea4f0, regno=80) at /home/simark/src/binutils-gdb/gdb/target.c:3287
#13 0x00000100006a8c5c in regcache::raw_update (this=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/regcache.c:584
#14 0x00000100006a8d94 in readable_regcache::raw_read (this=0x10000fea4f0, regnum=80, buf=0x7feffe3b7c0 "") at /home/simark/src/binutils-gdb/gdb/regcache.c:598
#15 0x00000100006a93b8 in readable_regcache::cooked_read (this=0x10000fea4f0, regnum=80, buf=0x7feffe3b7c0 "") at /home/simark/src/binutils-gdb/gdb/regcache.c:690
#16 0x00000100006b288c in readable_regcache::cooked_read<unsigned long, void> (this=0x10000fea4f0, regnum=80, val=0x7feffe3b948) at /home/simark/src/binutils-gdb/gdb/regcache.c:777
#17 0x00000100006a9b44 in regcache_cooked_read_unsigned (regcache=0x10000fea4f0, regnum=80, val=0x7feffe3b948) at /home/simark/src/binutils-gdb/gdb/regcache.c:791
#18 0x00000100006abf3c in regcache_read_pc (regcache=0x10000fea4f0) at /home/simark/src/binutils-gdb/gdb/regcache.c:1295
#19 0x0000010000507920 in save_stop_reason (lp=0x10000fc5b10) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:2612
#20 0x00000100005095a4 in linux_nat_filter_event (lwpid=520983, status=1407) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3050
#21 0x0000010000509f9c in linux_nat_wait_1 (ptid=..., ourstatus=0x7feffe3c8f0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3194
#22 0x000001000050b1d0 in linux_nat_target::wait (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, ptid=..., ourstatus=0x7feffe3c8f0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3432
#23 0x00000100007f8ac0 in target_wait (ptid=..., status=0x7feffe3c8f0, options=...) at /home/simark/src/binutils-gdb/gdb/target.c:2000
#24 0x00000100004ac17c in do_target_wait_1 (inf=0x1000116d280, ptid=..., status=0x7feffe3c8f0, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3464
#25 0x00000100004ac3b8 in operator() (__closure=0x7feffe3c678, inf=0x1000116d280) at /home/simark/src/binutils-gdb/gdb/infrun.c:3527
#26 0x00000100004ac7cc in do_target_wait (wait_ptid=..., ecs=0x7feffe3c8c8, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3540
#27 0x00000100004ad8c4 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:3880
#28 0x0000010000485568 in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
#29 0x000001000050d394 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
#30 0x0000010000ab5c8c in handle_file_event (file_ptr=0x10001207270, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
#31 0x0000010000ab6334 in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
#32 0x0000010000ab487c in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
#33 0x0000010000542668 in start_event_loop () at /home/simark/src/binutils-gdb/gdb/main.c:348
#34 0x000001000054287c in captured_command_loop () at /home/simark/src/binutils-gdb/gdb/main.c:408
#35 0x0000010000544e84 in captured_main (data=0x7feffe3d188) at /home/simark/src/binutils-gdb/gdb/main.c:1242
#36 0x0000010000544f2c in gdb_main (args=0x7feffe3d188) at /home/simark/src/binutils-gdb/gdb/main.c:1257
#37 0x00000100000c1f14 in main (argc=4, argv=0x7feffe3d548) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
There is a target_read_memory call in sparc_supply_rwindow, whose return
value is not checked. That call fails, because inferior_ptid does not
contain a valid ptid, and uninitialized buffer contents is used.
Ultimately it results in a corrupt stop_pc.
target_ops::fetch_registers can be (and should remain, in my opinion)
independent of inferior_ptid, because the ptid of the thread from which
to fetch registers can be obtained from the regcache. In other words,
implementations of target_ops::fetch_registers should not rely on
inferior_ptid having a sensible value on entry.
The sparc64_linux_nat_target::fetch_registers case is special, because it calls
a target method that is dependent on the inferior_ptid value
(target_read_inferior, and ultimately target_ops::xfer_partial). So I would
say it's the responsibility of sparc64_linux_nat_target::fetch_registers to set
up inferior_ptid correctly prior to calling target_read_inferior.
This patch makes sparc64_linux_nat_target::fetch_registers (and
store_registers, since it works the same) temporarily set inferior_ptid. If we
ever make target_ops::xfer_partial independent of inferior_ptid, setting
inferior_ptid won't be necessary, we'll simply pass down the ptid as a
parameter in some way.
I chose to set/restore inferior_ptid in sparc_fetch_inferior_registers, because
I am not convinced that doing so in an inner location (in sparc_supply_rwindow
for instance) would always be correct. We have access to the ptid in
sparc_supply_rwindow (from the regcache), so we _could_ set inferior_ptid
there. However, I don't want to just set inferior_ptid, as that would make it
not desync'ed with `current_thread ()` and `current_inferior ()`. It's
preferable to use switch_to_thread instead, as that switches all the global
"current" stuff in a coherent way. But doing so requires a `thread_info *`,
and getting a `thread_info *` from a ptid requires a `process_stratum_target
*`. We could use `current_inferior()->process_target()` in
sparc_supply_rwindow for this (using target_read_memory uses the current
inferior's target stack anyway). However, sparc_supply_rwindow is also used in
the context of BSD uthreads, where a thread stratum target defines threads. I
presume the ptid in the regcache would be the ptid of the uthread, defined by
the thread stratum target (bsd_uthread_target). Using
`current_inferior()->process_target()` would look up a ptid defined by the
thread stratum target using the process stratum target. I don't think it would
give good results. So I prefer playing it safe and looking up the thread
earlier, in sparc_fetch_inferior_registers.
I added some assertions (in sparc_supply_rwindow and others) to verify
that the regcache's ptid matches inferior_ptid. That verifies that the
caller has properly set the correct global context. This would have
caught (though a failed assertion) the current problem.
gdb/ChangeLog:
PR gdb/27147
* sparc-nat.h (sparc_fetch_inferior_registers): Add
process_stratum_target parameter,
sparc_store_inferior_registers): update callers.
* sparc-nat.c (sparc_fetch_inferior_registers,
sparc_store_inferior_registers): Add process_stratum_target
parameter. Switch current thread before calling
sparc_supply_gregset / sparc_collect_rwindow.
(sparc_store_inferior_registers): Likewise.
* sparc-obsd-tdep.c (sparc32obsd_supply_uthread): Add assertion.
(sparc32obsd_collect_uthread): Likewise.
* sparc-tdep.c (sparc_supply_rwindow, sparc_collect_rwindow):
Add assertion.
* sparc64-obsd-tdep.c (sparc64obsd_collect_uthread,
sparc64obsd_supply_uthread): Add assertion.
Change-Id: I16c658cd70896cea604516714f7e2428fbaf4301
2021-03-04 23:57:03 +08:00
|
|
|
|
2021-03-04 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/27147
|
|
|
|
|
* sparc-nat.h (sparc_fetch_inferior_registers): Add
|
|
|
|
|
process_stratum_target parameter,
|
|
|
|
|
sparc_store_inferior_registers): update callers.
|
|
|
|
|
* sparc-nat.c (sparc_fetch_inferior_registers,
|
|
|
|
|
sparc_store_inferior_registers): Add process_stratum_target
|
|
|
|
|
parameter. Switch current thread before calling
|
|
|
|
|
sparc_supply_gregset / sparc_collect_rwindow.
|
|
|
|
|
(sparc_store_inferior_registers): Likewise.
|
|
|
|
|
* sparc-obsd-tdep.c (sparc32obsd_supply_uthread): Add assertion.
|
|
|
|
|
(sparc32obsd_collect_uthread): Likewise.
|
|
|
|
|
* sparc-tdep.c (sparc_supply_rwindow, sparc_collect_rwindow):
|
|
|
|
|
Add assertion.
|
|
|
|
|
* sparc64-obsd-tdep.c (sparc64obsd_collect_uthread,
|
|
|
|
|
sparc64obsd_supply_uthread): Add assertion.
|
|
|
|
|
|
2021-03-04 22:30:42 +08:00
|
|
|
|
2021-03-04 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (struct match_data) <found_sym>: Now bool.
|
|
|
|
|
(aux_add_nonlocal_symbols): Update.
|
|
|
|
|
(ada_add_block_symbols): Change "found_sym" to bool.
|
|
|
|
|
|
2021-03-04 03:02:16 +08:00
|
|
|
|
2021-03-03 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_resolve_function): Update comment.
|
|
|
|
|
(is_nonfunction, add_symbols_from_enclosing_procs)
|
|
|
|
|
(remove_extra_symbols): Likewise.
|
|
|
|
|
(struct match_data): Add constructor, initializers.
|
|
|
|
|
(add_nonlocal_symbols): Remove memset.
|
|
|
|
|
(aux_add_nonlocal_symbols): Update comment.
|
|
|
|
|
(ada_add_block_renamings, add_nonlocal_symbols)
|
|
|
|
|
(ada_add_all_symbols): Likewise.
|
|
|
|
|
* ada-exp.y (write_var_or_type): Clean up trailing whitespace.
|
|
|
|
|
|
Rewrite GNAT-encoded fixed point types in DWARF reader
gdb currently supports two different styles of fixed-point. The
original style, where fixed point types are "GNAT encoded", is handled
primarily in the Ada code. The newer style, encoded using DWARF, is
handled by the core of gdb.
This patch changes gdb to read the GNAT encodings in the DWARF reader
as well. This removes some code and unifies the two paths. As a
result, GNAT-encoded fixed-point now works a bit better.
One possible drawback of this change is that, if someone uses stabs,
then fixed-point might now stop working. I consider stabs to be fully
obsolete, though, so I don't intend to address this.
gdb/ChangeLog
2021-03-02 Tom Tromey <tromey@adacore.com>
* ada-lang.c (cast_from_gnat_encoded_fixed_point_type)
(cast_to_gnat_encoded_fixed_point_type): Remove.
(ada_value_cast, ada_evaluate_subexp): Update.
(gnat_encoded_fixed_point_type_info)
(ada_is_gnat_encoded_fixed_point_type)
(gnat_encoded_fixed_point_delta)
(gnat_encoded_fixed_point_scaling_factor): Remove.
* ada-lang.h (ada_is_gnat_encoded_fixed_point_type)
(gnat_encoded_fixed_point_delta)
(gnat_encoded_fixed_point_scaling_factor): Don't declare.
* ada-typeprint.c (print_gnat_encoded_fixed_point_type): Remove.
(ada_print_type): Update.
* ada-valprint.c (ada_value_print_num): Update.
* dwarf2/read.c (ada_get_gnat_encoded_number)
(ada_get_gnat_encoded_ratio): New functions.
(finish_fixed_point_type): Use them. Add parameters.
(GNAT_FIXED_POINT_SUFFIX): New define.
(gnat_encoded_fixed_point_type_info): New function.
(read_base_type): Handle gnat encodings.
gdb/testsuite/ChangeLog
2021-03-02 Tom Tromey <tromey@adacore.com>
* gdb.ada/fixed_points.exp: Remove most special cases for minimal
encodings.
2021-03-03 04:08:24 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (cast_from_gnat_encoded_fixed_point_type)
|
|
|
|
|
(cast_to_gnat_encoded_fixed_point_type): Remove.
|
|
|
|
|
(ada_value_cast, ada_evaluate_subexp): Update.
|
|
|
|
|
(gnat_encoded_fixed_point_type_info)
|
|
|
|
|
(ada_is_gnat_encoded_fixed_point_type)
|
|
|
|
|
(gnat_encoded_fixed_point_delta)
|
|
|
|
|
(gnat_encoded_fixed_point_scaling_factor): Remove.
|
|
|
|
|
* ada-lang.h (ada_is_gnat_encoded_fixed_point_type)
|
|
|
|
|
(gnat_encoded_fixed_point_delta)
|
|
|
|
|
(gnat_encoded_fixed_point_scaling_factor): Don't declare.
|
|
|
|
|
* ada-typeprint.c (print_gnat_encoded_fixed_point_type): Remove.
|
|
|
|
|
(ada_print_type): Update.
|
|
|
|
|
* ada-valprint.c (ada_value_print_num): Update.
|
|
|
|
|
* dwarf2/read.c (ada_get_gnat_encoded_number)
|
|
|
|
|
(ada_get_gnat_encoded_ratio): New functions.
|
|
|
|
|
(finish_fixed_point_type): Use them. Add parameters.
|
|
|
|
|
(GNAT_FIXED_POINT_SUFFIX): New define.
|
|
|
|
|
(gnat_encoded_fixed_point_type_info): New function.
|
|
|
|
|
(read_base_type): Handle gnat encodings.
|
|
|
|
|
|
2021-03-03 04:00:45 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_fold_name, ada_variant_discrim_name)
|
|
|
|
|
(ada_enum_name, scan_discrim_bound, to_fixed_range_type): Use
|
|
|
|
|
std::string.
|
|
|
|
|
(GROW_VECT): Remove.
|
|
|
|
|
(grow_vect): Remove.
|
|
|
|
|
|
2021-03-03 04:00:45 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.h (ada_lookup_symbol_list): Return a vector.
|
|
|
|
|
* ada-lang.c (resolve_subexp): Update.
|
|
|
|
|
(ada_resolve_function): Accept a vector.
|
|
|
|
|
(is_nonfunction, add_defn_to_vec)
|
|
|
|
|
(add_symbols_from_enclosing_procs): Likewise.
|
|
|
|
|
(num_defns_collected, defns_collected): Remove.
|
|
|
|
|
(remove_extra_symbols): Return a vector.
|
|
|
|
|
(remove_irrelevant_renamings): Return void.
|
|
|
|
|
(ada_add_local_symbols): Accept a vector.
|
|
|
|
|
(struct match_data) <obstackp>: Remove.
|
|
|
|
|
<resultp>: New member.
|
|
|
|
|
(aux_add_nonlocal_symbols): Update.
|
|
|
|
|
(ada_add_block_renamings, add_nonlocal_symbols)
|
|
|
|
|
(ada_add_all_symbols): Accept a vector.
|
|
|
|
|
(ada_lookup_symbol_list_worker, ada_lookup_symbol_list): Return a
|
|
|
|
|
vector.
|
|
|
|
|
(ada_lookup_symbol): Update.
|
|
|
|
|
(ada_add_block_symbols): Accept a vector.
|
|
|
|
|
(get_var_value, iterate_over_symbols): Update.
|
|
|
|
|
* ada-exp.y (block_lookup, write_var_or_type, write_name_assoc):
|
|
|
|
|
Update.
|
|
|
|
|
|
2021-03-03 04:00:45 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (resolve_subexp): Use any_of and erase-remove idiom.
|
|
|
|
|
|
2021-03-03 04:00:45 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (struct ada_symbol_cache) <cache_space>: Now an
|
|
|
|
|
auto_obstack.
|
|
|
|
|
<root>: Initialize.
|
|
|
|
|
(ada_pspace_data): Remove destructor.
|
|
|
|
|
<sym_cache>: Now a unique_ptr.
|
|
|
|
|
(ada_init_symbol_cache, ada_free_symbol_cache): Remove.
|
|
|
|
|
(ada_get_symbol_cache): Use 'new'.
|
|
|
|
|
(ada_clear_symbol_cache): Rewrite.
|
|
|
|
|
|
2021-03-03 02:57:01 +08:00
|
|
|
|
2021-03-02 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (add_nonlocal_symbols): Handle case where objfile->sf
|
|
|
|
|
is null.
|
|
|
|
|
|
2021-02-25 08:30:49 +08:00
|
|
|
|
2021-02-27 Lancelot Six <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/27393
|
|
|
|
|
* source.c (add_path): Skip empty dirnames.
|
|
|
|
|
|
2021-02-26 07:00:43 +08:00
|
|
|
|
2021-02-25 Kevin Buettner <kevinb@redhat.com>
|
2021-02-26 06:25:49 +08:00
|
|
|
|
|
|
|
|
|
* nat/aarch64-sve-linux-ptrace.h: Add comment regarding
|
|
|
|
|
include order for <sys/ptrace.h> and <asm/ptrace.h>.
|
|
|
|
|
|
gdb: relax assertion in target_mourn_inferior
As reported in PR 26861, when killing an inferior on macOS, we hit the
assert:
../../gdb-10.1/gdb/target.c:2149: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
This is because darwin_nat_target::kill passes a pid-only ptid to
target_mourn_inferior, with the pid of the current inferior:
target_mourn_inferior (ptid_t (inf->pid));
... which doesn't satisfy the assert in target_mourn_inferior:
gdb_assert (ptid == inferior_ptid);
The reason for this assertion is that target_mourn_inferior is a
prototype shared between GDB and GDBserver, so that shared code in
gdb/nat (used in both GDB and GDBserver) can call target_mourn_inferior.
In GDB's implementation, it is likely that some targets still rely on
inferior_ptid being set to "the current thread we are working on". So
until targets are completely decoupled from inferior_ptid (at least
their mourn_inferior implementations), we need to ensure the passed in
ptid matches inferior_ptid, to ensure the calling code called
target_mourn_inferior with the right global context.
However, I think the assert is a bit too restrictive. The
mourn_inferior operation works on an inferior, not a specific thread.
And by the time we call mourn_inferior, the threads of the inferior
don't exist anymore, the process is gone, so it doesn't really make
sense to require inferior_ptid to point a specific thread.
I looked at all the target_ops::mourn_inferior implementations, those
that read inferior_ptid only care about the pid field, which supports
the idea that only the inferior matters. Other implementations look at
the current inferior (call `current_inferior ()`).
I think it would make sense to change target_mourn_inferior to accept
only a pid rather than a ptid. It would then assert that the pid is the
same as the current inferior's pid. However, this would be a quite
involved change, so I'll keep it for later.
To fix the macOS issue immediately, I propose to relax the assert to
only compare the pids, as is done in this patch.
Another solution would obviously be to make darwin_nat_target::kill pass
inferior_ptid to target_mourn_inferior. However, the solution I propose
is more in line with where I think we want to go (passing a pid to
target_mourn_inferior).
gdb/ChangeLog:
PR gdb/26861
* target.c (target_mourn_inferior): Only compare pids in
target_mourn_inferior.
Change-Id: If2439ccc5aa67272ea16148a43c5362ef23fb2b8
2021-02-26 04:52:29 +08:00
|
|
|
|
2021-02-25 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/26861
|
|
|
|
|
* target.c (target_mourn_inferior): Only compare pids in
|
|
|
|
|
target_mourn_inferior.
|
|
|
|
|
|
2021-02-25 15:27:09 +08:00
|
|
|
|
2021-02-25 Jan Matyas <jmatyas@codasip.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26819
|
|
|
|
|
* remote.c (remote_target::start_remote): Ensure the single
|
|
|
|
|
thread, automatically added for remote targets without the
|
|
|
|
|
concept of threading, is initially in set to the "resumed"
|
|
|
|
|
state.
|
|
|
|
|
* remote.c (remote_target::add_current_inferior_and_thread):
|
|
|
|
|
Add return value - return the main thread.
|
|
|
|
|
|
2021-02-26 00:22:13 +08:00
|
|
|
|
2021-02-25 Jan Vrany <jan.vrany@labware.com>
|
|
|
|
|
|
|
|
|
|
* gdb/mi/mi-interp.c (mi_traceframe_changed): Remove trailing \n from output.
|
|
|
|
|
(mi_tsv_created): Likewise.
|
|
|
|
|
(mi_tsv_deleted): Likewise.
|
|
|
|
|
|
[gdb/symtab] Fix wrong unit_type Dwarf Error
When running test-case gdb.dwarf2/fission-mix.exp using gcc-11 (and using the
tentative fix for PR27353 to get past that assertion failure), I run into:
...
(gdb) file fission-mix^M
Reading symbols from fission-mix...^M
Dwarf Error: wrong unit_type in compilation unit header \
(is DW_UT_split_compile (0x05), should be DW_UT_type (0x02)) \
[in module fission-mix2.dwo]^M
(No debugging symbols found in fission-mix)^M
...
The compilation unit that is complained about is:
...
Contents of the .debug_info.dwo section (loaded from fission-mix2.dwo):
Compilation Unit @ offset 0x0:
Length: 0x57 (32-bit)
Version: 5
Unit Type: DW_UT_split_compile (5)
Abbrev Offset: 0x0
Pointer Size: 8
DWO ID: 0x3e3930d3cc1805df
<0><14>: Abbrev Number: 1 (DW_TAG_compile_unit)
...
And the dwarf error is triggered here in read_comp_unit_head:
...
case DW_UT_split_compile:
if (section_kind != rcuh_kind::COMPILE)
error (_("Dwarf Error: wrong unit_type in compilation unit header "
"(is %s, should be %s) [in module %s]"),
dwarf_unit_type_name (cu_header->unit_type),
dwarf_unit_type_name (DW_UT_type), filename);
break;
...
due to passing rcuh_kind::TYPE here in open_and_init_dwo_file:
...
create_debug_type_hash_table (per_objfile, dwo_file.get (),
&dwo_file->sections.info, dwo_file->tus,
rcuh_kind::TYPE);
...
Fix this by changing the section_kind argument to create_debug_type_hash_table
to rcuh_kind::COMPILE, to reflect that we're passing &dwo_file->sections.info
rather than &dwo_file->sections.types.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-02-25 Tom de Vries <tdevries@suse.de>
PR symtab/27354
* dwarf2/read.c (open_and_init_dwo_file): Use rcuh_kind::COMPILE as
section_kind for &dwo_file->sections.info.
2021-02-25 22:41:49 +08:00
|
|
|
|
2021-02-25 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27354
|
|
|
|
|
* dwarf2/read.c (open_and_init_dwo_file): Use rcuh_kind::COMPILE as
|
|
|
|
|
section_kind for &dwo_file->sections.info.
|
|
|
|
|
|
gdb/fortran: don't access non-existent type fields
When attempting to call a Fortran function for which there is no debug
information we currently trigger undefined behaviour in GDB by
accessing non-existent type fields.
The reason is that in order to prepare the arguments, for a call to a
Fortran function, we need to know the type of each argument. If the
function being called has no debug information then obviously GDB
doesn't know about the argument types and we should either give the
user an error or pick a suitable default. What we currently do is
just assume the field exist and access undefined memory, which is
clearly wrong.
The reason GDB needs to know the argument type is to tell if the
argument is artificial or not, artificial arguments will be passed by
value while non-artificial arguments will be passed by reference.
An ideal solution for this problem would be to allow the user to cast
the function to the correct type, we already do this to some degree
with the return value, for example:
(gdb) print some_func_ ()
'some_func_' has unknown return type; cast the call to its declared return type
(gdb) print (integer) some_func_ ()
$1 = 1
But if we could extend this to allow casting to the full function
type, GDB could figure out from the signature what are real
parameters, and what are artificial parameters. Maybe something like
this:
(gdb) print ((integer () (integer, double)) some_other_func_ (1, 2.3)
Alas, right now the Fortran expression parser doesn't seem to support
parsing function signatures, and we certainly don't have support for
figuring out real vs artificial arguments from a signature.
Still, I think we can prevent GDB from accessing undefined memory and
provide a reasonable default behaviour.
In this commit I:
- Only ask if the argument is artificial if the type of the argument
is actually known.
- Unknown arguments are assumed to be artificial and passed by
value (non-artificial arguments are pass by reference).
- If an artificial argument is prefixed with '&' by the user then we
treat the argument as pass-by-reference.
With these three changes we avoid undefined behaviour in GDB, and
allow the user, in most cases, to get a reasonably natural default
behaviour.
gdb/ChangeLog:
PR fortran/26155
* f-lang.c (fortran_argument_convert): Delete declaration.
(fortran_prepare_argument): New function.
(evaluate_subexp_f): Move logic to new function
fortran_prepare_argument.
gdb/testsuite/ChangeLog:
PR fortran/26155
* gdb.fortran/call-no-debug-func.f90: New file.
* gdb.fortran/call-no-debug-prog.f90: New file.
* gdb.fortran/call-no-debug.exp: New file.
2020-11-13 18:39:23 +08:00
|
|
|
|
2021-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
PR fortran/26155
|
|
|
|
|
* f-lang.c (fortran_argument_convert): Delete declaration.
|
|
|
|
|
(fortran_prepare_argument): New function.
|
|
|
|
|
(evaluate_subexp_f): Move logic to new function
|
|
|
|
|
fortran_prepare_argument.
|
|
|
|
|
|
2021-02-24 20:50:00 +08:00
|
|
|
|
2021-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (f77_keywords): Add 'associated'.
|
|
|
|
|
* f-lang.c (fortran_associated): New function.
|
|
|
|
|
(evaluate_subexp_f): Handle FORTRAN_ASSOCIATED.
|
|
|
|
|
(operator_length_f): Likewise.
|
|
|
|
|
(print_unop_or_binop_subexp_f): New function.
|
|
|
|
|
(print_subexp_f): Make use of print_unop_or_binop_subexp_f for
|
|
|
|
|
FORTRAN_ASSOCIATED, FORTRAN_LBOUND, and FORTRAN_UBOUND.
|
|
|
|
|
(dump_subexp_body_f): Handle FORTRAN_ASSOCIATED.
|
|
|
|
|
(operator_check_f): Likewise.
|
|
|
|
|
* std-operator.def: Add FORTRAN_ASSOCIATED.
|
|
|
|
|
|
2021-02-25 01:35:18 +08:00
|
|
|
|
2021-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (fortran_operators): Add ".xor.".
|
|
|
|
|
|
2021-02-25 06:58:42 +08:00
|
|
|
|
2021-02-24 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27336
|
|
|
|
|
* dwarf2/attribute.c (attribute::form_is_signed): New function
|
|
|
|
|
factored out of ...
|
|
|
|
|
* dwarf2/attribute.h (attribute::as_signed): ... here.
|
|
|
|
|
(attribute::is_nonnegative, attribute::as_nonnegative): New function.
|
|
|
|
|
(attribute::form_is_signed): Declare.
|
|
|
|
|
* dwarf2/read.c (new_symbol): Use is_nonnegative and as_nonnegative
|
|
|
|
|
for DW_AT_decl_file.
|
|
|
|
|
|
2021-02-25 05:35:07 +08:00
|
|
|
|
2021-02-24 Kevin Buettner <kevinb@redhat.com>
|
|
|
|
|
|
|
|
|
|
* nat/aarch64-linux-hw-point.c: Add comment regarding include
|
|
|
|
|
order for <sys/ptrace.h> and <asm/ptrace.h>.
|
|
|
|
|
|
2021-02-25 02:48:04 +08:00
|
|
|
|
2021-02-24 Kevin Buettner <kevinb@redhat.com>
|
|
|
|
|
|
|
|
|
|
* nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
|
|
|
|
|
<sys/ptrace.h>.
|
|
|
|
|
|
2021-02-20 01:39:18 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* exec.c (set_section_command): Move variable declarations into
|
|
|
|
|
the function body, and use std::string instead of a fixed size
|
|
|
|
|
buffer.
|
|
|
|
|
|
gdb: move get_section_table from exec_target to dummy_target
The only target that implements target_ops::get_section_table in a
meaningful way is exec_target. This target calls back into the
program space to return the current global section_table.
The global section table is populated whenever the user provides GDB
with an executable, or when a symbol file is loaded, e.g. when a
dynamic library is loaded, or when the user does add-symbol-file.
I recently ran into a situation where a user, debugging a remote
target, was not supplying GDB with a main executable at all. Instead
the user attached to the target then did add-symbol-file, and then
proceeded to debug the target.
This works fine, but it was noticed that even when
trust-readonly-sections was on GDB was still accessing the target to
get the contents of readonly sections.
The problem is that by not providing an executable there was no
exec_target in the target stack, and so when GDB calls the
target_ops::get_section_table function GDB ends up in
dummy_target::get_section_table, which just returns NULL.
What I want is that even when GDB doesn't have an exec_target in the
target stack, a call to target_ops::get_section_table will still
return the section_table from the current program space.
When considering how to achieve this my first though was, why is the
request for the section table going via the target stack at all? The
set of sections loaded is a property of the program space, not the
target. This is, after all, why the data is being stored in the
program space.
So I initially tried changing target_get_section_table so that,
instead of calling into the target it just returns
current_program_space->target_sections ().
This would be fine except for one issue, target_bfd (from
bfd-target.c). This code is used from solib-svr4.c to create a
temporary target_ops structure that implements two functions
target_bfd::xfer_partial and target_bfd::get_section_table.
The purpose behind the code is to enable two targets, ppc64 and frv to
decode function descriptors from the dynamic linker, based on the
non-relocated addresses from within the dynamic linker bfd object.
Both of the implemented functions in target_bfd rely on the target_bfd
object holding a section table, and the ppc64 target requires that the
target_bfd implement ::get_section_table.
The frv target doesn't require ::get_section_table, instead it
requires the ::xfer_partial. We could in theory change the ppc64
target to use the same approach as frv, however, this would be a bad
idea. I believe that the frv target approach is broken. I'll
explain:
The frv target calls get_target_memory_unsigned to read the function
descriptor. The address being read is the non-relocated address read
from the dynamic linker in solib-srv4.c:enable_break. Calling
get_target_memory_unsigned eventually ends up in target_xfer_partial
with an object type of TARGET_OBJECT_RAW_MEMORY. This will then call
memory_xfer_check_region. I believe that it is quite possible that a
the non-relocated addresses pulled from the dynamic linker could be in
a memory region that is not readable, while the relocated addresses
are in a readable memory region. If this was ever the case for the
frv target then GDB would reject the attempt to read the non-relocated
function pointer.
In contrast the ppc64 target calls target_section_by_addr, which calls
target_get_section_table, which then calls the ::get_section_table
function on the target.
Thus, when reflecting on target_bfd we see two functions,
::xfer_partial and ::get_section_table. The former is required by the
frv target, but that target is (I think) potentially broken. While
the latter is required by the ppc64 target, but this forces
::get_section_table to exist as a target_ops member function.
So my original plan, have target_get_section_table NOT call a
target_ops member function appears to be flawed.
My next idea was to remove exec_target::get_section_table, and instead
move the implementation into dummy_target::get_section_table.
Currently the dummy_target implementation always returns NULL
indicating no section table, but plenty of other dummy_target member
functions do more than just return null values.
So now, dummy_target::get_section_table returns the section table from
the current program space. This allows target_bfd to remain
unchanged, so ppc64 and frv should not be affected.
Making this change removes the requirement for the user to provide an
executable, GDB can now always access the section_table, as the
dummy_target always exists in the target stack.
Finally, there's a test that the target_section table is not empty in
the case where the user does add-symbol-file without providing an
executable.
gdb/ChangeLog:
* exec.c (exec_target::get_section_table): Delete member function.
(section_table_read_available_memory): Use current_top_target, not
just the exec_ops target.
* target-delegates.c: Regenerate.
* target.c (default_get_section_table): New function.
* target.h (target_ops::get_section_table): Change default
behaviour to call default_get_section_table.
(default_get_section_table): Declare.
2021-02-12 19:39:31 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* exec.c (exec_target::get_section_table): Delete member function.
|
|
|
|
|
(section_table_read_available_memory): Use current_top_target, not
|
|
|
|
|
just the exec_ops target.
|
|
|
|
|
* target-delegates.c: Regenerate.
|
|
|
|
|
* target.c (default_get_section_table): New function.
|
|
|
|
|
* target.h (target_ops::get_section_table): Change default
|
|
|
|
|
behaviour to call default_get_section_table.
|
|
|
|
|
(default_get_section_table): Declare.
|
|
|
|
|
|
2021-02-12 20:06:15 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* exec.c (exec_target::close): Call new clear_target_sections
|
|
|
|
|
function.
|
|
|
|
|
(program_space::add_target_sections): Update name of member
|
|
|
|
|
variable.
|
|
|
|
|
(program_space::add_target_sections): Update name of member
|
|
|
|
|
variable.
|
|
|
|
|
(program_space::remove_target_sections): Likewise.
|
|
|
|
|
(exec_one_fork): Use new target_sections member function.
|
|
|
|
|
(exec_target::get_section_table): Likewise.
|
|
|
|
|
(exec_target::files_info): Likewise.
|
|
|
|
|
(set_section_command): Likewise.
|
|
|
|
|
(exec_set_section_address): Likewise.
|
|
|
|
|
(exec_target::has_memory): Use new target_sections member
|
|
|
|
|
function.
|
|
|
|
|
* progspace.h (program_space::clear_target_sections): New member
|
|
|
|
|
function.
|
|
|
|
|
(program_space::target_sections): Rename member variable to
|
|
|
|
|
m_target_sections, replace with a new member function.
|
|
|
|
|
(program_space::m_target_sections): New member variable.
|
|
|
|
|
* solib-dsbt.c (scan_dyntag): Use new member function.
|
|
|
|
|
* solib-svr4.c (scan_dyntag): Likewise.
|
|
|
|
|
|
2021-02-12 19:39:23 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* gdb/bfd-target.c (class target_bfd) <get_section_table>: Make
|
|
|
|
|
return type const.
|
|
|
|
|
* gdb/exec.c (struct exec_target) <get_section_table>: Likewise.
|
|
|
|
|
(section_table_read_available_memory): Make local const.
|
|
|
|
|
(exec_target::xfer_partial): Make local const.
|
|
|
|
|
(print_section_info): Make parameter const.
|
|
|
|
|
* gdb/exec.h (print_section_info): Likewise.
|
|
|
|
|
* gdb/ppc64-tdep.c (ppc64_convert_from_func_ptr_addr): Make local
|
|
|
|
|
const.
|
|
|
|
|
* gdb/record-btrace.c (record_btrace_target::xfer_partial):
|
|
|
|
|
Likewise.
|
|
|
|
|
* gdb/remote.c (remote_target::remote_xfer_live_readonly_partial):
|
|
|
|
|
Likewise.
|
|
|
|
|
* gdb/s390-tdep.c (s390_load): Likewise.
|
|
|
|
|
* gdb/solib-dsbt.c (scan_dyntag): Likewise.
|
|
|
|
|
* gdb/solib-svr4.c (scan_dyntag): Likewise.
|
|
|
|
|
* gdb/target-debug.h (target_debug_print_target_section_table_p):
|
|
|
|
|
Rename to...
|
|
|
|
|
(target_debug_print_const_target_section_table_p): ...this.
|
|
|
|
|
* gdb/target-delegates.c: Regenerate.
|
|
|
|
|
* gdb/target.c (target_get_section_table): Make return type const.
|
|
|
|
|
(target_section_by_addr): Likewise. Also make some locals const.
|
|
|
|
|
(memory_xfer_partial_1): Make some locals const.
|
|
|
|
|
* gdb/target.h (struct target_ops) <get_section_table>: Make
|
|
|
|
|
return type const.
|
|
|
|
|
(target_section_by_addr): Likewise.
|
|
|
|
|
(target_get_section_table): Likewise.
|
|
|
|
|
|
2021-02-13 00:10:56 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* NEWS: Mention new 'maint info target-sections' command.
|
|
|
|
|
* maint.c (maintenance_info_target_sections): New function.
|
|
|
|
|
(_initialize_maint_cmds): Register new command.
|
|
|
|
|
|
2021-02-05 02:34:13 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* riscv-tdep.c (riscv_features_from_gdbarch_info): Rename to...
|
|
|
|
|
(riscv_features_from_bfd): ...this. Change parameter type to
|
|
|
|
|
'bfd*', and update as required.
|
|
|
|
|
(riscv_find_default_target_description): Update call to
|
|
|
|
|
riscv_features_from_bfd. Select a default xlen based on
|
|
|
|
|
info.bfd_arch_info.
|
|
|
|
|
(riscv_gdbarch_init): Update call to riscv_features_from_bfd.
|
|
|
|
|
|
gdb: call value_ind for pointers to dynamic types in UNOP_IND evaluation
When evaluating and expression containing UNOP_IND in mode
EVAL_AVOID_SIDE_EFFECTS, GDB currently (mostly) returns the result of
a call to value_zero meaning we get back an object with the correct
type, but its contents are all zero.
If the target type contains fields with dynamic type then in order to
resolve these dynamic fields GDB will need to read the value of the
field from within the parent object. In this case the field value
will be zero as a result of the call to value_zero mentioned above.
The idea behind EVAL_AVOID_SIDE_EFFECTS is to avoid the chance that
doing something like `ptype` will modify state within the target, for
example consider: ptype i++.
However, there is already precedence within GDB that sometimes, in
order to get accurate type results, we can't avoid reading from the
target, even when EVAL_AVOID_SIDE_EFFECTS is in effect. For example I
would point to eval.c:evaluate_var_value, the handling of OP_REGISTER,
the handling of value_x_unop in many places. I believe the Ada
expression evaluator also ignore EVAL_AVOID_SIDE_EFFECTS in some
cases.
I am therefor proposing that, in the case where a pointer points at a
dynamic type, we allow UNOP_IND to perform the actual indirection.
This allows accurate types to be displayed in more cases.
gdb/ChangeLog:
* eval.c (evaluate_subexp_standard): Call value_ind for points to
dynamic types in UNOP_IND.
gdb/testsuite/ChangeLog:
* gdb.fortran/pointer-to-pointer.exp: Additional tests.
2021-01-08 22:00:45 +08:00
|
|
|
|
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* eval.c (evaluate_subexp_standard): Call value_ind for points to
|
|
|
|
|
dynamic types in UNOP_IND.
|
|
|
|
|
|
gdb/dwarf: create and destroy dwarf2_per_bfd's CUs-to-expand queue
As described in the log of patch "gdb/dwarf: add assertion in
maybe_queue_comp_unit", it would happen that a call to
maybe_queue_comp_unit would enqueue a CU in the to-expand queue while
nothing up the stack was processing the queue. This is not desirable,
as items are then left lingering in the queue when we exit the
dwarf2/read code. This is an inconsistent state.
The normal case of using the queue is when we go through
dw2_do_instantiate_symtab and process_queue. As depended-on CUs are
found, they get added to the queue. process_queue expands CUs until the
queue is empty.
To catch these cases where things are enqueued while nothing up the
stack is processing the queue, change dwarf2_per_bfd::queue to be an
optional. The optional is instantiated in dwarf2_queue_guard, just
before where we call process_queue. In the dwarf2_queue_guard
destructor, the optional gets reset. Therefore, the queue object is
instantiated only when something up the stack is handling it. If
another entry point tries to enqueue a CU for expansion, an assertion
will fail and we know we have something to fix.
dwarf2_queue_guard sounds like the good place for this, as it's
currently responsible for making sure the queue gets cleared if we exit
due to an error.
This also allows asserting that when age_comp_units or remove_all_cus
run, the queue is not instantiated, and gives us one more level of
assurance that we won't free the DIEs of a CU that is in the
CUs-to-expand queue.
gdb/ChangeLog:
PR gdb/26828
* dwarf2/read.c (dwarf2_queue_guard) <dwarf2_queue_guard>:
Instantiate queue.
(~dwarf2_queue_guard): Clear queue.
(queue_comp_unit): Assert that queue is
instantiated.
(process_queue): Adjust.
* dwarf2/read.h (struct dwarf2_per_bfd) <queue>: Make optional.
Change-Id: I8fe3d77845bb4ad3d309eac906acebe79d9f0a9d
2021-02-24 02:37:44 +08:00
|
|
|
|
2021-02-23 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/26828
|
|
|
|
|
* dwarf2/read.c (dwarf2_queue_guard) <dwarf2_queue_guard>:
|
|
|
|
|
Instantiate queue.
|
|
|
|
|
(~dwarf2_queue_guard): Clear queue.
|
|
|
|
|
(queue_comp_unit): Assert that queue is
|
|
|
|
|
instantiated.
|
|
|
|
|
(process_queue): Adjust.
|
|
|
|
|
* dwarf2/read.h (struct dwarf2_per_bfd) <queue>: Make optional.
|
|
|
|
|
|
gdb/dwarf: don't enqueue CU in maybe_queue_comp_unit if already expanded
The previous commit log described how items could be left lingering in
the dwarf2_per_bfd::queue and how that could cause trouble.
This patch fixes the issue by changing maybe_queue_comp_unit so that it
doesn't put a CU in the to-expand queue if that CU is already expanded.
This will make it so that when dwarf2_fetch_die_type_sect_off calls
follow_die_offset and maybe_queue_comp_unit, it won't enqueue the target
CU, because it will see the CU is already expanded.
This assumes that if a CU is dwarf2_fetch_die_type_sect_off's target CU,
it will have previously been expanded. I think it is the case, but I
can't be 100% sure. If that's not true, the assertions added in the
following patch will catch it, and it means we'll have to re-think a bit
more how things work (it wouldn't be well handled at all today anyway).
This fixes something else in maybe_queue_comp_unit that looks wrong.
Imagine the DIEs of a CU are loaded in memory, but that CU is not
expanded. In that case, maybe_queue_comp_unit will use this early
return:
/* If the compilation unit is already loaded, just mark it as
used. */
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
if (cu != nullptr)
{
cu->last_used = 0;
return 0;
}
... so the CU won't be queued for expansion. Whether the DIEs of a CU
are loaded in memory and whether that CU is expanded are two orthogonal
things, but that function appears to mix them. So, move the queuing
above that check / early return, so that if the CU's DIEs are loaded in
memory but the CU is not expanded yet, it gets enqueued.
I tried to improve maybe_queue_comp_unit's documentation to clarify what
the return value means. By clarifying this, I noticed that two callers
(follow_die_offset and follow_die_sig_1) access the CU's DIEs after
calling maybe_queue_comp_unit, only relying on maybe_queue_comp_unit's
return value to tell whether DIEs need to be loaded first or not. As
explained in the new comment, this is problematic:
maybe_queue_comp_unit's return value doesn't tell whether DIEs are
currently loaded, it means whether maybe_queue_comp_unit requires the
caller to load them. If the CU is already expanded but the DIEs to have
been freed, maybe_queue_comp_unit returns 0, meaning "I don't need you
to load the DIEs". So if these two functions (follow_die_offset and
follow_die_sig_1) need to access the DIEs in any case, for their own
usage, they should make sure to load them if they are not loaded
already. I therefore added an extra check to the condition they use,
making it so they will always load the DIEs if they aren't already.
From what I found, other callers don't care for the CU's DIEs, they call
maybe_queue_comp_unit to ensure the CU gets expanded eventually, but
don't care for it after that.
gdb/ChangeLog:
PR gdb/26828
* dwarf2/read.c (maybe_queue_comp_unit): Check if CU is expanded
to decide whether or not to enqueue it for expansion.
(follow_die_offset, follow_die_sig_1): Ensure we load the DIEs
after calling maybe_queue_comp_unit.
Change-Id: Id98c6b60669f4b4b21b9be16d0518fc62bdf686a
2021-02-24 01:07:10 +08:00
|
|
|
|
2021-02-23 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/26828
|
|
|
|
|
* dwarf2/read.c (maybe_queue_comp_unit): Check if CU is expanded
|
|
|
|
|
to decide whether or not to enqueue it for expansion.
|
|
|
|
|
(follow_die_offset, follow_die_sig_1): Ensure we load the DIEs
|
|
|
|
|
after calling maybe_queue_comp_unit.
|
|
|
|
|
|
2021-02-23 23:56:41 +08:00
|
|
|
|
2021-02-23 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* linux-nat.c (linux_nat_filter_event): Return void.
|
|
|
|
|
|
2021-02-23 00:47:37 +08:00
|
|
|
|
2021-02-22 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* solib-svr4.c (enable_break): Update.
|
|
|
|
|
* bfd-target.c (class target_bfd) <target_bfd>: Change parameter
|
|
|
|
|
type.
|
|
|
|
|
(target_bfd_reopen): Change parameter type.
|
|
|
|
|
* bfd-target.h (target_bfd_reopen): Change parameter type.
|
|
|
|
|
|
2021-02-23 00:42:03 +08:00
|
|
|
|
2021-02-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* thread.c (add_thread_silent): Add assert.
|
|
|
|
|
(find_thread_ptid): Add assert.
|
|
|
|
|
|
gdb: push target earlier in procfs_target::attach (PR 27435)
Since this is a GDB 9 -> 10 regression, I would like to push it to
gdb-10-branch.
This is a follow-up to:
https://sourceware.org/pipermail/gdb-patches/2021-February/176202.html
This patch fixes a segfault seen when attaching to a process on Solaris.
The steps leading to the segfault are:
- procfs_target::attach calls do_attach, at this point the inferior's
process slot in the target stack is empty.
- do_attach adds a thread with `add_thread (&the_procfs_target, ptid)`
- in add_thread_silent, the passed target (&the_procfs_target) is
passed to find_inferior_ptid
- find_inferior_ptid returns nullptr, as there is no inferior with this
ptid that has &the_procfs_target as its process target
- the nullptr `inf` is passed to find_thread_ptid, which dereferences
it, causing a segfault
- back in procfs_target::attach, after do_attach, we push the
the_procfs_target on the inferior's target stack, although we never
reach this because the segfault happens before.
To fix this, I think we need to do the same as is done in
inf_ptrace_target::attach: push the target early and unpush it in case
the attach fails (and keep it if the attach succeeds).
Implement it by moving target_unpush_up to target.h, so it can be
re-used here. Make procfs_target::attach use it. Note that just like
is mentioned in inf_ptrace_target::attach, we should push the target
before calling target_pid_to_str, so that calling target_pid_to_str ends
up in procfs_target::pid_to_str.
Tested by trying to attach on a process on gcc211 on the gcc compile
farm.
gdb/ChangeLog:
PR gdb/27435
* inf-ptrace.c (struct target_unpusher): Move to target.h.
(target_unpush_up): Likewise.
* procfs.c (procfs_target::attach): Push target early. Use
target_unpush_up to unpush target in case of error.
* target.h (struct target_unpusher): Move here.
(target_unpush_up): Likewise.
Change-Id: I88aff8b20204e1ca1d792e27ac6bc34fc1aa0d52
2021-02-23 00:41:32 +08:00
|
|
|
|
2021-02-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/27435
|
|
|
|
|
* inf-ptrace.c (struct target_unpusher): Move to target.h.
|
|
|
|
|
(target_unpush_up): Likewise.
|
|
|
|
|
* procfs.c (procfs_target::attach): Push target early. Use
|
|
|
|
|
target_unpush_up to unpush target in case of error.
|
|
|
|
|
* target.h (struct target_unpusher): Move here.
|
|
|
|
|
(target_unpush_up): Likewise.
|
|
|
|
|
|
2021-02-19 13:46:58 +08:00
|
|
|
|
2021-02-19 Kevin Buettner <kevinb@redhat.com>
|
|
|
|
|
|
|
|
|
|
* nat/amd64-linux-siginfo.c: Include "gdbsupport/common-defs.h"
|
|
|
|
|
(which in turn includes <gnulib/config.h>) before include
|
|
|
|
|
of <signal.h>.
|
|
|
|
|
|
2021-01-26 18:02:38 +08:00
|
|
|
|
2021-02-19 Nelson Chu <nelson.chu@sifive.com>
|
|
|
|
|
|
|
|
|
|
PR 27158
|
|
|
|
|
* riscv-tdep.c (decode_ci_type_insn): Updated encoding macros.
|
|
|
|
|
(decode_j_type_insn): Likewise.
|
|
|
|
|
(decode_cj_type_insn): Likewise.
|
|
|
|
|
(decode_b_type_insn): Likewise.
|
|
|
|
|
(decode): Likewise.
|
|
|
|
|
|
2021-02-19 02:23:33 +08:00
|
|
|
|
2021-02-18 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* expression.h (struct expression) <evaluate>: Declare method.
|
|
|
|
|
* eval.c (evaluate_subexp): Simplify.
|
|
|
|
|
(expression::evaluate): New method.
|
|
|
|
|
(evaluate_expression, evaluate_type): Use expression::evaluate.
|
|
|
|
|
|
Fix completion related libstdc++ assert when using -D_GLIBCXX_DEBUG
This commit fixes a libstdc++ assertion failure encountered when
running gdb.base/completion.exp. In order to see this problem,
GDB must be built with the follow CFLAGS and CXXFLAGS as part
of the configure line:
CFLAGS='-D_GLIBCXX_DEBUG' CXXFLAGS='-D_GLIBCXX_DEBUG'
(Also, this problem was encountered using Fedora rawhide. It might
not be reproducible in Fedora versions prior to Fedora 34.)
Using the gdb.base/completion.exp test program, the problem can be
observed as follows:
[kev@rawhide-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/completion/completion
Reading symbols from testsuite/outputs/gdb.base/completion/completion...
(gdb) start
Temporary breakpoint 1 at 0x401179: file ../../worktree-master/gdb/testsuite/gdb.base/break.c, line 43.
Starting program: testsuite/outputs/gdb.base/completion/completion
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd718, envp=0x7fffffffd728) at ../../worktree-master/gdb/testsuite/gdb.base/break.c:43
43 if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
(gdb) p <TAB>/usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed.
Aborted (core dumped)
(Note that I added "<TAB>" to make it clear where the tab key was
pressed.)
gdb/ChangeLog:
* ada-lang.c (ada_fold_name): Check for non-empty string prior
to accessing it.
(ada_lookup_name_info): Likewise.
2021-02-13 08:53:51 +08:00
|
|
|
|
2021-02-17 Kevin Buettner <kevinb@redhat.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_fold_name): Check for non-empty string prior
|
|
|
|
|
to accessing it.
|
|
|
|
|
(ada_lookup_name_info): Likewise.
|
|
|
|
|
|
2021-02-07 08:24:29 +08:00
|
|
|
|
2021-02-13 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* aclocal.m4: Regenerate.
|
|
|
|
|
|
[gdb/threads] Fix lin_thread_get_thread_signals for glibc 2.28
When running test-case gdb.threads/create-fail.exp on openSUSE Factory
(with glibc version 2.32) I run into:
...
(gdb) continue
Continuing.
[New Thread 0x7ffff7c83700 (LWP 626354)]
[New Thread 0x7ffff7482700 (LWP 626355)]
[Thread 0x7ffff7c83700 (LWP 626354) exited]
[New Thread 0x7ffff6c81700 (LWP 626356)]
[Thread 0x7ffff7482700 (LWP 626355) exited]
[New Thread 0x7ffff6480700 (LWP 626357)]
[Thread 0x7ffff6c81700 (LWP 626356) exited]
[New Thread 0x7ffff5c7f700 (LWP 626358)]
[Thread 0x7ffff6480700 (LWP 626357) exited]
pthread_create: 22: Invalid argument
Thread 6 "create-fail" received signal SIG32, Real-time event 32.
[Switching to Thread 0x7ffff5c7f700 (LWP 626358)]
0x00007ffff7d87695 in clone () from /lib64/libc.so.6
(gdb) FAIL: gdb.threads/create-fail.exp: iteration 1: run till end
...
The problem is that glibc-internal signal SIGCANCEL is not recognized by gdb.
There's code in check_thread_signals that is supposed to take care of that,
but it's not working because this code in lin_thread_get_thread_signals has
stopped working:
...
/* NPTL reserves the first two RT signals, but does not provide any
way for the debugger to query the signal numbers - fortunately
they don't change. */
sigaddset (set, __SIGRTMIN);
sigaddset (set, __SIGRTMIN + 1);
...
Since glibc commit d2dc5467c6 "Filter out NPTL internal signals (BZ #22391)"
(first released as part of glibc 2.28), a sigaddset with a glibc-internal
signal has no other effect than setting errno to EINVALID.
Fix this by eliminating the usage of sigset_t in check_thread_signals and
lin_thread_get_thread_signals.
The same problem was observed on Ubuntu 20.04.
Tested on x86_64-linux, openSUSE Factory.
Tested on aarch64-linux, Ubuntu 20.04 and Ubuntu 18.04.
gdb/ChangeLog:
2021-02-12 Tom de Vries <tdevries@suse.de>
PR threads/26228
* linux-nat.c (lin_thread_get_thread_signals): Remove.
(lin_thread_signals): New static var.
(lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
New function.
* linux-nat.h (lin_thread_get_thread_signals): Remove.
(lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
Declare.
* linux-thread-db.c (check_thread_signals): Use
lin_thread_get_thread_signal_num and lin_thread_get_thread_signal.
2021-02-13 03:12:37 +08:00
|
|
|
|
2021-02-12 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR threads/26228
|
|
|
|
|
* linux-nat.c (lin_thread_get_thread_signals): Remove.
|
|
|
|
|
(lin_thread_signals): New static var.
|
|
|
|
|
(lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
|
|
|
|
|
New function.
|
|
|
|
|
* linux-nat.h (lin_thread_get_thread_signals): Remove.
|
|
|
|
|
(lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
|
|
|
|
|
Declare.
|
|
|
|
|
* linux-thread-db.c (check_thread_signals): Use
|
|
|
|
|
lin_thread_get_thread_signal_num and lin_thread_get_thread_signal.
|
|
|
|
|
|
2021-02-11 21:34:06 +08:00
|
|
|
|
2021-02-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (f77_keywords): Add allocated.
|
|
|
|
|
* f-lang.c (evaluate_subexp_f): Handle UNOP_FORTRAN_ALLOCATED.
|
|
|
|
|
(operator_length_f): Likewise.
|
|
|
|
|
(print_subexp_f): Likewise.
|
|
|
|
|
(dump_subexp_body_f): Likewise.
|
|
|
|
|
(operator_check_f): Likewise.
|
|
|
|
|
* std-operator.def (UNOP_FORTRAN_ALLOCATED): New operator.
|
|
|
|
|
|
2021-02-12 04:03:03 +08:00
|
|
|
|
2021-02-11 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27353
|
|
|
|
|
* dwarf2/attribute.c (attribute::form_requires_reprocessing):
|
|
|
|
|
Return true for DW_FORM_strx.
|
|
|
|
|
|
2021-02-11 23:27:46 +08:00
|
|
|
|
2021-02-11 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/27383:
|
|
|
|
|
* parse.c (write_exp_symbol_reference): Write sym.block.
|
|
|
|
|
|
gdb: change 'maint info section' to use command options
The 'maintenance info sections' command currently takes a list of
filters on the command line. It can also accept the magic string
'ALLOBJ' which acts more like a command line flag, telling the command
to print information about all objfiles.
The manual has this to say about the options and filters:
... In addition, 'maint info sections' provides the following
command options (which may be arbitrarily combined): ...
Implying (to me at least) that I can do this:
(gdb) maint info sections ALLOBJ READONLY
to list all the read-only sections from all currently loaded object
files.
Unfortunately, this doesn't work. The READONLY filter will work, but
ALLOBJ will not be detected correctly.
It would be fairly simple to fix the ALLOBJ detection. However, I
dislike this mixing of command options (ALLOBJ) with command data (the
filters, e.g. READONLY, etc).
As this is a maintenance command, so not really intended for end
users, I think we can be a little more aggressive in "fixing" the
option parsing. So that's what I do in this commit.
The ALLOBJ mechanism is replaced with a real command
option (-all-objects). The rest of the command operates just as
before. The example above would now become:
(gdb) maint info sections -all-objects READONLY
The manual has been updated, and I added a NEWS entry to document the
change.
gdb/ChangeLog:
* NEWS: Mention changes to 'maint info sections'.
* maint.c (match_substring): Return a bool, fix whitespace issue.
(struct single_bfd_flag_info): New struct.
(bfd_flag_info): New static global.
(match_bfd_flags): Return a bool, use bfd_flag_info.
(print_bfd_flags): Use bfd_flag_info.
(maint_print_section_info): Delete trailing whitespace.
(struct maint_info_sections_opts): New struct.
(maint_info_sections_option_defs): New static global.
(maint_info_sections_completer): New function.
(maintenance_info_sections): Use option parsing mechanism.
(_initialize_maint_cmds): Register command completer.
gdb/doc/ChangeLog:
* gdb.texinfo (Files): Update documentation for 'maint info
sections'.
gdb/testsuite/ChangeLog:
* gdb.base/maint-info-sections.exp: Update expected output, and
add additional tests. Again.
2021-02-05 21:51:34 +08:00
|
|
|
|
2021-02-11 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* NEWS: Mention changes to 'maint info sections'.
|
|
|
|
|
* maint.c (match_substring): Return a bool, fix whitespace issue.
|
|
|
|
|
(struct single_bfd_flag_info): New struct.
|
|
|
|
|
(bfd_flag_info): New static global.
|
|
|
|
|
(match_bfd_flags): Return a bool, use bfd_flag_info.
|
|
|
|
|
(print_bfd_flags): Use bfd_flag_info.
|
|
|
|
|
(maint_print_section_info): Delete trailing whitespace.
|
|
|
|
|
(struct maint_info_sections_opts): New struct.
|
|
|
|
|
(maint_info_sections_option_defs): New static global.
|
|
|
|
|
(maint_info_sections_completer): New function.
|
|
|
|
|
(maintenance_info_sections): Use option parsing mechanism.
|
|
|
|
|
(_initialize_maint_cmds): Update command help text for 'maint info
|
|
|
|
|
sections' and register a command completer.
|
|
|
|
|
|
gdb: 'maint info sections' - handle the no executable case
The 'maint info sections' command is split into two blocks or work,
first if there's an executable then the sections from the executable,
and optionally all other loaded object files are printed. Then all
the sections from any core file are printed.
I ran into a situation where (for various reasons) I wasn't using a
main executable. Instead I connected to a remote target and used
add-symbol-file. This allowed me to debug an image that was already
loaded on the remote system.
Unfortunately, when I tried to use 'maint info sections' I saw
nothing. The reason is that the loop over all object files is hidden
behind a check that we have a main executable.
This commit removes this check and merges together some duplicate
code. I also (I think) made the output of this command cleaner.
Here is the original output of 'maint info sections':
Exec file:
`/tmp/hello.x', file type elf64-x86-64.
[0] 0x004002a8->0x004002c4 at 0x000002a8: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x004002c4->0x004002e8 at 0x000002c4: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
And my modified output:
Exec file: `/home/andrew/tmp/hello.x', file type elf64-x86-64.
[0] 0x004002a8->0x004002c4 at 0x000002a8: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x004002c4->0x004002e8 at 0x000002c4: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
The forced newline after 'Exec file: ' has been removed. This is now
a wrap point (in case the filename is very long).
Here is the original output of 'maint info sections ALLOBJ':
Exec file:
`/tmp/hello.x', file type elf64-x86-64.
Object file: /tmp/hello.x
[0] 0x004002a8->0x004002c4 at 0x000002a8: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x004002c4->0x004002e8 at 0x000002c4: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
Object file: /lib64/ld-linux-x86-64.so.2
[0] 0x7ffff7fd12a8->0x7ffff7fd12c8 at 0x000002a8: .note.gnu.property ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x7ffff7fd12c8->0x7ffff7fd12ec at 0x000002c8: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
And my modified output:
Exec file: `/tmp/hello.x', file type elf64-x86-64.
[0] 0x004002a8->0x004002c4 at 0x000002a8: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x004002c4->0x004002e8 at 0x000002c4: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
Object file: `/lib64/ld-linux-x86-64.so.2', file type elf64-x86-64.
[0] 0x7ffff7fd12a8->0x7ffff7fd12c8 at 0x000002a8: .note.gnu.property ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x7ffff7fd12c8->0x7ffff7fd12ec at 0x000002c8: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
The executable now only gets a single header line. The header line
for the additional object files is no longer indented as it was
before, and the line is laid out in a similar style to the main
executable line (with quotes and file type information).
And of course, the biggest change. If GDB is started with no
executable, but then the user does 'add-symbol-file ....' followed by
'maint info sections ALLOBJ', previously they got nothing, now they
get:
Object file: `/tmp/hello.x', file type elf64-x86-64.
[0] 0x004002a8->0x004002c4 at 0x000002a8: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x004002c4->0x004002e8 at 0x000002c4: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
...
gdb/ChangeLog:
* maint.c (print_bfd_section_info_maybe_relocated): Delete,
functionality merged into...
(maint_print_all_sections): ...this new function.
(maintenance_info_sections): Make use of maint_print_all_sections,
allow all objects to be printed even where there's no executable.
gdb/testsuite/ChangeLog:
* gdb.base/maint-info-sections.exp: Update expected output, and
add additional tests.
2021-02-05 19:16:31 +08:00
|
|
|
|
2021-02-11 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* maint.c (print_bfd_section_info_maybe_relocated): Delete,
|
|
|
|
|
functionality merged into...
|
|
|
|
|
(maint_print_all_sections): ...this new function.
|
|
|
|
|
(maintenance_info_sections): Make use of maint_print_all_sections,
|
|
|
|
|
allow all objects to be printed even where there's no executable.
|
|
|
|
|
|
2021-02-10 23:07:04 +08:00
|
|
|
|
2021-02-11 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* breakpoint.c (resolve_sal_pc): Make use of
|
|
|
|
|
bound_minimal_symbol::obj_section.
|
|
|
|
|
* maint.c (maintenance_translate_address): Likewise.
|
|
|
|
|
* minsyms.c (minimal_symbol_upper_bound): Likewise.
|
|
|
|
|
* minsyms.h (struct bound_minimal_symbol) <obj_section>: New
|
|
|
|
|
member function.
|
|
|
|
|
* printcmd.c (info_address_command): Make use of
|
|
|
|
|
bound_minimal_symbol::obj_section.
|
|
|
|
|
|
2021-02-10 10:08:47 +08:00
|
|
|
|
2021-02-11 Alan Modra <amodra@gmail.com>
|
|
|
|
|
|
|
|
|
|
* arm-symbian-tdep.c: Delete.
|
|
|
|
|
* NEWS: Mention arm-symbian removal.
|
|
|
|
|
* Makefile.in: Remove arm-symbian-tdep entries.
|
|
|
|
|
* configure.tgt: Remove arm*-*-symbianelf*.
|
|
|
|
|
* doc/gdb.texinfo: Remove mention of SymbianOS.
|
|
|
|
|
* osabi.c (gdb_osabi_names): Remove "Symbian".
|
|
|
|
|
* osabi.h (enum gdb_osabi): Remove GDB_OSABI_SYMBIAN.
|
|
|
|
|
* testsuite/gdb.base/ending-run.exp: Remove E32Main handling.
|
|
|
|
|
* testsuite/gdb.ada/catch_ex_std.exp: Remove arm*-*-symbianelf*
|
|
|
|
|
handling.
|
|
|
|
|
* testsuite/gdb.base/dup-sect.exp: Likewise.
|
|
|
|
|
* testsuite/gdb.base/long_long.exp: Likewise.
|
|
|
|
|
* testsuite/gdb.base/solib-weak.exp: Likewise.
|
|
|
|
|
* testsuite/gdb.guile/scm-section-script.exp: Likewise.
|
|
|
|
|
* testsuite/gdb.python/py-section-script.exp: Likewise.
|
|
|
|
|
* testsuite/lib/dwarf.exp: Likewise.
|
|
|
|
|
* testsuite/lib/gdb.exp: Likewise.
|
|
|
|
|
|
2021-02-09 23:46:13 +08:00
|
|
|
|
2021-02-10 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (UNOP_OR_BINOP_INTRINSIC): New token.
|
|
|
|
|
(exp): New pattern using UNOP_OR_BINOP_INTRINSIC.
|
|
|
|
|
(one_or_two_args): New pattern.
|
|
|
|
|
(f77_keywords): Add lbound and ubound.
|
|
|
|
|
* f-lang.c (fortran_bounds_all_dims): New function.
|
|
|
|
|
(fortran_bounds_for_dimension): New function.
|
|
|
|
|
(evaluate_subexp_f): Handle FORTRAN_LBOUND and FORTRAN_UBOUND.
|
|
|
|
|
(operator_length_f): Likewise.
|
|
|
|
|
(print_subexp_f): Likewise.
|
|
|
|
|
(dump_subexp_body_f): Likewise.
|
|
|
|
|
(operator_check_f): Likewise.
|
|
|
|
|
* std-operator.def (FORTRAN_LBOUND): Define.
|
|
|
|
|
(FORTRAN_UBOUND): Define.
|
|
|
|
|
|
2021-02-08 05:15:12 +08:00
|
|
|
|
2021-02-10 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* coff-pe-read.c (add_pe_forwarded_sym): Make use of section_index
|
|
|
|
|
and set_section_index member functions where appropriate.
|
|
|
|
|
* coffread.c (coff_symtab_read): Likewise.
|
|
|
|
|
(process_coff_symbol): Likewise.
|
|
|
|
|
* ctfread.c (set_symbol_address): Likewise.
|
|
|
|
|
* dwarf2/read.c (add_partial_symbol): Likewise.
|
|
|
|
|
(var_decode_location): Likewise.
|
|
|
|
|
* language.c: Likewise.
|
|
|
|
|
* minsyms.c (minimal_symbol_reader::record_full): Likewise.
|
|
|
|
|
(compact_minimal_symbols): Likewise.
|
|
|
|
|
(minimal_symbol_upper_bound): Likewise.
|
|
|
|
|
* objfiles.c (relocate_one_symbol): Likewise.
|
|
|
|
|
* psympriv.h (partial_symbol::obj_section): Likewise.
|
|
|
|
|
(partial_symbol::address): Likewise.
|
|
|
|
|
* psymtab.c (partial_symtab::add_psymbol): Likewise.
|
|
|
|
|
* stabsread.c (scan_file_globals): Likewise.
|
|
|
|
|
* symmisc.c (dump_msymbols): Likewise.
|
|
|
|
|
* symtab.c (general_symbol_info::obj_section): Likewise.
|
|
|
|
|
(fixup_section): Likewise.
|
|
|
|
|
(get_msymbol_address): Likewise.
|
|
|
|
|
* symtab.h (general_symbol_info::section): Rename to...
|
|
|
|
|
(general_symbol_info::m_section): ...this.
|
|
|
|
|
(general_symbol_info::set_section_index): New member function.
|
|
|
|
|
(general_symbol_info::section_index): Likewise.
|
|
|
|
|
(SYMBOL_SECTION): Delete.
|
|
|
|
|
(MSYMBOL_VALUE_ADDRESS): Make use of section_index and
|
|
|
|
|
set_section_index member functions where appropriate.
|
|
|
|
|
(MSYMBOL_SECTION): Delete.
|
|
|
|
|
(symbol::symbol): Update to initialize 'm_section'.
|
|
|
|
|
* xcoffread.c (read_xcoff_symtab): Make use of set_section_index.
|
|
|
|
|
(process_xcoff_symbol): Likewise.
|
|
|
|
|
|
2021-02-06 06:01:48 +08:00
|
|
|
|
2021-02-10 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* breakpoint.c (resolve_sal_pc): Replace SYMBOL_OBJ_SECTION and
|
|
|
|
|
MSYMBOL_OBJ_SECTION.
|
|
|
|
|
* findvar.c (language_defn::read_var_value): Likewise.
|
|
|
|
|
* infcmd.c (jump_command): Likewise.
|
|
|
|
|
* linespec.c (minsym_found): Likewise.
|
|
|
|
|
* maint.c (maintenance_translate_address): Likewise.
|
|
|
|
|
* minsyms.c (lookup_minimal_symbol_by_pc_section): Likewise.
|
|
|
|
|
(minimal_symbol_upper_bound): Likewise.
|
|
|
|
|
* parse.c (find_minsym_type_and_address): Likewise.
|
|
|
|
|
(operator_check_standard): Likewise.
|
|
|
|
|
* printcmd.c (info_address_command): Likewise.
|
|
|
|
|
* symmisc.c (dump_msymbols): Likewise.
|
|
|
|
|
(print_symbol): Likewise.
|
|
|
|
|
* symtab.c (general_symbol_info::obj_section): Define new
|
|
|
|
|
function.
|
|
|
|
|
(fixup_symbol_section): Replace SYMBOL_OBJ_SECTION.
|
|
|
|
|
(find_pc_sect_compunit_symtab): Likewise.
|
|
|
|
|
(find_function_start_sal): Likewise.
|
|
|
|
|
(skip_prologue_sal): Replace SYMBOL_OBJ_SECTION and
|
|
|
|
|
MSYMBOL_OBJ_SECTION.
|
|
|
|
|
* symtab.h (struct general_symbol_info) <obj_section>: Declare new
|
|
|
|
|
function.
|
|
|
|
|
(SYMBOL_OBJ_SECTION): Delete.
|
|
|
|
|
(MSYMBOL_OBJ_SECTION): Delete.
|
|
|
|
|
|
2021-02-10 08:35:59 +08:00
|
|
|
|
2021-02-09 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* stap-probe.c (stap_parse_argument_conditionally): Fix typo.
|
|
|
|
|
|
2021-02-10 06:28:16 +08:00
|
|
|
|
2021-02-09 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27341
|
|
|
|
|
* dwarf2/read.c (read_array_type): Return NULL when not being able to
|
|
|
|
|
construct an array type. Add assert to ensure that element_type is
|
|
|
|
|
not being modified.
|
|
|
|
|
|
2021-02-10 05:41:30 +08:00
|
|
|
|
2021-02-09 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* gcore.c (struct gcore_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(gcore_collect_regset_section_cb): Delete.
|
|
|
|
|
(gcore_collect_thread_registers): Delete.
|
|
|
|
|
(gcore_build_thread_register_notes): Delete.
|
|
|
|
|
(gcore_find_signalled_thread): Delete.
|
|
|
|
|
* gcore.h: Remove 'gdbsupport/gdb_signals.h' include and delete
|
|
|
|
|
'gdbarch' and 'thread_info' declarations.
|
|
|
|
|
(gcore_build_thread_register_notes): Delete declaration.
|
|
|
|
|
(gcore_find_signalled_thread): Likewise.
|
|
|
|
|
* fbsd-tdep.c: Remove 'gcore.h' include.
|
|
|
|
|
(struct fbsd_collect_regset_section_cb_data): New struct.
|
|
|
|
|
(fbsd_collect_regset_section_cb): New function.
|
|
|
|
|
(fbsd_collect_thread_registers): New function.
|
|
|
|
|
(struct fbsd_corefile_thread_data): New struct.
|
|
|
|
|
(fbsd_corefile_thread): New function.
|
|
|
|
|
(fbsd_make_corefile_notes): Call FreeBSD specific code.
|
|
|
|
|
* linux-tdep.c: Remove 'gcore.h' include.
|
|
|
|
|
(struct linux_collect_regset_section_cb_data): New struct.
|
|
|
|
|
(linux_collect_regset_section_cb): New function.
|
|
|
|
|
(linux_collect_thread_registers): New function.
|
|
|
|
|
(linux_corefile_thread): Call Linux specific code.
|
|
|
|
|
(find_signalled_thread): New function.
|
|
|
|
|
(linux_make_corefile_notes): Call find_signalled_thread.
|
|
|
|
|
|
Avoid crash from coerce_unspec_val_to_type
With a certain Ada program, ada-lang.c:coerce_unspec_val_to_type can
cause a crash. This function may copy a value, and in the particular
case in the crash, the new value's type is smaller than the original
type. This causes coerce_unspec_val_to_type to create a lazy value --
but the original value is also not_lval, so later, when the value is
un-lazied, gdb asserts.
As with the previous patch, we believe there is a compiler bug here,
but it is difficult to reproduce, so we're not completely certain.
In the particular case we saw, the original value has record type, and
the record holds some variable-length arrays. This leads to the
type's length being 0. At the same time, the value is optimized out.
This patch changes coerce_unspec_val_to_type to handle an
optimized-out value correctly.
It also slightly restructures this code to avoid a crash should a
not_lval value wind up here. This is a purely defensive change.
This change also made it clear that value_contents_copy_raw can now be
made static, so that is also done.
gdb/ChangeLog
2021-02-09 Tom Tromey <tromey@adacore.com>
* ada-lang.c (coerce_unspec_val_to_type): Avoid making lazy
not_lval value.
* value.c (value_contents_copy_raw): Now static.
* value.h (value_contents_copy_raw): Don't declare.
2021-02-10 03:15:39 +08:00
|
|
|
|
2021-02-09 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (coerce_unspec_val_to_type): Avoid making lazy
|
|
|
|
|
not_lval value.
|
|
|
|
|
* value.c (value_contents_copy_raw): Now static.
|
|
|
|
|
* value.h (value_contents_copy_raw): Don't declare.
|
|
|
|
|
|
2021-02-10 03:15:39 +08:00
|
|
|
|
2021-02-09 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.c (resolve_dynamic_struct): Handle structure with no
|
|
|
|
|
fields.
|
|
|
|
|
|
gdb: Do not interrupt atomic sequences for ARC
When stepping over thread-lock related codes (in uClibc), the inferior process
gets stuck and never manages to enter the critical section:
------8<-------
1 size_t fwrite(const void * __restrict ptr, size_t size,
2 size_t nmemb, register FILE * __restrict stream)
3 {
4 size_t retval;
5 __STDIO_AUTO_THREADLOCK_VAR;
6
7 > __STDIO_AUTO_THREADLOCK(stream);
8
9 retval = fwrite_unlocked(ptr, size, nmemb, stream);
10
11 __STDIO_AUTO_THREADUNLOCK(stream);
12
13 return retval;
14 }
------>8-------
Here, we are at line 7. Using the "next" command leads no where.
However, setting a breakpoint on line 9 and issuing "continue" works.
Looking at the assembly instructions reveals that we're dealing with the
critical section entry code [1] that should never be interrupted, in this
case by the debugger's implicit breakpoints:
------8<-------
...
1 add_s r0,r13,0x38
2 mov_s r3,1
3 llock r2,[r0] <-.
4 brne.nt r2,0,14 --. |
5 scond r3,[r0] | |
6 bne -10 --|--'
7 brne_s r2,0,84 <-'
...
------>8-------
Lines 3 until 5 (inclusive) are supposed to be executed atomically.
Therefore, GDB should never (implicitly) insert a breakpoint on lines
4 and 5, else the program will try to acquire the lock again by jumping
back to line 3 and gets stuck in an infinite loop.
The solution is to make GDB aware of these patterns so it inserts
breakpoints after the sequence -- line 6 in this example.
[1]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/bits/atomic.h#n46
------8<-------
({ \
__typeof(oldval) prev; \
\
__asm__ __volatile__( \
"1: llock %0, [%1] \n" \
" brne %0, %2, 2f \n" \
" scond %3, [%1] \n" \
" bnz 1b \n" \
"2: \n" \
: "=&r"(prev) \
: "r"(mem), "ir"(oldval), \
"r"(newval) /* can't be "ir". scond can't take limm for "b" */\
: "cc", "memory"); \
\
prev; \
})
------>8-------
"llock" (Load Locked) loads the 32-bit word pointed by the source
operand. If the load is completed without any interruption or
exception, the physical address is remembered, in Lock Physical Address
(LPA), and the Lock Flag (LF) is set to 1. LF is a non-architecturally
visible flag and is cleared whenever an interrupt or exception takes
place. LF is also cleared (atomically) whenever another process writes
to the LPA.
"scond" (Store Conditional) will write to the destination address if
and only if the LF is set to 1. When finished, with or without a write,
it atomically copies the LF value to ZF (Zero Flag).
These two instructions together provide the mechanism for entering a
critical section. The code snippet above comes from uClibc:
-----------------------
v3 (after Tom's remarks[2]):
handle_atomic_sequence()
- no need to initialize the std::vector with "{}"
- fix typo in comments: "conditial" -> "conditional"
- add braces to the body of "if" condition because of the comment line
arc_linux_software_single_step()
- make the performance slightly more efficient by moving a few
variables after the likely "return" point.
v2 (after Simon's remarks[3]):
- handle_atomic_sequence() gets a copy of an instruction instead of
a reference.
- handle_atomic_sequence() asserts if the given instruction is an llock.
[2]
https://sourceware.org/pipermail/gdb-patches/2021-February/175805.html
[3]
https://sourceware.org/pipermail/gdb-patches/2021-January/175487.html
gdb/ChangeLog:
PR tdep/27369
* arc-linux-tdep.c (handle_atomic_sequence): New.
(arc_linux_software_single_step): Call handle_atomic_sequence().
2019-11-01 00:33:08 +08:00
|
|
|
|
2021-02-08 Shahab Vahedi <shahab@synopsys.com>
|
|
|
|
|
|
|
|
|
|
PR tdep/27369
|
|
|
|
|
* arc-linux-tdep.c (handle_atomic_sequence): New.
|
|
|
|
|
(arc_linux_software_single_step): Call handle_atomic_sequence().
|
|
|
|
|
|
gdb: return true in TuiWindow.is_valid only if TUI is enabled
If the user implements a TUI window in Python, and this window
responds to GDB events and then redraws its window contents then there
is currently an edge case which can lead to problems.
The Python API documentation suggests that calling methods like erase
or write on a TUI window (from Python code) will raise an exception if
the window is not valid.
And the description for is_valid says:
This method returns True when this window is valid. When the user
changes the TUI layout, windows no longer visible in the new layout
will be destroyed. At this point, the gdb.TuiWindow will no longer
be valid, and methods (and attributes) other than is_valid will
throw an exception.
From this I, as a user, would expect that if I did 'tui disable' to
switch back to CLI mode, then the window would no longer be valid.
However, this is not the case.
When the TUI is disabled the windows in the TUI are not deleted, they
are simply hidden. As such, currently, the is_valid method continues
to return true.
This means that if the users Python code does something like:
def event_handler (e):
global tui_window_object
if tui_window_object->is_valid ():
tui_window_object->erase ()
tui_window_object->write ("Hello World")
gdb.events.stop.connect (event_handler)
Then when a stop event arrives GDB will try to draw the TUI window,
even when the TUI is disabled.
This exposes two bugs. First, is_valid should be returning false in
this case, second, if the user forgot to add the is_valid call, then I
believe the erase and write calls should be throwing an
exception (when the TUI is disabled).
The solution to both of these issues is I think bound together, as it
depends on having a working 'is_valid' check.
There's a rogue assert added into tui-layout.c as part of this
commit. While working on this commit I managed to break GDB such that
TUI_CMD_WIN was nullptr, this was causing GDB to abort. I'm leaving
the assert in as it might help people catch issues in the future.
This patch is inspired by the work done here:
https://sourceware.org/pipermail/gdb-patches/2020-December/174338.html
gdb/ChangeLog:
* python/py-tui.c (gdbpy_tui_window) <is_valid>: New member
function.
(REQUIRE_WINDOW): Call is_valid member function.
(REQUIRE_WINDOW_FOR_SETTER): New define.
(gdbpy_tui_is_valid): Call is_valid member function.
(gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead.
* tui/tui-data.h (struct tui_win_info) <is_visible>: Check
tui_active too.
* tui/tui-layout.c (tui_apply_current_layout): Add an assert.
* tui/tui.c (tui_enable): Move setting of tui_active earlier in
the function.
gdb/doc/ChangeLog:
* python.texinfo (TUI Windows In Python): Extend description of
TuiWindow.is_valid.
gdb/testsuite/ChangeLog:
* gdb.python/tui-window-disabled.c: New file.
* gdb.python/tui-window-disabled.exp: New file.
* gdb.python/tui-window-disabled.py: New file.
2021-01-15 18:31:19 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* python/py-tui.c (gdbpy_tui_window) <is_valid>: New member
|
|
|
|
|
function.
|
|
|
|
|
(REQUIRE_WINDOW): Call is_valid member function.
|
|
|
|
|
(REQUIRE_WINDOW_FOR_SETTER): New define.
|
|
|
|
|
(gdbpy_tui_is_valid): Call is_valid member function.
|
|
|
|
|
(gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead.
|
|
|
|
|
* tui/tui-data.h (struct tui_win_info) <is_visible>: Check
|
|
|
|
|
tui_active too.
|
|
|
|
|
* tui/tui-layout.c (tui_apply_current_layout): Add an assert.
|
|
|
|
|
* tui/tui.c (tui_enable): Move setting of tui_active earlier in
|
|
|
|
|
the function.
|
|
|
|
|
|
2021-02-08 19:44:51 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* python/py-tui.c (gdbpy_tui_set_title): Check that the new value
|
|
|
|
|
for the title is not nullptr.
|
|
|
|
|
|
gdb/tui: don't add windows to global list from tui_layout:window::apply
This commit was inspired by this mailing list patch:
https://sourceware.org/pipermail/gdb-patches/2021-January/174713.html
Currently, calling tui_layout_window::apply will add the window from
the layout object to the global tui_windows list.
Unfortunately, when the user runs the 'winheight' command, this calls
tui_adjust_window_height, which calls the tui_layout_base::adjust_size
function, which can then call tui_layout_base::apply. The consequence
of this is that when the user does 'winheight' duplicate copies of a
window can be added to the global tui_windows list.
The original patch fixed this by changing the apply function to only
update the global list some of the time.
This patch takes a different approach. The apply function no longer
updates the global tui_windows list. Instead a new virtual function
is added to tui_layout_base which is used to gather all the currently
applied windows into a vector. Finally tui_apply_current_layout is
updated to make use of this new function to update the tui_windows
list.
The benefits I see in this approach are, (a) the apply function now no
longer touches global state, this solves the immediate problem,
and (b) now that tui_windows is updated directly in the function
tui_apply_current_layout, we can drop the saved_tui_windows global.
gdb/ChangeLog:
* tui-layout.c (saved_tui_windows): Delete.
(tui_apply_current_layout): Don't make use of saved_tui_windows,
call new get_windows member function instead.
(tui_get_window_by_name): Check in tui_windows.
(tui_layout_window::apply): Don't add to tui_windows.
* tui-layout.h (tui_layout_base::get_windows): New member function.
(tui_layout_window::get_windows): Likewise.
(tui_layout_split::get_windows): Likewise.
gdb/testsuite/ChangeLog:
* gdb.tui/winheight.exp: Add more tests.
2021-01-25 23:46:58 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* tui-layout.c (saved_tui_windows): Delete.
|
|
|
|
|
(tui_apply_current_layout): Don't make use of saved_tui_windows,
|
|
|
|
|
call new get_windows member function instead.
|
|
|
|
|
(tui_get_window_by_name): Check in tui_windows.
|
|
|
|
|
(tui_layout_window::apply): Don't add to tui_windows.
|
|
|
|
|
* tui-layout.h (tui_layout_base::get_windows): New member function.
|
|
|
|
|
(tui_layout_window::get_windows): Likewise.
|
|
|
|
|
(tui_layout_split::get_windows): Likewise.
|
|
|
|
|
|
2021-02-08 19:11:24 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* tui/tui-layout.c (tui_apply_current_layout): Restore the delete
|
|
|
|
|
of the window objects.
|
|
|
|
|
|
gdb/python: reformat an error string
While working on another patch I noticed an oddly formatted error
message in the Python code.
When 'set python print-stack message' is in effect then consider this
Python script:
class TestCommand (gdb.Command):
def __init__ (self):
gdb.Command.__init__ (self, "test-cmd", gdb.COMMAND_DATA)
def invoke(self, args, from_tty):
raise RuntimeError ("bad")
TestCommand ()
And this GDB session:
(gdb) source path/to/python/script.py
(gdb) test-cmd
Python Exception <class 'RuntimeError'> bad:
Error occurred in Python: bad
The line 'Python Exception <class 'RuntimeError'> bad:' doesn't look
terrible in this situation, the colon at the end of the first line
makes sense given the second line.
However, there are places in GDB where there is no second line
printed, for example consider this python script:
def stop_listener (e):
raise RuntimeError ("bad")
gdb.events.stop.connect (stop_listener)
Then this GDB session:
(gdb) file helloworld.exe
(gdb) start
Temporary breakpoint 1 at 0x40112a: file hello.c, line 6.
Starting program: helloworld.exe
Temporary breakpoint 1, main () at hello.c:6
6 printf ("Hello World\n");
Python Exception <class 'RuntimeError'> bad:
(gdb) si
0x000000000040112f 6 printf ("Hello World\n");
Python Exception <class 'RuntimeError'> bad:
In this case there is no auxiliary information displayed after the
warning, and the line ending in the colon looks weird to me.
A quick survey of the code seems to indicate that it is not uncommon
for there to be no auxiliary information line printed, its not just
the one case I found above.
I propose that the line that currently looks like this:
Python Exception <class 'RuntimeError'> bad:
Be reformatted like this:
Python Exception <class 'RuntimeError'>: bad
I think this looks fine then in either situation. The first now looks
like this:
(gdb) test-cmd
Python Exception <class 'RuntimeError'>: bad
Error occurred in Python: bad
And the second like this:
(gdb) si
0x000000000040112f 6 printf ("Hello World\n");
Python Exception <class 'RuntimeError'>: bad
There's just two tests that needed updating. Errors are checked for
in many more tests, but most of the time the pattern doesn't care
about the colon.
gdb/ChangeLog:
* python/python.c (gdbpy_print_stack): Reformat an error message.
gdb/testsuite/ChangeLog:
* gdb.python/py-framefilter.exp: Update expected results.
* gdb.python/python.exp: Update expected results.
2021-01-18 18:03:21 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* python/python.c (gdbpy_print_stack): Reformat an error message.
|
|
|
|
|
|
gdb/tui: fix issue with handling the return character
My initial goal was to fix our gdb/testsuite/lib/tuiterm.exp such that
it would correctly support (some limited) scrolling of the command
window.
What I observe is that when sending commands to the tui command window
in a test script with:
Term::command "p 1"
The command window would be left looking like this:
(gdb)
(gdb) p 1$1 = 1
(gdb)
When I would have expected it to look like this:
(gdb) p 1
$1 = 1
(gdb)
Obviously a bug in our tuiterm.exp library, right???
Wrong!
Turns out there's a bug in GDB.
If in GDB I enable the tui and then type (slowly) the 'p 1\r' (the \r
is pressing the return key at the end of the string), then you do
indeed get the "expected" terminal output.
However, if instead I copy the 'p 1\r' string and paste it into the
tui in one go then I now see the same corrupted output as we do when
using tuiterm.exp.
It turns out the problem is that GDB fails when handling lots of input
arriving quickly with a \r (or \n) on the end.
The reason for this bug is as follows:
When the tui is active the terminal is in no-echo mode, so characters
sent to the terminal are not echoed out again. This means that when
the user types \r, this is not echoed to the terminal.
The characters read in are passed to readline and \r indicates that
the command line is complete and ready to be processed. However, the
\r is not included in readlines command buffer, and is NOT printed by
readline when is displays its buffer to the screen.
So, in GDB we have to manually spot the \r when it is read in and
update the display. Printing a newline character to the output and
moving the cursor to the next line. This is done in tui_getc_1.
Now readline tries to reduce the number of write calls. So if we very
quickly (as in paste in one go) the text 'p 1' to readline (this time
with no \r on the end), then readline will fetch the fist character
and add it to its internal buffer. But before printing the character
out readline checks to see if there's more input incoming. As we
pasted multiple characters, then yes, readline sees the ' ' and adds
this to its buffer, and finally the '1', this too is added to the
buffer.
Now if at this point we take a break, readline sees there is no more
input available, and so prints its buffer out.
Now when we press \r the code in tui_getc_1 kicks in, adds a \n to the
output and moves the cursor to the next line.
But, if instead we paste 'p 1\r' in one go then readline adds 'p 1' to
its buffer as before, but now it sees that there is still more input
available. Now it fetches the '\r', but this triggers the newline
behaviour, we print '\n' and move to the next line - however readline
has not printed its buffer yet!
So finally we end up on the next line. There's no more input
available so readline prints its buffer, then GDB gets passed the
buffer, handles it, and prints the result.
The solution I think is to put of our special newline insertion code
until we know that readline has finished printing its buffer. Handily
we know when this is - the next thing readline does is pass us the
command line buffer for processing. So all we need to do is hook in
to the command line processing, and before we pass the command line to
GDB's internals we do all of the magic print a newline and move the
cursor to the next line stuff.
Luckily, GDB's interpreter mechanism already provides the hooks we
need to do this. So all I do here is move the newline printing code
from tui_getc_1 into a new function, setup a new input_handler hook
for the tui, and call my new newline printing function.
After this I can enable the tui and paste in 'p 1\r' and see the
correct output.
Also the tuiterm.exp library will now see non-corrupted output.
gdb/ChangeLog:
* tui/tui-interp.c (tui_command_line_handler): New function.
(tui_interp::resume): Register tui_command_line_handler as the
input_handler.
* tui/tui-io.c (tui_inject_newline_into_command_window): New
function.
(tui_getc_1): Delete handling of '\n' and '\r'.
* tui-io.h (tui_inject_newline_into_command_window): Declare.
gdb/testsuite/ChangeLog:
* gdb.tui/scroll.exp: Tighten expected results. Remove comment
about bug in GDB, update expected results, and add more tests.
2021-01-23 01:40:19 +08:00
|
|
|
|
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* tui/tui-interp.c (tui_command_line_handler): New function.
|
|
|
|
|
(tui_interp::resume): Register tui_command_line_handler as the
|
|
|
|
|
input_handler.
|
|
|
|
|
* tui/tui-io.c (tui_inject_newline_into_command_window): New
|
|
|
|
|
function.
|
|
|
|
|
(tui_getc_1): Delete handling of '\n' and '\r'.
|
|
|
|
|
* tui-io.h (tui_inject_newline_into_command_window): Declare.
|
|
|
|
|
|
2021-01-06 00:29:02 +08:00
|
|
|
|
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-regs.c (tui_data_window::display_registers_from):
|
|
|
|
|
Mark invisible register sub windows.
|
|
|
|
|
(tui_data_window::check_register_values): Ignore invisible
|
|
|
|
|
register sub windows.
|
|
|
|
|
|
2021-01-06 00:10:15 +08:00
|
|
|
|
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-regs.c (tui_data_item_window::rerender): Don't call
|
|
|
|
|
n_spaces with a negative value.
|
|
|
|
|
|
2021-01-05 23:56:01 +08:00
|
|
|
|
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-regs.c (tui_data_window::display_registers_from):
|
|
|
|
|
Add refresh_window call.
|
|
|
|
|
|
2020-12-19 01:23:41 +08:00
|
|
|
|
2021-02-07 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* python/py-frame.c (frapy_richcompare): Compare frame_id_is_next.
|
|
|
|
|
|
2021-02-06 02:06:33 +08:00
|
|
|
|
2021-02-05 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* symmisc.c (std_in, std_out, std_err): Remove.
|
|
|
|
|
(_initialize_symmisc): Don't set std_in, std_out and std_err.
|
|
|
|
|
|
2021-02-06 00:47:07 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27330
|
|
|
|
|
* breakpoint.c (create_exception_master_breakpoint): Handle case that
|
|
|
|
|
glibc object file has debug info.
|
|
|
|
|
|
2021-02-06 00:47:07 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27333
|
|
|
|
|
* dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.
|
|
|
|
|
|
2021-02-06 00:47:07 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27313
|
|
|
|
|
* break-catch-syscall.c (catch_syscall_split_args): Reject negative
|
|
|
|
|
syscall numbers.
|
|
|
|
|
|
2021-02-05 22:17:11 +08:00
|
|
|
|
2021-02-05 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* compile/compile-c-support.c (get_compile_context)
|
|
|
|
|
(c_get_compile_context, cplus_get_compile_context): Change return
|
|
|
|
|
type.
|
|
|
|
|
* language.c (language_defn::get_compile_instance): New method.
|
|
|
|
|
* language.h (language_defn::get_compile_instance): Change return
|
|
|
|
|
type. No longer inline.
|
|
|
|
|
* c-lang.c (c_language::get_compile_instance): Change return type.
|
|
|
|
|
(cplus_language::get_compile_instance): Change return type.
|
|
|
|
|
* c-lang.h (c_get_compile_context, cplus_get_compile_context):
|
|
|
|
|
Change return type.
|
|
|
|
|
* compile/compile.c (compile_to_object): Update.
|
|
|
|
|
|
2021-02-05 22:11:01 +08:00
|
|
|
|
2021-02-05 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* parser-defs.h (write_exp_symbol_reference): Declare.
|
|
|
|
|
* parse.c (write_exp_symbol_reference): New function.
|
|
|
|
|
* p-exp.y (variable): Use write_exp_symbol_reference.
|
|
|
|
|
* m2-exp.y (variable): Use write_exp_symbol_reference.
|
|
|
|
|
* f-exp.y (variable): Use write_exp_symbol_reference.
|
|
|
|
|
* d-exp.y (PrimaryExpression): Use write_exp_symbol_reference.
|
|
|
|
|
* c-exp.y (variable): Use write_exp_symbol_reference.
|
|
|
|
|
|
2021-02-05 17:56:39 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR exp/27265
|
|
|
|
|
* valarith.c (complex_binop): Throw an error if complex type can't
|
|
|
|
|
be created.
|
|
|
|
|
|
2021-02-05 16:14:25 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/27307
|
|
|
|
|
* dwarf2/read.c (create_cus_from_debug_names_list): Add missing
|
|
|
|
|
return.
|
|
|
|
|
|
2021-02-05 16:14:25 +08:00
|
|
|
|
2021-02-05 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (create_cus_from_debug_names_list): Fix indentation.
|
|
|
|
|
|
2015-06-16 23:44:48 +08:00
|
|
|
|
2021-02-04 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* configure.tgt (riscv*-*-*): Set gdb_sim.
|
|
|
|
|
|
2021-02-05 04:45:20 +08:00
|
|
|
|
2021-02-04 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target.c (target_is_non_stop_p): Return bool.
|
|
|
|
|
* target.h (target_is_non_stop_p): Return bool.
|
|
|
|
|
|
2021-02-05 02:35:37 +08:00
|
|
|
|
2021-02-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* record-full.c (record_full_async_inferior_event_handler):
|
|
|
|
|
Don't clear async event handler.
|
|
|
|
|
(record_full_base_target::wait): Clear async event handler at
|
|
|
|
|
beginning.
|
|
|
|
|
|
2021-02-05 02:35:09 +08:00
|
|
|
|
2021-02-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* record-btrace.c (record_btrace_handle_async_inferior_event):
|
|
|
|
|
Don't clear async event handler.
|
|
|
|
|
(record_btrace_target::wait): Clear async event handler at
|
|
|
|
|
beginning.
|
|
|
|
|
|
gdb: make remote target clear its handler in remote_target::wait
The remote target's remote_async_inferior_event_token is a flag that
tells when it wants the infrun loop to call its wait method. The flag
is cleared in the async_event_handler's callback
(remote_async_inferior_event_handler), just before calling
inferior_event_handler. However, since inferior_event_handler may
actually call another target's wait method, there needs to be code that
checks if we need to re-raise the flag.
It would be simpler instead for remote_target::wait to clear the flag
when it returns an event and there are no more to report after that. If
another target's wait method gets called by inferior_event_handler, the
remote target's flag will stay naturally stay marked.
Note that this is already partially implemented in remote_target::wait,
since the remote target may have multiple events to report (and it can
only report one at the time):
if (target_is_async_p ())
{
remote_state *rs = get_remote_state ();
/* If there are are events left in the queue tell the event loop
to return here. */
if (!rs->stop_reply_queue.empty ())
mark_async_event_handler (rs->remote_async_inferior_event_token);
}
The code in remote_async_inferior_event_handler also checks for pending
events as well, in addition to the stop reply queue, so I've made
remote_target::wait check for that as well. I'm not completely sure
this is ok, since I don't understand very well how the pending events
mechanism works. But I figured it was safer to do this, worst case it
just leads to unnecessary calls to remote_target::wait.
gdb/ChangeLog:
* remote.c (remote_target::wait): Clear async event handler at
beginning, mark if needed at the end.
(remote_async_inferior_event_handler): Don't set or clear async
event handler.
Change-Id: I20117f5b5acc8a9972c90f16280249b766c1bf37
2021-02-05 02:34:11 +08:00
|
|
|
|
2021-02-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* remote.c (remote_target::wait): Clear async event handler at
|
|
|
|
|
beginning, mark if needed at the end.
|
|
|
|
|
(remote_async_inferior_event_handler): Don't set or clear async
|
|
|
|
|
event handler.
|
|
|
|
|
|
gdb: make async event handlers clear themselves
The `ready` flag of async event handlers is cleared by the async event
handler system right before invoking the associated callback, in
check_async_event_handlers.
This is not ideal with how the infrun subsystem consumes events: all
targets' async event handler callbacks essentially just invoke
`inferior_event_handler`, which eventually calls `fetch_inferior_event`
and `do_target_wait`. `do_target_wait` picks an inferior at random,
and thus a target at random (it could be the target whose `ready` flag
was cleared, or not), and pulls one event from it.
So it's possible that:
- the async event handler for a target A is called
- we end up consuming an event for target B
- all threads of target B are stopped, target_async(0) is called on it,
so its async event handler is cleared (e.g.
record_btrace_target::async)
As a result, target A still has events to report while its async event
handler is left unmarked, so these events are not consumed. To counter
this, at the end of their async event handler callbacks, targets check
if they still have something to report and re-mark their async event
handler (e.g. remote_async_inferior_event_handler).
The linux_nat target does not suffer from this because it doesn't use an
async event handler at the moment. It only uses a pipe registered with
the event loop. It is written to in the SIGCHLD handler (and in other
spots that want to get target wait method called) and read from in
the target's wait method. So if linux_nat happened to be target A in
the example above, the pipe would just stay readable, and the event loop
would wake up again, until linux_nat's wait method is finally called and
consumes the contents of the pipe.
I think it would be nicer if targets using async_event_handler worked in
a similar way, where the flag would stay set until the target's wait
method is actually called. As a first step towards that, this patch
moves the responsibility of clearing the ready flags of async event
handlers to the invoked callback.
All async event handler callbacks are modified to clear their ready flag
before doing anything else. So in practice, nothing changes with this
patch. It's only the responsibility of clearing the flag that is
shifted toward the callee.
gdb/ChangeLog:
* async-event.h (async_event_handler_func): Add documentation.
* async-event.c (check_async_event_handlers): Don't clear
async_event_handler ready flag.
* infrun.c (infrun_async_inferior_event_handler): Clear ready
flag.
* record-btrace.c (record_btrace_handle_async_inferior_event):
Likewise.
* record-full.c (record_full_async_inferior_event_handler):
Likewise.
* remote-notif.c (remote_async_get_pending_events_handler):
Likewise.
* remote.c (remote_async_inferior_event_handler): Likewise.
Change-Id: I179ef8e99580eae642d332846fd13664dbddc0c1
2021-02-05 02:13:30 +08:00
|
|
|
|
2021-02-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* async-event.h (async_event_handler_func): Add documentation.
|
|
|
|
|
* async-event.c (check_async_event_handlers): Don't clear
|
|
|
|
|
async_event_handler ready flag.
|
|
|
|
|
* infrun.c (infrun_async_inferior_event_handler): Clear ready
|
|
|
|
|
flag.
|
|
|
|
|
* record-btrace.c (record_btrace_handle_async_inferior_event):
|
|
|
|
|
Likewise.
|
|
|
|
|
* record-full.c (record_full_async_inferior_event_handler):
|
|
|
|
|
Likewise.
|
|
|
|
|
* remote-notif.c (remote_async_get_pending_events_handler):
|
|
|
|
|
Likewise.
|
|
|
|
|
* remote.c (remote_async_inferior_event_handler): Likewise.
|
|
|
|
|
|
2021-02-04 03:36:54 +08:00
|
|
|
|
2021-02-03 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* infrun.c (handle_inferior_event): Move stop_soon variable to
|
|
|
|
|
inner scope.
|
|
|
|
|
|
detach in all-stop with threads running
A following patch will add a testcase that has a number of threads
constantly stepping over a breakpoint, and then has GDB detach the
process, while threads are running. If we have more than one inferior
running, and we detach from just one of the inferiors, we expect that
the remaining inferior continues running. However, in all-stop, if
GDB needs to pause the target for the detach, nothing is re-resuming
the other inferiors after the detach. "info threads" shows the
threads as running, but they really aren't. This fixes it.
gdb/ChangeLog:
* infcmd.c (detach_command): Hold strong reference to target, and
if all-stop on entry, restart threads on exit.
* infrun.c (switch_back_to_stepped_thread): Factor out bits to ...
(restart_stepped_thread): ... this new function. Also handle
trap_expected.
(restart_after_all_stop_detach): New function.
* infrun.h (restart_after_all_stop_detach): Declare.
2021-01-12 04:01:58 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* infcmd.c (detach_command): Hold strong reference to target, and
|
|
|
|
|
if all-stop on entry, restart threads on exit.
|
|
|
|
|
* infrun.c (switch_back_to_stepped_thread): Factor out bits to ...
|
|
|
|
|
(restart_stepped_thread): ... this new function. Also handle
|
|
|
|
|
trap_expected.
|
|
|
|
|
(restart_after_all_stop_detach): New function.
|
|
|
|
|
* infrun.h (restart_after_all_stop_detach): Declare.
|
|
|
|
|
|
2021-01-12 07:11:57 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* infrun.c (struct step_over_info): Initialize fields.
|
|
|
|
|
(prepare_for_detach): Handle ongoing in-line step over.
|
|
|
|
|
|
detach and breakpoint removal
A following patch will add a testcase that has a number of threads
constantly stepping over a breakpoint, and then has GDB detach the
process. That testcase sometimes fails with the inferior crashing
with SIGTRAP after the detach because of the bug fixed by this patch,
when tested with the native target.
The problem is that target_detach removes breakpoints from the target
immediately, and that does not work with the native GNU/Linux target
(and probably no other native target) currently. The test wouldn't
fail with this issue when testing against gdbserver, because gdbserver
does allow accessing memory while the current thread is running, by
transparently pausing all threads temporarily, without GDB noticing.
Implementing that in gdbserver was a lot of work, so I'm not looking
forward right now to do the same in the native target. Instead, I
came up with a simpler solution -- push the breakpoints removal down
to the targets. The Linux target conveniently already pauses all
threads before detaching them, since PTRACE_DETACH only works with
stopped threads, so we move removing breakpoints to after that. Only
the remote and GNU/Linux targets support support async execution, so
no other target should really need this.
gdb/ChangeLog:
* linux-nat.c (linux_nat_target::detach): Remove breakpoints
here...
* remote.c (remote_target::remote_detach_1): ... and here ...
* target.c (target_detach): ... instead of here.
* target.h (target_ops::detach): Add comment.
2020-12-13 09:35:05 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* linux-nat.c (linux_nat_target::detach): Remove breakpoints
|
|
|
|
|
here...
|
|
|
|
|
* remote.c (remote_target::remote_detach_1): ... and here ...
|
|
|
|
|
* target.c (target_detach): ... instead of here.
|
|
|
|
|
* target.h (target_ops::detach): Add comment.
|
|
|
|
|
|
prepare_for_detach and ongoing displaced stepping
I noticed that "detach" while a program was running sometimes resulted
in the process crashing. I tracked it down to this change to
prepare_for_detach in commit 187b041e ("gdb: move displaced stepping
logic to gdbarch, allow starting concurrent displaced steps"):
/* Is any thread of this process displaced stepping? If not,
there's nothing else to do. */
- if (displaced->step_thread == nullptr)
+ if (displaced_step_in_progress (inf))
return;
The problem above is that the condition was inadvertently flipped. It
should have been:
if (!displaced_step_in_progress (inf))
So I fixed it, and wrote a testcase to exercise it. The testcase has
a number of threads constantly stepping over a breakpoint, and then
GDB detaches the process, while threads are running and stepping over
the breakpoint. And then I was surprised that my testcase would hang
-- GDB would get stuck in an infinite loop in prepare_for_detach,
here:
while (displaced_step_in_progress (inf))
{
...
What is going on is that since we now have two displaced stepping
buffers, as one displaced step finishes, GDB starts another, and
there's another one already in progress, and on and on, so the
displaced_step_in_progress condition never turns false. This happens
because we go via the whole handle_inferior_event, which tries to
start new step overs when one finishes. And also because while we
remove breakpoints from the target before prepare_for_detach is
called, handle_inferior_event ends up calling insert_breakpoints via
e.g. keep_going.
Thinking through all this, I came to the conclusion that going through
the whole handle_inferior_event isn't ideal. A _lot_ is done by that
function, e.g., some thread may get a signal which is passed to the
inferior, and gdb decides to try to get over the signal handler, which
reinstalls breakpoints. Or some process may exit. We can end up
reporting these events via normal_stop while detaching, maybe end up
running some breakpoint commands, or maybe even something runs an
inferior function call. Etc. All this after the user has already
declared they don't want to debug the process anymore, by asking to
detach.
I came to the conclusion that it's better to do the minimal amount of
work possible, in a more controlled fashion, without going through
handle_inferior_event. So in the new approach implemented by this
patch, if there are threads of the inferior that we're detaching in
the middle of a displaced step, stop them, and cancel the displaced
step. This is basically what stop_all_threads already does, via
wait_one and (the now factored out) handle_one, so I'm reusing those.
gdb/ChangeLog:
* infrun.c (struct wait_one_event): Move higher up.
(prepare_for_detach): Abort in-progress displaced steps instead of
letting them complete.
(handle_one): If the inferior is detaching, don't add the thread
back to the global step-over chain.
(restart_threads): Don't restart threads if detaching.
(handle_signal_stop): Remove inferior::detaching reference.
2020-12-13 09:35:05 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* infrun.c (struct wait_one_event): Move higher up.
|
|
|
|
|
(prepare_for_detach): Abort in-progress displaced steps instead of
|
|
|
|
|
letting them complete.
|
|
|
|
|
(handle_one): If the inferior is detaching, don't add the thread
|
|
|
|
|
back to the global step-over chain.
|
|
|
|
|
(restart_threads): Don't restart threads if detaching.
|
|
|
|
|
(handle_signal_stop): Remove inferior::detaching reference.
|
|
|
|
|
|
2021-01-12 02:52:12 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* infrun.c (prepare_for_detach): Don't release scoped_restore
|
|
|
|
|
before returning.
|
|
|
|
|
|
2020-12-13 09:35:05 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* infrun.c (handle_one): New function, factored out from ...
|
|
|
|
|
(stop_all_threads): ... here.
|
|
|
|
|
|
Fix a couple vStopped pending ack bugs
A following patch will add a testcase that has two processes with
threads stepping over a breakpoint continuously, and then detaches
from one of the processes while threads are running. The other
process continues stepping over its breakpoint. And then the testcase
sends a SIGUSR1, expecting that GDB reports it. That would sometimes
hang against gdbserver, due to the bugs fixed here. Both bugs are
related, in that they're about remote protocol asynchronous Stop
notifications. There's a bug in GDB, and another in GDBserver.
The GDB bug:
- when we detach from a process, the remote target discards any
pending RSP notification related to that process, including the
in-flight, yet-unacked notification. Discarding the in-flight
notification is the problem. Until the in-flight notification is
acked with a vStopped packet, the server won't send another %Stop
notification. As a result, the debug session gets messed up. In
the new testcase's case, GDB would hang inside stop_all_threads,
waiting for a stop for one of the process'es threads, which never
arrived -- its stop reply was permanently stuck in the stop reply
queue, waiting for a vStopped packet that never arrived.
In summary:
1. GDBserver sends stop notification about thread X, the remote
target receives it and stores it
2. At the same time, GDB detaches thread X's inferior
3. The remote target discards the received stop notification
4. GDBserver waits forever for the ack
The GDBserver bug:
GDBserver has the opposite bug. It also discards notifications for
the process being detached. If that discards the head of the
notification queue, when gdb sends an ack, it ends up acking the
_next_ notification. Meaning, gdb loses one notification. In the
testcase, this results in a similar hang in stop_all_threads.
So we have two very similar bugs in GDB and GDBserver, both resulting
in a similar symptom. That's why I'm fixing them both at the same
time.
gdb/ChangeLog:
* remote.c (remote_notif_stop_ack): Don't error out on
TARGET_WAITKIND_IGNORE; instead, just ignore the notification.
(remote_target::discard_pending_stop_replies): Don't delete
in-flight notification; instead, clear its contents.
gdbserver/ChangeLog:
* server.cc (discard_queued_stop_replies): Don't ever discard the
notification at the head of the list.
2021-01-06 10:19:38 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* remote.c (remote_notif_stop_ack): Don't error out on
|
|
|
|
|
TARGET_WAITKIND_IGNORE; instead, just ignore the notification.
|
|
|
|
|
(remote_target::discard_pending_stop_replies): Don't delete
|
|
|
|
|
in-flight notification; instead, clear its contents.
|
|
|
|
|
|
2020-12-24 20:26:20 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* remote.c (extended_remote_target::attach): Set target async in
|
|
|
|
|
the target-non-stop path too.
|
|
|
|
|
|
Fix attaching in non-stop mode (PR gdb/27055)
Attaching in non-stop mode currently misbehaves, like so:
(gdb) attach 1244450
Attaching to process 1244450
[New LWP 1244453]
[New LWP 1244454]
[New LWP 1244455]
[New LWP 1244456]
[New LWP 1244457]
[New LWP 1244458]
[New LWP 1244459]
[New LWP 1244461]
[New LWP 1244462]
[New LWP 1244463]
No unwaited-for children left.
At this point, GDB's stopped/running thread state is out of sync with
the inferior:
(gdb) info threads
Id Target Id Frame
* 1 LWP 1244450 "attach-non-stop" 0xf1b443bf in ?? ()
2 LWP 1244453 "attach-non-stop" (running)
3 LWP 1244454 "attach-non-stop" (running)
4 LWP 1244455 "attach-non-stop" (running)
5 LWP 1244456 "attach-non-stop" (running)
6 LWP 1244457 "attach-non-stop" (running)
7 LWP 1244458 "attach-non-stop" (running)
8 LWP 1244459 "attach-non-stop" (running)
9 LWP 1244461 "attach-non-stop" (running)
10 LWP 1244462 "attach-non-stop" (running)
11 LWP 1244463 "attach-non-stop" (running)
(gdb)
(gdb) interrupt -a
(gdb)
*nothing*
The problem is that attaching installs an inferior continuation,
called when the target reports the initial attach stop, here, in
inf-loop.c:inferior_event_handler:
/* Do all continuations associated with the whole inferior (not
a particular thread). */
if (inferior_ptid != null_ptid)
do_all_inferior_continuations (0);
However, currently in non-stop mode, inferior_ptid is still null_ptid
when we get here.
If you try to do "set debug infrun 1" to debug the problem, however,
then the attach completes correctly, with GDB reporting a stop for
each thread.
The bug is that we're missing a switch_to_thread/context_switch call
when handling the initial stop, here:
if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
&& (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_STOP
|| ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
|| ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_0))
{
stop_print_frame = true;
stop_waiting (ecs);
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
return;
}
Note how the STOP_QUIETLY / STOP_QUIETLY_REMOTE case above that does
call context_switch.
And the reason "set debug infrun 1" "fixes" it, is that the debug path
has a switch_to_thread call.
This patch fixes it by moving the main context_switch call earlier.
It also removes the:
if (ecs->ptid != inferior_ptid)
check at the same time because:
#1 - that is half of what context_switch already does
#2 - deprecated_context_hook is only used in Insight, and all it does
is set an int. It won't care if we call it when the current
thread hasn't actually changed.
A testcase exercising this will be added in a following patch.
gdb/ChangeLog:
PR gdb/27055
* infrun.c (handle_signal_stop): Move main context_switch call
earlier, before STOP_QUIETLY_NO_SIGSTOP.
2020-12-23 08:34:54 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
PR gdb/27055
|
|
|
|
|
* infrun.c (handle_signal_stop): Move main context_switch call
|
|
|
|
|
earlier, before STOP_QUIETLY_NO_SIGSTOP.
|
|
|
|
|
|
2021-01-07 04:58:04 +08:00
|
|
|
|
2021-02-02 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* NEWS (Changed commands): Add entry for the behavior change of
|
|
|
|
|
the inferior command.
|
|
|
|
|
* inferior.c (inferior_command): When no argument is given to the
|
|
|
|
|
inferior command, display info about the currently selected
|
|
|
|
|
inferior.
|
|
|
|
|
|
2021-02-02 23:40:52 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index, read_rnglist_index): Return
|
|
|
|
|
a sect_offset.
|
|
|
|
|
(read_attribute_reprocess): Adjust.
|
|
|
|
|
|
gdb/dwarf: split dwarf2_cu::ranges_base in two
Consider the test case added in this patch. It defines a compilation
unit with a DW_AT_rnglists_base attribute (used for attributes of form
DW_FORM_rnglistx), but also uses DW_AT_ranges of form
DW_FORM_sec_offset:
0x00000027: DW_TAG_compile_unit
DW_AT_ranges [DW_FORM_sec_offset] (0x0000004c
[0x0000000000005000, 0x0000000000006000))
DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000044)
The DW_AT_rnglists_base does not play a role in reading the DW_AT_ranges of
form DW_FORM_sec_offset, but it should also not do any harm.
This case is currently not handled correctly by GDB. This is not
something that a compiler is likely to emit, but in my opinion there's
no reason why GDB should fail reading it.
The problem is that in partial_die_info::read and a few other places
where the same logic is replicated, the cu->ranges_base value,
containing the DW_AT_rnglists_base value, is wrongfully added to the
DW_AT_ranges value.
It is quite messy how to decide whether cu->ranges_base should be added
to the attribute's value or not. But to summarize, the only time we
want to add it is when the attribute comes from a pre-DWARF 5 split unit
file (a .dwo) [1]. In this case, the DW_AT_ranges attribute from the
split unit file will have form DW_FORM_sec_offset, pointing somewhere in
the linked file's .debug_ranges section. *But* it's not a "true"
DW_FORM_sec_offset, in that it's an offset relative to the beginning of
that CU's contribution in the section, not relative to the beginning of
the section. So in that case, and only that case, do we want to add the
ranges base value, which we found from the DW_AT_GNU_ranges_base
attribute on the skeleton unit.
Almost all instances of the DW_AT_ranges attribute will be found in the
split unit (on DW_TAG_subprogram, for example), and therefore need to
have the ranges base added. However, the DW_TAG_compile_unit DIE in the
skeleton may also have a DW_AT_ranges attribute. For that one, the
ranges base must not be added. Once the DIEs have been loaded in GDB,
however, the distinction between what's coming from the skeleton and
what's coming from the split unit is not clear. It is all merged in one
big happy tree. So how do we know if a given attribute comes from the
split unit or not?
We use the fact that in pre-DWARF 5 split DWARF, DW_AT_ranges is found
on the skeleton's DW_TAG_compile_unit (in the linked file) and never in
the split unit's DW_TAG_compile_unit. This is why you have this in
partial_die_info::read:
int need_ranges_base = (tag != DW_TAG_compile_unit
&& attr.form != DW_FORM_rnglistx);
However, with the corner case described above (where we have a
DW_AT_rnglists_base attribute and a DW_AT_ranges attribute of form
DW_FORM_sec_offset) the condition gets it wrong when it encounters an
attribute like DW_TAG_subprogram with a DW_AT_ranges attribute of
DW_FORM_sec_offset form: it thinks that it is necessary to add the base,
when it reality it is not.
The problem boils down to failing to differentiate these cases:
- a DW_AT_ranges attribute of form DW_FORM_sec_offset in a
pre-DWARF 5 split unit (in which case we need to add the base)
- a DW_AT_ranges attribute of form DW_FORM_sec_offset in a DWARF 5
non-split unit (in which case we must not add the base)
What makes it unnecessarily complex is that the cu->ranges_base field is
overloaded, used to hold the pre-DWARF 5, non-standard
DW_AT_GNU_ranges_base and the DWARF 5 DW_AT_rnglists_base. In reality,
these two are called "bases" but are not the same thing. The result is
that we need twisted conditions to try to determine whether or not we
should add the base to the attribute's value.
To fix it, split the field in two distinct fields. I renamed everything
related to the "old" ranges base to "gnu_ranges_base", to make it clear
that it's about the non-standard, pre-DWARF 5 thing. And everything
related to the DWARF 5 thing gets renamed "rnglists". I think it
becomes much easier to reason this way.
The issue described above gets fixed by the fact that the
DW_AT_rnglists_base value does not end up in cu->gnu_ranges_base, so
cu->gnu_ranges_base stays 0. The condition to determine whether
gnu_ranges_base should be added can therefore be simplified back to:
tag != DW_TAG_compile_unit
... as it was before rnglistx support was added.
Extend the gdb.dwarf2/rnglists-sec-offset.exp to cover this case. I
also extended the test case for loclists similarly, just to see if there
would be some similar problem. There wasn't, but I think it's not a bad
idea to test that case for loclists as well, so I left it in the patch.
[1] https://gcc.gnu.org/wiki/DebugFission
gdb/ChangeLog:
* dwarf2/die.h (struct die_info) <ranges_base>: Split in...
<gnu_ranges_base>: ... this...
<rnglists_base>: ... and this.
* dwarf2/read.c (struct dwarf2_cu) <ranges_base>: Split in...
<gnu_ranges_base>: ... this...
<rnglists_base>: ... and this.
(read_cutu_die_from_dwo): Adjust
(dwarf2_get_pc_bounds): Adjust
(dwarf2_record_block_ranges): Adjust.
(read_full_die_1): Adjust
(partial_die_info::read): Adjust.
(read_rnglist_index): Adjust.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/rnglists-sec-offset.exp: Add test for DW_AT_ranges
of DW_FORM_sec_offset form plus DW_AT_rnglists_base attribute.
* gdb.dwarf2/loclists-sec-offset.exp: Add test for
DW_AT_location of DW_FORM_sec_offset plus DW_AT_loclists_base
attribute
Change-Id: Icd109038634b75d0e6e9d7d1dcb62fb9eb951d83
2021-02-02 23:41:59 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/die.h (struct die_info) <ranges_base>: Split in...
|
|
|
|
|
<gnu_ranges_base>: ... this...
|
|
|
|
|
<rnglists_base>: ... and this.
|
|
|
|
|
* dwarf2/read.c (struct dwarf2_cu) <ranges_base>: Split in...
|
|
|
|
|
<gnu_ranges_base>: ... this...
|
|
|
|
|
<rnglists_base>: ... and this.
|
|
|
|
|
(read_cutu_die_from_dwo): Adjust
|
|
|
|
|
(dwarf2_get_pc_bounds): Adjust
|
|
|
|
|
(dwarf2_record_block_ranges): Adjust.
|
|
|
|
|
(read_full_die_1): Adjust
|
|
|
|
|
(partial_die_info::read): Adjust.
|
|
|
|
|
(read_rnglist_index): Adjust.
|
|
|
|
|
|
gdb/dwarf: read correct rnglist/loclist header in read_{rng,loc}list_index
When loading the binary from PR 26813 in GDB, we get:
DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array [in module /home/simark/build/binutils-gdb/gdb/MagicPurse]
... and the symbols fail to load.
In read_rnglist_index and read_loclist_index, we read the header
(documented in sections 7.28 and 7.29 of DWARF 5) of the CU's
contribution to the .debug_rnglists / .debug_loclists sections to
validate that the index we want to read makes sense. However, we always
read the header at the beginning of the section, rather than the header
for the contribution from which we want to read the index.
To illustrate, here's what the binary from PR 26813 contains. There are
two compile units:
0x0000000c: DW_TAG_compile_unit 1
DW_AT_ranges [DW_FORM_rnglistx]: 0x0
DW_AT_rnglists_base [DW_FORM_sec_offset]: 0xC
0x00003ec9: DW_TAG_compile_unit 2
DW_AT_ranges [DW_FORM_rnglistx]: 0xB
DW_AT_rnglists_base [DW_FORM_sec_offset]: 0x85
The layout of the .debug_rnglists is the following:
[0x00, 0x0B]: header for CU 1's contribution
[0x0C, 0x0F]: list of offsets for CU 1 (1 element)
[0x10, 0x78]: range lists data for CU 1
[0x79, 0x84]: header for CU 2's contribution
[0x85, 0xB4]: list of offsets for CU 2 (12 elements)
[0xB5, 0xBD7]: range lists data for CU 2
The DW_AT_rnglists_base attrbute points to the beginning of the list of
offsets for that CU, relative to the start of the .debug_rnglists
section. That's right after the header for that contribution.
When we try to read the DW_AT_ranges attribute for CU 2,
read_rnglist_index reads the header for CU 1 instead of the one for CU
2. Since there's only one element in CU 1's offset list, it believes
(wrongfully) that the index 0xB is out of range.
Fix it by reading the header just before where DW_AT_rnglists_base
points to. With this patch, I am able to load GDB built with clang-11
and -gdwarf-5 in itself, with and without -readnow.
gdb/ChangeLog:
PR gdb/26813
* dwarf2/read.c (read_loclists_rnglists_header): Add
header_offset parameter and use it.
(read_loclist_index): Read header of the current contribution,
not the one at the beginning of the section.
(read_rnglist_index): Likewise.
Change-Id: Ie53ff8251af8c1556f0a83a31aa8572044b79e3d
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26813
|
|
|
|
|
* dwarf2/read.c (read_loclists_rnglists_header): Add
|
|
|
|
|
header_offset parameter and use it.
|
|
|
|
|
(read_loclist_index): Read header of the current contribution,
|
|
|
|
|
not the one at the beginning of the section.
|
|
|
|
|
(read_rnglist_index): Likewise.
|
|
|
|
|
|
gdb/dwarf: few fixes for handling DW_FORM_{rng,loc}listx
We hit an assertion when loading the binary from PR 26813. When fixing
it, execution goes a up bit further but then hits another assert, and
another, and another. With these fours fixes, I am able to load the
binary and get to the prompt. An error is shown (index pointing outside
of the section), because the DW_FORM_rnglistx attribute is not read
correctly, but that one is taken care of by the next patch.
The four fixes are:
- attribute::form_requires_reprocessing needs to handle forms
DW_FORM_rnglistx and DW_FORM_loclistx, because set_unsigned_reprocess
is called for them in read_attribute_value.
- read_attribute_reprocess must call set_unsigned for them, not
set_address. The parameter of set_address is a CORE_ADDR, meaning
it's for program addresses. Post-reprocess, DW_FORM_rnglistx and
DW_FORM_loclistx are offsets into their respective sections
(.debug_rnglists and .debug_loclists). set_unsigned is the current
attribute value setter that fits the best. But perhaps we should have
a setter that takes a sect_offset?
- read_attribute_process must call as_unsigned_reprocess instead of
as_unsigned to get the pre-reprocess value, otherwise we hit the
assert inside as_unsigned that makes sure the attribute doesn't need
reprocessing.
- attribute::set_unsigned needs to clear the requires_reprocessing flag,
otherwise it stays set when reprocessing DW_FORM_rnglistx and
DW_FORM_loclistx attributes.
There's another assert that we hit once the next patch is applied, but
since it's in the same vein as the changes in this patch, I included it
in this patch:
- attribute::form_is_unsigned must handle form DW_FORM_loclistx,
otherwise we hit the assert when trying to call set_unsigned for an
attribute of this form. DW_FORM_rnglistx is already handled.
gdb/ChangeLog:
PR gdb/26813
* dwarf2/attribute.h (struct attribute) <set_unsigned>: Clear
requires_reprocessing flag.
* dwarf2/attribute.c (attribute::form_is_unsigned): Handle
DW_FORM_loclistx.
(attribute::form_requires_reprocessing): Handle DW_FORM_rnglistx
and DW_FORM_loclistx.
* dwarf2/read.c (read_attribute_reprocess): Use set_unsigned
instead of set_address for DW_FORM_loclistx and
DW_FORM_rnglistx.
Change-Id: I06c156fa3913ca98e4e39085f4ef171645b4bc1e
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26813
|
|
|
|
|
* dwarf2/attribute.h (struct attribute) <set_unsigned>: Clear
|
|
|
|
|
requires_reprocessing flag.
|
|
|
|
|
* dwarf2/attribute.c (attribute::form_is_unsigned): Handle
|
|
|
|
|
DW_FORM_loclistx.
|
|
|
|
|
(attribute::form_requires_reprocessing): Handle DW_FORM_rnglistx
|
|
|
|
|
and DW_FORM_loclistx.
|
|
|
|
|
* dwarf2/read.c (read_attribute_reprocess): Use set_unsigned
|
|
|
|
|
instead of set_address for DW_FORM_loclistx and
|
|
|
|
|
DW_FORM_rnglistx.
|
|
|
|
|
|
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Remove bound check for
|
|
|
|
|
start of offset.
|
|
|
|
|
(read_rnglist_index): Likewise.
|
|
|
|
|
|
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Add bound check for the end
|
|
|
|
|
of the offset.
|
|
|
|
|
|
2021-02-02 23:40:50 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_rnglist_index): Fix bound check.
|
|
|
|
|
|
2021-02-02 23:40:50 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Change complaints into
|
|
|
|
|
errors.
|
|
|
|
|
|
2021-02-02 15:37:45 +08:00
|
|
|
|
2021-02-02 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/24620
|
|
|
|
|
* dwarf2/index-write.c (write_one_signatured_type): Skip if
|
|
|
|
|
psymtab == nullptr.
|
|
|
|
|
|
2021-01-19 00:00:38 +08:00
|
|
|
|
2021-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (HFILES_NO_SRCDIR): Add corefile.h.
|
|
|
|
|
* gcore.c (struct gcore_collect_regset_section_cb_data): Moved
|
|
|
|
|
here from linux-tdep.c and given a new name. Minor cleanups.
|
|
|
|
|
(gcore_collect_regset_section_cb): Likewise.
|
|
|
|
|
(gcore_collect_thread_registers): Likewise.
|
|
|
|
|
(gcore_build_thread_register_notes): Likewise.
|
|
|
|
|
(gcore_find_signalled_thread): Likewise.
|
|
|
|
|
* gcore.h (gcore_build_thread_register_notes): Declare.
|
|
|
|
|
(gcore_find_signalled_thread): Declare.
|
|
|
|
|
* fbsd-tdep.c: Add 'gcore.h' include.
|
|
|
|
|
(struct fbsd_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(fbsd_collect_regset_section_cb): Delete.
|
|
|
|
|
(fbsd_collect_thread_registers): Delete.
|
|
|
|
|
(struct fbsd_corefile_thread_data): Delete.
|
|
|
|
|
(fbsd_corefile_thread): Delete.
|
|
|
|
|
(fbsd_make_corefile_notes): Call
|
|
|
|
|
gcore_build_thread_register_notes instead of the now deleted
|
|
|
|
|
FreeBSD code.
|
|
|
|
|
* linux-tdep.c: Add 'gcore.h' include.
|
|
|
|
|
(struct linux_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(linux_collect_regset_section_cb): Delete.
|
|
|
|
|
(linux_collect_thread_registers): Delete.
|
|
|
|
|
(linux_corefile_thread): Call
|
|
|
|
|
gcore_build_thread_register_notes.
|
|
|
|
|
(find_signalled_thread): Delete.
|
|
|
|
|
(linux_make_corefile_notes): Call gcore_find_signalled_thread.
|
|
|
|
|
|
[gdb/breakpoint] Fix stepping past non-stmt line-table entries
Consider the test-case small.c:
...
$ cat -n small.c
1 __attribute__ ((noinline, noclone))
2 int foo (char *c)
3 {
4 asm volatile ("" : : "r" (c) : "memory");
5 return 1;
6 }
7
8 int main ()
9 {
10 char tpl1[20] = "/tmp/test.XXX";
11 char tpl2[20] = "/tmp/test.XXX";
12 int fd1 = foo (tpl1);
13 int fd2 = foo (tpl2);
14 if (fd1 == -1) {
15 return 1;
16 }
17
18 return 0;
19 }
...
Compiled with gcc-8 and optimization:
...
$ gcc-8 -O2 -g small.c
...
We step through the calls to foo, but fail to visit line 13:
...
12 int fd1 = foo (tpl1);
(gdb) step
foo (c=c@entry=0x7fffffffdea0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
foo (c=c@entry=0x7fffffffdec0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
main () at small.c:14
14 if (fd1 == -1) {
(gdb)
...
This is caused by the following. The calls to foo are implemented by these
insns:
....
4003df: 0f 29 04 24 movaps %xmm0,(%rsp)
4003e3: 0f 29 44 24 20 movaps %xmm0,0x20(%rsp)
4003e8: e8 03 01 00 00 callq 4004f0 <foo>
4003ed: 48 8d 7c 24 20 lea 0x20(%rsp),%rdi
4003f2: 89 c2 mov %eax,%edx
4003f4: e8 f7 00 00 00 callq 4004f0 <foo>
4003f9: 31 c0 xor %eax,%eax
...
with corresponding line table entries:
...
INDEX LINE ADDRESS IS-STMT
8 12 0x00000000004003df Y
9 10 0x00000000004003df
10 11 0x00000000004003e3
11 12 0x00000000004003e8
12 13 0x00000000004003ed
13 12 0x00000000004003f2
14 13 0x00000000004003f4 Y
15 13 0x00000000004003f4
16 14 0x00000000004003f9 Y
17 14 0x00000000004003f9
...
Once we step out of the call to foo at 4003e8, we land at 4003ed, and gdb
enters process_event_stop_test to figure out what to do.
That entry has is-stmt=n, so it's not the start of a line, so we don't stop
there. However, we do update ecs->event_thread->current_line to line 13,
because the frame has changed (because we stepped out of the function).
Next we land at 4003f2. Again the entry has is-stmt=n, so it's not the start
of a line, so we don't stop there. However, because the frame hasn't changed,
we don't update update ecs->event_thread->current_line, so it stays 13.
Next we land at 4003f4. Now is-stmt=y, so it's the start of a line, and we'd
like to stop here.
But we don't stop because this test fails:
...
if ((ecs->event_thread->suspend.stop_pc == stop_pc_sal.pc)
&& (ecs->event_thread->current_line != stop_pc_sal.line
|| ecs->event_thread->current_symtab != stop_pc_sal.symtab))
{
...
because ecs->event_thread->current_line == 13 and stop_pc_sal.line == 13.
Fix this by resetting ecs->event_thread->current_line to 0 if is-stmt=n and
the frame has changed, such that we have:
...
12 int fd1 = foo (tpl1);
(gdb) step
foo (c=c@entry=0x7fffffffdbc0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
main () at small.c:13
13 int fd2 = foo (tpl2);
(gdb)
...
Tested on x86_64-linux, with gcc-7 and gcc-8.
gdb/ChangeLog:
2021-01-29 Tom de Vries <tdevries@suse.de>
PR breakpoints/26063
* infrun.c (process_event_stop_test): Reset
ecs->event_thread->current_line to 0 if is-stmt=n and frame has
changed.
gdb/testsuite/ChangeLog:
2021-01-29 Tom de Vries <tdevries@suse.de>
PR breakpoints/26063
* gdb.dwarf2/dw2-step-out-of-function-no-stmt.c: New test.
* gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp: New file.
2021-01-29 20:36:52 +08:00
|
|
|
|
2021-01-29 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/26063
|
|
|
|
|
* infrun.c (process_event_stop_test): Reset
|
|
|
|
|
ecs->event_thread->current_line to 0 if is-stmt=n and frame has
|
|
|
|
|
changed.
|
|
|
|
|
|
2021-01-28 02:20:35 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* thread.c (thr_try_catch_cmd): Replace swith_to_thread with an
|
|
|
|
|
assert. Extend the header comment.
|
|
|
|
|
|
gdb/tui: remove special handling of locator/status window
The locator window, or status window as it is sometimes called is
handled differently to all the other windows.
The reason for this is that the class representing this
window (tui_locator_window) does two jobs, first this class represents
a window just like any other that has space on the screen and fills
the space with content. The second job is that this class serves as a
storage area to hold information about the current location that the
TUI windows represent, so the class has members like 'addr' and
'line_no', for example which are used within this class, and others
when they want to know which line/address the TUI windows should be
showing to the user.
Because of this dual purpose we must always have an instance of the
tui_locator_window so that there is somewhere to store this location
information.
The result of this is that the locator window must never be deleted
like other windows, which results in some special case code.
In this patch I propose splitting the two roles of the
tui_locator_window class. The tui_locator_window class will retain
just its window drawing parts, and will be treated just like any other
window. This should allow all special case code for this window to be
deleted.
The other role, that of tracking the current tui location will be
moved into a new class (tui_location_tracker), of which there will be
a single global instance. All of the places where we previously use
the locator window to get location information will now be updated to
get this from the tui_location_tracker.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c.
(HFILES_NO_SRCDIR): Add tui/tui-location.h.
* tui/tui-data.h (TUI_STATUS_WIN): Define.
(tui_locator_win_info_ptr): Delete declaration.
* tui/tui-disasm.c: Add 'tui/tui-location.h' include.
(tui_disasm_window::set_contents): Fetch state from tui_location
global.
(tui_get_begin_asm_address): Likewise.
* tui/tui-layout.c (tui_apply_current_layout): Remove special case
for locator window.
(get_locator_window): Delete.
(initialize_known_windows): Treat locator window just like all the
rest.
* tui/tui-source.c: Add 'tui/tui-location.h' include.
(tui_source_window::set_contents): Fetch state from tui_location
global.
(tui_source_window::showing_source_p): Likewise.
* tui/tui-stack.c: Add 'tui/tui-location.h' include.
(_locator): Delete.
(tui_locator_win_info_ptr): Delete.
(tui_locator_window::make_status_line): Fetch state from
tui_location global.
(tui_locator_window::rerender): Remove check of 'handle',
reindent function body.
(tui_locator_window::set_locator_fullname): Delete.
(tui_locator_window::set_locator_info): Delete.
(tui_update_locator_fullname): Delete.
(tui_show_frame_info): Likewise.
(tui_show_locator_content): Access window through TUI_STATUS_WIN.
* tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to
tui/tui-location.h and renamed to
tui_location_tracker::set_location.
(tui_locator_window::set_locator_fullname): Moved to
tui/tui-location.h and renamed to
tui_location_tracker::set_fullname.
(tui_locator_window::full_name): Delete.
(tui_locator_window::proc_name): Delete.
(tui_locator_window::line_no): Delete.
(tui_locator_window::addr): Delete.
(tui_locator_window::gdbarch): Delete.
(tui_update_locator_fullname): Delete declaration.
* tui/tui-wingeneral.c (tui_refresh_all): Removed special handling
for locator window.
* tui/tui-winsource.c: Add 'tui/tui-location.h' include.
(tui_display_main): Call function on tui_location directly.
* tui/tui.h (enum tui_win_type): Add STATUS_WIN.
* tui/tui-location.c: New file.
* tui/tui-location.h: New file.
2021-01-26 02:43:19 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c.
|
|
|
|
|
(HFILES_NO_SRCDIR): Add tui/tui-location.h.
|
|
|
|
|
* tui/tui-data.h (TUI_STATUS_WIN): Define.
|
|
|
|
|
(tui_locator_win_info_ptr): Delete declaration.
|
|
|
|
|
* tui/tui-disasm.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_disasm_window::set_contents): Fetch state from tui_location
|
|
|
|
|
global.
|
|
|
|
|
(tui_get_begin_asm_address): Likewise.
|
|
|
|
|
* tui/tui-layout.c (tui_apply_current_layout): Remove special case
|
|
|
|
|
for locator window.
|
|
|
|
|
(get_locator_window): Delete.
|
|
|
|
|
(initialize_known_windows): Treat locator window just like all the
|
|
|
|
|
rest.
|
|
|
|
|
* tui/tui-source.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_source_window::set_contents): Fetch state from tui_location
|
|
|
|
|
global.
|
|
|
|
|
(tui_source_window::showing_source_p): Likewise.
|
|
|
|
|
* tui/tui-stack.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(_locator): Delete.
|
|
|
|
|
(tui_locator_win_info_ptr): Delete.
|
|
|
|
|
(tui_locator_window::make_status_line): Fetch state from
|
|
|
|
|
tui_location global.
|
|
|
|
|
(tui_locator_window::rerender): Remove check of 'handle',
|
|
|
|
|
reindent function body.
|
|
|
|
|
(tui_locator_window::set_locator_fullname): Delete.
|
|
|
|
|
(tui_locator_window::set_locator_info): Delete.
|
|
|
|
|
(tui_update_locator_fullname): Delete.
|
|
|
|
|
(tui_show_frame_info): Likewise.
|
|
|
|
|
(tui_show_locator_content): Access window through TUI_STATUS_WIN.
|
|
|
|
|
* tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to
|
|
|
|
|
tui/tui-location.h and renamed to
|
|
|
|
|
tui_location_tracker::set_location.
|
|
|
|
|
(tui_locator_window::set_locator_fullname): Moved to
|
|
|
|
|
tui/tui-location.h and renamed to
|
|
|
|
|
tui_location_tracker::set_fullname.
|
|
|
|
|
(tui_locator_window::full_name): Delete.
|
|
|
|
|
(tui_locator_window::proc_name): Delete.
|
|
|
|
|
(tui_locator_window::line_no): Delete.
|
|
|
|
|
(tui_locator_window::addr): Delete.
|
|
|
|
|
(tui_locator_window::gdbarch): Delete.
|
|
|
|
|
(tui_update_locator_fullname): Delete declaration.
|
|
|
|
|
* tui/tui-wingeneral.c (tui_refresh_all): Removed special handling
|
|
|
|
|
for locator window.
|
|
|
|
|
* tui/tui-winsource.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_display_main): Call function on tui_location directly.
|
|
|
|
|
* tui/tui.h (enum tui_win_type): Add STATUS_WIN.
|
|
|
|
|
* tui/tui-location.c: New file.
|
|
|
|
|
* tui/tui-location.h: New file.
|
|
|
|
|
|
2021-01-28 23:12:10 +08:00
|
|
|
|
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (get_type_arch): Rename to...
|
|
|
|
|
(struct type) <arch>: ... this, update all users.
|
|
|
|
|
|
2021-01-28 23:09:02 +08:00
|
|
|
|
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (struct type) <arch>: Rename to...
|
|
|
|
|
<arch_owner>: ... this, update all users.
|
|
|
|
|
<objfile>: Rename to...
|
|
|
|
|
<objfile_owner>: ... this, update all users.
|
|
|
|
|
|
2021-01-28 17:58:43 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* gdbcmd.h (execute_command_to_string): Update comment.
|
|
|
|
|
* top.c (execute_command_to_string): Update header comment.
|
|
|
|
|
|
[gdb/breakpoints] Fix longjmp master breakpoint with separate debug info
When running test-case gdb.base/longjmp.exp with target board unix/-m32, we
run into:
...
(gdb) next^M
Warning:^M
Cannot insert breakpoint 0.^M
Cannot access memory at address 0x7dbf7353^M
^M
__libc_siglongjmp (env=0x804a040 <env>, val=1) at longjmp.c:28^M
28 longjmps++;^M
(gdb) FAIL: gdb.base/longjmp.exp: next over longjmp(1)
...
The failure to access memory happens in i386_get_longjmp_target and is due to
glibc having pointer encryption (aka "pointer mangling" or "pointer guard") of
the long jump buffer. This is a known problem.
In create_longjmp_master_breakpoint (which attempts to install a master
longjmp breakpoint) a preference scheme is present, which installs a
probe breakpoint if a libc:longjmp probe is present, and otherwise falls back
to setting breakpoints at the names in the longjmp_names array.
But in fact, both the probe breakpoint and the longjmp_names breakpoints are
set. The latter ones are set when processing libc.so.debug, and the former
one when processing libc.so. In other words, this is the longjmp variant of
PR26881, which describes the same problem for master exception breakpoints.
This problem only triggers when the glibc debug info package is installed,
which is not due to the debug info itself in libc.so.debug, but due to the
minimal symbols (because create_longjmp_master_breakpoint uses minimal symbols
to translate the longjmp_names to addresses).
The problem doesn't trigger for -m64, because there tdep->jb_pc_offset is not
set.
Fix this similar to commit 1940319c0ef (the fix for PR26881): only install
longjmp_names breakpoints in libc.so/libc.so.debug if installing the
libc:longjmp probe in libc.so failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-28 Tom de Vries <tdevries@suse.de>
PR breakpoints/27205
* breakpoint.c (create_longjmp_master_breakpoint_probe)
(create_longjmp_master_breakpoint_names): New function, factored out
of ...
(create_longjmp_master_breakpoint): ... here. Only try to install
longjmp_names breakpoints in libc.so/libc.so.debug if installing probe
breakpoint in libc.so failed.
2021-01-28 17:59:42 +08:00
|
|
|
|
2021-01-28 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27205
|
|
|
|
|
* breakpoint.c (create_longjmp_master_breakpoint_probe)
|
|
|
|
|
(create_longjmp_master_breakpoint_names): New function, factored out
|
|
|
|
|
of ...
|
|
|
|
|
(create_longjmp_master_breakpoint): ... here. Only try to install
|
|
|
|
|
longjmp_names breakpoints in libc.so/libc.so.debug if installing probe
|
|
|
|
|
breakpoint in libc.so failed.
|
|
|
|
|
|
2021-01-02 04:11:28 +08:00
|
|
|
|
2021-01-27 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/27133
|
|
|
|
|
* cli/cli-interp.c (cli_interp_base::set_logging): Ensure the
|
|
|
|
|
unique_ptr is released when the wrapped pointer is kept for later
|
|
|
|
|
use.
|
|
|
|
|
|
GDB: aarch64: Add ability to displaced step over a BR/BLR instruction
Enable displaced stepping over a BR/BLR instruction
Displaced stepping over an instruction executes a instruction in a
scratch area and then manually fixes up the PC address to leave
execution where it would have been if the instruction were in its
original location.
The BR instruction does not need modification in order to run correctly
at a different address, but the displaced step fixup method should not
manually adjust the PC since the BR instruction sets that value already.
The BLR instruction should also avoid such a fixup, but must also have
the link register modified to point to just after the original code
location rather than back to the scratch location.
This patch adds the above functionality.
We add this functionality by modifying aarch64_displaced_step_others
rather than by adding a new visitor method to aarch64_insn_visitor.
We choose this since it seems that visitor approach is designed
specifically for PC relative instructions (which must always be modified
when executed in a different location).
It seems that the BR and BLR instructions are more like the RET
instruction which is already handled specially in
aarch64_displaced_step_others.
This also means the gdbserver code to relocate an instruction when
creating a fast tracepoint does not need to be modified, since nothing
special is needed for the BR and BLR instructions there.
Regression tests showed nothing untoward on native aarch64 (though it
took a while for me to get the testcase to account for PIE).
------#####
Original observed (mis)behaviour before was that displaced stepping over
a BR or BLR instruction would not execute the function they called.
Most easily seen by putting a breakpoint with a condition on such an
instruction and a print statement in the functions they called.
When run with the breakpoint enabled the function is not called and
"numargs called" is not printed.
When run with the breakpoint disabled the function is called and the
message is printed.
--- GDB Session
~ [15:57:14] % gdb ../using-blr
Reading symbols from ../using-blr...done.
(gdb) disassemble blr_call_value
Dump of assembler code for function blr_call_value:
...
0x0000000000400560 <+28>: blr x2
...
0x00000000004005b8 <+116>: ret
End of assembler dump.
(gdb) break *0x0000000000400560
Breakpoint 1 at 0x400560: file ../using-blr.c, line 22.
(gdb) condition 1 10 == 0
(gdb) run
Starting program: /home/matmal01/using-blr
[Inferior 1 (process 33279) exited with code 012]
(gdb) disable 1
(gdb) run
Starting program: /home/matmal01/using-blr
numargs called
[Inferior 1 (process 33289) exited with code 012]
(gdb)
Test program:
---- using-blr ----
\#include <stdio.h>
typedef int (foo) (int, int);
typedef void (bar) (int, int);
struct sls_testclass {
foo *x;
bar *y;
int left;
int right;
};
__attribute__ ((noinline))
int blr_call_value (struct sls_testclass x)
{
int retval = x.x(x.left, x.right);
if (retval % 10)
return 100;
return 9;
}
__attribute__ ((noinline))
int blr_call (struct sls_testclass x)
{
x.y(x.left, x.right);
if (x.left % 10)
return 100;
return 9;
}
int
numargs (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right)
{
printf("numargs called\n");
return 10;
}
void
altfunc (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right)
{
printf("altfunc called\n");
}
int main(int argc, char **argv)
{
struct sls_testclass x = { .x = numargs, .y = altfunc, .left = 1, .right = 2 };
if (argc > 2)
{
blr_call (x);
}
else
blr_call_value (x);
return 10;
}
2021-01-28 01:09:46 +08:00
|
|
|
|
2021-01-27 Matthew Malcomson <matthew.malcomson@arm.com>
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_displaced_step_others): Account for
|
|
|
|
|
BLR and BR instructions.
|
|
|
|
|
* arch/aarch64-insn.h (enum aarch64_opcodes): Add BR opcode.
|
|
|
|
|
(enum aarch64_masks): New.
|
|
|
|
|
|
2021-01-26 23:49:09 +08:00
|
|
|
|
2021-01-26 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* windows-nat.c (DEBUG_EXEC, DEBUG_EVENTS, DEBUG_MEM)
|
|
|
|
|
(DEBUG_EXCEPT): Use debug_prefixed_printf_cond.
|
|
|
|
|
(windows_init_thread_list, windows_nat::handle_load_dll)
|
|
|
|
|
(windows_nat::handle_unload_dll, windows_nat_target::resume)
|
|
|
|
|
(windows_nat_target::resume)
|
|
|
|
|
(windows_nat_target::get_windows_debug_event)
|
|
|
|
|
(windows_nat_target::interrupt, windows_xfer_memory)
|
|
|
|
|
(windows_nat_target::close): Update.
|
|
|
|
|
* nat/windows-nat.c (DEBUG_EVENTS): Use
|
|
|
|
|
debug_prefixed_printf_cond.
|
|
|
|
|
(matching_pending_stop, fetch_pending_stop)
|
|
|
|
|
(continue_last_debug_event): Update.
|
|
|
|
|
|
2020-12-17 03:36:15 +08:00
|
|
|
|
2020-12-17 Mihails Strasuns <mihails.strasuns@intel.com>
|
|
|
|
|
|
|
|
|
|
* linux-tdep.c (linux_make_mappings_corefile_notes): Start using
|
|
|
|
|
elfcore_write_file_note.
|
|
|
|
|
|
2020-01-15 07:14:24 +08:00
|
|
|
|
2021-01-26 Shahab Vahedi <shahab@synopsys.com>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.c (arc_add_reggroups): New function.
|
|
|
|
|
(arc_gdbarch_init): Call arc_add_reggroups.
|
|
|
|
|
|
2021-01-26 18:00:38 +08:00
|
|
|
|
2021-01-26 Anton Kolesov <anton.kolesov@synopsys.com>
|
2017-06-28 18:15:46 +08:00
|
|
|
|
|
|
|
|
|
* arc-tdep.c (arc_skip_prologue): Log "pc" address.
|
|
|
|
|
|
2021-01-25 23:32:31 +08:00
|
|
|
|
2021-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
|
|
|
|
Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (partial_die_info::read): Use as_unsigned () for
|
|
|
|
|
DW_AT_ranges.
|
|
|
|
|
|
2021-01-25 23:13:51 +08:00
|
|
|
|
2021-01-25 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (get_mpz): New function.
|
|
|
|
|
(get_dwarf2_rational_constant): Use it.
|
|
|
|
|
|
2021-01-25 22:38:21 +08:00
|
|
|
|
2021-01-25 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (resolve_subexp): Handle array context.
|
|
|
|
|
|
2021-01-24 03:20:11 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
PR compile/25575
|
|
|
|
|
* compile/compile-loc2c.c (note_register): New function.
|
|
|
|
|
(pushf_register_address, pushf_register): Use it.
|
|
|
|
|
|
2021-01-24 03:20:11 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
|
|
|
|
|
Change type of "registers_used".
|
|
|
|
|
* dwarf2/loc.h (dwarf2_compile_property_to_c): Update.
|
|
|
|
|
* dwarf2/loc.c (dwarf2_compile_property_to_c)
|
|
|
|
|
(locexpr_generate_c_location, loclist_generate_c_location): Change
|
|
|
|
|
type of "registers_used".
|
|
|
|
|
* compile/compile.h (compile_dwarf_expr_to_c)
|
|
|
|
|
(compile_dwarf_bounds_to_c): Update.
|
|
|
|
|
* compile/compile-loc2c.c (pushf_register_address)
|
|
|
|
|
(pushf_register, do_compile_dwarf_expr_to_c)
|
|
|
|
|
(compile_dwarf_expr_to_c, compile_dwarf_bounds_to_c): Change type
|
|
|
|
|
of "registers_used".
|
|
|
|
|
* compile/compile-c.h (generate_c_for_variable_locations):
|
|
|
|
|
Update.
|
|
|
|
|
* compile/compile-c-symbols.c (generate_vla_size)
|
|
|
|
|
(generate_c_for_for_one_variable): Change type of
|
|
|
|
|
"registers_used".
|
|
|
|
|
(generate_c_for_variable_locations): Return std::vector.
|
|
|
|
|
* compile/compile-c-support.c (generate_register_struct): Change
|
|
|
|
|
type of "registers_used".
|
|
|
|
|
(compute): Update.
|
|
|
|
|
|
2021-01-24 08:48:32 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* compile/compile-internal.h (class compile_instance)
|
|
|
|
|
<set_arguments>: Change return type.
|
|
|
|
|
* compile/compile.c (compile_to_object): Remove call to reset.
|
|
|
|
|
(compile_instance::set_arguments): Change return type.
|
|
|
|
|
|
gdb: fix regression in copy_type_recursive
Commit 5b7d941b90d1 ("gdb: add owner-related methods to struct type")
introduced a regression when running gdb.base/jit-reader-simple.exp and
others. A NULL pointer dereference happens here:
#3 0x0000557b7e9e8650 in gdbarch_obstack (arch=0x0) at /home/simark/src/binutils-gdb/gdb/gdbarch.c:484
#4 0x0000557b7ea5b138 in copy_type_recursive (objfile=0x614000006640, type=0x62100018da80, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/gdbtypes.c:5537
#5 0x0000557b7ea5dcbb in copy_type_recursive (objfile=0x614000006640, type=0x62100018e200, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/gdbtypes.c:5598
#6 0x0000557b802cef51 in preserve_one_value (value=0x6110000b3640, objfile=0x614000006640, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/value.c:2518
#7 0x0000557b802cf787 in preserve_values (objfile=0x614000006640) at /home/simark/src/binutils-gdb/gdb/value.c:2562
#8 0x0000557b7fbaf19b in reread_symbols () at /home/simark/src/binutils-gdb/gdb/symfile.c:2489
#9 0x0000557b7ec65d1d in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at /home/simark/src/binutils-gdb/gdb/infcmd.c:439
#10 0x0000557b7ec67a97 in run_command (args=0x0, from_tty=1) at /home/simark/src/binutils-gdb/gdb/infcmd.c:546
This is inside a TYPE_ALLOC macro. The fact that gdbarch_obstack is
called means that the type is flagged as being arch-owned, but arch=0x0
means that type::arch returned NULL, probably meaning that the m_owner
field contains NULL.
If we look at the code before the problematic patch, in the
copy_type_recursive function, we see:
if (! TYPE_OBJFILE_OWNED (type))
return type;
...
TYPE_OBJFILE_OWNED (new_type) = 0;
TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
The last two lines were replaced with:
new_type->set_owner (type->arch ());
get_type_arch and type->arch isn't the same thing: get_type_arch gets
the type's arch owner if it is arch-owned, and gets the objfile's arch
if the type is objfile owned. So it always returns non-NULL.
type->arch returns the type's arch if the type is arch-owned, else NULL.
So since the original type is objfile owned, it effectively made the new
type arch-owned (that is good) but set the owner to NULL (that is bad).
Fix this by using get_type_arch again there.
I spotted one other similar change in lookup_array_range_type, in the
original patch. But that one appears to be correct, as it is executed
only if the type is arch-owned.
Add some asserts in type::set_owner to ensure we never set a NULL owner.
That would have helped catch the issue a little bit earlier, so it could
help in the future.
gdb/ChangeLog:
* gdbtypes.c (copy_type_recursive): Use get_type_arch.
* gdbtypes.h (struct type) <set_owner>: Add asserts.
Change-Id: I5d8bc7bfc83b3abc579be0b5aadeae4241179a00
2021-01-24 06:36:55 +08:00
|
|
|
|
2021-01-23 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.c (copy_type_recursive): Use get_type_arch.
|
|
|
|
|
* gdbtypes.h (struct type) <set_owner>: Add asserts.
|
|
|
|
|
|
2021-01-12 06:40:59 +08:00
|
|
|
|
2021-01-23 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (SELFTESTS_SRCS): Add
|
|
|
|
|
unittests/gdb_tilde_expand-selftests.c.
|
|
|
|
|
* unittests/gdb_tilde_expand-selftests.c: New file.
|
|
|
|
|
|
gdb: add new version style
This commit adds a new 'version' style, which replaces the hard coded
styling currently used for GDB's version string. GDB's version number
is displayed:
1. In the output of 'show version', and
2. When GDB starts up (without the --quiet option).
This new style can only ever affect the first of these two cases as
the second case is printed before GDB has processed any initialization
files, or processed any GDB commands passed on the command line.
However, because the first case exists I think this commit makes
sense, it means the style is no longer hard coded into GDB, and we can
add some tests that the style can be enabled/disabled correctly.
This commit is an alternative to a patch Tom posted here:
https://sourceware.org/pipermail/gdb-patches/2020-June/169820.html
I've used the style name 'version' instead of 'startup' to reflect
what the style is actually used for. If other parts of the startup
text end up being highlighted I imagine they would get their own
styles based on what is being highlighted. I feel this is more inline
with the other style names that are already in use within GDB.
I also decoupled adding this style from the idea of startup options,
and the possibility of auto-saving startup options. Those ideas can
be explored in later patches.
This commit should probably be considered only a partial solution to
issue PR cli/25956. The colours of the style are no longer hard
coded, however, it is still impossible to change the styling of the
version string displayed during startup, so in one sense, the styling
of that string is still "hard coded". A later patch will hopefully
extend GDB to allow it to adjust the version styling before the
initial version string is printed.
gdb/ChangeLog:
PR cli/25956
* cli/cli-style.c: Add 'cli/cli-setshow.h' include.
(version_style): Define.
(cli_style_option::cli_style_option): Add intensity parameter, and
use as appropriate.
(_initialize_cli_style): Register version style set/show commands.
* cli/cli-style.h (cli_style_option): Add intensity parameter.
(version_style): Declare.
* top.c (print_gdb_version): Use version_stype, and styled_string
to print the GDB version string.
gdb/doc/ChangeLog:
PR cli/25956
* gdb.texinfo (Output Styling): Document version style.
gdb/testsuite/ChangeLog:
PR cli/25956
* gdb.base/style.exp (run_style_tests): Add version string test.
(test_startup_version_string): Use version style name.
* lib/gdb-utils.exp (style): Handle version style name.
2021-01-14 04:08:51 +08:00
|
|
|
|
2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
PR cli/25956
|
|
|
|
|
* NEWS: Mention new command.
|
|
|
|
|
* cli/cli-style.c: Add 'cli/cli-setshow.h' include.
|
|
|
|
|
(version_style): Define.
|
|
|
|
|
(cli_style_option::cli_style_option): Add intensity parameter, and
|
|
|
|
|
use as appropriate.
|
|
|
|
|
(_initialize_cli_style): Register version style set/show commands.
|
|
|
|
|
* cli/cli-style.h (cli_style_option): Add intensity parameter.
|
|
|
|
|
(version_style): Declare.
|
|
|
|
|
* top.c (print_gdb_version): Use version_stype, and styled_string
|
|
|
|
|
to print the GDB version string.
|
|
|
|
|
|
gdb: don't print escape characters when a style is disabled
While working on another patch I noticed that if I disable a single
style with, for example:
set style filename background none
set style filename foreground none
set style filename intensity normal
Then in some places escape characters are still injected into the
output stream. This is a bit of an edge case, and I can't think when
this would actually cause problems, but it still felt like a bit of an
annoyance.
One place where this does impact is in testing, where it becomes
harder to write tight test patterns if it is not obvious when GDB will
decide to inject escape sequences.
It's especially annoying because depending on how something is printed
then GDB might, or might not, add escape characters. So this would
not add escape characters if the filename style was disabled:
fprintf_filtered (file, "%ps",
styled_string (file_name_style.style (),
"This is a test"));
But this would add escape characters:
fprintf_styled (file, file_name_style.style (),
"%s", "This is a test");
I tracked this down to some calls to set_output_style in utils.c.
Currently some calls to set_output_style (in utils.c) are guarded like
this:
if (!STYLE.is_default ())
set_output_style (stream, STYLE);
But some calls are not. It is the calls that are NOT guarded that
cause the extra escape sequences to be emitted.
My initial proposal to resolve this issue was simply to ensure that
all calls to set_output_style were guarded. The patch I posted for
this can be found here:
https://sourceware.org/pipermail/gdb-patches/2021-January/175096.html
The feedback on this proposal was that it might be better to guard
against the escape sequences being emitted at a later lever, right
down at emit_style_escape.
So this is what this version does. In emit_style_escape we already
track the currently applied style, so if the style we are being asked
to switch to is the same as the currently applied style then no escape
sequence needs to be emitted.
Making this change immediately exposed some issues in
fputs_maybe_filtered related to line wrapping. The best place to start
to understand what's going on with the styling and wrapping is look at
the test:
gdb.base/style.exp: all styles enabled: frame when width=20
If you run this test and then examine the output in an editor so the
escape sequences can be seen you'll see the duplicate escape sequences
that are emitted before this patch, the compare to after this patch
you'll see the set of escape sequences should be the minimum required.
In order to test these changes I have rewritten the gdb.base/style.exp
test script. The core of the script is now run multiple times. The
first time the test is run things are as they were before, all styles
are on.
After that the test is rerun multiple times. Each time through a
single style is disabled using the 3 explicit set calls listed above.
I then repeat all the tests, however, I arrange so that the patterns
for the disabled style now require no escape sequences.
gdb/ChangeLog:
* utils.c (emit_style_escape): Only emit an escape sequence if the
requested style is different than the current applied style.
(fputs_maybe_filtered): Adjust the juggling of the wrap_style, and
current applied_style.
(fputs_styled): Remove is_default check.
(fputs_styled_unfiltered): Likewise.
(vfprintf_styled_no_gdbfmt): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/style.exp (limited_style): New proc.
(clean_restart_and_disable): New proc.
(run_style_tests): New proc. Most of the old tests from this file
are now in this proc.
(test_startup_version_string): New proc. Reamining test from the
old file is in this proc.
2021-01-14 04:08:42 +08:00
|
|
|
|
2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* utils.c (emit_style_escape): Only emit an escape sequence if the
|
|
|
|
|
requested style is different than the current applied style.
|
|
|
|
|
(fputs_maybe_filtered): Adjust the juggling of the wrap_style, and
|
|
|
|
|
current applied_style.
|
|
|
|
|
(fputs_styled): Remove is_default check.
|
|
|
|
|
(fputs_styled_unfiltered): Likewise.
|
|
|
|
|
(vfprintf_styled_no_gdbfmt): Likewise.
|
|
|
|
|
|
gdb: add remote_debug_printf
This is the next in the new-style debug macro series.
For this one, I decided to omit the function name from the "Sending packet" /
"Packet received" kind of prints, just because it's not very useful in that
context and hinders readability more than anything else. This is completely
arbitrary.
This is with:
[remote] putpkt_binary: Sending packet: $qTStatus#49...
[remote] getpkt_or_notif_sane_1: Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
and without:
[remote] Sending packet: $qTStatus#49...
[remote] Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
A difference is that previously, the query packet and its reply would be
printed on the same line, like this:
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
Now, they are printed on two lines, since each remote_debug_printf{,_nofunc}
prints its own complete message including an end of line. It's probably
a matter of taste, but I prefer the two-line version, it's easier to
follow, especially when the query packet is long.
As a result, lib/range-stepping-support.exp needs to be updated, as it
currently expects the vCont packet and the reply to be on the same line.
I think it's sufficient in that context to just expect the vCont packet
and not the reply, since the goal is just to count how many vCont;r GDB
sends.
gdb/ChangeLog:
* remote.h (remote_debug_printf): New.
(remote_debug_printf_nofunc): New.
(REMOTE_SCOPED_DEBUG_ENTER_EXIT): New.
* remote.c: Use above macros throughout file.
gdbsupport/ChangeLog:
* common-debug.h (debug_prefixed_printf_cond_nofunc): New.
* common-debug.c (debug_prefixed_vprintf): Handle a nullptr
func.
gdb/testsuite/ChangeLog:
* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
Adjust to "set debug remote" changes.
Change-Id: Ica6dead50d3f82e855c7d763f707cef74bed9fee
2021-01-23 01:43:27 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.h (remote_debug_printf): New.
|
|
|
|
|
(remote_debug_printf_nofunc): New.
|
|
|
|
|
(REMOTE_SCOPED_DEBUG_ENTER_EXIT): New.
|
|
|
|
|
* remote.c: Use above macros throughout file.
|
|
|
|
|
|
2021-01-23 01:40:48 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.h (remote_debug): Change to bool.
|
|
|
|
|
* remote.c (remote_debug): Change to bool.
|
|
|
|
|
(_initialize_remote): Adjust.
|
|
|
|
|
|
2021-01-23 01:39:08 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target.h (remote_debug): Move to...
|
|
|
|
|
* remote.h (remote_debug): ... here.
|
|
|
|
|
* top.c (remote_debug): Move to...
|
|
|
|
|
* remote.c (remote_debug): ... here.
|
|
|
|
|
* remote-sim.c: Include remote.h.
|
|
|
|
|
|
2021-01-23 01:35:54 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* cli/cli-cmds.c (show_remote_debug): Remove.
|
|
|
|
|
(show_remote_timeout): Remove.
|
|
|
|
|
(_initialize_cli_cmds): Don't register commands.
|
|
|
|
|
* remote.c (show_remote_debug): Move here.
|
|
|
|
|
(show_remote_timeout): Move here.
|
|
|
|
|
(_initialize_remote): Register commands.
|
|
|
|
|
|
2021-01-23 01:23:53 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE): Remove, change all users to use the
|
|
|
|
|
type::objfile method instead.
|
|
|
|
|
|
2021-01-23 01:23:40 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE_OWNED): Remove, update all users to
|
|
|
|
|
use the type::is_objfile_owned method.
|
|
|
|
|
|
2021-01-23 01:21:09 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE_OWNED): Adjust.
|
|
|
|
|
(TYPE_OWNER): Remove.
|
|
|
|
|
(TYPE_OBJFILE): Adjust.
|
|
|
|
|
(struct main_type) <flag_objfile_owned>: Rename to...
|
|
|
|
|
<m_flag_objfile_owned>: ... this.
|
|
|
|
|
<owner>: Rename to...
|
|
|
|
|
<m_owner>: ... this.
|
|
|
|
|
(struct type) <is_objfile_owned, set_owner, objfile, arch>: New
|
|
|
|
|
methods.
|
|
|
|
|
(TYPE_ALLOC): Adjust.
|
|
|
|
|
* gdbtypes.c (alloc_type): Adjust.
|
|
|
|
|
(alloc_type_arch): Adjust.
|
|
|
|
|
(alloc_type_copy): Adjust.
|
|
|
|
|
(get_type_arch): Adjust.
|
|
|
|
|
(smash_type): Adjust.
|
|
|
|
|
(lookup_array_range_type): Adjust.
|
|
|
|
|
(recursive_dump_type): Adjust.
|
|
|
|
|
(copy_type_recursive): Adjust.
|
|
|
|
|
* compile/compile-c-types.c (convert_func): Adjust.
|
|
|
|
|
(convert_type_basic): Adjust.
|
|
|
|
|
* compile/compile-cplus-types.c (compile_cplus_convert_func):
|
|
|
|
|
Adjust.
|
|
|
|
|
* language.c
|
|
|
|
|
(language_arch_info::type_and_symbol::alloc_type_symbol):
|
|
|
|
|
Adjust.
|
|
|
|
|
|
2021-01-21 21:27:12 +08:00
|
|
|
|
2021-01-21 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* coffread.c (enter_linenos): Passing string to complaint.
|
|
|
|
|
* valops.c (value_assign): Make array view.
|
|
|
|
|
|
2021-01-22 03:12:22 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (debug_auto_load): Move here.
|
|
|
|
|
(auto_load_debug_printf): New.
|
|
|
|
|
* auto-load.c: Use auto_load_debug_printf.
|
|
|
|
|
(debug_auto_load): Move to header.
|
|
|
|
|
* linux-thread-db.c (try_thread_db_load): Use
|
|
|
|
|
auto_load_debug_printf.
|
|
|
|
|
* main.c (captured_main_1): Likewise.
|
|
|
|
|
|
2021-01-22 03:07:45 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* f-valprint.c (f77_array_offset_tbl): Remove.
|
|
|
|
|
|
2021-01-22 03:05:54 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdb_bfd.c (bfd_cache_debug_printf): New, use throughout file.
|
|
|
|
|
|
gdb: use interruptible_select when connecting to a remote
When GDB is waiting trying to connect to a remote target and it receives
a SIGWINCH (terminal gets resized), the blocking system call gets
interrupted and we abort.
For example, I connect to some port (on which nothing listens):
(gdb) tar rem :1234
... GDB blocks here, resize the terminal ...
:1234: Interrupted system call.
The backtrace where GDB is blocked while waiting for the connection to
establish is:
#0 0x00007fe9db805b7b in select () from /usr/lib/libc.so.6
#1 0x000055f2472e9c42 in gdb_select (n=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7ffe8fafe050) at /home/simark/src/binutils-gdb/gdb/posix-hdep.c:31
#2 0x000055f24759c212 in wait_for_connect (sock=-1, polls=0x7ffe8fafe300) at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:147
#3 0x000055f24759d0e8 in net_open (scb=0x62500015b900, name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:356
#4 0x000055f2475a0395 in serial_open_ops_1 (ops=0x55f24892ca60 <tcp_ops>, open_name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:244
#5 0x000055f2475a01d6 in serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:231
#6 0x000055f2474d5274 in remote_serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/remote.c:5019
#7 0x000055f2474d7025 in remote_target::open_1 (name=0x6020000601d8 ":1234", from_tty=1, extended_p=0) at /home/simark/src/binutils-gdb/gdb/remote.c:5571
#8 0x000055f2474d47d5 in remote_target::open (name=0x6020000601d8 ":1234", from_tty=1) at /home/simark/src/binutils-gdb/gdb/remote.c:4898
#9 0x000055f24776379f in open_target (args=0x6020000601d8 ":1234", from_tty=1, command=0x611000042bc0) at /home/simark/src/binutils-gdb/gdb/target.c:242
Fix that by using interruptible_select in wait_for_connect, instead of
gdb_select. Resizing the terminal now no longer aborts the connection.
It is still possible to interrupt the connection using ctrl-c.
gdb/ChangeLog:
* ser-tcp.c (wait_for_connect): Use interruptible_select instead
of gdb_select.
Change-Id: Ie25577bd1e5699e4847b6b53fdfa10b8c0dc5c89
2021-01-22 03:04:52 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* ser-tcp.c (wait_for_connect): Use interruptible_select instead
|
|
|
|
|
of gdb_select.
|
|
|
|
|
|
2021-01-02 20:51:27 +08:00
|
|
|
|
2021-01-21 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
PR python/19151
|
|
|
|
|
* python/py-breakpoint.c (bppy_get_location): Handle
|
|
|
|
|
bp_hardware_breakpoint.
|
|
|
|
|
(bppy_init): Likewise.
|
|
|
|
|
(gdbpy_breakpoint_created): Likewise.
|
|
|
|
|
|
2021-01-21 22:26:44 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arm-tdep.c (arm_debug_printf): Add and use throughout file.
|
|
|
|
|
|
2021-01-21 11:38:20 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdb_bfd.c (debug_bfd_cache): Change type to bool.
|
|
|
|
|
(_initialize_gdb_bfd): Adjust.
|
|
|
|
|
|
gdb/dwarf: add assertion in maybe_queue_comp_unit
The symptom that leads to this is the crash described in PR 26828:
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:23478:25: runtime error: member access within null pointer of type 'struct dwarf2_cu'
The line of the crash is the following, in follow_die_offset:
if (target_cu != cu)
target_cu->ancestor = cu; <--- HERE
The line that assign nullptr to `target_cu` is the `per_objfile->get_cu`
call after having called maybe_queue_comp_unit:
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
false, cu->language);
target_cu = per_objfile->get_cu (per_cu); <--- HERE
Some background: there is an invariant, documented in
maybe_queue_comp_unit's doc, that if a CU is queued for expansion
(present in dwarf2_per_bfd::queue), then its DIEs are loaded in memory.
"its DIEs are loaded in memory" is a synonym for saying that a dwarf2_cu
object exists for this CU. Yet another way to say it is that
`per_objfile->get_cu (per_cu)` returns something not nullptr for that
CU.
The crash documented in PR 26828 triggers some hard-to-reproduce
sequence that ends up violating the invariant:
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A
- The DIE in CU A requires some DIE in CU B
- follow_die_offset calls maybe_queue_comp_unit. maybe_queue_comp_unit
sees CU B is not queued and its DIEs are not loaded, so it enqueues it
and returns 1 to its caller - meaning "the DIEs are not loaded, you
should load them" - prompting follow_die_offset to load the DIEs by
calling load_full_comp_unit
- Note that CU B is enqueued by maybe_queue_comp_unit even if it has
already been expanded. It's a bit useless (and causes trouble, see
next patch), but that's how it works right now.
- Since we entered the dwarf2/read code through
dwarf2_fetch_die_type_sect_off, nothing processes the queue, so we
exit the dwarf2/read code with CU B still lingering in the queue.
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A, again
- The DIE in CU A requires some DIE in CU B, again
- This time, maybe_queue_comp_unit sees that CU B is in the queue.
Because of the invariant that if a CU is in the queue, its DIEs are
loaded in the memory, it returns 0 to its caller, meaning "you don't
need to load the DIEs!".
- That happens to be true, so everything is fine for now.
- Time passes, some things call dwarf2_per_objfile::age_comp_units
enough so that CU B's age becomes past the dwarf_max_cache_age
threshold. age_comp_units proceeds to free CU B's DIEs. Remember
that CU B is still lingering in the queue (oops, the invariant just
got violated).
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A, again
- The DIE in CU A requires some DIE in CU B, again
- maybe_queue_comp_unit sees that CU B is in the queue, so returns to
its caller "you don't need to load the DIEs!". However, we know at
this point this is false.
- follow_die_offset doesn't load the DIEs and tries to obtain the DIEs for
CU B:
target_cu = per_objfile->get_cu (per_cu);
But since they are not loaded, target_cu is nullptr, and we get the
crash mentioned above a few lines after that.
This patch adds an assertions in maybe_queue_comp_unit to verify the
invariant, to make sure it doesn't return a falsehood to its caller.
The current patch doesn't fix the issue (the next patch does), but it
makes it so we catch the problem earlier and get this assertion failure
instead of a segmentation fault:
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:9100: internal-error:
int maybe_queue_comp_unit(dwarf2_cu*, dwarf2_per_cu_data*, dwarf2_per_objfile*, language):
Assertion `per_objfile->get_cu (per_cu) != nullptr' failed.
gdb/ChangeLog:
PR gdb/26828
* dwarf2/read.c (maybe_queue_comp_unit): Add assertion.
Change-Id: I4e51bd7bd58773f9fadf480179cbc4bae61508fe
2021-01-21 10:04:43 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/26828
|
|
|
|
|
* dwarf2/read.c (maybe_queue_comp_unit): Add assertion.
|
|
|
|
|
|
2021-01-21 09:57:49 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (follow_die_offset): Add logging.
|
|
|
|
|
(dwarf2_per_objfile::age_comp_units): Add logging.
|
|
|
|
|
|
gdb: make some variables static
I'm trying to enable clang's -Wmissing-variable-declarations warning.
This patch fixes all the obvious spots where we can simply add "static"
(at least, found when building on x86-64 Linux).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
aarch64_stub_unwind, aarch64_normal_base, ): Make static.
* arm-linux-tdep.c (arm_prologue_unwind): Make static.
* arm-tdep.c (struct frame_unwind): Make static.
* auto-load.c (auto_load_safe_path_vec): Make static.
* csky-tdep.c (csky_stub_unwind): Make static.
* gdbarch.c (gdbarch_data_registry): Make static.
* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
* i386-tdep.c (i386_frame_setup_skip_insns,
i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
Make static.
* infrun.c (observer_mode): Make static.
* linux-nat.c (sigchld_action): Make static.
* linux-thread-db.c (thread_db_list): Make static.
* maint-test-options.c (maintenance_test_options_list):
* mep-tdep.c (mep_csr_registers): Make static.
* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
(stats): Make static.
* nat/linux-osdata.c (struct osdata_type): Make static.
* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
* progspace.c (last_program_space_num): Make static.
* python/py-param.c (struct parm_constant): Remove struct type
name.
(parm_constants): Make static.
* python/py-record-btrace.c (btpy_list_methods): Make static.
* python/py-record.c (recpy_gap_type): Make static.
* record.c (record_goto_cmdlist): Make static.
* regcache.c (regcache_descr_handle): Make static.
* registry.h (DEFINE_REGISTRY): Make definition static.
* symmisc.c (std_in, std_out, std_err): Make static.
* top.c (previous_saved_command_line): Make static.
* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
static.
* unittests/command-def-selftests.c (nr_duplicates,
nr_invalid_prefixcmd, lists): Make static.
* unittests/observable-selftests.c (test_notification): Make
static.
* unittests/optional/assignment/1.cc (counter): Make static.
* unittests/optional/assignment/2.cc (counter): Make static.
* unittests/optional/assignment/3.cc (counter): Make static.
* unittests/optional/assignment/4.cc (counter): Make static.
* unittests/optional/assignment/5.cc (counter): Make static.
* unittests/optional/assignment/6.cc (counter): Make static.
gdbserver/ChangeLog:
* ax.cc (bytecode_address_table): Make static.
* debug.cc (debug_file): Make static.
* linux-low.cc (stopping_threads): Make static.
(step_over_bkpt): Make static.
* linux-x86-low.cc (amd64_emit_ops, i386_emit_ops): Make static.
* tracepoint.cc (stop_tracing_bkpt, flush_trace_buffer_bkpt,
alloced_trace_state_variables, trace_buffer_ctrl,
tracing_start_time, tracing_stop_time, tracing_user_name,
tracing_notes, tracing_stop_note): Make static.
Change-Id: Ic1d8034723b7802502bda23770893be2338ab020
2021-01-21 09:55:05 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
|
|
|
|
|
* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
|
|
|
|
|
aarch64_stub_unwind, aarch64_normal_base, ): Make static.
|
|
|
|
|
* arm-linux-tdep.c (arm_prologue_unwind): Make static.
|
|
|
|
|
* arm-tdep.c (struct frame_unwind): Make static.
|
|
|
|
|
* auto-load.c (auto_load_safe_path_vec): Make static.
|
|
|
|
|
* csky-tdep.c (csky_stub_unwind): Make static.
|
|
|
|
|
* gdbarch.c (gdbarch_data_registry): Make static.
|
|
|
|
|
* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
|
|
|
|
|
* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
|
|
|
|
|
* i386-tdep.c (i386_frame_setup_skip_insns,
|
|
|
|
|
i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
|
|
|
|
|
Make static.
|
|
|
|
|
* infrun.c (observer_mode): Make static.
|
|
|
|
|
* linux-nat.c (sigchld_action): Make static.
|
|
|
|
|
* linux-thread-db.c (thread_db_list): Make static.
|
|
|
|
|
* maint-test-options.c (maintenance_test_options_list):
|
|
|
|
|
* mep-tdep.c (mep_csr_registers): Make static.
|
|
|
|
|
* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
|
|
|
|
|
(stats): Make static.
|
|
|
|
|
* nat/linux-osdata.c (struct osdata_type): Make static.
|
|
|
|
|
* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
|
|
|
|
|
* progspace.c (last_program_space_num): Make static.
|
|
|
|
|
* python/py-param.c (struct parm_constant): Remove struct type
|
|
|
|
|
name.
|
|
|
|
|
(parm_constants): Make static.
|
|
|
|
|
* python/py-record-btrace.c (btpy_list_methods): Make static.
|
|
|
|
|
* python/py-record.c (recpy_gap_type): Make static.
|
|
|
|
|
* record.c (record_goto_cmdlist): Make static.
|
|
|
|
|
* regcache.c (regcache_descr_handle): Make static.
|
|
|
|
|
* registry.h (DEFINE_REGISTRY): Make definition static.
|
|
|
|
|
* symmisc.c (std_in, std_out, std_err): Make static.
|
|
|
|
|
* top.c (previous_saved_command_line): Make static.
|
|
|
|
|
* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
|
|
|
|
|
static.
|
|
|
|
|
* unittests/command-def-selftests.c (nr_duplicates,
|
|
|
|
|
nr_invalid_prefixcmd, lists): Make static.
|
|
|
|
|
* unittests/observable-selftests.c (test_notification): Make
|
|
|
|
|
static.
|
|
|
|
|
* unittests/optional/assignment/1.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/2.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/3.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/4.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/5.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/6.cc (counter): Make static.
|
|
|
|
|
|
2021-01-21 09:38:57 +08:00
|
|
|
|
2021-01-20 Joel Sherrill <joel@rtems.org>
|
|
|
|
|
|
|
|
|
|
PR gdb/27219
|
|
|
|
|
* remote.c (struct remote_thread_info) <resume_state>: Rename
|
|
|
|
|
to...
|
|
|
|
|
<get_resume_state>: ... this.
|
|
|
|
|
(remote_target::resume): Adjust.
|
|
|
|
|
(remote_target::commit_resume): Adjust.
|
|
|
|
|
(remote_target::select_thread_for_ambiguous_stop_reply): Adjust.
|
|
|
|
|
|
2021-01-03 15:42:52 +08:00
|
|
|
|
2021-01-20 Sergio Durigan Junior <sergiodj@sergiodj.net>
|
|
|
|
|
Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* stap-probe.c (stap_parse_single_operand): Handle '!'
|
|
|
|
|
operator.
|
|
|
|
|
(stap_parse_argument_conditionally): Likewise.
|
|
|
|
|
Skip spaces after processing open-parenthesis sub-expression.
|
|
|
|
|
(stap_parse_argument_1): Skip spaces after call to
|
|
|
|
|
stap_parse_argument_conditionally.
|
|
|
|
|
Handle case when right-side expression is a parenthesized
|
|
|
|
|
sub-expression.
|
|
|
|
|
Skip spaces after call to stap_parse_argument_1.
|
|
|
|
|
|
2021-01-16 03:35:36 +08:00
|
|
|
|
2021-01-19 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
|
|
|
|
|
|
trad-frame cleanups
With the new member functions for struct trad_frame_saved_reg, there is no
need to invoke some of the set/get functions anymore. This patch removes
those and adjusts all callers.
Even though the most natural initial state of a saved register value is
UNKNOWN, there are target backends relying on the previous initial state
of REALREG set to a register's own number. I noticed this in at least a
couple targets: aarch64 and riscv.
Because of that, I decided to keep the reset function that sets the set of
register values to REALREG. I can't exercise all the targets to make sure
the initial state change won't break things, hence why it is risky to change
the default.
Validated with --enable-targets=all on aarch64-linux Ubuntu 18.04/20.04.
gdb/ChangeLog
2021-01-19 Luis Machado <luis.machado@linaro.org>
* trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
memory and save data.
(trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes)
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p): Remove.
(trad_frame_reset_saved_regs): Adjust documentation.
* trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
constructor and reset the state of the registers.
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p, trad_frame_set_value)
(trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
(trad_frame_set_reg_realreg): Update to call member function.
(trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
(trad_frame_get_prev_register): Likewise.
* aarch64-tdep.c (aarch64_analyze_prologue)
(aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
(aarch64_prologue_prev_register): Update to use member functions.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
* arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
* arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
(arm_make_epilogue_frame_cache): Likewise.
* avr-tdep.c (avr_frame_unwind_cache)
(avr_frame_prev_register): Likewise.
* cris-tdep.c (cris_scan_prologue): Likewise.
* csky-tdep.c (csky_frame_unwind_cache): Likewise.
* frv-tdep.c (frv_analyze_prologue): Likewise.
* hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
(mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
(reset_saved_regs): Adjust to set realreg.
* riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
call member functions.
* rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
* s390-tdep.c (s390_prologue_frame_unwind_cache)
(s390_backchain_frame_unwind_cache): Likewise.
* score-tdep.c (score7_analyze_prologue)
(score3_analyze_prologue, score_make_prologue_cache): Likewise.
* sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
* sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue)
(tilegx_frame_cache): Likewise.
* v850-tdep.c (v850_frame_cache): Likewise.
* vax-tdep.c (vax_frame_cache): Likewise.
2021-01-15 02:43:28 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
|
|
|
|
|
memory and save data.
|
|
|
|
|
(trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
|
|
|
|
|
(trad_frame_set_unknown, trad_frame_set_value_bytes)
|
|
|
|
|
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
|
|
|
|
|
(trad_frame_value_bytes_p): Remove.
|
|
|
|
|
(trad_frame_reset_saved_regs): Adjust documentation.
|
|
|
|
|
* trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
|
|
|
|
|
constructor and reset the state of the registers.
|
|
|
|
|
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
|
|
|
|
|
(trad_frame_value_bytes_p, trad_frame_set_value)
|
|
|
|
|
(trad_frame_set_realreg, trad_frame_set_addr)
|
|
|
|
|
(trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
|
|
|
|
|
(trad_frame_set_reg_realreg): Update to call member function.
|
|
|
|
|
(trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_get_prev_register): Likewise.
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_analyze_prologue)
|
|
|
|
|
(aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
|
|
|
|
|
(aarch64_prologue_prev_register): Update to use member functions.
|
|
|
|
|
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
|
|
|
|
|
* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
|
|
|
|
|
* arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
|
|
|
|
|
* arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
|
|
|
|
|
(arm_make_epilogue_frame_cache): Likewise.
|
|
|
|
|
* avr-tdep.c (avr_frame_unwind_cache)
|
|
|
|
|
(avr_frame_prev_register): Likewise.
|
|
|
|
|
* cris-tdep.c (cris_scan_prologue): Likewise.
|
|
|
|
|
* csky-tdep.c (csky_frame_unwind_cache): Likewise.
|
|
|
|
|
* frv-tdep.c (frv_analyze_prologue): Likewise.
|
|
|
|
|
* hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
|
|
|
|
|
* lm32-tdep.c (lm32_frame_cache): Likewise.
|
|
|
|
|
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
|
|
|
|
|
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
|
|
|
|
|
* mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
|
|
|
|
|
(mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
|
|
|
|
|
(reset_saved_regs): Adjust to set realreg.
|
|
|
|
|
* riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
|
|
|
|
|
call member functions.
|
|
|
|
|
* rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
|
|
|
|
|
* s390-tdep.c (s390_prologue_frame_unwind_cache)
|
|
|
|
|
(s390_backchain_frame_unwind_cache): Likewise.
|
|
|
|
|
* score-tdep.c (score7_analyze_prologue)
|
|
|
|
|
(score3_analyze_prologue, score_make_prologue_cache): Likewise.
|
|
|
|
|
* sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
|
|
|
|
|
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
|
|
|
|
|
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* tilegx-tdep.c (tilegx_analyze_prologue)
|
|
|
|
|
(tilegx_frame_cache): Likewise.
|
|
|
|
|
* v850-tdep.c (v850_frame_cache): Likewise.
|
|
|
|
|
* vax-tdep.c (vax_frame_cache): Likewise.
|
|
|
|
|
|
2021-01-16 00:16:04 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* frame.h (get_frame_register_bytes): Pass a gdb::array_view instead
|
|
|
|
|
of buffer + length.
|
|
|
|
|
(put_frame_register_bytes): Likewise.
|
|
|
|
|
Adjust documentation.
|
|
|
|
|
(get_frame_memory): Pass a gdb::array_view instead of buffer + length.
|
|
|
|
|
(safe_frame_unwind_memory): Likewise.
|
|
|
|
|
* frame.c (get_frame_register_bytes, put_frame_register_bytes)
|
|
|
|
|
(get_frame_memory, safe_frame_unwind_memory): Adjust to use
|
|
|
|
|
gdb::array_view.
|
|
|
|
|
* amd64-fbsd-tdep.c (amd64fbsd_sigtramp_p): Likewise.
|
|
|
|
|
* amd64-linux-tdep.c (amd64_linux_sigtramp_start): Likewise.
|
|
|
|
|
* amd64-obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
|
|
|
|
|
* arc-linux-tdep.c (arc_linux_is_sigtramp): Likewise.
|
|
|
|
|
* cris-tdep.c (cris_sigtramp_start, cris_rt_sigtramp_start): Likewise.
|
|
|
|
|
* dwarf2/loc.c (rw_pieced_value): Likewise.
|
|
|
|
|
* hppa-tdep.c (hppa_frame_cache): Likewise.
|
|
|
|
|
* i386-fbsd-tdep.c (i386fbsd_sigtramp_p): Likewise.
|
|
|
|
|
* i386-gnu-tdep.c (i386_gnu_sigtramp_start): Likewise.
|
|
|
|
|
* i386-linux-tdep.c (i386_linux_sigtramp_start)
|
|
|
|
|
(i386_linux_rt_sigtramp_start): Likewise.
|
|
|
|
|
* i386-obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
|
|
|
|
|
* i386-tdep.c (i386_register_to_value): Likewise.
|
|
|
|
|
* i387-tdep.c (i387_register_to_value): Likewise.
|
|
|
|
|
* ia64-tdep.c (ia64_register_to_value): Likewise.
|
|
|
|
|
* m32r-linux-tdep.c (m32r_linux_sigtramp_start)
|
|
|
|
|
(m32r_linux_rt_sigtramp_start): Likewise.
|
|
|
|
|
* m68k-linux-tdep.c (m68k_linux_pc_in_sigtramp): Likewise.
|
|
|
|
|
* m68k-tdep.c (m68k_register_to_value): Likewise.
|
|
|
|
|
* mips-tdep.c (mips_register_to_value)
|
|
|
|
|
(mips_value_to_register): Likewise.
|
|
|
|
|
* ppc-fbsd-tdep.c (ppcfbsd_sigtramp_frame_sniffer)
|
|
|
|
|
(ppcfbsd_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* ppc-obsd-tdep.c (ppcobsd_sigtramp_frame_sniffer)
|
|
|
|
|
(ppcobsd_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* rs6000-tdep.c (rs6000_in_function_epilogue_frame_p)
|
|
|
|
|
(rs6000_register_to_value): Likewise.
|
|
|
|
|
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
|
|
|
|
|
* tramp-frame.c (tramp_frame_start): Likewise.
|
|
|
|
|
* valops.c (value_assign): Likewise.
|
|
|
|
|
|
2020-12-24 03:06:11 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* aarch64-linux-tdep.c (aarch64_linux_restore_vreg): Pass in an
|
|
|
|
|
array_view.
|
|
|
|
|
* trad-frame.c (trad_frame_set_value_bytes): Use gdb::array_view
|
|
|
|
|
instead of buffer and size.
|
|
|
|
|
(trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
* trad-frame.h (trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_set_value_bytes): Likewise.
|
|
|
|
|
|
2021-01-19 10:28:20 +08:00
|
|
|
|
2021-01-18 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* copyright.py (NOT_FSF_LIST): Delete sim/testsuite/sim/bfin/s21.s.
|
|
|
|
|
|
2020-12-02 23:10:06 +08:00
|
|
|
|
2021-01-18 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* riscv-fbsd-tdep.c (riscv_fbsd_supply_gregset): Delete.
|
|
|
|
|
(riscv_fbsd_gregset): Use riscv_supply_regset.
|
|
|
|
|
(riscv_fbsd_fpregset): Likewise.
|
|
|
|
|
* riscv-linux-tdep.c (riscv_linux_gregset): Likewise.
|
|
|
|
|
(riscv_linux_fregset): Likewise.
|
|
|
|
|
* riscv-tdep.c (riscv_supply_regset): Define new function.
|
|
|
|
|
* riscv-tdep.h (riscv_supply_regset): Declare new function.
|
|
|
|
|
|
[gdb/tdep] Handle si_addr_bnd in compat_siginfo_from_siginfo
When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
unix/-m32, we run into:
...
(gdb) continue^M
Continuing.^M
Saw a #BR! status 1 at 0x8048c2d^M
^M
Program received signal SIGSEGV, Segmentation fault^M
Upper bound violation while accessing address 0x0804c15c^M
Bounds: [lower = 0x00000000, upper = 0x00000000].^M
0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0, \
d=0x804c1e0, len=1) at i386-mpx-sigsegv.c:79^M
79 value = *(p - len);^M
(gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...
The problem is that lower and upper in the Bounds message are 0x0, which is
caused by $_siginfo._sifields._sigfault._addr_bnd.{_lower,_upper} evaluating
to 0x0.
Fix this by copying the si_lower/si_upper fields in
compat_siginfo_from_siginfo.
Tested on x86_64-linux, with target board unix/-m32.
gdb/ChangeLog:
2021-01-18 Tom de Vries <tdevries@suse.de>
PR tdep/27172
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
New macro.
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
for SEGV_BNDERR.
2021-01-18 16:32:38 +08:00
|
|
|
|
2021-01-18 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR tdep/27172
|
|
|
|
|
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
|
|
|
|
|
New macro.
|
|
|
|
|
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
|
|
|
|
|
for SEGV_BNDERR.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target) <remote_hostio_send_command,
|
|
|
|
|
remote_hostio_parse_result>: Constify parameter.
|
|
|
|
|
(remote_hostio_parse_result): Likewise.
|
|
|
|
|
(remote_target::remote_hostio_send_command): Adjust.
|
|
|
|
|
(remote_target::remote_hostio_pread_vFile): Adjust.
|
|
|
|
|
(remote_target::fileio_readlink): Adjust.
|
|
|
|
|
(remote_target::fileio_fstat): Adjust.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (remote_target::start_remote): Move wait_status to
|
|
|
|
|
narrower scope.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target):
|
|
|
|
|
<add_current_inferior_and_thread>: Constify parameter.
|
|
|
|
|
(stop_reply_extract_thread): Likewise.
|
|
|
|
|
(remote_target::get_current_thread): Likewise.
|
|
|
|
|
(remote_target::add_current_inferior_and_thread): Likewise.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target)
|
|
|
|
|
<remote_unpack_thread_info_response,
|
|
|
|
|
parse_threadlist_response>: Constify parameter and/or return
|
|
|
|
|
value and or local variable.
|
|
|
|
|
(stub_unpack_int): Likewise.
|
|
|
|
|
(unpack_nibble): Likewise.
|
|
|
|
|
(unpack_byte): Likewise.
|
|
|
|
|
(unpack_int): Likewise.
|
|
|
|
|
(unpack_string): Likewise.
|
|
|
|
|
(unpack_threadid): Likewise.
|
|
|
|
|
(remote_target::remote_unpack_thread_info_response): Likewise.
|
|
|
|
|
(remote_target::parse_threadlist_response): Likewise.
|
|
|
|
|
|
2021-01-16 04:21:04 +08:00
|
|
|
|
2021-01-15 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
|
|
|
|
|
|
2021-01-15 06:52:00 +08:00
|
|
|
|
2021-01-14 Lancelot Six <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* MAINTAINERS (Write After Approval): Add myself.
|
|
|
|
|
|
2021-01-05 04:40:41 +08:00
|
|
|
|
2021-01-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
|
|
|
|
|
|
|
|
|
* trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error
|
|
|
|
|
because is_trivially_default_constructible was first implemented with
|
|
|
|
|
gcc-5.
|
|
|
|
|
|
[gdb/breakpoint] Handle .plt.sec in in_plt_section
Consider the following test-case small.c:
...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void) {
int *p = (int *)malloc (sizeof(int) * 4);
memset (p, 0, sizeof(p));
printf ("p[0] = %d; p[3] = %d\n", p[0], p[3]);
return 0;
}
...
On Ubuntu 20.04, we get:
...
$ gcc -O0 -g small.c
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
p[0] = 0; p[3] = 0
[Inferior 1 (process $dec) exited normally]
...
but after switching off the on-by-default fcf-protection, we get the desired
behaviour:
...
$ gcc -O0 -g small.c -fcf-protection=none
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
7 memset (p, 0, sizeof(p));
...
Using "set debug infrun 1", the first observable difference between the two
debug sessions is that with -fcf-protection=none we get:
...
[infrun] process_event_stop_test: stepped into dynsym resolve code
...
In this case, "in_solib_dynsym_resolve_code (malloc@plt)" returns true because
"in_plt_section (malloc@plt)" returns true.
With -fcf-protection=full, "in_solib_dynsym_resolve_code (malloc@plt)" returns
false because "in_plt_section (malloc@plt)" returns false, because the section
name for malloc@plt is .plt.sec instead of .plt, which is not handled in
in_plt_section:
...
static inline int
in_plt_section (CORE_ADDR pc)
{
return pc_in_section (pc, ".plt");
}
...
Fix this by handling .plt.sec in in_plt_section.
Tested on x86_64-linux.
[ Another requirement to be able to reproduce this is to have a dynamic linker
with a "malloc" minimal symbol, which causes find_solib_trampoline_target to
find it, such that skip_language_trampoline returns the address for the
dynamic linkers malloc. This causes the step machinery to set a breakpoint
there, and to continue, expecting to hit it. Obviously, we execute glibc's
malloc instead, so the breakpoint is not hit and we continue to program
completion. ]
gdb/ChangeLog:
2021-01-14 Tom de Vries <tdevries@suse.de>
PR breakpoints/27151
* objfiles.h (in_plt_section): Handle .plt.sec.
2021-01-14 17:35:34 +08:00
|
|
|
|
2021-01-14 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27151
|
|
|
|
|
* objfiles.h (in_plt_section): Handle .plt.sec.
|
|
|
|
|
|
gdb: better handling of 'S' packets
This commit builds on work started in the following two commits:
commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493
Date: Thu Jan 30 14:35:40 2020 +0000
gdb/remote: Restore support for 'S' stop reply packet
commit cada5fc921e39a1945c422eea055c8b326d8d353
Date: Wed Mar 11 12:30:13 2020 +0000
gdb: Handle W and X remote packets without giving a warning
This is related to how GDB handles remote targets that send back 'S'
packets.
In the first of the above commits we fixed GDB's ability to handle a
single process, single threaded target that sends back 'S' packets.
Although the 'T' packet would always be preferred to 'S' these days,
there's nothing really wrong with 'S' for this situation.
The second commit above fixed an oversight in the first commit, a
single-process, multi-threaded target can send back a process wide
event, for example the process exited event 'W' without including a
process-id, this also is fine as there is no ambiguity in this case.
In PR gdb/26819 we run into yet another problem with the above
commits. In this case we have a single process with two threads, GDB
hits a breakpoint in thread 2 and then performs a stepi:
(gdb) b main
Breakpoint 1 at 0x1212340830: file infinite_loop.S, line 10.
(gdb) c
Continuing.
Thread 2 hit Breakpoint 1, main () at infinite_loop.S:10
10 in infinite_loop.S
(gdb) set debug remote 1
(gdb) stepi
Sending packet: $vCont;s:2#24...Packet received: S05
../binutils-gdb/gdb/infrun.c:5807: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
What happens in this case is that on the RISC-V target displaced
stepping is not supported, so when the stepi is issued GDB steps just
thread 2. As only a single thread was set running the target decides
that is can get away with sending back an 'S' packet without a
thread-id. GDB then associates the stop with thread 1 (the first
non-exited thread), but as thread 1 was not previously set executing
the assertion seen above triggers.
As an aside I am surprised that the target sends pack 'S' in this
situation. The target is happy to send back 'T' (including thread-id)
when multiple threads are set running, so (to me) it would seem easier
to just always use the 'T' packet when multiple threads are in use.
However, the target only uses 'T' when multiple threads are actually
executing, otherwise an 'S' packet it used.
Still, when looking at the above situation we can see that GDB should
be able to understand which thread the 'S' reply is referring too.
The problem is that is that in commit 24ed6739b699 (above) when a stop
reply comes in with no thread-id we look for the first non-exited
thread and select that as the thread the stop applies too.
What we should really do is select the first non-exited, resumed thread,
and associate the stop event with this thread. In the above example
both thread 1 and 2 are non-exited, but only thread 2 is resumed, so
this is what we should use.
There's a test for this issue included which works with stock
gdbserver by disabling use of the 'T' packet, and enabling
'scheduler-locking' within GDB so only one thread is set running.
gdb/ChangeLog:
PR gdb/26819
* remote.c
(remote_target::select_thread_for_ambiguous_stop_reply): New
member function.
(remote_target::process_stop_reply): Call
select_thread_for_ambiguous_stop_reply.
gdb/testsuite/ChangeLog:
PR gdb/26819
* gdb.server/stop-reply-no-thread-multi.c: New file.
* gdb.server/stop-reply-no-thread-multi.exp: New file.
Change-Id: I9b49d76c2a99063dcc76203fa0f5270a72825d15
2021-01-14 09:26:58 +08:00
|
|
|
|
2021-01-13 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26819
|
|
|
|
|
* remote.c
|
|
|
|
|
(remote_target::select_thread_for_ambiguous_stop_reply): New
|
|
|
|
|
member function.
|
|
|
|
|
(remote_target::process_stop_reply): Call
|
|
|
|
|
select_thread_for_ambiguous_stop_reply.
|
|
|
|
|
|
2021-01-14 09:25:58 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* record-btrace.c (class record_btrace_target): Remove.
|
|
|
|
|
(record_btrace_target::commit_resume): Remove.
|
|
|
|
|
* record-full.c (class record_full_target): Remove.
|
|
|
|
|
(record_full_target::commit_resume): Remove.
|
|
|
|
|
|
gdb: make the remote target track its own thread resume state
The next patch moves the target commit_resume method to be a
process_stratum_target-only method. The only non-process targets that
currently implement the commit_resume method are the btrace and full
record targets. The only reason they need to do so is to prevent a
commit resume from reaching the beneath (process) target if they are
currently replaying.
This is important if a record target is used on top of the remote target
(the only process target implementing the commit_resume method).
Currently, the remote target checks the `thread_info::executing` flag of
a thread to know if it should commit resume that thread:
if (!tp->executing || remote_thr->vcont_resumed)
continue;
The `tp->executing` flag is set by infrun when it has asked the target
stack to resume the thread, and therefore if the thread is executing,
from its point of view. It _not_ equivalent to whether the remote
target was asked to resume this thread.
Indeed, if infrun asks the target stack to resume some thread while the
record target is replaying, the record target won't forward the resume
request the remote target beneath, because we don't actually want to
resume the thread on the execution target. But the `tp->executing` flag
is still set, because from the point of view of infrun, the thread
executes. So, if the commit_resume call wasn't intercepted by the
record target as it is today and did reach the remote target, the remote
target would say "Oh, this thread should be executing and I haven't
vCont-resumed it! I must vCont-resume it!". But that would be wrong,
because it was never asked to resume this thread, the resume request did
not reach it. This is why the record targets currently need to
implement commit_resume: to prevent the beneath target from
commit_resuming threads it wasn't asked to resume.
Since commit_resume will become a method on process_stratum_target in
the following patch, record targets won't have a chance to intercept the
calls and that would result in the remote target commit_resuming threads
it shouldn't. To avoid this, this patch makes the remote target track
its own thread resumption state. That means, tracking which threads it
was asked to resume via target_ops::resume. Regardless of the context
of this patch, I think this change makes it easier to understand how
resume / commit_resume works in the remote target. It makes the target
more self-contained, as it only depends on what it gets asked to do via
the target methods, and not on tp->executing, which is a flag maintained
from the point of view of infrun.
I initially made it so this state was only used when the remote target
operates in non-stop mode, since commit_resume is only used when the
target is non-stop. However, it's more consistent and it can be useful
to maintain this state even in all-stop too. In all-stop, receiving a
stop notification for one thread means all threads of the target are
considered stopped.
From the point of view of the remote target, there are three states a
thread can be in:
1. not resumed
2. resumed but pending vCont-resume
3. resumed
State 2 only exists when the target is non-stop.
As of this patch, valid state transitions are:
- 1 -> 2 (through the target resume method if in non-stop)
- 2 -> 3 (through the target commit_resume method if in non-stop)
- 1 -> 3 (through the target resume method if in all-stop)
- 3 -> 1 (through a remote stop notification / reporting an event to the
event loop)
A subsequent patch will make it possible to go from 2 to 1, in case
infrun asks to stop a thread that was resumed but not commit-resumed
yet. I don't think it can happen as of now.
In terms of code, this patch replaces the vcont_resumed field with an
enumeration that explicitly represents the three states described above.
The last_resume_sig and last_resume_step fields are moved to a structure
which is clearly identified as only used when the thread is in the
"resumed but pending vCont-resume" state.
gdb/ChangeLog:
* remote.c (enum class resume_state): New.
(struct resumed_pending_vcont_info): New.
(struct remote_thread_info) <resume_state, set_not_resumed,
set_resumed_pending_vcont, resumed_pending_vcont_info,
set_resumed, m_resume_state, m_resumed_pending_vcont_info>:
New.
<last_resume_step, last_resume_sig, vcont_resumed>: Remove.
(remote_target::remote_add_thread): Adjust.
(remote_target::process_initial_stop_replies): Adjust.
(remote_target::resume): Adjust.
(remote_target::commit_resume): Rely on state in
remote_thread_info and not on tp->executing.
(remote_target::process_stop_reply): Adjust.
Change-Id: I10480919ccb4552faa62575e447a36dbe7c2d523
2021-01-14 09:20:43 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* remote.c (enum class resume_state): New.
|
|
|
|
|
(struct resumed_pending_vcont_info): New.
|
|
|
|
|
(struct remote_thread_info) <resume_state, set_not_resumed,
|
|
|
|
|
set_resumed_pending_vcont, resumed_pending_vcont_info,
|
|
|
|
|
set_resumed, m_resume_state, m_resumed_pending_vcont_info>:
|
|
|
|
|
New.
|
|
|
|
|
<last_resume_step, last_resume_sig, vcont_resumed>: Remove.
|
|
|
|
|
(remote_target::remote_add_thread): Adjust.
|
|
|
|
|
(remote_target::process_initial_stop_replies): Adjust.
|
|
|
|
|
(remote_target::resume): Adjust.
|
|
|
|
|
(remote_target::commit_resume): Rely on state in
|
|
|
|
|
remote_thread_info and not on tp->executing.
|
|
|
|
|
(remote_target::process_stop_reply): Adjust.
|
|
|
|
|
|
2021-01-14 03:32:39 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.h (arc_debug_printf): New.
|
|
|
|
|
* arc-tdep.c: Use arc_debug_printf.
|
|
|
|
|
* arc-linux-nat.c (arc_linux_nat_debug_printf): Add and use.
|
|
|
|
|
* arc-linux-tdep.c (arc_linux_debug_printf): Add and use.
|
|
|
|
|
* arc-newlib-tdep.c (arc_newlib_debug_printf): Add and use.
|
|
|
|
|
|
2021-01-14 03:32:23 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.h (arc_debug): Change type to bool.
|
|
|
|
|
* arc-tdep.c (arc_debug): Change type to bool.
|
|
|
|
|
(arc_analyze_prologue): Adjust.
|
|
|
|
|
(_initialize_arc_tdep): Use add_setshow_boolean_cmd.
|
|
|
|
|
* arc-linux-nat.c (ps_get_thread_area): Adjust.
|
|
|
|
|
|
2021-01-14 01:00:37 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.c (auto_load_objfile_script_1): Use bool.
|
|
|
|
|
(execute_script_contents): Use bool.
|
|
|
|
|
|
2021-01-14 00:57:24 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move
|
|
|
|
|
comment here.
|
|
|
|
|
* auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move
|
|
|
|
|
comment to header.
|
|
|
|
|
* extension-priv.h (struct extension_language_script_ops)
|
|
|
|
|
<auto_load_enabled>: Return bool.
|
|
|
|
|
* extension.h (ext_lang_auto_load_enabled): Return bool, move
|
|
|
|
|
comment here.
|
|
|
|
|
* extension.c (ext_lang_auto_load_enabled): Return bool, move
|
|
|
|
|
comment to header.
|
|
|
|
|
* guile/guile-header.h (gdbscm_auto_load_enabled): Return bool,
|
|
|
|
|
move comment here.
|
|
|
|
|
* guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool,
|
|
|
|
|
move comment to header.
|
|
|
|
|
* python/python-header.h (gdbpy_auto_load_enabled): Return bool,
|
|
|
|
|
move comment here.
|
|
|
|
|
* python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool,
|
|
|
|
|
move comment to header.
|
|
|
|
|
|
2021-01-14 00:44:24 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (file_is_auto_load_safe): Change return type to
|
|
|
|
|
bool, move comment here.
|
|
|
|
|
* auto-load.c (file_is_auto_load_safe): Change return type and
|
|
|
|
|
advice_printed to bool. Move comment to header.
|
|
|
|
|
|
gdb: convert jit to new-style debug macros
Here's a sample output, with infrun debug enabled as well to show
nesting:
[infrun] fetch_inferior_event: enter
[infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
[infrun] print_target_wait_results: 4116727.4116727.0 [process 4116727],
[infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 0
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] handle_signal_stop: stop_pc=0x555555555229
[infrun] handle_jit_event: handling bp_jit_event
[jit] jit_read_descriptor: descriptor_addr = 0x5555555580b0
[jit] jit_register_code: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_bfd_try_read_symtab: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_breakpoint_re_set_internal: breakpoint_addr = 0x555555555229
[infrun] process_event_stop_test: BPSTAT_WHAT_SINGLE
[infrun] process_event_stop_test: no stepping, continue
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [process 4116727] at 0x555555555229
[infrun] prepare_to_wait: prepare_to_wait
[infrun] fetch_inferior_event: exit
gdb/ChangeLog:
* jit.c (jit_debug_printf): New, use throughout file.
Change-Id: Ic0f5eb3ffc926fb555de4914e7dc1076ada63a97
2021-01-13 23:48:51 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* jit.c (jit_debug_printf): New, use throughout file.
|
|
|
|
|
|
2021-01-13 07:09:51 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* infrun.c (normal_stop): Fix indentation.
|
|
|
|
|
|
2021-01-13 03:19:49 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* top.h (readnow_symbol_files, readnever_symbol_files): Move
|
|
|
|
|
declarations to ...
|
|
|
|
|
* symfile.h: ... here.
|
|
|
|
|
* symfile.c: Update doc.
|
|
|
|
|
|
2021-01-13 03:19:49 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target.h (baud_rate, serial_parity): Move declarations...
|
|
|
|
|
* serial.h: ... here.
|
|
|
|
|
* main.c: Include serial.h.
|
|
|
|
|
* serial.c (baud_rate, serial_parity): Update doc.
|
|
|
|
|
|
2021-01-12 23:42:43 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* top.c (pre_init_ui_hook): Remove.
|
|
|
|
|
|
aarch64: Add support for bfloat16 in gdb.
This patch adds support for bfloat16 in AArch64 gdb.
Also adds the field "bf" to vector registers h0-h31.
Also adds the vector "bf" to h field in vector registers v0-v31.
The following is how the vector register h and v looks like.
Before this patch:
(gdb) p $h0
$1 = {f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0}, s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
After this patch:
(gdb) p $h0
$1 = {bf = 0, f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {bf = 0x0, f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {bf = {0, 0, 0, 0, 0, 0, 0, 0}, f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0},
s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {bf = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
gdb/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
(aarch64_vnv_type): Add "bf" type in h field of v registers.
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
* features/aarch64-fpu.xml: Add bfloat16 type.
gdb/testsuite/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* gdb.arch/aarch64-fp.exp: Modify to test bfloat16 support.
2021-01-12 21:57:23 +08:00
|
|
|
|
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
|
|
|
|
|
(aarch64_vnv_type): Add "bf" type in h field of v registers.
|
|
|
|
|
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
|
|
|
|
|
* features/aarch64-fpu.xml: Add bfloat16 type.
|
|
|
|
|
|
gdb: fix debug dump of OP_BOOL expressions
Consider this GDB session:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x4055d90, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x4055d90, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL Unknown format
1 BINOP_ADD
2 OP_BOOL Unknown format
3 OP_NULL Unknown format
$1 = .TRUE.
The final dump of the OP_BOOL is completely wrong. After this patch
we now get:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x2d07470, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x2d07470, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL TRUE
$1 = .TRUE.
Much better. I added a test for this into the Fortran testsuite.
gdb/ChangeLog:
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
gdb/testsuite/ChangeLog:
* gdb.fortran/debug-expr.exp: Add new tests.
2021-01-11 23:40:18 +08:00
|
|
|
|
2021-01-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
|
|
|
|
|
|
2021-01-11 22:14:02 +08:00
|
|
|
|
2021-01-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (dot_ops): Rename to...
|
|
|
|
|
(fortran_operators): ...this. Add a header comment. Add symbol
|
|
|
|
|
based operators.
|
|
|
|
|
(yylex): Update to use fortran_operators not dot_ops. Remove
|
|
|
|
|
special handling for '**', this is now included in
|
|
|
|
|
fortran_operators.
|
|
|
|
|
|
2021-01-12 05:52:42 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arch/aarch64-insn.h (aarch64_debug_printf): New.
|
|
|
|
|
* arch/aarch64-insn.c: Use aarch64_debug_printf.
|
|
|
|
|
* aarch64-tdep.c: Use aarch64_debug_printf.
|
|
|
|
|
|
2021-01-12 05:30:44 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* solib-aix.c (solib_aix_debug_printf): New, use throughout
|
|
|
|
|
file.
|
|
|
|
|
|
2021-01-12 05:18:48 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* jit.c (jit_debug): Change type to bool.
|
|
|
|
|
(_initialize_jit): Adjust.
|
|
|
|
|
|
2021-01-10 02:38:41 +08:00
|
|
|
|
2021-01-09 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
PR compile/23672
|
|
|
|
|
* compile/compile.c (compile_to_object): Avoid crash when
|
|
|
|
|
osabi_triplet_regexp returns NULL.
|
|
|
|
|
|
2021-01-10 01:06:25 +08:00
|
|
|
|
2021-01-09 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* tracepoint.h (class collection_list) <append_exp>: Take a
|
|
|
|
|
std::string.
|
|
|
|
|
* tracepoint.c (collection_list::append_exp): Take a std::string.
|
|
|
|
|
(encode_actions_1): Update.
|
|
|
|
|
|
2021-01-09 03:20:12 +08:00
|
|
|
|
2021-01-08 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* parse.c (parse_expression): Add void_context_p parameter. Use
|
|
|
|
|
parse_exp_in_context.
|
|
|
|
|
* printcmd.c (print_command_1): Change voidprint to bool. Pass to
|
|
|
|
|
parse_expression.
|
|
|
|
|
(print_command, call_command): Update.
|
|
|
|
|
* expression.h (parse_expression): Add void_context_p parameter.
|
|
|
|
|
|
gdb: user variables with components of dynamic type
Consider this Fortran type:
type :: some_type
integer, allocatable :: array_one (:,:)
integer :: a_field
integer, allocatable :: array_two (:,:)
end type some_type
And a variable declared:
type(some_type) :: some_var
Now within GDB we try this:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one =
../../src/gdb/value.c:3968: internal-error: Unexpected lazy value type.
Normally, when an internalvar ($a in this case) is created, it is
non-lazy, the value is immediately copied out of the inferior into
GDB's memory.
When printing the internalvar ($a) GDB will extract each field in
turn, so in this case `array_one`. As the original internalvar is
non-lazy then the extracted field will also be non-lazy, with its
contents immediately copied from the parent internalvar.
However, when the field has a dynamic type this is not the case, in
value_primitive_field we see that any field with dynamic type is
always created lazy. Further, the content of this field will usually
not have been captured in the contents buffer of the original value, a
field with dynamic location is effectively a pointer value contained
within the parent value, with rules in the DWARF for how to
dereference the pointer.
So, we end up with a lazy lval_internalvar_component representing a
field within an lval_internalvar. This eventually ends up in
value_fetch_lazy, which currently does not support
lval_internalvar_component, and we see the error above.
My original plan for how to handle this involved extending
value_fetch_lazy to handle lval_internalvar_component. However, when
I did this I ran into another error:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one = ((1, 1) (1, 1) (1, 1)), a_field = 5, array_two = ((0, 0, 0) (0, 0, 0)) )
(gdb) p $a%array_one
$2 = ((1, 1) (1, 1) (1, 1))
(gdb) p $a%array_one(1,1)
../../src/gdb/value.c:1547: internal-error: void set_value_address(value*, CORE_ADDR): Assertion `value->lval == lval_memory' failed.
The problem now is inside set_value_component_location, where we
attempt to set the address for a component if the original parent
value has a dynamic location. GDB does not expect to ever set the
address on anything other than an lval_memory value (which seems
reasonable).
In order to resolve this issue I initially thought about how an
internalvar should "capture" the value of a program variable at the
moment the var is created. In an ideal world (I think) GDB would be
able to do this even for values with dynamic type. So in our above
example doing `set $a = some_var` would capture the content of
'some_var', but also the content of 'array_one', and also 'array_two',
even though these content regions are not contained within the region
of 'some_var'.
Supporting this would require GDB values to be able to carry around
multiple non-contiguous regions of memory as content in some way,
which sounds like a pretty huge change to a core part of GDB.
So, I wondered if there was some other solution that wouldn't require
such a huge change.
What if values with a dynamic location were though of like points with
automatic dereferencing? Given this C structure:
struct foo_t {
int *val;
}
struct foo_t my_foo;
Then in GDB:
(gdb) $a = my_foo
We would expect GDB to capture the pointer value in '$a', but not the
value pointed at by the pointer. So maybe it's not that unreasonable
to think that given a dynamically typed field GDB will capture the
address of the content, but not the actual content itself.
That's what this patch does.
The approach is to catch this case in set_value_component_location.
When we create a component location (of an lval_internalvar) that has
a dynamic data location, the lval_internalvar_component is changed
into an lval_memory. After this, both of the above issues are
resolved. In the first case, the lval_memory is still lazy, but
value_fetch_lazy knows how to handle that. In the second case, when
we access an element of the array we are now accessing an element of
an lval_memory, not an lval_internalvar_component, and calling
set_value_address on an lval_memory is fine.
gdb/ChangeLog:
* value.c (set_value_component_location): Adjust the VALUE_LVAL
for internalvar components that have a dynamic location.
gdb/testsuite/ChangeLog:
* gdb.fortran/intvar-dynamic-types.exp: New file.
* gdb.fortran/intvar-dynamic-types.f90: New file.
2020-10-22 18:34:52 +08:00
|
|
|
|
2021-01-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* value.c (set_value_component_location): Adjust the VALUE_LVAL
|
|
|
|
|
for internalvar components that have a dynamic location.
|
|
|
|
|
|
[gdb] Fix internal-error in process_event_stop_test
The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile. It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
for (objfile *objfile : current_program_space->objfiles ())
{
/* Try using probes. */
if (/* successful */)
continue;
/* Try using _Unwind_DebugHook */
}
...
The preference scheme works ok both if the objfile has debug info, and if it's
stripped.
But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present). What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).
This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
void process_event_stop_test(execution_control_state*): \
Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...
To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".
Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-08 Tom de Vries <tdevries@suse.de>
PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here. Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.
2021-01-08 18:11:16 +08:00
|
|
|
|
2021-01-08 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR gdb/26881
|
|
|
|
|
* breakpoint.c (create_exception_master_breakpoint_probe)
|
|
|
|
|
(create_exception_master_breakpoint_hook): Factor out
|
|
|
|
|
of ...
|
|
|
|
|
(create_exception_master_breakpoint): ... here. Only try to install
|
|
|
|
|
the master exception breakpoint in objfile.debug using the
|
|
|
|
|
_Unwind_DebugHook method, if the install using probes in objfile
|
|
|
|
|
failed.
|
|
|
|
|
|
2021-01-08 01:13:21 +08:00
|
|
|
|
2021-01-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (fortran_value_subarray): Call value_from_component.
|
|
|
|
|
|
2015-12-30 12:52:57 +08:00
|
|
|
|
2021-01-07 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* remote-sim.c: Include memory-map.h.
|
|
|
|
|
(gdbsim_target): Define memory_map override.
|
|
|
|
|
(gdbsim_target::memory_map): Define.
|
|
|
|
|
|
2021-01-07 22:02:46 +08:00
|
|
|
|
2021-01-07 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (do_full_match): Conditionally skip "_ada_" prefix.
|
|
|
|
|
|
2021-01-07 21:58:19 +08:00
|
|
|
|
2021-01-07 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (add_component_interval): Start loop using vector's
|
|
|
|
|
updated size.
|
|
|
|
|
|
Fix fixed-point binary operation type handling
Testing showed that gdb was not correctly handling some fixed-point
binary operations correctly.
Addition and subtraction worked by casting the result to the type of
left hand operand. So, "fixed+int" had a different type -- and
different value -- from "int+fixed".
Furthermore, for multiplication and division, it does not make sense
to first cast both sides to the fixed-point type. For example, this
can prevent "f * 1" from yielding "f", if 1 is not in the domain of
"f". Instead, this patch changes gdb to use the value. (This is
somewhat different from Ada semantics, as those can yield a "universal
fixed point".)
This includes a new test case. It is only run in "minimal" mode, as
the old-style fixed point works differently, and is obsolete, so I
have no plans to change it.
gdb/ChangeLog
2021-01-06 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_evaluate_subexp) <BINOP_ADD, BINOP_SUB>:
Do not cast result.
* valarith.c (fixed_point_binop): Handle multiplication
and division specially.
* valops.c (value_to_gdb_mpq): New function.
(value_cast_to_fixed_point): Use it.
gdb/testsuite/ChangeLog
2021-01-06 Tom Tromey <tromey@adacore.com>
* gdb.ada/fixed_points/pck.ads (Delta4): New constant.
(FP4_Type): New type.
(FP4_Var): New variable.
* gdb.ada/fixed_points/fixed_points.adb: Update.
* gdb.ada/fixed_points.exp: Add tests for binary operators.
2021-01-07 04:47:48 +08:00
|
|
|
|
2021-01-06 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_evaluate_subexp) <BINOP_ADD, BINOP_SUB>:
|
|
|
|
|
Do not cast result.
|
|
|
|
|
* valarith.c (fixed_point_binop): Handle multiplication
|
|
|
|
|
and division specially.
|
|
|
|
|
* valops.c (value_to_gdb_mpq): New function.
|
|
|
|
|
(value_cast_to_fixed_point): Use it.
|
|
|
|
|
|
2020-12-21 21:26:29 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
|
|
|
|
|
Call wnoutrefresh instead of tui_win_info::refresh_window.
|
|
|
|
|
|
2020-12-21 20:52:03 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-source.c (tui_source_window::show_line_number):
|
|
|
|
|
Redraw second space after line number.
|
|
|
|
|
|
2020-12-21 20:16:24 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
PR tui/26927
|
|
|
|
|
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
|
|
|
|
|
Fix source pad size in prefresh.
|
|
|
|
|
(tui_source_window_base::show_source_content): Grow source pad
|
|
|
|
|
if necessary.
|
|
|
|
|
|
2015-06-19 16:24:13 +08:00
|
|
|
|
2021-01-04 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* bfin-tdep.c (bfin_push_dummy_call): Use align_up.
|
|
|
|
|
(bfin_frame_align): Use align_down.
|
|
|
|
|
|
2021-01-05 02:34:25 +08:00
|
|
|
|
2021-01-04 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
* buildsym.c (buildsym_compunit::record_line): Filter out end-of-seq
|
|
|
|
|
terminators that do not terminate anything.
|
|
|
|
|
|
gdb: introduce scoped debug prints
I spent a lot of time reading infrun debug logs recently, and I think
they could be made much more readable by being indented, to clearly see
what operation is done as part of what other operation. In the current
format, there are no visual cues to tell where things start and end,
it's just a big flat list. It's also difficult to understand what
caused a given operation (e.g. a call to resume_1) to be done.
To help with this, I propose to add the new scoped_debug_start_end
structure, along with a bunch of macros to make it convenient to use.
The idea of scoped_debug_start_end is simply to print a start and end
message at construction and destruction. It also increments/decrements
a depth counter in order to make debug statements printed during this
range use some indentation. Some care is taken to handle the fact that
debug can be turned on or off in the middle of such a range. For
example, a "set debug foo 1" command in a breakpoint command, or a
superior GDB manually changing the debug_foo variable.
Two macros are added in gdbsupport/common-debug.h, which are helpers to
define module-specific macros:
- scoped_debug_start_end: takes a message that is printed both at
construction / destruction, with "start: " and "end: " prefixes.
- scoped_debug_enter_exit: prints hard-coded "enter" and "exit"
messages, to denote the entry and exit of a function.
I added some examples in the infrun module to give an idea of how it can
be used and what the result looks like. The macros are in capital
letters (INFRUN_SCOPED_DEBUG_START_END and
INFRUN_SCOPED_DEBUG_ENTER_EXIT) to mimic the existing SCOPE_EXIT, but
that can be changed if you prefer something else.
Here's an excerpt of the debug
statements printed when doing "continue", where a displaced step is
started:
[infrun] proceed: enter
[infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
[infrun] global_thread_step_over_chain_enqueue: enqueueing thread Thread 0x7ffff75a5640 (LWP 2289301) in global step over chain
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 1
[infrun] start_step_over: resuming [Thread 0x7ffff75a5640 (LWP 2289301)] for step-over
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [Thread 0x7ffff75a5640 (LWP 2289301)] at 0x5555555551bd
[displaced] displaced_step_prepare_throw: displaced-stepping Thread 0x7ffff75a5640 (LWP 2289301) now
[displaced] prepare: selected buffer at 0x5555555550c2
[displaced] prepare: saved 0x5555555550c2: 1e fa 31 ed 49 89 d1 5e 48 89 e2 48 83 e4 f0 50
[displaced] amd64_displaced_step_copy_insn: copy 0x5555555551bd->0x5555555550c2: c7 45 fc 00 00 00 00 eb 13 8b 05 d4 2e 00 00 83
[displaced] displaced_step_prepare_throw: prepared successfully thread=Thread 0x7ffff75a5640 (LWP 2289301), original_pc=0x5555555551bd, displaced_pc=0x5555555550c2
[displaced] resume_1: run 0x5555555550c2: c7 45 fc 00
[infrun] infrun_async: enable=1
[infrun] prepare_to_wait: prepare_to_wait
[infrun] start_step_over: [Thread 0x7ffff75a5640 (LWP 2289301)] was resumed.
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] proceed: start: resuming threads, all-stop-on-top-of-non-stop
[infrun] proceed: resuming Thread 0x7ffff7da7740 (LWP 2289296)
[infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [Thread 0x7ffff7da7740 (LWP 2289296)] at 0x7ffff7f7d9b7
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: resuming Thread 0x7ffff7da6640 (LWP 2289300)
[infrun] resume_1: thread Thread 0x7ffff7da6640 (LWP 2289300) has pending wait status status->kind = stopped, signal = GDB_SIGNAL_TRAP (currently_stepping=0).
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: [Thread 0x7ffff75a5640 (LWP 2289301)] resumed
[infrun] proceed: resuming Thread 0x7ffff6da4640 (LWP 2289302)
[infrun] resume_1: thread Thread 0x7ffff6da4640 (LWP 2289302) has pending wait status status->kind = stopped, signal = GDB_SIGNAL_TRAP (currently_stepping=0).
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: end: resuming threads, all-stop-on-top-of-non-stop
[infrun] proceed: exit
We can easily see where the call to `proceed` starts and end. We can
also see why there are a bunch of resume_1 calls, it's because we are
resuming threads, emulating all-stop on top of a non-stop target.
We also see that debug statements nest well with other modules that have
been migrated to use the "new" debug statement helpers (because they all
use debug_prefixed_vprintf in the end. I think this is desirable, for
example we could see the debug statements about reading the DWARF info
of a library nested under the debug statements about loading that
library.
Of course, modules that haven't been migrated to use the "new" helpers
will still print without indentations. This will be one good reason to
migrate them.
I think the runtime cost (when debug statements are disabled) of this is
reasonable, given the improvement in readability. There is the cost of
the conditionals (like standard debug statements), one more condition
(if (m_must_decrement_print_depth)) and the cost of constructing a stack
object, which means copying a fews pointers.
Adding the print in fetch_inferior_event breaks some tests that use "set
debug infrun", because it prints a debug statement after the prompt. I
adapted these tests to cope with it, by using the "-prompt" switch of
gdb_test_multiple to as if this debug statement is part of the expected
prompt. It's unfortunate that we have to do this, but I think the debug
print is useful, and I don't want a few tests to get in the way of
adding good debug output.
gdbsupport/ChangeLog:
* common-debug.h (debug_print_depth): New.
(struct scoped_debug_start_end): New.
(scoped_debug_start_end): New.
(scoped_debug_enter_exit): New.
* common-debug.cc (debug_prefixed_vprintf): Print indentation.
gdb/ChangeLog:
* debug.c (debug_print_depth): New.
* infrun.h (INFRUN_SCOPED_DEBUG_START_END): New.
(INFRUN_SCOPED_DEBUG_ENTER_EXIT): New.
* infrun.c (start_step_over): Use
INFRUN_SCOPED_DEBUG_ENTER_EXIT.
(proceed): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT and
INFRUN_SCOPED_DEBUG_START_END.
(fetch_inferior_event): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT.
gdbserver/ChangeLog:
* debug.cc (debug_print_depth): New.
gdb/testsuite/ChangeLog:
* gdb.base/ui-redirect.exp: Expect infrun debug print after
prompt.
* gdb.threads/ia64-sigill.exp: Likewise.
* gdb.threads/watchthreads-reorder.exp: Likewise.
Change-Id: I7c3805e6487807aa63a1bae318876a0c69dce949
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* debug.c (debug_print_depth): New.
|
|
|
|
|
* infrun.h (INFRUN_SCOPED_DEBUG_START_END): New.
|
|
|
|
|
(INFRUN_SCOPED_DEBUG_ENTER_EXIT): New.
|
|
|
|
|
* infrun.c (start_step_over): Use
|
|
|
|
|
INFRUN_SCOPED_DEBUG_ENTER_EXIT.
|
|
|
|
|
(proceed): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT and
|
|
|
|
|
INFRUN_SCOPED_DEBUG_START_END.
|
|
|
|
|
(fetch_inferior_event): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT.
|
|
|
|
|
|
gdb: use infrun_debug_printf in print_target_wait_results
The code in print_target_wait_results uses a single call to debug_printf
in order to make sure a single timestamp is emitted, despite printing
multiple lines. The result is:
941502.043284 [infrun] target_wait (-1.0.0, status) =
[infrun] 649832.649832.0 [process 649832],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
I find this decision a bit counter productive, because it messes up the
alignment of the three lines. We don't care that three (slightly
different) timestamps are printed.
I suggest to change this function to use infrun_debug_printf, with this
result:
941601.425771 [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
941601.425824 [infrun] print_target_wait_results: 651481.651481.0 [process 651481],
941601.425867 [infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
Note that the current code only prints the waiton_ptid as a string
between square brackets if pid != -1. I don't think this complexity is
needed in a debug print. I made it so it's always printed, which I
think results in a much simpler function.
gdb/ChangeLog:
* infrun.c (print_target_wait_results): Use infrun_debug_printf.
Change-Id: I817bd10286b8e641a6c751ac3a1bd1ddf9b18ce0
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* infrun.c (print_target_wait_results): Use infrun_debug_printf.
|
|
|
|
|
|
gdb: make "set debug timestamp" work nice with new debug printouts
New in v2:
- implement by modifying vprintf_unfiltered rather than
debug_prefixed_vprintf.
I tried enabling debug timestamps, and realized that it doesn't play
well with the revamp of the debug printouts I've been working on:
$ ./gdb -q -nx --data-directory=data-directory -ex "set debug infrun" -ex "set debug timestamp" a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x1131: file test.c, line 2.
Starting program: /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out
939897.769338 [infrun] infrun_async:
939897.769383 enable=1
939897.769409
939897.915218 [infrun] proceed:
939897.915281 addr=0x7ffff7fd0100, signal=GDB_SIGNAL_0
939897.915315
939897.915417 [infrun] start_step_over:
939897.915464 stealing global queue of threads to step, length = 0
939897.915502
939897.915567 [infrun] operator():
939897.915601 step-over queue now empty
939897.915633
939897.915690 [infrun] proceed:
939897.915729 resuming process 636244
939897.915768
939897.915892 [infrun] resume_1:
939897.915954 step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [process 636244] at 0x7ffff7fd0100
939897.915991
939897.916119 [infrun] prepare_to_wait:
939897.916153 prepare_to_wait
939897.916201
939897.916661 [infrun] target_wait (-1.0.0, status) =
[infrun] 636244.636244.0 [process 636244],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
939897.916734 [infrun] handle_inferior_event:
939897.916768 status->kind = stopped, signal = GDB_SIGNAL_TRAP
939897.916799
This is due to debug_prefixed_vprintf being implemented as three
separate calls to debug_printf / debug_vprintf. Each call gets its own
timestamp and newline, curtesy of vprintf_unfiltered.
My first idea was to add a "line_start" parameter to debug_vprintf,
allowing the caller to say whether the print is the start of the line.
A debug timestamp would only be printed if line_start was true.
However, that was much more invasive than the simple fix implemented in
this patch.
My second idea was to make debug_prefixed_vprintf use string_printf and
issue a single call to debug_printf. That would however prevent future
use of styling in the debug messages.
What is implemented in this patch is the same as is implemented in
GDBserver: the timestamp-printing code in GDB tracks whether the last
debug output ended with a newline. If so, it prints a timestamp on the
next debug output.
After the fix, it looks like this:
$ ./gdb -q -nx --data-directory=data-directory -ex "set debug infrun" -ex "set debug timestamp" a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x1131: file test.c, line 2.
Starting program: /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out
941112.135662 [infrun] infrun_async: enable=1
941112.279930 [infrun] proceed: addr=0x7ffff7fd0100, signal=GDB_SIGNAL_0
941112.280064 [infrun] start_step_over: stealing global queue of threads to step, length = 0
941112.280125 [infrun] operator(): step-over queue now empty
941112.280194 [infrun] proceed: resuming process 646228
941112.280332 [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [process 646228] at 0x7ffff7fd0100
941112.280480 [infrun] prepare_to_wait: prepare_to_wait
941112.281004 [infrun] target_wait (-1.0.0, status) =
[infrun] 646228.646228.0 [process 646228],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
941112.281078 [infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
gdb/ChangeLog:
* utils.c (vfprintf_unfiltered): Print timestamp only when
previous debug output ended with a newline.
Change-Id: Idcfe3acc7e3d0f526a5f0a43a5e0884bf93c41ae
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* utils.c (vfprintf_unfiltered): Print timestamp only when
|
|
|
|
|
previous debug output ended with a newline.
|
|
|
|
|
|
Refactor struct trad_frame_saved_regs
The following patch drops the overloading going on with the trad_frame_saved_reg
struct and defines a new struct with a KIND enum and a union of different
fields.
The new struct looks like this:
struct trad_frame_saved_reg
{
setters/getters
...
private:
trad_frame_saved_reg_kind m_kind;
union {
LONGEST value;
int realreg;
LONGEST addr;
const gdb_byte *value_bytes;
} m_reg;
};
And the enums look like this:
/* Describes the kind of encoding a stored register has. */
enum class trad_frame_saved_reg_kind
{
/* Register value is unknown. */
UNKNOWN = 0,
/* Register value is a constant. */
VALUE,
/* Register value is in another register. */
REALREG,
/* Register value is at an address. */
ADDR,
/* Register value is a sequence of bytes. */
VALUE_BYTES
};
The patch also adds setters/getters and updates all the users of the old
struct.
It is worth mentioning that due to the previous overloaded nature of the
fields, some tdep files like to store negative offsets and indexes in the ADDR
field, so I kept the ADDR as LONGEST instead of CORE_ADDR. Those cases may
be better supported by a new enum entry.
I have not addressed those cases in this patch to prevent unwanted breakage,
given I have no way to test some of the targets. But it would be nice to
clean those up eventually.
The change to frame-unwind.* is to constify the parameter being passed to the
unwinding functions, given we now accept a "const gdb_byte *" for value bytes.
Tested on aarch64-linux/Ubuntu 20.04/18.04 and by building GDB with
--enable-targets=all.
gdb/ChangeLog:
2021-01-04 Luis Machado <luis.machado@linaro.org>
Update all users of trad_frame_saved_reg to use the new member
functions.
Remote all struct keywords from declarations of trad_frame_saved_reg
types, except on forward declarations.
* aarch64-tdep.c: Update.
* alpha-mdebug-tdep.c: Update.
* alpha-tdep.c: Update.
* arc-tdep.c: Update.
* arm-tdep.c: Update.
* avr-tdep.c: Update.
* cris-tdep.c: Update.
* csky-tdep.c: Update.
* frv-tdep.c: Update.
* hppa-linux-tdep.c: Update.
* hppa-tdep.c: Update.
* hppa-tdep.h: Update.
* lm32-tdep.c: Update.
* m32r-linux-tdep.c: Update.
* m32r-tdep.c: Update.
* m68hc11-tdep.c: Update.
* mips-tdep.c: Update.
* moxie-tdep.c: Update.
* riscv-tdep.c: Update.
* rs6000-tdep.c: Update.
* s390-linux-tdep.c: Update.
* s390-tdep.c: Update.
* score-tdep.c: Update.
* sparc-netbsd-tdep.c: Update.
* sparc-sol2-tdep.c: Update.
* sparc64-fbsd-tdep.c: Update.
* sparc64-netbsd-tdep.c: Update.
* sparc64-obsd-tdep.c: Update.
* sparc64-sol2-tdep.c: Update.
* tilegx-tdep.c: Update.
* v850-tdep.c: Update.
* vax-tdep.c: Update.
* frame-unwind.c (frame_unwind_got_bytes): Make parameter const.
* frame-unwind.h (frame_unwind_got_bytes): Likewise.
* trad-frame.c: Update.
Remove TF_REG_* enum.
(trad_frame_alloc_saved_regs): Add a static assertion to check for
a trivially-constructible struct.
(trad_frame_reset_saved_regs): Adjust to use member function.
(trad_frame_value_p): Likewise.
(trad_frame_addr_p): Likewise.
(trad_frame_realreg_p): Likewise.
(trad_frame_value_bytes_p): Likewise.
(trad_frame_set_value): Likewise.
(trad_frame_set_realreg): Likewise.
(trad_frame_set_addr): Likewise.
(trad_frame_set_unknown): Likewise.
(trad_frame_set_value_bytes): Likewise.
(trad_frame_get_prev_register): Likewise.
* trad-frame.h: Update.
(trad_frame_saved_reg_kind): New enum.
(struct trad_frame_saved_reg) <addr, realreg, data>: Remove.
<m_kind, m_reg>: New member fields.
<set_value, set_realreg, set_addr, set_unknown, set_value_bytes>
<kind, value, realreg, addr, value_bytes, is_value, is_realreg>
<is_addr, is_unknown, is_value_bytes>: New member functions.
2020-12-23 04:45:21 +08:00
|
|
|
|
2021-01-04 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
Update all users of trad_frame_saved_reg to use the new member
|
|
|
|
|
functions.
|
|
|
|
|
|
|
|
|
|
Remote all struct keywords from declarations of trad_frame_saved_reg
|
|
|
|
|
types, except on forward declarations.
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c: Update.
|
|
|
|
|
* alpha-mdebug-tdep.c: Update.
|
|
|
|
|
* alpha-tdep.c: Update.
|
|
|
|
|
* arc-tdep.c: Update.
|
|
|
|
|
* arm-tdep.c: Update.
|
|
|
|
|
* avr-tdep.c: Update.
|
|
|
|
|
* cris-tdep.c: Update.
|
|
|
|
|
* csky-tdep.c: Update.
|
|
|
|
|
* frv-tdep.c: Update.
|
|
|
|
|
* hppa-linux-tdep.c: Update.
|
|
|
|
|
* hppa-tdep.c: Update.
|
|
|
|
|
* hppa-tdep.h: Update.
|
|
|
|
|
* lm32-tdep.c: Update.
|
|
|
|
|
* m32r-linux-tdep.c: Update.
|
|
|
|
|
* m32r-tdep.c: Update.
|
|
|
|
|
* m68hc11-tdep.c: Update.
|
|
|
|
|
* mips-tdep.c: Update.
|
|
|
|
|
* moxie-tdep.c: Update.
|
|
|
|
|
* riscv-tdep.c: Update.
|
|
|
|
|
* rs6000-tdep.c: Update.
|
|
|
|
|
* s390-linux-tdep.c: Update.
|
|
|
|
|
* s390-tdep.c: Update.
|
|
|
|
|
* score-tdep.c: Update.
|
|
|
|
|
* sparc-netbsd-tdep.c: Update.
|
|
|
|
|
* sparc-sol2-tdep.c: Update.
|
|
|
|
|
* sparc64-fbsd-tdep.c: Update.
|
|
|
|
|
* sparc64-netbsd-tdep.c: Update.
|
|
|
|
|
* sparc64-obsd-tdep.c: Update.
|
|
|
|
|
* sparc64-sol2-tdep.c: Update.
|
|
|
|
|
* tilegx-tdep.c: Update.
|
|
|
|
|
* v850-tdep.c: Update.
|
|
|
|
|
* vax-tdep.c: Update.
|
|
|
|
|
|
|
|
|
|
* frame-unwind.c (frame_unwind_got_bytes): Make parameter const.
|
|
|
|
|
* frame-unwind.h (frame_unwind_got_bytes): Likewise.
|
|
|
|
|
|
|
|
|
|
* trad-frame.c: Update.
|
|
|
|
|
Remove TF_REG_* enum.
|
|
|
|
|
(trad_frame_alloc_saved_regs): Add a static assertion to check for
|
|
|
|
|
a trivially-constructible struct.
|
|
|
|
|
(trad_frame_reset_saved_regs): Adjust to use member function.
|
|
|
|
|
(trad_frame_value_p): Likewise.
|
|
|
|
|
(trad_frame_addr_p): Likewise.
|
|
|
|
|
(trad_frame_realreg_p): Likewise.
|
|
|
|
|
(trad_frame_value_bytes_p): Likewise.
|
|
|
|
|
(trad_frame_set_value): Likewise.
|
|
|
|
|
(trad_frame_set_realreg): Likewise.
|
|
|
|
|
(trad_frame_set_addr): Likewise.
|
|
|
|
|
(trad_frame_set_unknown): Likewise.
|
|
|
|
|
(trad_frame_set_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_get_prev_register): Likewise.
|
|
|
|
|
* trad-frame.h: Update.
|
|
|
|
|
(trad_frame_saved_reg_kind): New enum.
|
|
|
|
|
(struct trad_frame_saved_reg) <addr, realreg, data>: Remove.
|
|
|
|
|
<m_kind, m_reg>: New member fields.
|
|
|
|
|
<set_value, set_realreg, set_addr, set_unknown, set_value_bytes>
|
|
|
|
|
<kind, value, realreg, addr, value_bytes, is_value, is_realreg>
|
|
|
|
|
<is_addr, is_unknown, is_value_bytes>: New member functions.
|
|
|
|
|
|
2021-01-03 10:32:14 +08:00
|
|
|
|
2021-01-02 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target-float.c: Fix typos.
|
|
|
|
|
|
2021-01-03 00:35:25 +08:00
|
|
|
|
2021-01-02 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* gdb-gdb.py.in: Fix main_type.flds_bnds.bounds pretty printer.
|
|
|
|
|
|
2021-01-01 16:08:28 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* gdbarch.sh: Update copyright year range.
|
|
|
|
|
|
2021-01-01 16:03:39 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
Update copyright year range in copyright header of all GDB files.
|
|
|
|
|
|
2021-01-01 15:56:12 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
|
|
|
|
|
to the list of directories to update.
|
|
|
|
|
|
2021-01-01 15:53:14 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* top.c (print_gdb_version): Update copyright year.
|
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
2020-12-28 04:36:55 +08:00
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2020.
|
2020-12-28 04:36:55 +08:00
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
For older changes see ChangeLog-2020.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
mode: change-log
|
|
|
|
|
left-margin: 8
|
|
|
|
|
fill-column: 74
|
|
|
|
|
version-control: never
|
2007-08-10 06:44:38 +08:00
|
|
|
|
coding: utf-8
|
1999-04-16 09:35:26 +08:00
|
|
|
|
End:
|