Tom Tromey [Mon, 31 Oct 2016 17:23:34 +0000 (11:23 -0600)]
Fix py-value.exp failure on Python 3
I happened to notice that one test in py-value.exp did not work
properly with Python 3. This patch fixes the problem.
2016-11-08 Tom Tromey <tom@tromey.com>
* gdb.python/py-value.exp (test_value_creation): Make "long" test
depend on Python 2.
Tom Tromey [Mon, 31 Oct 2016 17:10:35 +0000 (11:10 -0600)]
Fix some error-handling bugs in python frame filters
While writing a Python frame filter, I found a few bugs in the current
frame filter code. In particular:
* One spot converts a Python long to a CORE_ADDR using PyLong_AsLong.
However, this can fail on overflow. I changed this to use
get_addr_from_python.
* Another spot is doing the same but with PyLong_AsUnsignedLongLong; I
changed this as well just for consistency.
* Converting line numbers can print "-1" if conversion from long
fails. This isn't fatal but just a bit ugly.
I've included a test case for the first issue. The line number one
didn't seem important enough to bother with.
2016-11-08 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_frame): Use
get_addr_from_python. Check for errors when getting line number.
2016-11-08 Tom Tromey <tom@tromey.com>
* gdb.python/py-framefilter.py (ElidingFrameDecorator.address):
New method.
Yao Qi [Tue, 8 Nov 2016 16:02:42 +0000 (16:02 +0000)]
Remove parameter valaddr from la_val_print
Nowadays, we pass both val and return value of
value_contents_for_printing (val) to la_val_print. The latter is
unnecessary. This patch removes the second parameter of la_val_print,
and get valaddr in each language's implementation by calling
value_contents_for_printing. Since value_contents_for_printing calls
value_fetch_lazy, I also make VAL non-const.
Note that
- I don't clean up the valaddr usages in each language's routines,
- I don't remove valaddr from apply_ext_lang_val_pretty_printer, and
extension language ops apply_val_pretty_printer.
They can be done in followup patches.
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* ada-lang.h (ada_val_print): Remove second parameter. Remove
const from "struct value *".
* ada-valprint.c (print_field_values): Remove const from
"struct value *".
(val_print_packed_array_elements): Likewise.
(print_variant_part): Likewise.
(ada_val_print_string): Likewise.
(ada_val_print_gnat_array): Likewise.
(ada_val_print_ptr): Likewise.
(ada_val_print_num): Likewise.
(ada_val_print_enum): Likewise.
(ada_val_print_flt): Likewise.
(ada_val_print_union): Likewise.
(ada_val_print_struct_union): Likewise.
(ada_val_print_ref): Likewise.
(ada_val_print_1): Remove second parameter. Remove const from
"struct value *".
(ada_val_print): Likewise.
* c-lang.h (c_val_print): Likewise.
* c-valprint.c (c_val_print_array): Remove const from
"struct value *".
(c_val_print_ptr): Likewise.
(c_val_print_struct): Likewise.
(c_val_print_union): Likewise.
(c_val_print_int): Likewise.
(c_val_print_memberptr): Likewise.
(c_val_print): Remove second parameter. Remove const from
"struct value *". All callers updated.
* cp-valprint.c (cp_print_value): Remove const from
"struct value *".
(cp_print_value_fields): Likewise.
(c_val_print_value): Likewise.
* d-lang.h (d_val_print): Remove second parameter. Remove const
from "struct value *".
* d-valprint.c (dynamic_array_type): Likewise.
(d_val_print): Likewise.
* f-lang.h (f_val_print): Likewise.
* f-valprint.c (f_val_print): Likewise.
* go-lang.h (go_val_print): Likewise.
* go-valprint.c (print_go_string): Likewise.
(go_val_print): Likewise.
* language.c (unk_lang_val_print): Likewise.
* language.h (struct language_defn) <la_val_print>: Likewise.
Update comments.
(LA_VAL_PRINT): Remove.
* m2-lang.h (m2_val_print): Remove const from
"struct value *".
* m2-valprint.c (m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* p-lang.h (pascal_val_print): Remove second parameter. Remove
const from "struct value *".
(pascal_object_print_value_fields): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_value_fields): Likewise.
(pascal_object_print_value): Likewise.
* rust-lang.c (rust_get_disr_info): Likewise.
(val_print_struct): Likewise.
(rust_val_print): Likewise.
* valprint.c (generic_val_print_array): Likewise.
(generic_val_print_ptr): Likewise.
(generic_val_print_memberptr): Likewise.
(generic_val_print_ref): Likewise.
(generic_val_print_enum): Likewise.
(generic_val_print_flags): Likewise.
(generic_val_print_func): Likewise.
(generic_val_print_bool): Likewise.
(generic_val_print_int): Likewise.
(generic_val_print_char): Likewise.
(generic_val_print_float): Likewise.
(generic_val_print_decfloat): Likewise.
(generic_val_print_complex): Likewise.
(generic_val_print): Likewise.
(val_print): Likewise.
(common_val_print): Likewise.
(val_print_type_code_flags): Likewise.
(val_print_scalar_formatted): Likewise.
(val_print_array_elements): Likewise.
* valprint.h (val_print_array_elements): Update declaration.
(val_print_scalar_formatted): Likewise.
(generic_val_print): Likewise.
* value.h (val_print): Likewise.
Yao Qi [Tue, 8 Nov 2016 15:58:47 +0000 (15:58 +0000)]
Use get_frame_register_value instead of deprecated_frame_register_read
This patch calls get_frame_register_value instead of
deprecated_frame_register_read, so that we can pass
value_contents_for_printing to val_print. Both
get_frame_register_value and deprecated_frame_register_read call
frame_unwind_register_value indirectly, so no functionality is changed
by this patch.
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* mt-tdep.c (mt_registers_info): Call
get_frame_register_value instead of
deprecated_frame_register_read.
* sh64-tdep.c (sh64_do_register): Likewise.
Pedro Alves [Tue, 8 Nov 2016 15:26:47 +0000 (15:26 +0000)]
Eliminate agent_expr_p; VEC -> std::vector in struct bp_target_info
After the previous patch, we end up with these two types with quite
similar, and potentially confusing names:
typedef gdb::unique_ptr<agent_expr> agent_expr_up;
/* Pointer to an agent_expr structure. */
typedef struct agent_expr *agent_expr_p;
The latter is only necessary to put agent_expr pointers in VECs. So
just eliminate it and use std::vector instead.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ax.h (agent_expr_p): Delete.
(DEF_VEC_P (agent_expr_p)): Delete.
* breakpoint.c (build_target_condition_list)
(build_target_command_list): Adjust to use of std::vector.
(bp_location_dtor): Remove now unnecessary VEC_free calls.
* breakpoint.h: Include <vector>.
(struct bp_target_info) <conditions, tcommands>: Now
std::vector's.
* remote.c (remote_add_target_side_condition): bp_tgt->conditions
is now a std::vector; adjust.
(remote_add_target_side_commands, remote_insert_breakpoint):
bp_tgt->tcommands is now a std::vector; adjust.
Pedro Alves [Tue, 8 Nov 2016 15:26:47 +0000 (15:26 +0000)]
'struct agent_expr *' -> unique_ptr<agent_expr>
This patch makes the gen_* functions return a unique_ptr instead of
raw pointer:
typedef gdb::unique_ptr<agent_expr> agent_expr_up;
and then adjusts the codebase throughout to stop using
make_cleanup_free_agent_expr.
The cond_bytecode and cmd_bytecode fields of struct bp_location are
owning pointers, so they're changed to be unique_ptr's instead of raw
pointers.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ax-gdb.c (is_nontrivial_conversion): Use agent_expr_up.
(gen_trace_for_var, gen_trace_for_expr, gen_eval_for_expr)
(gen_trace_for_return_address, gen_printf): Use and return an
agent_expr_up. Don't use make_cleanup_free_agent_expr.
(agent_eval_command_one, maint_agent_printf_command): Use
agent_expr_up. Don't use make_cleanup_free_agent_expr.
* ax-gdb.h (gen_trace_for_expr, gen_trace_for_var)
(gen_trace_for_return_address, gen_eval_for_expr, gen_printf): Use
agent_expr_up.
* ax-general.c (new_agent_expr): Rename to ...
(agent_expr::agent_expr): ... this, and now a constructor.
(free_agent_expr): Rename to ...
(agent_expr::~agent_exp): ... this, and now a destructor.
(do_free_agent_expr_cleanup, make_cleanup_free_agent_expr):
Delete.
* ax.h (struct agent_expr): Add ctor/dtor.
(agent_expr_up): New typedef.
(new_agent_expr, free_agent_expr, make_cleanup_free_agent_expr):
Delete declarations.
* breakpoint.c (parse_cond_to_aexpr): Use and return an
agent_expr_up. Don't use make_cleanup_free_agent_expr.
(build_target_condition_list): Adjust to use agent_expr_up.
(parse_cmd_to_aexpr): Use and return an agent_expr_up. Don't use
make_cleanup_free_agent_expr.
(build_target_command_list): Adjust to use agent_expr_up.
(force_breakpoint_reinsertion): Adjust to use agent_expr_up.
(bp_location_dtor): Remove unnecessary free_agent_expr and xfree
calls.
* breakpoint.h (struct bp_target_info) <cond_bytecode,
cmd_bytecode>: Now agent_expr_up's.
* remote.c (remote_download_tracepoint): Adjust to use
agent_expr_up and remove use of make_cleanup_free_agent_expr.
* tracepoint.c (validate_actionline, collect_symbol): Adjust to
use agent_expr_up and remove uses of make_cleanup_free_agent_expr.
(collection_list::~collection_list): Call delete instead of
free_agent_expr.
(encode_actions_1): Adjust to use agent_expr_up and remove uses of
make_cleanup_free_agent_expr.
(add_aexpr): Change parameter type to agent_expr_up; Return a raw
agent_expr pointer.
Pedro Alves [Tue, 8 Nov 2016 15:26:47 +0000 (15:26 +0000)]
Use ui_file_as_string throughout more
This replaces most of the remaining ui_file_xstrdup calls with
ui_file_as_string calls. Whenever a call was replaced, that led to a
cascade of other necessary adjustments throughout, to make the code
use std::string instead of raw pointers. And then whenever I added a
std::string as member of a struct, I needed to adjust
allocation/destruction of said struct to use new/delete instead of
xmalloc/xfree.
The stopping point was once gdb built again. These doesn't seem to be
a way to reasonably split this out further.
Maybe-not-obvious changes:
- demangle_for_lookup returns a cleanup today. To get rid of that,
and avoid unnecessary string dupping/copying, this introduces a
demangle_result_storage type that the caller instantiates and
passes to demangle_for_lookup.
- Many methods returned a "char *" to indicate that the caller owns
the memory and must free it. Those are switched to return a
std::string instead. Methods that return a "view" into some
internal string return a "const char *" instead. I.e., we only
copy/allocate when necessary.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_name_for_lookup, type_as_string): Use and return
std::string.
(type_as_string_and_cleanup): Delete.
(ada_lookup_struct_elt_type): Use type_as_string.
* ada-lang.h (ada_name_for_lookup): Now returns std::string.
* ada-varobj.c (ada_varobj_scalar_image): Return a std::string.
(ada_varobj_describe_child): Make 'child_name' and
'child_path_expr' parameters std::string pointers.
(ada_varobj_describe_struct_child, ada_varobj_describe_ptr_child):
Likewise, and use string_printf.
(ada_varobj_describe_simple_array_child)
(ada_varobj_describe_child): Likewise.
(ada_varobj_get_name_of_child, ada_varobj_get_path_expr_of_child)
(ada_varobj_get_value_image)
(ada_varobj_get_value_of_array_variable)
(ada_varobj_get_value_of_variable, ada_name_of_variable)
(ada_name_of_child, ada_path_expr_of_child)
(ada_value_of_variable): Now returns std::string. Use
string_printf.
(ada_value_of_child): Adjust.
* break-catch-throw.c (check_status_exception_catchpoint): Adjust
to use std::string.
* breakpoint.c (watch_command_1): Adjust to use std::string.
* c-lang.c (c_get_string): Adjust to use std::string.
* c-typeprint.c (print_name_maybe_canonical): Use std::string.
* c-varobj.c (varobj_is_anonymous_child): Use ==/!= std::string
operators.
(c_name_of_variable): Now returns a std::string.
(c_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(c_name_of_child, c_path_expr_of_child, c_value_of_variable)
(cplus_number_of_children): Adjust to use std::string and
string_printf.
(cplus_name_of_variable): Now returns a std::string.
(cplus_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(cplus_name_of_child, cplus_path_expr_of_child)
(cplus_value_of_variable): Now returns a std::string.
* cp-abi.c (cplus_typename_from_type_info): Return std::string.
* cp-abi.h (cplus_typename_from_type_info): Return std::string.
(struct cp_abi_ops) <get_typename_from_type_info>: Return
std::string.
* cp-support.c (inspect_type): Use std::string.
(cp_canonicalize_string_full, cp_canonicalize_string_no_typedefs)
(cp_canonicalize_string): Return std::string and adjust.
* cp-support.h (cp_canonicalize_string)
(cp_canonicalize_string_no_typedefs, cp_canonicalize_string_full):
Return std::string.
* dbxread.c (read_dbx_symtab): Use std::string.
* dwarf2read.c (dwarf2_canonicalize_name): Adjust to use std::string.
* gdbcmd.h (lookup_struct_elt_type): Adjust to use std::string.
* gnu-v3-abi.c (gnuv3_get_typeid): Use std::string.
(gnuv3_get_typename_from_type_info): Return a std::string and
adjust.
(gnuv3_get_type_from_type_info): Adjust to use std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* infcmd.c (print_return_value_1): Adjust to use std::string.
* linespec.c (find_linespec_symbols): Adjust to
demangle_for_lookup API change. Use std::string.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_set_format)
(mi_cmd_var_info_type, mi_cmd_var_info_path_expression)
(mi_cmd_var_info_expression, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, varobj_update_one): Adjust to use std::string.
* minsyms.c (lookup_minimal_symbol): Use std::string.
* python/py-varobj.c (py_varobj_iter_next): Use new instead of
XNEW. vitem->name is a std::string now, adjust.
* rust-exp.y (convert_ast_to_type, convert_name): Adjust to use
std::string.
* stabsread.c (define_symbol): Adjust to use std::string.
* symtab.c (demangle_for_lookup): Now returns 'const char *'. Add
a demangle_result_storage parameter. Use it for storage.
(lookup_symbol_in_language)
(lookup_symbol_in_objfile_from_linkage_name): Adjust to new
demangle_for_lookup API.
* symtab.h (struct demangle_result_storage): New type.
(demangle_for_lookup): Now returns 'const char *'. Add a
demangle_result_storage parameter.
* typeprint.c (type_to_string): Return std::string and use
ui_file_as_string.
* value.h (type_to_string): Change return type to std::string.
* varobj-iter.h (struct varobj_item) <name>: Now a std::string.
(varobj_iter_delete): Use delete instead of xfree.
* varobj.c (create_child): Return std::string instead of char * in
output parameter.
(name_of_variable, name_of_child, my_value_of_variable): Return
std::string instead of char *.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
Adjust to std::string fields.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression): Return a std::string.
(varobj_list_children): Adjust to use std::string.
(varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
Adjust to std::string fields.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Change type of 'expression' parameter to
std::string. Use std::string.
(install_new_value): Use std::string.
(delete_variable_1): Adjust to use std::string.
(create_child): Change the 'name' parameter to a std::string
reference. Swap it into the new item's name.
(create_child_with_value): Swap item's name into the new child's
name. Use string_printf.
(new_variable): Use new instead of XNEW.
(free_variable): Don't xfree fields that are now std::string.
(name_of_variable, name_of_child): Now returns std::string.
(value_of_root): Adjust to use std::string.
(my_value_of_variable, varobj_value_get_print_value): Return
and use std::string.
(varobj_value_get_print_value): Adjust to use ui_file_as_string
and std::string.
* varobj.h (struct varobj) <name, path_expr, obj_name,
print_value>: Now std::string's.
<name_of_variable, name_of_child, path_expr_of_child,
value_of_variable>: Return std::string.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression, varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Constify 'expression' parameter.
(varobj_value_get_print_value): Return a std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:47 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/language.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* language.c (add_language): Use ui_file_as_string and adjust to
use std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/rust-lang.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* rust-lang.c (struct disr_info) <name>: Now a std::string.
(rust_get_disr_info): Use ui_file_as_string and adjust to use
std::string.
(rust_val_print): Adjust to use std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/infrun.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* infrun.c (print_target_wait_results): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/ada-lang.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use ui_file_as_string and return
std::string.
(type_as_string_and_cleanup): Delete.
(ada_lookup_struct_elt_type): Use type_as_string.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdbarch.sh/gdbarch.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* gdbarch.sh (verify_gdbarch): Use ui_file_as_string and
std::string.
* gdbarch.c: Regenerate.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/c-exp.y
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/compile/
Using ui_file_as_string would imply changing a few prototypes to pass
around source and object file names as std::string. Instead of that,
wrap those two in a new class. This ends up eliminating a small
wrinkle: get_new_file_names and compile_object_load have swapped
parameters. The former takes "source, objfile", while the latter
takes "objfile, source".
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* c-lang.h (c_compute_program): Now returns std::string.
* compile/compile-internal.h (class compile_file_names): New
class.
* compile/compile-object-load.c (compile_object_load): Replace
object_file and source_file parameters with a compile_file_names
parameter. Adjust.
* compile-object-load.h: Include "compile-internal.h".
(compile_object_load): Replace object_file and source_file
parameters with a compile_file_names parameter.
* compile/compile-c-support.c (c_compute_program): Now returns a
std::string. Use ui_file_as_string.
* compile/compile.c (get_new_file_names): Remove parameters and
return a compile_file_names instead.
(compile_to_object): Now returns a compile_file_names. Use
ui_file_as_string.
(eval_compile_command): Use compile_file_names.
* language.h (struct language_defn) <la_compute_program>: Now
returns std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/cli/cli-setshow.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* cli/cli-setshow.c (do_show_command): Adjust to use
ui_file_as_string and std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/remote.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* remote.c (escape_buffer): Use ui_file_as_string and return
std::string.
(putpkt_binary, read_frame): Adjust to use std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/python/
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* python/py-arch.c (archpy_disassemble): Use ui_file_as_string and
std::string.
* python/py-breakpoint.c (bppy_get_commands): Use
ui_file_as_string and std::string.
* python/py-frame.c (frapy_str): Likewise.
* python/py-type.c (typy_str): Likewise.
* python/py-unwind.c (unwind_infopy_str): Likewise.
* python/py-value.c (valpy_str): Likewise.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/printcmd.c
Yet another cleanup eliminated.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* printcmd.c (eval_command): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/top.c
Yet another cleanup is eliminated.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* top.c (quit_confirm): Use ui_file_as_string and std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)]
Use ui_file_as_string in execute_command_to_string
... and then return std::string and adjust all callers.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* gdbcmd.h (execute_command_to_string): Now returns std::string.
(lookup_struct_elt_type): Adjust to use std::string.
* top.c (execute_command_to_string): Use ui_file_as_string and
return std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* python/python.c (execute_gdb_command): Adjust to use
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/guile/
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
ui_file_as_string and adjust to use std::string.
* guile/scm-disasm.c (gdbscm_arch_disassemble): Likewise.
* guile/scm-frame.c (frscm_print_frame_smob): Likewise.
* guile/scm-type.c (tyscm_type_name): Use ui_file_as_string and
adjust to use std::string. Throw exception directly instead of
returning it in EXCP output parameter.
(tyscm_print_type_smob, gdbscm_type_print_name): Adjust to
tyscm_type_name interface change.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use ui_file_as_string and std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/arm-tdep.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* arm-tdep.c (_initialize_arm_tdep): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/utils.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* utils.c (error_stream): Use ui_file_as_string and std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/ui-out.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ui-out.c (ui_out_field_stream): Use ui_file_as_string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/ada-valprint.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-valprint.c (ada_print_floating): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in gdb/xtensa-tdep.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* xtensa-tdep.c (xtensa_verify_config): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:44 +0000 (15:26 +0000)]
Use ui_file_as_string in dwarf2_compute_name
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (dwarf2_compute_name): Use ui_file_as_string and
std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:43 +0000 (15:26 +0000)]
Clean up tracepoint.h/c:collection_list
Noticed we could do this while working on the expression_up change.
The main goal here was getting rid of the
encode_actions_and_make_cleanup / do_clear_collection_list cleanups.
While at it, uncrustify the code:
- Make collection_list a C++ class, with data members private (and
thus renamed m_...).
- Make related functions be member methods.
- Use std::vector instead of an open coding a vector implementation.
- Use std::sort instead of qsort.
- Rename the "list" member of collection_list, which is an incredibly
obfuscating name.
- Rename a couple other things here and there for clarify.
- Use "bool" more.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* mi/mi-main.c (print_variable_or_computed): Constify 'expression'
parameter.
(mi_cmd_trace_frame_collected): Call encode_actions instead of
encode_actions_and_make_cleanup. Adjust to use std::vector.
* tracepoint.c (memrange_cmp): Delete.
(memrange_comp): New.
(memrange_sortmerge): Take a memrange vector as parameter instead
of a collection_list. Use std::sort instead of qsort.
(add_register): Now a method of collection_list. Adjust to m_
prefix of data fields.
(add_memrange): Now a method of collection_list. Adjust to m_
prefix of data fields. Adjust to use std::vector.
(collect_symbol): Now a method of collection_list. Adjust to m_
prefix of data fields.
(do_collect_symbol): Adjust. Call add_wholly_collected instead of
accessing the vector directly.
(collection_list::add_wholly_collected): New.
(add_local_symbols): Now a method of collection_list.
(add_static_trace_data): Now a method of collection_list. Adjust
to use bool.
(clear_collection_list, do_clear_collection_list): Delete.
(init_collection_list): Delete.
(collection_list::collection_list): New.
(collection_list::~collection_list): New.
(stringify_collection_list): Rename to ...
(collection_list::stringify): ... this and adjust to being a
method of collection_list. Adjust to use of std::vector.
(append_exp): Now a method of collection_list. Use
ui_file_as_string. Adjust to std::vector.
(collection_list::finish): New.
(encode_actions_1): Adjust.
(encode_actions_and_make_cleanup): Rename to ...
(encode_actions)... this. No longer returns a cleanup. No longer
call init_collection_list nor install do_clear_collection_list
cleanups. Call collection_list::finish instead of
memrange_sortmerge directly.
(encode_actions_rsp): Adjust to call encode_actions instead of
encode_actions_and_make_cleanup. Adjust to method renames.
(add_aexpr): Now a method of collection_list.
* tracepoint.h: Include <vector> and <string>.
(struct memrange): Add constructors.
(struct collection_list): Now a class.
(class collection_list) <collection_list, ~collection_list,
add_wholly_collected, append_exp, add_aexpr, add_register,
add_memrange, collect_symbol, add_local_symbols,
add_static_trace_data, finish, stringify, wholly_collected, and
computed>: New methods.
<regs_mask>: Rename to ...
<m_regs_mask>: ... this.
<listsize, next_memrange, list>: Delete fields.
<m_memranges>: New field.
<aexpr_listsize, next_aexpr_elt, aexpr_list>: Delete fields.
<m_aexprs>: New field.
<strace_data>: Rename to ...
<m_strace_data>: ... this. Now a bool.
<wholly_collected>: Rename to ...
<m_wholly_collected>: ... this. Now a std::vector<std::string>.
<computed>: Rename to ...
<m_computed>: ... this. Now a std::vector<std::string>.
(encode_actions_and_make_cleanup): Delete declaration.
(encode_actions): New declaration.
Pedro Alves [Tue, 8 Nov 2016 15:26:43 +0000 (15:26 +0000)]
Introduce ui_file_as_string
ui_file_as_string is a variant of ui_file_xstrdup that returns a
std::string instead of a xmalloc'ed char *. The idea is using the new
function to eliminate "make_cleanup (xfree, ...)" cleanups
throughout.
Following patches will make use of this.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ui-file.c (do_ui_file_as_string, ui_file_as_string): New
functions.
* ui-file.h: Include <string>.
(ui_file_as_string): New declaration.
Pedro Alves [Tue, 8 Nov 2016 15:26:43 +0000 (15:26 +0000)]
'struct expression *' -> gdb::unique_xmalloc_ptr<expression>
This patch makes parse_expression and friends return a unique_ptr
instead of raw pointer [1]:
typedef gdb::unique_malloc_ptr<expression> expression_up;
and then adjusts the codebase throughout to stop using cleanups to
manage lifetime of expression pointers.
Whenever I found a structure owning an expression pointer, I made it
store a unique_ptr instead of a raw pointer, which then requires using
new/delete of the holding structure, instead of XNEW/xfree.
[1] - I'd like to set the rule that types named with an "_up" suffix
are unique_ptr typedefs.
Note I used gdb::unique_xmalloc_ptr instead of gdb::unique_ptr, simply
because we still use xmalloc instead of new to allocate expression
objects. Once that's changed, all we need to do is change the
expression_up typedef and the smart pointer will then call delete
instead of xfree.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_read_renaming_var_value): Use expression_up.
(struct ada_catchpoint_location) <excep_cond_expr>: Now an
expression_up.
(ada_catchpoint_location_dtor): Reset excep_cond_expr instead of
using xfree.
(create_excep_cond_exprs): Use expression_up and gdb::move.
(allocate_location_exception): Use new instead of XNEW.
(should_stop_exception): Likewise. Adjust to use expression_up.
(create_ada_exception_catchpoint): Use new instead of XNEW.
* ax-gdb.c (agent_eval_command_one): Use expression_up instead of
cleanups.
(maint_agent_printf_command): Use expression_up.
* break-catch-sig.c (create_signal_catchpoint): Use new instead of
XNEW.
* break-catch-syscall.c (create_syscall_event_catchpoint):
Likewise.
* break-catch-throw.c (handle_gnu_v3_exceptions): Use new instead
of XCNEW. Use gdb::unique_ptr instead of cleanups.
* breakpoint.c (set_breakpoint_condition, update_watchpoint)
(parse_cmd_to_aexpr, watchpoint_check)
(bpstat_check_breakpoint_conditions, watchpoint_locations_match):
Adjust to use expression_up.
(init_bp_location): Adjust.
(free_bp_location): Use delete instead of xfree.
(set_raw_breakpoint_without_location, set_raw_breakpoint)
(add_solib_catchpoint, create_fork_vfork_event_catchpoint)
(new_single_step_breakpoint, create_breakpoint_sal): Use new
instead of XNEW.
(find_condition_and_thread): Adjust to use expression_up.
(create_breakpoint): Use new instead of XNEW.
(dtor_watchpoint): Don't xfree expression pointers, they're
unique_ptr's now.
(insert_watchpoint, remove_watchpoint): Adjust.
(watch_command_1): Use expression_up. Use new instead of XCNEW.
(catch_exec_command_1): Use new instead of XNEW.
(bp_location_dtor): Don't xfree expression pointers, they're
unique_ptr's now.
(base_breakpoint_allocate_location)
(strace_marker_create_breakpoints_sal): Use new instead of XNEW.
(delete_breakpoint): Use delete instead of xfree.
* breakpoint.h (struct bp_location) <cond>: Now an
unique_ptr<expression> instead of a raw pointer.
(struct watchpoint) <exp, cond_exp>: Likewise.
* cli/cli-script.c (execute_control_command): Use expression_up
instead of cleanups.
* dtrace-probe.c (dtrace_process_dof_probe): Use expression_up.
* eval.c (parse_and_eval_address, parse_and_eval_long)
(parse_and_eval, parse_to_comma_and_eval, parse_and_eval_type):
Use expression_up instead of cleanups.
* expression.h (expression_up): New typedef.
(parse_expression, parse_expression_with_language, parse_exp_1):
Change return type to expression_up.
* mi/mi-main.c (mi_cmd_data_evaluate_expression)
(print_variable_or_computed): Use expression_up.
* objc-lang.c (print_object_command): Use expression_up instead of
cleanups.
* parse.c (parse_exp_1, parse_exp_in_context)
(parse_exp_in_context_1, parse_expression)
(parse_expression_with_language): Return an expression_up instead
of a raw pointer.
(parse_expression_for_completion): Use expression_up.
* printcmd.c (struct display) <exp>: Now an expression_up instead
of a raw pointer.
(print_command_1, output_command_const, set_command, x_command):
Use expression_up instead of cleanups.
(display_command): Likewise. Use new instead of XNEW.
(free_display): Use delete instead of xfree.
(do_one_display): Adjust to use expression_up.
* remote.c (remote_download_tracepoint): Likewise.
* stack.c (return_command): Likewise.
* tracepoint.c (validate_actionline, encode_actions_1): Use
expression_up instead of cleanups.
* typeprint.c (whatis_exp, maintenance_print_type): Likewise.
* value.c (init_if_undefined_command): Likewise.
* varobj.c (struct varobj_root) <exp>: Now an expression_up
instead of a raw pointer.
(varobj_create): Adjust.
(varobj_set_value): Use an expression_up instead of cleanups.
(new_root_variable): Use new instead of XNEW.
(free_variable): Use delete instead of xfree.
(value_of_root_1): Use std::swap.
Pedro Alves [Tue, 8 Nov 2016 15:26:43 +0000 (15:26 +0000)]
cli-script.c: Simplify using std::string, eliminate cleanups
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* cli/cli-script.c (execute_control_command): Use std::string
instead of cleanups.
(locate_arg): Constify return type.
(insert_args): Constify paremeter. Simplify using std::string.
Return a std::string.
Pedro Alves [Tue, 8 Nov 2016 15:26:43 +0000 (15:26 +0000)]
breakpoint.c:commands_command_1 constification and cleanup
This is constification needed for next patch. Adjust
commands_command_1 to use std::string too because the "arg" parameter
is currently overwritten and then passed to make_cleanup. The
constification alone would trigger a compile error in the make_cleanup
call otherwise (passing const char * to void * parameter). Using
std::string gets rid of the cleanup in the first place, resulting in
simpler code.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* breakpoint.c (struct commands_info) <arg>: Constify.
(commands_command_1): Constify 'arg' parameter. Use std::string
and string_printf.
(commands_from_control_command): Constify 'arg' parameter.
(map_breakpoint_numbers): Constify 'args' parameter.
* breakpoint.h (commands_from_control_command): Constify 'arg'
parameter.
Pedro Alves [Tue, 8 Nov 2016 15:26:42 +0000 (15:26 +0000)]
cli/cli-script.c: Remove some dead NULL checks
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* cli/cli-script.c (execute_control_command): Assume insert_args
never returns NULL.
(insert_args): Assume xmalloc never returns NULL.
Pedro Alves [Tue, 8 Nov 2016 15:26:42 +0000 (15:26 +0000)]
Introduce string_printf
This introduces the string_printf function. Like asprintf, but
returns a std::string.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_OBS): Add utils-selftests.o.
* common/common-utils.c (string_printf): New function.
* common/common-utils.h: Include <string>.
(string_printf): Declare.
* utils-selftests.c: New file.
Nick Clifton [Tue, 8 Nov 2016 15:03:46 +0000 (15:03 +0000)]
Fix heap-buffer-overflow error detected by address sanitization on a fuzzed binary.
PR binutils/20794
* readelf.c (process_section_headers): Fix off-by-one error when
checking for invalid sh_link and sh_info fields.
Yao Qi [Tue, 8 Nov 2016 14:28:32 +0000 (14:28 +0000)]
gdbarch software_single_step returns VEC (CORE_ADDR) *
This patch changes gdbarch method software_single_step to return a
vector of addresses on which GDB should insert breakpoints, and don't
insert breakpoints. Instead, the caller of
gdbarch_software_single_step inserts breakpoints if the returned
vector is not NULL.
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_software_single_step): Return
VEC (CORE_ADDR) *. Return NULL instead of 0. Don't call
insert_single_step_breakpoint.
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise.
(alpha_software_single_step): Likewise.
* alpha-tdep.h (alpha_software_single_step): Update declaration.
* arm-linux-tdep.c (arm_linux_software_single_step): Return
VEC (CORE_ADDR) *. Return NULL instead of 0.
* arm-tdep.c (arm_software_single_step): Return NULL instead of 0.
* arm-tdep.h (arm_software_single_step): Update declaration.
* breakpoint.c (insert_single_step_breakpoints): New function.
* breakpoint.h (insert_single_step_breakpoints): Declare.
* cris-tdep.c (cris_software_single_step): Return
VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint.
* gdbarch.sh (software_single_step): Change it to return
VEC (CORE_ADDR) *.
* gdbarch.c, gdbarch.h: Regenerated.
* infrun.c (maybe_software_singlestep): Adjust.
* mips-tdep.c (mips_deal_with_atomic_sequence): Return
VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint.
(micromips_deal_with_atomic_sequence): Likewise.
(deal_with_atomic_sequence): Likewise.
(mips_software_single_step): Likewise.
* mips-tdep.h (mips_software_single_step): Update declaration.
* moxie-tdep.c (moxie_software_single_step): Likewise.
* nios2-tdep.c (nios2_software_single_step): Likewise.
* ppc-tdep.h (ppc_deal_with_atomic_sequence): Update
declaration.
* record-full.c (record_full_resume): Adjust.
(record_full_wait_1): Likewise.
* rs6000-aix-tdep.c (rs6000_software_single_step): Return
VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Return
VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint.
* s390-linux-tdep.c (s390_software_single_step): Likewise.
* sparc-tdep.c (sparc_software_single_step): Likewise.
* spu-tdep.c (spu_software_single_step): Likewise.
* tic6x-tdep.c (tic6x_software_single_step): Likewise.
Yao Qi [Tue, 8 Nov 2016 12:58:33 +0000 (12:58 +0000)]
Clear addr bit in next_pcs vector
This patch is to split the loop of calling gdbarch_addr_bits_remove
and insert_single_step_breakpoint into two loops.
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_software_single_step): Write
adjusted address back to vector. Call insert_single_step_breakpoint
in a new loop.
* arm-tdep.c (arm_software_single_step): Likewise.
Yao Qi [Tue, 8 Nov 2016 12:47:16 +0000 (12:47 +0000)]
Remove arm_insert_single_step_breakpoint
This patch is to remove arm_insert_single_step_breakpoint.
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_software_single_step): Don't
call arm_insert_single_step_breakpoint, call
insert_single_step_breakpoint instead.
* arm-tdep.c (arm_insert_single_step_breakpoint): Remove.
(arm_software_single_step): Don't call
arm_insert_single_step_breakpoint, call
insert_single_step_breakpoint instead.
* arm-tdep.h (arm_insert_single_step_breakpoint): Remove
declaration.
Cordian A. Daniluk [Sat, 29 Oct 2016 18:39:57 +0000 (20:39 +0200)]
Fix PR breakpoints/20739: Badly formatted adress string in error message
Remove duplicate `0x'-prefix for the hex address printed. `paddress'
already prepends this, so no need to do it manually.
gdb/ChangeLog:
2016-11-08 Cordian A. Daniluk <th3c0r1uk@gmail.com>
PR breakpoints/20739
* breakpoint.c (check_fast_tracepoint_sals): Don't print duplicate
0x prefix.
Pedro Alves [Tue, 8 Nov 2016 12:32:05 +0000 (12:32 +0000)]
Fix bfd/dwarf2.c build breakage
Fix build breakage introduced by commit
089e3718bd8d ("Greatly improve
the speed if looking up DWARF line number information."):
- bfd_boolean is_linkage;
- const char *name;
- struct arange arange;
+ int line;
+ int tag;
+ bfd boolean is_linkage;
bfd/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* dwarf2.c (struct funcinfo) <is_linkage>: Type is bfd_boolean,
not "bfd boolean".
Igor Tsimbalist [Tue, 8 Nov 2016 12:01:58 +0000 (12:01 +0000)]
Greatly improve the speed if looking up DWARF line number information.
* dwarf2.c (comp_unit): Add new fields 'lookup_funcinfo_table' and
'number_of_functions' to keep lookup table and number of entries in
the table.
(line_sequence): Add new fields 'line_info_lookup' and 'num_lines'
to keep lookup table and number of entries in the table.
(lookup_funcinfo): New structure for lookup table for function
references.
(build_line_info_table): New function to create and build the lookup
table for line information.
(lookup_address_in_line_info_table): Use the lookup table instead of
traverse a linked list.
(compare_lookup_funcinfos): New compare fuction used in sorting of
lookup table for function references.
(build_lookup_funcinfo_table): New function to create, build and
sort the lookup table for functions references.
(lookup_address_in_function_table): Use the table instead of
traverse a linked list.
(_bfd_dwarf2_cleanup_debug_info): Free memory from function references
lookup table.
Yao Qi [Tue, 8 Nov 2016 11:32:53 +0000 (11:32 +0000)]
Fix indentation
gdb:
2016-11-08 Yao Qi <yao.qi@linaro.org>
* rust-lang.c (val_print_struct): Fix indentation.
Lionel Flandrin [Tue, 8 Nov 2016 10:27:36 +0000 (10:27 +0000)]
Check for truncated registers in process_g_packet
While investigating an unrelated issue in remote.c I noticed that the
bound checking for 'g' packets was bogus:
The previous code would only check that the first byte of the register
was within bounds before passing the buffer to regcache_raw_supply.
If it turned out that the register in the 'g' packet was incomplete
then regcache_raw_supply would proceed to memcpy out-of-bounds.
Since the buffer is allocated with alloca it's relatively unlikely to
crash (you just end up dumping gdb's stack into the cache) but it's
still a bit messy.
I changed this logic to check for truncated registers and raise an
error if one is encountered. Hopefully it should make debugging
remote stubs a bit easier.
gdb/ChangeLog:
2016-11-08 Lionel Flandrin <lionel@svkt.org>
* remote.c (process_g_packet): Detect truncated registers in 'g'
packets and raise an error.
GDB Administrator [Tue, 8 Nov 2016 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 7 Nov 2016 22:58:38 +0000 (14:58 -0800)]
X86: Properly handle bad FPU opcode
Since Bad_Opcode and FGRPd9_2 were the same in i386-dis.c, all
Bad_Opcode entries in float_reg were displaced as FGRPd9_2. This
patch adds an entry for Bad_Opcode in fgrps to avoid treating it
as FGRPd9_2.
gas/
PR binutils/20775
* testsuite/gas/i386/i386.exp: Run fpu-bad.
* testsuite/gas/i386/fpu-bad.d: New file.
* testsuite/gas/i386/fpu-bad.s: Likewise.
opcodes/
PR binutils/20775
* i386-dis.c (FGRPd9_2): Replace 0 with 1.
(FGRPd9_4): Replace 1 with 2.
(FGRPd9_5): Replace 2 with 3.
(FGRPd9_6): Replace 3 with 4.
(FGRPd9_7): Replace 4 with 5.
(FGRPda_5): Replace 5 with 6.
(FGRPdb_4): Replace 6 with 7.
(FGRPde_3): Replace 7 with 8.
(FGRPdf_4): Replace 8 with 9.
(fgrps): Add an entry for Bad_Opcode.
Doug Evans [Mon, 7 Nov 2016 21:31:24 +0000 (13:31 -0800)]
Fix ext lang calls to value_struct_elt.
gdb/ChangeLog:
* guile/scm-value.c (gdbscm_value_field): Fix call to value_struct_elt.
* python/py-value.c (valpy_getitem): Ditto.
Doug Evans [Mon, 7 Nov 2016 21:27:22 +0000 (13:27 -0800)]
i386-tdep.c (i386_gdbarch_init): Add comments.
gdb/ChangeLog:
* i386-tdep.c (i386_gdbarch_init): Add comments.
Doug Evans [Mon, 7 Nov 2016 21:23:10 +0000 (13:23 -0800)]
python/py-unwind.c (unwind_infopy_str): Fix use of VEC_iterate.
gdb/ChangeLog:
* python/py-unwind.c (unwind_infopy_str): Fix use of VEC_iterate.
Doug Evans [Mon, 7 Nov 2016 21:15:48 +0000 (13:15 -0800)]
configure.tgt (x86_64-*-elf*): Remove i386bsd-tdep.o.
gdb/ChangeLog:
* configure.tgt (x86_64-*-elf*): Remove i386bsd-tdep.o.
Doug Evans [Mon, 7 Nov 2016 21:08:55 +0000 (13:08 -0800)]
Sync config.sub,config.guess with upstream.
Loïc Yhuel [Mon, 7 Nov 2016 16:00:21 +0000 (08:00 -0800)]
Add missing '$' in configure.ac.
2016-11-04 Loïc Yhuel <loic.yhuel@softathome.com>
gold/
* configure.ac: add missing '$'.
* configure: Regenerate.
Nick Clifton [Mon, 7 Nov 2016 15:05:34 +0000 (15:05 +0000)]
Fix infinite loop when processing rpath tokens.
PR ld/20784
* emultempl/elf32.em (search_needed): Fix infinite loop when
unable to process a token. Add support for curly braced enclosed
tokens.
* ld.texinfo (--rpath-link): Document supprot for $ORIGIN and
$LIB.
Nick Clifton [Mon, 7 Nov 2016 12:28:16 +0000 (12:28 +0000)]
Note that the linker's --compress-debug-sections option overrides the compression status of any input debug sections.
* ld.texinfo (--compress-debug-sections): Expand documentation of
this option.
GDB Administrator [Mon, 7 Nov 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 6 Nov 2016 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Nathan Sidwell [Fri, 4 Nov 2016 03:42:23 +0000 (20:42 -0700)]
Fix gas crash with unreasonably long lines
gas/
* input-scrub.c (partial_size): Make size_t.
(buffer_length): Likewise. Adjust meaning.
(struct input_save): Adjust partial_size type.
(input_scrub_reinit): New.
(input_scrub_push, input_scrub_begin): Use it.
(input_scrub_next_buffer): Fix buffer extension logic. Only scan
newly read buffer for newline.
Simon Marchi [Sat, 5 Nov 2016 03:47:32 +0000 (23:47 -0400)]
Fix a few typos
gdb/ChangeLog:
* maint.c (scoped_command_stats::scoped_command_stats): Fix typo.
* ppcnbsd-tdep.c (_initialize_ppcnbsd_tdep): Likewise.
* ppcobsd-tdep.c (_initialize_ppcobsd_tdep): Likewise.
* ui-out.c (ui_out_new): Likewise.
* utils.c (init_page_info): Likewise.
(reset_prompt_for_continue_wait_time): Likewise.
* windows-nat.c (windows_init_thread_list): Likewise.
* xtensa-tdep.c (call0_analyze_prologue): Likewise.
GDB Administrator [Sat, 5 Nov 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 27 Sep 2016 11:06:01 +0000 (12:06 +0100)]
arc/nps400: Validate address type operands correctly
When we match against an address type operand within an instruction it
is important that we match exactly the right address type operand early
on, during the opcode selection phase. If we wait until the operand
insertion phase to check that we have the correct address operand, then
it is too late to select an alternative opcode. This becomes important
only when we have multiple opcodes with the same mnemonic, and operand
lists that differ only in the type of the address operands.
This commit fixes this issue, and adds some example instructions that
require this issue to be fixed (the instructions are identical except
for the address type operand).
gas/ChangeLog:
* config/tc-arc.c (find_opcode_match): Use insert function to
validate matching address type operands.
* testsuite/gas/arc/nps400-10.d: New file.
* testsuite/gas/arc/nps400-10.s: New file.
opcodes/ChangeLog:
* arc-opc.c (arc_flag_operands): Add F_DI14.
(arc_flag_classes): Add C_DI14.
* arc-nps400-tbl.h: Add new exc instructions.
Andrew Burgess [Thu, 11 Aug 2016 15:04:59 +0000 (16:04 +0100)]
objcopy: Close some memory leaks in error paths
Closes some memory leaks within objcopy for error paths.
binutils/ChangeLog:
* objcopy.c (copy_section): Add extra calls to free for error
paths.
Tom Tromey [Mon, 22 Aug 2016 03:47:14 +0000 (21:47 -0600)]
set default-directory in dwarf-browse
I've been using dwarf-mode.el again recently and I found it mildly
annoying that the mode doesn't set default-directory. Setting it
means that operations in the dwarf-browsing buffer default to the
directory holding the object file being investigated.
This bumps the version number as well so that updating it via the
package manager works properly.
2016-11-04 Tom Tromey <tom@tromey.com>
* dwarf-mode.el (dwarf-browse): Set default-directory. Bump
version number.
Andreas Krebbel [Fri, 4 Nov 2016 18:48:35 +0000 (19:48 +0100)]
S/390: Fix 16 bit pc relative relocs.
Since the bpp instruction has been added the 16 bit wide pc relative
relocs might occur at offset 2 as well at offset 4 in an instruction.
With this patch the different adjustment is passed from
md_gather_operand to md_apply_fix via fx_pcrel_adjust field in the fix
data structure.
No regressions on s390x.
gas/ChangeLog:
2016-11-04 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (md_gather_operands): Set fx_pcrel_adjust.
(md_apply_fix): Use/Set fx_pcrel_adjust.
* testsuite/gas/s390/zarch-zEC12.d: Add bpp reloc test pattern.
* testsuite/gas/s390/zarch-zEC12.s: Add bpp reloc test.
Thomas Preud'homme [Fri, 4 Nov 2016 16:32:08 +0000 (16:32 +0000)]
Commit missing ChangeLog entry for Cortex-M33 support
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
include/
* opcode/arm.h (ARM_AEXT_V8M_MAIN_DSP): Define.
(ARM_AEXT2_V8M_MAIN_DSP): Likewise.
(ARM_ARCH_V8M_MAIN_DSP): Likewise.
Thomas Preud'homme [Fri, 4 Nov 2016 16:24:59 +0000 (16:24 +0000)]
Add support for ARM Cortex-M33 processor
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (cortex-m33): Declare new processor.
* doc/c-arm.texi (-mcpu ARM command line option): Document new
Cortex-M33 processor.
* NEWS: Mention ARM Cortex-M33 support.
Thomas Preud'homme [Fri, 4 Nov 2016 16:24:08 +0000 (16:24 +0000)]
Add support for ARM Cortex-M23 processor
2016-11-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (cortex-m23): Declare new processor.
* doc/c-arm.texi (-mcpu ARM command line option): Document new
Cortex-M23 processor.
* NEWS: Mention ARM Cortex-M23 support.
Palmer Dabbelt [Fri, 4 Nov 2016 16:08:31 +0000 (16:08 +0000)]
Add maintainers for RISC-V target.
* MAINTAINERS: Add myself and Andrew Waterman as maintainers for
the RISC-V target.
Palmer Dabbelt [Fri, 4 Nov 2016 14:18:06 +0000 (14:18 +0000)]
Update RISC-V documentation and make sure that it is included in the gas info file.
* Makefile.am (CPU_DOCS): Add c-riscv.texi.
* Makefile.in: Regenerate.
* doc/all.texi: Set RISCV.
* doc/as.texinfo: Add RISCV options.
Add RISC-V-Dependent node.
Include c-riscv.texi.
* doc/c-riscv.texi: Rename RISC-V Options to RISC-V-Opts.
Nick Clifton [Fri, 4 Nov 2016 13:57:40 +0000 (13:57 +0000)]
Remove support for $PLATFORM in rpath search paths.
* emultempl/elf32.em (search_needed): Remove use of getauxval and
inclusion of <sys/auxv.h>. Replace support for $PLATFORM with a
warning message.
* configure.ac (AC_CHECK_FUNCS): Remove getauxval.
* configure: Regenerate.
* config.in: Regenerate.
Nick Clifton [Fri, 4 Nov 2016 13:50:01 +0000 (13:50 +0000)]
Fix building binutils for all 32-bit targets by moving riscv32 target into 64-bit builds only.
* targets.c (bfd_target_vector): Only add riscv_elf32_vec target
when supporting 64-bit BFD targets.
Andrew Burgess [Tue, 20 Sep 2016 13:21:05 +0000 (14:21 +0100)]
ld: Allow EXCLUDE_FILE to be used outside of the section list
Currently the EXCLUDE_FILE linker script construct can only be used
within the input section list, and applied only to the section pattern
immediately following the EXCLUDE_FILE. For example:
*.o (EXCLUDE_FILE (a.o) .text .rodata)
In this case all sections matching '.text' are included from all files
matching '*.o' but not from the file 'a.o'. All sections matching
'.rodata' are also included from all files matching '*.o' (incluing from
'a.o').
If the user wants to restrict the inclusion of section '.rodata' so that
this too is not taken from the file 'a.o' then the above example must be
extended like this:
*.o (EXCLUDE_FILE (a.o) .text EXCLUDE_FILE (a.o) .rodata)
However, due to the internal grammar of the linker script language the
snippet 'EXCLUDE_FILE (a.o) .text' is parsed by a pattern called
'wildcard_spec'. The same 'wildcard_spec' pattern is also used to parse
the input file name snippet '*.o' in the above examples. As a result of
this pattern reuse within the linker script grammar then the following
is also a valid linker script construct:
EXCLUDE_FILE (a.o) *.o (.text .rodata)
However, though the linker accepts this without complaint the
EXCLUDE_FILE part is silently ignored and has no effect.
This commit takes this last example and makes it a useful, valid,
construct. The last example now means to include sections '.text' and
'.rodata' from all files matching '*.o' except for the file 'a.o'.
If the list of input sections is long, and the user knows that the file
exclusion applies across the list then the second form might be a
clearer alternative to replicating the EXCLUDE_FILE construct.
I've added a set of tests for EXCLUDE_FILE to the linker, including
tests for the new functionality.
ld/ChangeLog:
* ldlang.h (struct lang_wild_statement_struct): Add
exclude_name_list field.
* ldlang.c (walk_wild_file_in_exclude_list): New function.
(walk_wild_consider_section): Use new
walk_wild_file_in_exclude_list function.
(walk_wild_file): Add call to walk_wild_file_in_exclude_list.
(print_wild_statement): Print new exclude_name_list field.
(lang_add_wild): Initialise new exclude_name_list field.
* testsuite/ld-scripts/exclude-file-1.d: New file.
* testsuite/ld-scripts/exclude-file-1.map: New file.
* testsuite/ld-scripts/exclude-file-1.t: New file.
* testsuite/ld-scripts/exclude-file-2.d: New file.
* testsuite/ld-scripts/exclude-file-2.map: New file.
* testsuite/ld-scripts/exclude-file-2.t: New file.
* testsuite/ld-scripts/exclude-file-3.d: New file.
* testsuite/ld-scripts/exclude-file-3.map: New file.
* testsuite/ld-scripts/exclude-file-3.t: New file.
* testsuite/ld-scripts/exclude-file-4.d: New file.
* testsuite/ld-scripts/exclude-file-4.map: New file.
* testsuite/ld-scripts/exclude-file-4.t: New file.
* testsuite/ld-scripts/exclude-file-a.s: New file.
* testsuite/ld-scripts/exclude-file-b.s: New file.
* testsuite/ld-scripts/exclude-file.exp: New file.
* ld.texinfo (Input Section Basics): Update description of
EXCLUDE_FILE to cover the new features.
* NEWS: Mention new EXCLUDE_FILE usage.
Andrew Burgess [Tue, 20 Sep 2016 14:25:55 +0000 (15:25 +0100)]
ld: Create test object files based on source file name
When creating object files during testing, base the name of the object
file on the name of the source file, rather than using dump0.o,
dump1.o, etc. There's a few places where we have multiple source
files with the same name but in different directories, in these cases,
even after this change, we still add a numerical suffix to make the
object file names unique. So if we have 'foo/src.s' and 'bar/src.s',
we will create object files 'src.o' and 'src1.o'.
Update the few tests that hard code the object file name into the
expected test results.
ld/ChangeLog:
* testsuite/lib/ld-lib.exp (run_dump_test): Use object file names
based on the original source file name.
* testsuite/ld-discard/extern.d: Update object file names.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/orphan-8.map: Likewise.
Andrew Burgess [Sun, 30 Oct 2016 08:11:30 +0000 (08:11 +0000)]
ld/xc16x: This target does not support -shared
Add the xc16x-elf target to the list of targets that do not support
the -shared option. Being missing from this list was causing the
linker to add '-z norelro' to the link line of many tests, which in
turn caused these tests to fail.
ld/ChangeLog:
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Add
xc16x-*-elf to the list of targets that don't support -shared.
Andrew Burgess [Tue, 20 Sep 2016 10:18:12 +0000 (11:18 +0100)]
ld: Rename pattern within yacc grammar file
Rename file_NAME_list to section_NAME_list in the linker's grammar
file. This rename reflects how the pattern is now being used, and makes
the grammar easier to understand.
There should be no functional change after this commit.
ld/ChangeLog:
* ldgram.y: Rename file_NAME_list to section_NAME_list
throughout.
GDB Administrator [Fri, 4 Nov 2016 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Manish Goregaokar [Sat, 29 Oct 2016 12:55:58 +0000 (05:55 -0700)]
Add support for the sizeof function in Rust
2016-10-29 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-exp.y: Parse `sizeof(exp)` as `UNOP_SIZEOF`
gdb/testsuite/ChangeLog:
* gdb.rust/simple.exp: Add tests for `sizeof(expr)`
Manish Goregaokar [Sat, 29 Oct 2016 01:00:43 +0000 (18:00 -0700)]
Add support for untagged unions in Rust
2016-10-28 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_union_is_untagged): Add function to
check if a union is an untagged unioni
(rust_val_print): Handle printing of untagged union values
(rust_print_type): Handle printing of untagged union types
(rust_evaluate_subexp): Handle evaluating field
access on untagged unions
Manish Goregaokar [Thu, 27 Oct 2016 23:46:34 +0000 (16:46 -0700)]
Fix handling of discriminantless univariant enums in Rust; fix bug with encoded enums
2016-10-27 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_get_disr_info): Treat univariant enums
without discriminants as encoded enums with a real field
* rust-lang.c (rust_evaluate_subexp): Handle field access
on encoded struct-like enums
gdb/testsuite/ChangeLog:
* simple.rs: Add test for univariant enums without discriminants
and for encoded struct-like enums
* simple.exp: Add test expectations
Graham Markall [Wed, 26 Oct 2016 16:53:21 +0000 (17:53 +0100)]
[ARC] Fix ldbit test on 32-bit systems
The long immediate operand chosen for one of the ldbit tests is
equivalent to a small negative value that would fit inside an s9
operand, leading to the assembler to choose an unexpected (but
legitimate) encoding of the instruction on 32-bit systems, and
therefore causing the test to fail. This commit fixes the test by
changing the offending limm value so that it can no longer be
interpreted as an s9 operand.
gas/ChangeLog:
* testsuite/gas/arc/nps400-6.s: Change ldbit tests so that
limm operands are out of the range of an s9, in order to fix
the test.
* testsuite/gas/arc/nps400-6.d: Updated to match new expected
output.
Graham Markall [Tue, 18 Oct 2016 19:10:25 +0000 (20:10 +0100)]
arc: Implement NPS-400 dcmac instruction
gas/ChangeLog:
* testsuite/gas/arc/nps-400-9.d: Added.
* testsuite/gas/arc/nps-400-9.s: Added.
include/ChangeLog:
* opcode/arc.h: Add PROTOCOL_DECODE to insn_class_t.
opcodes/ChangeLog:
* arc-dis.c (arc_insn_length): Return length 8 for instructions with
major opcode 0xa.
* arc-nps-400-tbl.h: Add dcmac instruction.
* arc-opc.c (arc_operands): Added operands for dcmac instruction.
(insert_nps_rbdouble_64): Added.
(extract_nps_rbdouble_64): Added.
(insert_nps_proto_size): Added.
(extract_nps_proto_size): Added.
Andrew Burgess [Wed, 6 Jul 2016 18:39:55 +0000 (19:39 +0100)]
arc: Change max instruction length to 64-bits
The current handling for arc instructions longer than 32-bits is all
handled as a special case in both the assembler and disassembler.
The problem with this approach is that it leads to code duplication,
selecting a long instruction is exactly the same process as selecting a
short instruction, except over more bits, in both cases we select based
on bit comparison, and initial operand insertion and extraction.
This commit unifies both the long and short instruction worlds,
converting the core opcodes library from being largely 32-bit focused,
to being largely 64-bit focused.
The changes are, on the whole, not too much. There's obviously a lot of
type changes but otherwise the bulk of the code just works. Most of the
actual functional changes are to code that previously handled the longer
48 or 64 bit instructions. The insert/extract handlers for these have
now been brought into line with the short instruction insert/extract
handlers.
All of the special case handling code that was previously added has now
been removed again. Overall, this commit reduces the amount of code in
the arc assembler and disassembler.
gas/ChangeLog:
* config/tc-arc.c (struct arc_insn): Change type of insn field.
(md_number_to_chars_midend): Support 6- and 8-byte values.
(emit_insn0): Update debug output.
(find_opcode_match): Likewise.
(build_fake_opcode_hash_entry): Delete.
(find_special_case_long_opcode): Delete.
(find_special_case): Remove long format special case handling.
(insert_operand): Change instruction type and update debug print
format.
(assemble_insn): Change instruction type, update debug print
formats, and remove unneeded assert.
include/ChangeLog:
* opcode/arc.h (struct arc_opcode): Change type of opcode and mask
fields.
(struct arc_long_opcode): Delete.
(struct arc_operand): Change types for insert and extract
handlers.
opcodes/ChangeLog:
* arc-dis.c (struct arc_operand_iterator): Remove all fields
relating to long instruction processing, add new limm field.
(OPCODE): Rename to...
(OPCODE_32BIT_INSN): ...this.
(OPCODE_AC): Delete.
(skip_this_opcode): Handle different instruction lengths, update
macro name.
(special_flag_p): Update parameter type.
(find_format_from_table): Update for more instruction lengths.
(find_format_long_instructions): Delete.
(find_format): Update for more instruction lengths.
(arc_insn_length): Likewise.
(extract_operand_value): Update for more instruction lengths.
(operand_iterator_next): Remove code relating to long
instructions.
(arc_opcode_to_insn_type): New function.
(print_insn_arc):Update for more instructions lengths.
* arc-ext.c (extInstruction_t): Change argument type.
* arc-ext.h (extInstruction_t): Change argument type.
* arc-fxi.h: Change type unsigned to unsigned long long
extensively throughout.
* arc-nps400-tbl.h: Add long instructions taken from
arc_long_opcodes table in arc-opc.c.
* arc-opc.c: Update parameter types on insert/extract handlers.
(arc_long_opcodes): Delete.
(arc_num_long_opcodes): Delete.
(arc_opcode_len): Update for more instruction lengths.
Graham Markall [Thu, 13 Oct 2016 08:34:16 +0000 (09:34 +0100)]
arc: Swap highbyte and lowbyte in print_insn_arc
highbyte and lowbyte actually refer to the low byte and the high
byte respectively, but are used consistently in this swapped
order. This commit swaps them round so that highbyte refers to the
high byte and lowbyte refers to the low byte.
There should be no functional change after this commit.
opcodes/ChangeLog:
* arc-dis.c (print_insn_arc): Swap highbyte and lowbyte.
Graham Markall [Wed, 6 Jul 2016 18:01:53 +0000 (19:01 +0100)]
opcodes/arc: Make some macros 64-bit safe
In preparation to moving to a world where arc instructions can be 2, 4,
6, or 8 bytes long, make some macros 64-bit safe.
There should be no functional change after this commit.
include/ChangeLog:
* opcode/arc.h: Make macros 64-bit safe.
Graham Markall [Thu, 29 Sep 2016 18:25:25 +0000 (19:25 +0100)]
arc: Replace ARC_SHORT macro with arc_opcode_len function
In preparation for moving to a world where arc instructions can be 2, 4,
6, or 8 bytes in length, replace the ARC_SHORT macro (which is either
true of false) with an arc_opcode_len function that returns a length in
bytes.
There should be no functional change after this commit.
gas/ChangeLog:
* config/tc-arc.c (assemble_insn): Replace use of ARC_SHORT with
arc_opcode_len.
include/ChangeLog:
* opcode/arc.h (arc_opcode_len): Declare.
(ARC_SHORT): Delete.
opcodes/ChangeLog:
* arc-dis.c (find_format_from_table): Replace use of ARC_SHORT
with arc_opcode_len.
(find_format_long_instructions): Likewise.
* arc-opc.c (arc_opcode_len): New function.
Graham Markall [Wed, 6 Jul 2016 14:04:37 +0000 (15:04 +0100)]
gas/arc: Replace short_insn flag with insn length field
When assembling an instruction replace the short_insn boolean flag with
an integer field for holding the instruction length. This is in
preparation for moving to a world where instructions can be 2, 4, 6, or
8 bytes in length.
gas/ChangeLog:
* config/tc-arc.c (struct arc_insn): Replace short_insn flag with
len field.
(apply_fixups): Update to use len field.
(emit_insn0): Simplify code, making use of len field.
(md_convert_frag): Update to use len field.
(assemble_insn): Update to use len field.
Andrew Burgess [Thu, 29 Sep 2016 16:51:16 +0000 (17:51 +0100)]
arc/opcodes/nps400: Fix some instruction masks
A few masks were incorrect, there were opcode bits that lives outside of
the instruction mask, the effected instructions are decode1, zncv, and
efabgt.
Previously these instructions would assemble and disassemble correctly,
and a correctly encoded binary should behave no differently. The only
difference would be seen in a few incorrectly encoded binaries,
previously these would have decoded to the above instructions, while now
they will not.
opcodes/ChangeLog:
* arc-nps400-tbl.h: Fix some instruction masks.
Siddhesh Poyarekar [Wed, 19 Oct 2016 18:59:34 +0000 (00:29 +0530)]
New option falkor for Qualcomm server part
This adds an option for the Qualcomm falkor core, the corresponding
gcc patch is here:
https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00262.html
This was tested with aarch64 and armhf builds and make check and also
by building and running SPEC2006.
* config/tc-aarch64.c (aarch64_cpus): Add falkor.
* config/tc-arm.c (arm_cpus): Likewise.
* doc/c-aarch64.texi: Likewise.
* doc/c-arm.texi: Likewise.
H.J. Lu [Thu, 3 Nov 2016 16:55:01 +0000 (09:55 -0700)]
X86: Reuse opcode 0x80 decoder for opcode 0x82
Since opcode 0x82 is an alias of opcode 0x80, we can reuse opcode 0x80
decoder.
* i386-dis.c (REG_82): Removed.
(X86_64_82_REG_0): Likewise.
(X86_64_82_REG_1): Likewise.
(X86_64_82_REG_2): Likewise.
(X86_64_82_REG_3): Likewise.
(X86_64_82_REG_4): Likewise.
(X86_64_82_REG_5): Likewise.
(X86_64_82_REG_6): Likewise.
(X86_64_82_REG_7): Likewise.
(X86_64_82): New.
(dis386): Use X86_64_82 instead of REG_82.
(reg_table): Remove REG_82.
(x86_64_table): Add X86_64_82. Remove X86_64_82_REG_0,
X86_64_82_REG_1, X86_64_82_REG_2, X86_64_82_REG_3,
X86_64_82_REG_4, X86_64_82_REG_5, X86_64_82_REG_6 and
X86_64_82_REG_7.
H.J. Lu [Thu, 3 Nov 2016 16:13:01 +0000 (09:13 -0700)]
X86: Decode opcode 0x82 as opcode 0x80 in 32-bit mode
Update x86 disassembler to treat opcode 0x82 as an aliase of opcode 0x80
in 32-bit mode.
gas/
PR binutils/20754
* testsuite/gas/i386/opcode.s: Add tests for opcode 0x82.
* testsuite/gas/i386/opcode-intel.d: Updated.
* testsuite/gas/i386/opcode.d: Likewise.
opcodes/
PR binutils/20754
* i386-dis.c (REG_82): New.
(X86_64_82_REG_0): Likewise.
(X86_64_82_REG_1): Likewise.
(X86_64_82_REG_2): Likewise.
(X86_64_82_REG_3): Likewise.
(X86_64_82_REG_4): Likewise.
(X86_64_82_REG_5): Likewise.
(X86_64_82_REG_6): Likewise.
(X86_64_82_REG_7): Likewise.
(dis386): Use REG_82.
(reg_table): Add REG_82.
(x86_64_table): Add X86_64_82_REG_0, X86_64_82_REG_1,
X86_64_82_REG_2, X86_64_82_REG_3, X86_64_82_REG_4,
X86_64_82_REG_5, X86_64_82_REG_6 and X86_64_82_REG_7.
Yao Qi [Thu, 3 Nov 2016 16:09:42 +0000 (16:09 +0000)]
Replace YY_NULL with YY_NULLPTR in LANG-exp.c
As we require c++11, GDB fails to build if bison is not new enough.
I see the following error on the system (fedora 19) that bison is
2.6.4,
g++ -std=gnu++11 .... \
-c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF .deps/ada-exp.Tpo 'if test -f ada-exp.c; then echo ada-exp.c; else echo ../../binutils-gdb/gdb/ada-exp.c; fi`
In file included from ../../binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:113:0: error: "YY_NULL" redefined [-Werror]
#define YY_NULL 0
^
ada-exp.c:158:0: note: this is the location of the previous definition
# define YY_NULL nullptr
^
cc1plus: all warnings being treated as errors
make: *** [ada-exp.o] Error 1
Both ada-exp.c and ada-lex.c has macro YY_NULL, like this,
$ cat 1.c
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# else
# define YY_NULL 0
# endif
# endif
#define YY_NULL 0
as we can see, YY_NULL is defined differently (nullptr vs 0)
$ g++ -std=c++11 -Wall 1.c -c
1.c:9:0: warning: "YY_NULL" redefined
#define YY_NULL 0
^
1.c:3:0: note: this is the location of the previous definition
# define YY_NULL nullptr
^
$ g++ -Wall 1.c -c
bison renames YY_NULL to YY_NULLPTR in 2013 Nov,
https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00002.html
and bison released later than 2013 Nov have this patch. Bison 3.0.2,
released on 2013 Dec, is OK.
The fix is to replace YY_NULL with YY_NULLPTR via sed. With old bison,
YY_NULL becomes YY_NULLPTR; with new bison, YY_NULLPTR becomes
YY_NULLPTRPTR,
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR.
Tristan Gingold [Tue, 27 Sep 2016 13:06:51 +0000 (15:06 +0200)]
Deprecate old platforms
bfd/
* config.bfd: Deprecate many old triplets.
H.J. Lu [Thu, 3 Nov 2016 15:38:13 +0000 (08:38 -0700)]
X86: Rename REG_82 to REG_83
The REG_82 entry in x86 disassembler is for opcode 0x83, not opcode
0x82.
* i386-dis.c (REG_82): Renamed to ...
(REG_83): This.
(dis386): Updated.
(reg_table): Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION
Both of them are used in conversion. We can remove them since the
conversion is done.
There are many architectures only have one breakpoint instruction,
so their gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind look very similar. Instead of macro, we
use template "template <size_t, const gdb_byte *> struct bp_manipulation"
for these architectures. In order to use template, I also change
breakpoint instruction of type "static const gdb_byte[]" to
"constexpr gdb_byte[]", and rename them to ARCH_break_insn.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* aarch64-tdep.c (aarch64_default_breakpoint): Change it to
constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(aarch64_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* alpha-tdep.c (break_insn): Rename to alpha_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(alpha_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arc-tdep.c (arc_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Remove.
(struct bp_manipulation): New.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Remove.
(struct bp_manipulation_endian): New.
(BP_MANIPULATION): New.
(BP_MANIPULATION_ENDIAN): New.
* arm-tdep.c (arm_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* avr-tdep.c (avr_break_insn): Change it constexpr.
(avr_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cris-tdep.c (cris_gdbarch_init): Likewise.
* frv-tdep.c (breakpoint): Rename it to frv_break_insn, and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(frv_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* ft32-tdep.c (breakpoint): Rename it to ft32_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(ft32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* h8300-tdep.c (breakpoint): Rename it to h8300_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(h8300_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* hppa-tdep.c (breakpoint): Rename it to h8300_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(hppa_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* i386-tdep.c (break_insn): Rename it to i386_break_insn.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(i386_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* iq2000-tdep.c (iq2000_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* lm32-tdep.c (breakpoint): Rename it to lm32_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(lm32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m32c-tdep.c (break_insn): Rename it to m32c_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m32c_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* m68hc11-tdep.c (breakpoint): Rename it to m68hc11_break_insn and
change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m68hc11_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m68k-tdep.c (break_insn): Rename it to m68k_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m68k_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* m88k-tdep.c (break_insn): Rename it to m88k_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(m88k_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mep-tdep.c (breakpoint): Rename it to mep_break_insn and change
its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(mep_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* microblaze-tdep.c (break_insn): Rename it to
microblaze_break_insn and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(microblaze_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (breakpoint): Rename it to mn10300_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(mn10300_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* moxie-tdep.c (breakpoint): Rename it to moxie_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(moxie_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* msp430-tdep.c (breakpoint): Rename it to msp430_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(msp430_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* nds32-tdep.c (break_insn): Rename it to nds32_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(nds32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* rl78-tdep.c (breakpoint): Rename it to rl78_break_ins
and change its type to rl78_break_insn. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(rl78_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* rs6000-tdep.c (big_breakpoint): Change its type to
constexpr.
(little_breakpoint): Likewise.
Don't use GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN.
(rs6000_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* rx-tdep.c (breakpoint): Rename it to rx_break_insn and
change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(rx_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* s390-linux-tdep.c (breakpoint): Rename it to s390_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION
(s390_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* score-tdep.c (score_gdbarch_init): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* sparc-tdep.c (break_insn): Rename it to sparc_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(sparc32_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* spu-tdep.c (breakpoint): Rename it to spu_break_insn and change
its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(spu_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* tilegx-tdep.c (breakpoint): Rename it to tilegx_break_insn
and change its type to constexpr. Don't use
GDBARCH_BREAKPOINT_MANIPULATION.
(tilegx_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* vax-tdep.c (break_insn): Rename it to vax_break_insn and
change its type to constexpr.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(vax_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* xstormy16-tdep.c (breakpoint): Rename it to
xstormy16_break_insn and change its type to constexpr.
Don't use GDBARCH_BREAKPOINT_MANIPULATION.
(xstormy16_gdbarch_init): Don't use
SET_GDBARCH_BREAKPOINT_MANIPULATION.
* xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove arm_override_mode
GDB can determine the kind of single step breakpoint by gdbarch
breakpoint_kind_from_current_state, so global variable
arm_override_mode is no longer needed. This patch removes it.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_override_mode): Remove.
(arm_pc_is_thumb): Update.
(arm_insert_single_step_breakpoint): Update.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Determine the kind of single step breakpoint
This patch adds a new gdbarch method breakpoint_kind_from_current_state
for single step breakpoint, and uses it in breakpoint_kind.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_kind_from_current_state):
New function.
* arch-utils.h (default_breakpoint_kind_from_current_state):
Declare.
* arm-tdep.c (arm_breakpoint_kind_from_current_state): New
function.
(arm_gdbarch_init): Call
set_gdbarch_breakpoint_kind_from_current_state.
* breakpoint.c (breakpoint_kind): Call
gdbarch_breakpoint_kind_from_current_state for single step
breakpoint. Update comments.
* gdbarch.sh (breakpoint_kind_from_current_state): New.
* gdbarch.c, gdbarch.h: Regenerate.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Add default_breakpoint_from_pc
This patch adds the default implementation of gdbarch breakpoint_from_pc,
which is,
const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
so gdbarch can only defines sw_breakpoint_from_kind and
breakpoint_kind_from_pc.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_from_pc): New function.
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
GDBARCH_BREAKPOINT_FROM_PC.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
set_gdbarch_breakpoint_from_pc.
(default_breakpoint_from_pc): Remove declaration.
* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
* gdbarch.c, gdbarch.h: Regenerate.
* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:14 +0000 (14:35 +0000)]
Remove gdbarch_remote_breakpoint_from_pc
This patch removes gdbarch method remote_breakpoint_from_pc, as it
is no longer used.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_remote_breakpoint_from_pc): Remove.
* arch-utils.h (default_remote_breakpoint_from_pc): Remove.
* arm-tdep.c (arm_remote_breakpoint_from_pc): Remove.
(arm_gdbarch_init): Don't call
set_gdbarch_remote_breakpoint_from_pc.
* gdbarch.sh (remote_breakpoint_from_pc): Remove.
* gdbarch.c, gdbarch.h: Regenerate.
* mips-tdep.c (mips_remote_breakpoint_from_pc): Remove.
(mips_gdbarch_init): Don't call
set_gdbarch_remote_breakpoint_from_pc.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Rename placed_size to kind
This patch renames placed_size to kind.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* breakpoint.h (struct bp_target_info) <placed_size>: Remove.
<kind>: New field.
Update all users.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Split breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind
We convert each ARCH_breakpoint_from_pc to ARCH_breakpoint_kind_from_pc
and ARCH_sw_breakpoint_from_kind. Note that gdbarch doesn't have methods
breakpoint_kind_from_pc and sw_breakpoint_from_kind so far.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): New macro.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): New macro.
* arm-tdep.c (arm_breakpoint_from_pc): Remove.
(arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): New function.
(arm_breakpoint_from_pc): Call arm_breakpoint_kind_from_pc
and arm_sw_breakpoint_from_kind.
Use GDBARCH_BREAKPOINT_FROM_PC.
(arm_remote_breakpoint_from_pc): Call
arm_breakpoint_kind_from_pc.
(arm_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc
with SET_GDBARCH_BREAKPOINT_MANIPULATION.
* arc-tdep.c: Likewise.
* bfin-tdep.c: Likewise.
* cris-tdep.c: Likewise.
* iq2000-tdep.c: Likewise.
* m32r-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* rs6000-tdep.c: Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* sh64-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
Yao Qi [Thu, 3 Nov 2016 14:35:13 +0000 (14:35 +0000)]
Add enum for mips breakpoint kinds
This patch adds an enum mips_breakpoint_kind to avoid using magic
numbers as much as possible.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* mips-tdep.c (mips_breakpoint_kind): New enum.
(mips_breakpoint_from_pc): Use it.
(mips_remote_breakpoint_from_pc): Likewise.