Commit Graph

58 Commits

Author SHA1 Message Date
Pedro Alves a121b7c1ac -Wwrite-strings: The Rest
This is the remainder boring constification that all looks more of less
borderline obvious IMO.

gdb/ChangeLog:
2017-04-05  Pedro Alves  <palves@redhat.com>

	* ada-exp.y (yyerror): Constify.
	* ada-lang.c (bound_name, get_selections)
	(ada_variant_discrim_type)
	(ada_variant_discrim_name, ada_value_struct_elt)
	(ada_lookup_struct_elt_type, is_unchecked_variant)
	(ada_which_variant_applies, standard_exc, ada_get_next_arg)
	(catch_ada_exception_command_split)
	(catch_ada_assert_command_split, catch_assert_command)
	(ada_op_name): Constify.
	* ada-lang.h (ada_yyerror, get_selections)
	(ada_variant_discrim_name, ada_value_struct_elt): Constify.
	* arc-tdep.c (arc_print_frame_cache): Constify.
	* arm-tdep.c (arm_skip_stub): Constify.
	* ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
	(gen_aggregate_elt_ref): Constify.
	* bcache.c (print_bcache_statistics): Constify.
	* bcache.h (print_bcache_statistics): Constify.
	* break-catch-throw.c (catch_exception_command_1):
	* breakpoint.c (struct ep_type_description::description):
	Constify.
	(add_solib_catchpoint): Constify.
	(catch_fork_command_1): Add cast.
	(add_catch_command): Constify.
	* breakpoint.h (add_catch_command, add_solib_catchpoint):
	Constify.
	* bsd-uthread.c (bsd_uthread_state): Constify.
	* buildsym.c (patch_subfile_names): Constify.
	* buildsym.h (next_symbol_text_func, patch_subfile_names):
	Constify.
	* c-exp.y (yyerror): Constify.
	(token::oper): Constify.
	* c-lang.h (c_yyerror, cp_print_class_member): Constify.
	* c-varobj.c (cplus_describe_child): Constify.
	* charset.c (find_charset_names): Add cast.
	(find_charset_names): Constify array and add const_cast.
	* cli/cli-cmds.c (complete_command, cd_command): Constify.
	(edit_command): Constify.
	* cli/cli-decode.c (lookup_cmd): Constify.
	* cli/cli-dump.c (dump_memory_command, dump_value_command):
	Constify.
	(struct dump_context): Constify.
	(add_dump_command, restore_command): Constify.
	* cli/cli-script.c (get_command_line): Constify.
	* cli/cli-script.h (get_command_line): Constify.
	* cli/cli-utils.c (check_for_argument): Constify.
	* cli/cli-utils.h (check_for_argument): Constify.
	* coff-pe-read.c (struct read_pe_section_data): Constify.
	* command.h (lookup_cmd): Constify.
	* common/print-utils.c (decimal2str): Constify.
	* completer.c (gdb_print_filename): Constify.
	* corefile.c (set_gnutarget): Constify.
	* cp-name-parser.y (yyerror): Constify.
	* cp-valprint.c (cp_print_class_member): Constify.
	* cris-tdep.c (cris_register_name, crisv32_register_name):
	Constify.
	* d-exp.y (yyerror): Constify.
	(struct token::oper): Constify.
	* d-lang.h (d_yyerror): Constify.
	* dbxread.c (struct header_file_location::name): Constify.
	(add_old_header_file, add_new_header_file, last_function_name)
	(dbx_next_symbol_text, add_bincl_to_list)
	(find_corresponding_bincl_psymtab, set_namestring)
	(find_stab_function_addr, read_dbx_symtab, start_psymtab)
	(dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
	* defs.h (command_line_input, print_address_symbolic)
	(deprecated_readline_begin_hook): Constify.
	* dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
	Constify.
	* event-top.c (handle_line_of_input): Constify and add cast.
	* exceptions.c (catch_errors): Constify.
	* exceptions.h (catch_errors): Constify.
	* expprint.c (print_subexp_standard, op_string, op_name)
	(op_name_standard, dump_raw_expression, dump_raw_expression):
	* expression.h (op_name, op_string, dump_raw_expression):
	Constify.
	* f-exp.y (yyerror): Constify.
	(struct token::oper): Constify.
	(struct f77_boolean_val::name): Constify.
	* f-lang.c (f_word_break_characters): Constify.
	* f-lang.h (f_yyerror): Constify.
	* fork-child.c (fork_inferior): Add cast.
	* frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
	(new_variant): Constify.
	* gdbarch.sh (pstring_ptr, pstring_list): Constify.
	* gdbarch.c: Regenerate.
	* gdbcore.h (set_gnutarget): Constify.
	* go-exp.y (yyerror): Constify.
	(token::oper): Constify.
	* go-lang.h (go_yyerror): Constify.
	* go32-nat.c (go32_sysinfo): Constify.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
	* guile/scm-cmd.c (cmdscm_function): Constify.
	* guile/scm-param.c (pascm_param_value): Constify.
	* h8300-tdep.c (h8300_register_name, h8300s_register_name)
	(h8300sx_register_name): Constify.
	* hppa-tdep.c (hppa32_register_name, hppa64_register_name):
	Constify.
	* ia64-tdep.c (ia64_register_names): Constify.
	* infcmd.c (construct_inferior_arguments): Constify.
	(path_command, attach_post_wait): Constify.
	* language.c (show_range_command, show_case_command)
	(unk_lang_error): Constify.
	* language.h (language_defn::la_error)
	(language_defn::la_name_of_this): Constify.
	* linespec.c (decode_line_2): Constify.
	* linux-thread-db.c (thread_db_err_str): Constify.
	* lm32-tdep.c (lm32_register_name): Constify.
	* m2-exp.y (yyerror): Constify.
	* m2-lang.h (m2_yyerror): Constify.
	* m32r-tdep.c (m32r_register_names): Constify and make static.
	* m68hc11-tdep.c (m68hc11_register_names): Constify.
	* m88k-tdep.c (m88k_register_name): Constify.
	* macroexp.c (appendmem): Constify.
	* mdebugread.c (fdr_name, add_data_symbol, parse_type)
	(upgrade_type, parse_external, parse_partial_symbols)
	(mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
	(new_symbol): Constify.
	* memattr.c (mem_info_command): Constify.
	* mep-tdep.c (register_name_from_keyword): Constify.
	* mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
	Constify.
	* mi/mi-cmd-stack.c (list_args_or_locals): Constify.
	* mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
	* mi/mi-main.c (captured_mi_execute_command): Constify and add
	cast.
	(mi_execute_async_cli_command): Constify.
	* mips-tdep.c (mips_register_name): Constify.
	* mn10300-tdep.c (register_name, mn10300_generic_register_name)
	(am33_register_name, am33_2_register_name)
	* moxie-tdep.c (moxie_register_names): Constify.
	* nat/linux-osdata.c (osdata_type): Constify fields.
	* nto-tdep.c (nto_parse_redirection): Constify.
	* objc-lang.c (lookup_struct_typedef, lookup_objc_class)
	(lookup_child_selector): Constify.
	(objc_methcall::name): Constify.
	* objc-lang.h (lookup_objc_class, lookup_child_selector)
	(lookup_struct_typedef): Constify.
	* objfiles.c (pc_in_section): Constify.
	* objfiles.h (pc_in_section): Constify.
	* p-exp.y (struct token::oper): Constify.
	(yyerror): Constify.
	* p-lang.h (pascal_yyerror): Constify.
	* parser-defs.h (op_name_standard): Constify.
	(op_print::string): Constify.
	(exp_descriptor::op_name): Constify.
	* printcmd.c (print_address_symbolic): Constify.
	* psymtab.c (print_partial_symbols): Constify.
	* python/py-breakpoint.c (stop_func): Constify.
	(bppy_get_expression): Constify.
	* python/py-cmd.c (cmdpy_completer::name): Constify.
	(cmdpy_function): Constify.
	* python/py-event.c (evpy_add_attribute)
	(gdbpy_initialize_event_generic): Constify.
	* python/py-event.h (evpy_add_attribute)
	(gdbpy_initialize_event_generic): Constify.
	* python/py-evts.c (add_new_registry): Constify.
	* python/py-finishbreakpoint.c (outofscope_func): Constify.
	* python/py-framefilter.c (get_py_iter_from_func): Constify.
	* python/py-inferior.c (get_buffer): Add cast.
	* python/py-param.c (parm_constant::name): Constify.
	* python/py-unwind.c (fprint_frame_id): Constify.
	* python/python.c (gdbpy_parameter_value): Constify.
	* remote-fileio.c (remote_fio_func_map): Make 'name' const.
	* remote.c (memory_packet_config::name): Constify.
	(show_packet_config_cmd, remote_write_bytes)
	(remote_buffer_add_string):
	* reverse.c (exec_reverse_once): Constify.
	* rs6000-tdep.c (variant::name, variant::description): Constify.
	* rust-exp.y (rustyyerror): Constify.
	* rust-lang.c (rust_op_name): Constify.
	* rust-lang.h (rustyyerror): Constify.
	* serial.h (serial_ops::name): Constify.
	* sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
	(sh_sh3e_register_name, sh_sh2e_register_name)
	(sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
	(sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
	(sh_sh4_register_name, sh_sh4_nofpu_register_name)
	(sh_sh4al_dsp_register_name): Constify.
	* sh64-tdep.c (sh64_register_name): Constify.
	* solib-darwin.c (lookup_symbol_from_bfd): Constify.
	* spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
	* stabsread.c (patch_block_stabs, read_type_number)
	(ref_map::stabs, ref_add, process_reference)
	(symbol_reference_defined, define_symbol, define_symbol)
	(error_type, read_type, read_member_functions, read_cpp_abbrev)
	(read_one_struct_field, read_struct_fields, read_baseclasses)
	(read_tilde_fields, read_struct_type, read_array_type)
	(read_enum_type, read_sun_builtin_type, read_sun_floating_type)
	(read_huge_number, read_range_type, read_args, common_block_start)
	(find_name_end): Constify.
	* stabsread.h (common_block_start, define_symbol)
	(process_one_symbol, symbol_reference_defined, ref_add):
	* symfile.c (get_section_index, add_symbol_file_command):
	* symfile.h (get_section_index): Constify.
	* target-descriptions.c (tdesc_type::name): Constify.
	(tdesc_free_type): Add cast.
	* target.c (find_default_run_target):
	(add_deprecated_target_alias, find_default_run_target)
	(target_announce_detach): Constify.
	(do_option): Constify.
	* target.h (add_deprecated_target_alias): Constify.
	* thread.c (print_thread_info_1): Constify.
	* top.c (deprecated_readline_begin_hook, command_line_input):
	Constify.
	(init_main): Add casts.
	* top.h (handle_line_of_input): Constify.
	* tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
	* tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
	(tfind_command): Rename to ...
	(tfind_command_1): ... this and constify.
	(tfind_command): New function.
	(tfind_end_command, tfind_start_command): Adjust.
	(encode_source_string): Constify.
	* tracepoint.h (encode_source_string): Constify.
	* tui/tui-data.c (tui_partial_win_by_name): Constify.
	* tui/tui-data.h (tui_partial_win_by_name): Constify.
	* tui/tui-source.c (tui_set_source_content_nil): Constify.
	* tui/tui-source.h (tui_set_source_content_nil): Constify.
	* tui/tui-win.c (parse_scrolling_args): Constify.
	* tui/tui-windata.c (tui_erase_data_content): Constify.
	* tui/tui-windata.h (tui_erase_data_content): Constify.
	* tui/tui-winsource.c (tui_erase_source_content): Constify.
	* tui/tui.c (tui_enable): Add cast.
	* utils.c (defaulted_query): Constify.
	(init_page_info): Add cast.
	(puts_debug, subset_compare): Constify.
	* utils.h (subset_compare): Constify.
	* varobj.c (varobj_format_string): Constify.
	* varobj.h (varobj_format_string): Constify.
	* vax-tdep.c (vax_register_name): Constify.
	* windows-nat.c (windows_detach): Constify.
	* xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
	* xml-support.c (gdb_xml_end_element): Constify.
	* xml-tdesc.c (tdesc_start_reg): Constify.
	* xstormy16-tdep.c (xstormy16_register_name): Constify.
	* xtensa-tdep.c (xtensa_find_register_by_name): Constify.
	* xtensa-tdep.h (xtensa_register_t::name): Constify.

gdb/gdbserver/ChangeLog:
2017-04-05  Pedro Alves  <palves@redhat.com>

	* gdbreplay.c (sync_error): Constify.
	* linux-x86-low.c (push_opcode): Constify.
2017-04-05 19:21:37 +01:00
Tom Tromey 17a22718b1 Remove ensure_python_env
All of gdb has been converted away from ensure_python_env and
varobj_ensure_python_env now; so remove them.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* python/python.c (ensure_python_env, restore_python_env):
	Remove.
	* python/python-internal.h (ensure_python_env): Don't declare.
	* varobj.h (varobj_ensure_python_env): Don't declare.
	* varobj.c (varobj_ensure_python_env): Remove.
2017-01-10 19:13:57 -07:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Tom Tromey 9b9720149d Use unique_xmalloc_ptr in Python code
This changes some utility functions in the Python code to return
unique_xmalloc_ptr, and then fixes up the callers.

I chose unique_xmalloc_ptr rather than std::string because at a few
call points the xmalloc'd string is released and ownership transferred
elsewhere.

This patch found a few existing memory leaks.  For example,
py-unwind.c called gdbpy_obj_to_string but never freed the result.

Built and regression tested on the buildbot.

2016-11-09  Tom Tromey  <tom@tromey.com>

	* varobj.h (varobj_get_display_hint): Change return type.
	* varobj.c (varobj_get_display_hint): Return unique_xmalloc_ptr.
	(varobj_value_get_print_value): Update.
	* python/python.c (gdbpy_before_prompt_hook, gdbpy_print_stack)
	(gdbpy_apply_type_printers): Update.
	* python/python-internal.h (unicode_to_target_string)
	(python_string_to_target_string, python_string_to_host_string)
	(gdbpy_obj_to_string, gdbpy_exception_to_string)
	(gdbpy_get_display_hint): Change return types.
	* python/py-varobj.c (py_varobj_iter_next): Update.
	* python/py-value.c (valpy_getitem, convert_value_from_python):
	Update.
	* python/py-utils.c (unicode_to_encoded_string)
	(unicode_to_target_string, python_string_to_target_string)
	(python_string_to_host_string, gdbpy_obj_to_string)
	(gdbpy_exception_to_string): Return unique_xmalloc_ptr.
	* python/py-unwind.c (pyuw_parse_register_id): Update.
	* python/py-type.c (typy_getitem): Update.
	* python/py-prettyprint.c (gdbpy_get_display_hint)
	(print_stack_unless_memory_error, print_children)
	(gdbpy_apply_val_pretty_printer): Update.
	* python/py-param.c (set_parameter_value): Update.
	(get_doc_string, call_doc_function): Return unique_xmalloc_ptr.
	(get_set_value, get_show_value, compute_enum_values, parmpy_init):
	Update.
	* python/py-infthread.c (thpy_set_name): Update.
	* python/py-function.c (fnpy_call, fnpy_init): Update.
	* python/py-framefilter.c (extract_sym): Change "name" to
	unique_xmalloc_ptr.
	(enumerate_args, enumerate_locals): Update.
	(py_print_frame): Use unique_xmalloc_ptr.
	* python/py-frame.c (frapy_read_var): Update.  Remove cleanup.
	* python/py-cmd.c (cmdpy_function, cmdpy_completer, cmdpy_init):
	Update.
	* python/py-breakpoint.c (bppy_set_condition): Use
	unique_xmalloc_ptr.
	(bppy_init): Likewise.  Remove cleanup.
	(local_setattro): Update.
	* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_list_children)
	(varobj_update_one): Update.
2016-11-09 19:40:12 -07:00
Pedro Alves 2f408ecb92 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.
2016-11-08 15:26:47 +00:00
Tom Tromey 9c37b5aed9 Remove Java support
This patch removes the Java support from gdb.  gcj has not seen much
development or use for years now, and was recently removed from GCC.
This patch changes gdb to follow; in the unlikely event that there are
still users using gcj, they can continue to use an older gdb to debug.
Or, they can debug in C++ mode.

Built and regtested on x86-64 Fedora 24.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* MAINTAINERS: Remove Java test maintainer.
	* varobj.h (java_varobj_ops): Don't declare.
	* valprint.h (struct value_print_options)
	<pascal_static_field_print>: Update comment.
	* utils.c (producer_is_gcc): Remove java reference.
	* symtab.h (struct general_symbol_info): Remove java references.
	(SYMBOL_SEARCH_NAME): Likewise.
	* objfiles.c (allocate_objfile): Update comment.
	* linespec.c (find_linespec_symbols): Remove java references.
	* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_baseclass_offset): Remove
	java references.
	* gdbtypes.h (struct cplus_struct_type) <is_java>: Remove.
	(TYPE_CPLUS_REALLY_JAVA): Remove.
	* c-varobj.c (enum vsections): Update comment.
	* symtab.c (symbol_set_language, symbol_set_names)
	(symbol_natural_name, symbol_demangled_name)
	(demangle_for_lookup, symbol_matches_domain)
	(default_make_symbol_completion_list_break_on_1): Remove java
	references.
	(JAVA_PREFIX, JAVA_PREFIX_LEN): Remove.
	* psymtab.c (match_partial_symbol, psymtab_search_name)
	(lookup_partial_symbol): Remove java references.
	* dwarf2read.c (find_slot_in_mapped_hash): Remove java references.
	(add_partial_symbol, dwarf2_compute_name, dwarf2_physname)
	(dwarf2_add_member_fn, is_vtable_name, read_structure_type)
	(process_structure_scope, read_subroutine_type)
	(read_subrange_type, load_partial_dies)
	(new_symbol_full, determine_prefix, typename_concat)
	(dwarf2_name): Remove java references.
	(set_cu_language): Treat Java as C++.
	* c-typeprint.c (c_type_print_args): Remove java reference.
	* defs.h (enum language) <language_java>: Remove.
	* Makefile.in (SFILES, HFILES_NO_SRCDIR, COMMON_OBS, YYFILES)
	(YYOBJ, local-maintainer-clean): Don't mention java files.
	* jv-exp.y, jv-lang.c, jv-lang.h, jv-typeprint.c, jv-valprint.c,
	jv-varobj.c: Remove.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* guile.texi (Types In Guile): Remove Java mentions.
	* python.texi (Types In Python): Remove Java mentions.
	* gdb.texinfo (Address Locations, Supported Languages)
	(Index Section Format): Remove Java mentions.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* gdb.compile/compile.exp: Change java tests to rust.
	* gdb.base/setshow.exp: Change java tests to rust.
	* gdb.base/default.exp: Remove java from language list.
	* README (Examples): Update language example.
	* gdb.python/py-lookup-type.exp (test_lookup_type): Remove java
	test.
	* lib/gdb.exp (skip_java_tests): Remove.
	* lib/java.exp: Remove.
	* gdb.java: Remove.
2016-10-06 10:10:40 -06:00
Simon Marchi 30914ca8c0 varobj: Cleanup dead code
This patch removes some dead code.

I noticed that varobj_delete was always called with dellist == NULL, so
I started removing that parameter.  That allows removing a good chunk of
the code in varobj_delete, making it almost trivial.  We can also remove
the resultp parameters in that whole trail.  In turn, this shows that
struct cpstack, cppush and cppop were only used fo that mechanism, so
they can be removed as well.

I also moved the function comment to the header file to comply with
today's guideline, even though the rest of the file does not respect it
(yet).

gdb/ChangeLog:

	* varobj.h (varobj_delete): Remove dellist parameter, update and
	move documentation here.
	* varobj.c (struct cpstack, cppush, cppop): Remove.
	(delete_variable): Remove resultp (first) parameter.
	(delete_variable_1): Likewise.
	(varobj_delete): Remove dellist parameter and unused code.
	(update_dynamic_varobj_children): Adjust varobj_delete call.
	(update_type_if_necessary): Likewise.
	(varobj_set_visualizer): Likewise.
	(varobj_update): Likewise.
	(value_of_root): Likewise.
	(varobj_invalidate_iter): Likewise.
	* mi/mi-cmd-var.c (mi_cmd_var_delete): Likewise.
2016-02-07 09:45:02 -05:00
Simon Marchi 5fa1307022 Fix some comments in varobj.{c,h}
A few typos.  The comment about varobj_create has been misplaced since
the dawn of time.

gdb/ChangeLog:

	* varobj.h (struct varobj): Fix typos in comments.
	(struct lang_varobj_ops): Likewise.
	* varobj.c (VAROBJ_TABLE_SIZE): Likewise.
	(varobj_create): Move misplaced comment.
2016-01-31 22:24:17 -05:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Luis Machado 1c35a88f1d varobj zero-padded hexadecimal format
This set of patches add support for the zero-padded hexadecimal format for
varobj's, defined as "zero-hexadecimal".  We currently only support regular
non-zero-padded hexadecimal.

Talking with IDE developers, they would like to have this option that is
already available to GDB's print/x commands, in the CLI, as 'z'.

gdb/ChangeLog:

2015-12-09  Luis Machado  <lgustavo@codesourcery.com>

	* gdb/mi/mi-cmd-var.c (mi_parse_format): Handle new "zero-hexadecimal"
	format.
	* gdb/varobj.c (varobj_format_string): Add "zero-hexadecimal" entry.
	(format_code): Add 'z' entry.
	(varobj_set_display_format): Handle FORMAT_ZHEXADECIMAL.
	* gdb/varobj.h (varobj_display_formats) <FORMAT_ZHEXADECIMAL>: New enum
	field.
	* NEWS: Add new note to MI changes citing the new zero-hexadecimal
	format for -var-set-format.

gdb/doc/ChangeLog:

2015-12-09  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.texinfo (GDB/MI Variable Objects): Update text to mention
	-var-set-format's new zero-hexadecimal format.

gdb/testsuite/ChangeLog:

2015-12-09  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.mi/mi-var-display.exp: Add new checks for the zero-hexadecimal
	  format and change test names to make them unique.
2015-12-09 11:00:47 -02:00
Pedro Alves fe978cb071 C++ keyword cleanliness, mostly auto-generated
This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
2015-02-27 16:33:07 +00:00
Simon Marchi c1cc615262 Finish constification of varobj interface
This completes the constification of the struct varobj pointers in the
lang_varobj_ops interface partially done in
b09e2c591f. As suggested by Pedro,
varobj_get_path_expr casts away the const to assign the "mutable" struct
member.

gdb/ChangeLog:

	* ada-varobj.c (ada_name_of_child): Constify parent.
	(ada_path_expr_of_child): Same.
	(ada_value_of_child): Same.
	(ada_type_of_child): Same.
	* c-varobj.c (c_is_path_expr_parent): Same.
	(c_describe_child): Same.
	(c_name_of_child): Same.
	(c_value_of_child): Same.
	(c_type_of_child): Same.
	(cplus_number_of_children): Same.
	(cplus_describe_child): Constify var.
	(cplus_name_of_child): Constify parent.
	(cplus_value_of_child): Same.
	(cplus_type_of_child): Same.
	* jv-varobj.c (java_name_of_child): Same.
	(java_value_of_child): Same.
	(java_type_of_child): Same.
	* varobj.c (value_of_child): Same.
	(varobj_default_is_path_expr_parent): Constify var, parent and return
	value.
	(varobj_get_path_expr): Constify var, modify path_expr through
	mutable_var.
	(install_new_value): Constify parent.
	(value_of_child): Constify parent.
	* varobj.h (struct varobj): Constify parent.
	(struct lang_varobj_ops): Constify name_of_child, value_of_child and
	type_of_child.
	(varobj_get_path_expr): Constify var.
	(varobj_get_path_expr_parent): Constify var and return value.
2015-02-10 12:57:47 -05:00
Simon Marchi aa3de2670f Mention which return values need to be freed in lang_varobj_ops
This is the result of a little bit of investigation of the C and Ada
languages, as well as some common sense.

gdb/ChangeLog:

	* varobj.h (lang_varobj_ops): Mention which return values need
	to be freed.
2015-02-02 13:17:19 -05:00
Simon Marchi b09e2c591f Constify some parameters in the varobj code
To make it clear that some functions should not modify the variable
object, this patch adds the const qualifier where it makes sense to some
struct varobj * parameters. Most getters should take a const pointer to
guarantee they don't modify the object.

Unfortunately, I couldn't add it to some callbacks (such as name_of_child).
In the C implementation, they call c_describe_child, which calls
varobj_get_path_expr. varobj_get_path_expr needs to modify the object in
order to cache the computed value. It therefore can't take a const
pointer, and it affects the whole call chain. I suppose that's where you
would use a "mutable" in C++.

I did that to make sure there was no other cases like the one fixed in
the previous patch. I don't think it can hurt.

gdb/ChangeLog:

	* ada-varobj.c (ada_number_of_children): Constify struct varobj *
	parameter.
	(ada_name_of_variable): Same.
	(ada_path_expr_of_child): Same.
	(ada_value_of_variable): Same.
	(ada_value_is_changeable_p): Same.
	(ada_value_has_mutated): Same.
	* c-varobj.c (varobj_is_anonymous_child): Same.
	(c_is_path_expr_parent): Same.
	(c_number_of_children): Same.
	(c_name_of_variable): Same.
	(c_path_expr_of_child): Same.
	(get_type): Same.
	(c_value_of_variable): Same.
	(cplus_number_of_children): Same.
	(cplus_name_of_variable): Same.
	(cplus_path_expr_of_child): Same.
	(cplus_value_of_variable): Same.
	* jv-varobj.c (java_number_of_children): Same.
	(java_name_of_variable): Same.
	(java_path_expr_of_child): Same.
	(java_value_of_variable): Same.
	* varobj.c (number_of_children): Same.
	(name_of_variable): Same.
	(is_root_p): Same.
	(varobj_ensure_python_env): Same.
	(varobj_get_objname): Same.
	(varobj_get_expression): Same.
	(varobj_get_display_format): Same.
	(varobj_get_display_hint): Same.
	(varobj_has_more): Same.
	(varobj_get_thread_id): Same.
	(varobj_get_frozen): Same.
	(dynamic_varobj_has_child_method): Same.
	(varobj_get_gdb_type): Same.
	(is_path_expr_parent): Same.
	(varobj_default_is_path_expr_parent): Same.
	(varobj_get_language): Same.
	(varobj_get_attributes): Same.
	(varobj_is_dynamic_p): Same.
	(varobj_get_child_range): Same.
	(varobj_value_has_mutated): Same.
	(varobj_get_value_type): Same.
	(number_of_children): Same.
	(name_of_variable): Same.
	(check_scope): Same.
	(varobj_editable_p): Same.
	(varobj_value_is_changeable_p): Same.
	(varobj_floating_p): Same.
	(varobj_default_value_is_changeable_p): Same.
	* varobj.h (struct lang_varobj_ops): Consitfy some struct varobj *
	parameters.
	(varobj_get_objname): Constify struct varobj * parameter.
	(varobj_get_expression): Same.
	(varobj_get_thread_id): Same.
	(varobj_get_frozen): Same.
	(varobj_get_child_range): Same.
	(varobj_get_display_hint): Same.
	(varobj_get_gdb_type): Same.
	(varobj_get_language): Same.
	(varobj_get_attributes): Same.
	(varobj_editable_p): Same.
	(varobj_floating_p): Same.
	(varobj_has_more): Same.
	(varobj_is_dynamic_p): Same.
	(varobj_ensure_python_env): Same.
	(varobj_default_value_is_changeable_p): Same.
	(varobj_value_is_changeable_p): Same.
	(varobj_get_value_type): Same.
	(varobj_is_anonymous_child): Same.
	(varobj_value_get_print_value): Same.
	(varobj_default_is_path_expr_parent): Same.
2015-01-30 15:07:15 -05:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Andrew Burgess 9a9a760829 Improve MI -var-info-path-expression for nested struct/union case.
https://sourceware.org/ml/gdb-patches/2014-05/msg00383.html

The MI command -var-info-path-expression currently does not handle
non-anonymous structs / unions nested within other structs / unions,
it will skip parts of the expression.  Consider this example:

  ## START EXAMPLE ##
  $ cat ex.c
  #include <string.h>

  int
  main ()
  {
    struct s1
    {
      int a;
    };

    struct ss
    {
      struct s1 x;
    };

    struct ss an_ss;
    memset (&an_ss, 0, sizeof (an_ss));
    return 0;
  }
  $ gcc -g -o ex.x ex.c
  $ gdb ex.x
  (gdb) break 18
  Breakpoint 1 at 0x80483ba: file ex.c, line 18.
  (gdb) run
  Starting program: /home/user/ex.x

  Breakpoint 1, main () at ex.c:18
  18	  return 0;
  (gdb) interpreter-exec mi "-var-create an_ss * an_ss"
  (gdb) interpreter-exec mi "-var-list-children an_ss"
  ^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0"
  (gdb) interpreter-exec mi "-var-list-children an_ss.x"
  ^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0"
  (gdb) interpreter-exec mi "-var-list-children an_ss.x.a"
  ^done,numchild="0",has_more="0"
  (gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a"
  ^done,path_expr="(an_ss).a"
  (gdb) print (an_ss).a
  There is no member named a.
  ## END EXAMPLE ##

Notice that the path expression returned is wrong, and as a result
the print command fails.

This patch adds a new method to the varobj_ops structure called
is_path_expr_parent, to allow language specific control over finding
the parent varobj, the current logic becomes the C/C++ version and is
extended to handle the nested cases.  No other language currently uses
this code, so all other languages just get a default method.

With this patch, the above example now finishes like this:

  ## START EXAMPLE ##
  $ gdb ex.x
  (gdb) break 18
  Breakpoint 1 at 0x80483ba: file ex.c, line 18.
  (gdb) run
  Starting program: /home/user/ex.x

  Breakpoint 1, main () at ex.c:18
  18	  return 0;
  (gdb) interpreter-exec mi "-var-list-children an_ss"
  ^done,numchild="1",children=[child={name="an_ss.x",exp="x",numchild="1",type="struct s1",thread-id="1"}],has_more="0"
  (gdb) interpreter-exec mi "-var-list-children an_ss.x"
  ^done,numchild="1",children=[child={name="an_ss.x.a",exp="a",numchild="0",type="int",thread-id="1"}],has_more="0"
  (gdb) interpreter-exec mi "-var-list-children an_ss.x.a"
  ^done,numchild="0",has_more="0"
  (gdb) interpreter-exec mi "-var-info-path-expression an_ss.x.a"
  ^done,path_expr="((an_ss).x).a"
  (gdb) print ((an_ss).x).a
  $1 = 0
  ## END EXAMPLE ##

Notice that the path expression is now correct, and the print is a
success.

gdb/ChangeLog:

	* ada-varobj.c (ada_varobj_ops): Fill in is_path_expr_parent
	field.
	* c-varobj.c (c_is_path_expr_parent): New function, moved core
	from varobj.c, with additional checks.
	(c_varobj_ops): Fill in is_path_expr_parent field.
	(cplus_varobj_ops): Fill in is_path_expr_parent field.
	* jv-varobj.c (java_varobj_ops): Fill in is_path_expr_parent
	field.
	* varobj.c (is_path_expr_parent): Call is_path_expr_parent varobj
	ops method.
	(varobj_default_is_path_expr_parent): New function.
	* varobj.h (lang_varobj_ops): Add is_path_expr_parent field.
	(varobj_default_is_path_expr_parent): Declare new function.

gdb/testsuite/ChangeLog:

	* gdb.mi/var-cmd.c (do_nested_struct_union_tests): New function
	setting up test structures.
	(main): Call new test function.
	* gdb.mi/mi2-var-child.exp: Create additional breakpoint in new
	test function, continue into test function and walk test
	structures.
2014-07-09 14:47:47 +01:00
Yao Qi cde5ef40f8 Rename varobj_pretty_printed_p to varobj_is_dynamic_p
We think varobj with --available-children-only behaves like a dynamic
varobj, so dyanmic varobj is not pretty-printer specific.  We rename
varobj_pretty_printed_p to varobj_is_dynamic_p, so that we can handle
available-children-only checking in varobj_is_dynamic_p in the next
patch.

gdb:

2014-06-12  Yao Qi  <yao@codesourcery.com>

	* varobj.c (varobj_pretty_printed_p): Rename to ...
	(varobj_is_dynamic_p): ... this.  New function.
	* varobj.h (varobj_pretty_printed_p): Remove declaration.
	(varobj_is_dynamic_p): Declare.
	* mi/mi-cmd-var.c (print_varobj): All callers updated.
	(mi_print_value_p, varobj_update_one): Likewise.
2014-06-12 15:27:31 +08:00
Yao Qi e525021603 Generalize varobj iterator
This patch generalizes varobj iterator, in a python-independent way.
Note varobj_item is still a typedef of PyObject, we can only focus on
API changes, and leave the data type changes to the next patch.  As a
result, we include "varobj-iter.h" after the typedef of PyObject in
varobj.c, but it is an intermediate state.  Finally, varobj-iter.h is
independent of PyObject.

This change is helpful to move some python-related code out of
varobj.c.

 V2:
  - Fix a missing cleanup.
  - Fix typos.
  - Use XNEW.
  - Check against NULL explicitly.
  - Update copyright year for new added files.

 V3:
  - Call PyGILState_Ensure before Py_XDECREF.
  - Use CPYCHECKER_STEALS_REFERENCE_TO_ARG.
  - Code indentation.

 V4:
  - use varobj_ensure_python_env instead of PyGILState_Ensure.

gdb:

2014-06-12  Pedro Alves  <pedro@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* Makefile.in (SUBDIR_PYTHON_OBS): Add "py-varobj.o".
	(SUBDIR_PYTHON_SRCS): Add "python/py-varobj.c".
	(HFILES_NO_SRCDIR): Add "varobj-iter.h".
	(py-varobj.o): New rule.
	* python/py-varobj.c: New file.
	* python/python-internal.h (py_varobj_get_iterator): Declare.
	* varobj-iter.h: New file.
	* varobj.c: Include "varobj-iter.h"
	(struct varobj) <child_iter>: Change its type from "PyObject *"
	to "struct varobj_iter *".
	<saved_item>: Likewise.
	[HAVE_PYTHON] (varobj_ensure_python_env): Make it extern.
	[HAVE_PYTHON] (varobj_get_iterator): New function.
	(update_dynamic_varobj_children) [HAVE_PYTHON]: Move
	python-specific code to python/py-varobj.c.
	(install_visualizer): Call varobj_iter_delete instead of
	Py_XDECREF.
	* varobj.h (varobj_ensure_python_env): Declare.
2014-06-12 15:27:15 +08:00
Tom Tromey 8838afaf75 mark *_varobj_ops as "extern"
The AIX linker pointed out that gdb had multiple definitions of the
various *_varobj_ops objects.  This patch fixes the problem by marking
the declarations as "extern" in varobj.h.  Tested by rebuilding on
x86-64 Fedora 18 and on AIX.

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

	* varobj.h (c_varobj_ops, cplus_varobj_ops, java_varobj_ops)
	(ada_varobj_ops): Mark "extern".
2014-02-20 14:12:33 -07:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Yao Qi fa4d0c4081 Remove varobj_language_string, languages and varobj_languages
This patch does some cleanups, removing some language-related stuff.
Note that mi_cmd_var_info_expression uses varobj_language_string,
which is redundant, because we can get language name from
lang->la_natural_name.

varobj_language_string doesn't have "Ada", which looks like a bug to
me.  With this patch applied, this problem doesn't exist, because the
language name is got from the same place (field la_natural_name).

gdb:

2013-11-07  Yao Qi  <yao@codesourcery.com>

	* mi/mi-cmd-var.c: Include "language.h".
	(mi_cmd_var_info_expression): Get language name from
	language_defn.
	* varobj.c (varobj_language_string): Remove.
	(variable_language): Remove declaration.
	(languages): Remove.
	(varobj_get_language): Change the type of return value.
	(variable_language): Remove.
	* varobj.h (enum varobj_languages): Remove.
	(varobj_language_string): Remove declaration.
	(varobj_get_language): Update declaration.

gdb/doc:

2013-11-07  Yao Qi  <yao@codesourcery.com>

	* gdb.texinfo (GDB/MI Variable Objects): Update doc about the
	output of "-var-info-expression".
2013-11-07 15:10:50 +08:00
Yao Qi a53b64eaa0 New field la_varobj_ops in struct language_defn
This is a follow-up series to move language stuff out of varobj.c.

This patch adds a new field la_varobj_ops in struct language_defn so
that each language has varobj-related options.  Not every language
supports varobj, and the operations are identical to operations of c
languages.

'struct language_defn' is the ideal place to save all language-related
operations.  After this patch, some cleanups can be done in patch 2/2,
which removes language-related stuff completely from varobj.c.

Regression tested on x86_64-linux.

gdb:

2013-10-25  Yao Qi  <yao@codesourcery.com>

	* language.h (struct lang_varobj_ops): Declare.
	(struct language_defn) <la_varobj_ops>: New field.
	* ada-lang.c: Include "varobj.h"
	(defn ada_language_defn): Initialize field 'la_varobj_ops' by
	ada_varobj_ops.
	* c-lang.c: Include "varobj.h"
	(c_language_defn): Initialize field 'la_varobj_ops' by
	c_varobj_ops.
	(cplus_language_defn): Initialize field 'la_varobj_ops' by
	cplus_varobj_ops.
	(asm_language_defn): Initialize field 'la_varobj_ops' by
	default_varobj_ops.
	(minimal_language_defn): Likewise.
	* d-lang.c (d_language_defn): Likewise.
	* f-lang.c (f_language_defn): Likewise.
	* go-lang.c (go_language_defn): Likewise.
	* m2-lang.c (m2_language_defn): Likewise.
	* objc-lang.c (objc_language_defn): Likewise.
	* opencl-lang.c (opencl_language_defn): Likewise.
	* p-lang.c (pascal_language_defn): Likewise.
	* language.c (unknown_language_defn): Likewise.
	(auto_language_defn): Likewise.
	(local_language_defn): Likewise.
	* jv-lang.c (java_language_defn): Initialize field
	'la_varobj_ops' by java_varobj_ops.
	* varobj.c (varobj_create): Update.
	* varobj.h (default_varobj_ops): Define macro.
2013-10-25 14:03:02 +00:00
Joel Brobecker 6ba1f11550 Minor coding style fixes in varobj.h
No actual code change, just a minor style fix.

gdb/ChangeLog:

        * varobj.h (struct lang_varobj_ops): Remove spaces between '*'
        and parameter name.
2013-10-25 14:03:00 +00:00
Yao Qi 99ad94278d gdb/
* Makefile.in (SFILES): Add c-varobj.c and jv-varobj.c.
	(COMMON_OBS): Add c-varobj.o and jv-varobj.o.
	* ada-varobj.c: Include "varobj.h".
	(ada_number_of_children): New.  Moved from varobj.c.
	(ada_name_of_variable, ada_name_of_child): Likewise.
	(ada_path_expr_of_child, ada_value_of_child): Likewise.
	(ada_type_of_child, ada_value_of_variable): Likewise.
	(ada_value_is_changeable_p, ada_value_has_mutated): Likewise.
	(ada_varobj_ops): New.
	* c-varobj.c, jv-varobj.c: New file.  Moved from varobj.c.
	* gdbtypes.c (get_target_type): New.  Moved from varobj.c.
	* gdbtypes.h (get_target_type): Declare.
	* varobj.c: Remove the inclusion of "ada-varobj.h" and
	"ada-lang.h".
	(ANONYMOUS_STRUCT_NAME): Move it to c-varobj.c.
	(ANONYMOUS_UNION_NAME): Likewise.
	(get_type, get_value_type, get_target_type): Remove declarations.
	(value_get_print_value, varobj_value_get_print_value): Likewise.
	(c_number_of_children, c_name_of_variable): Likewise.
	(c_name_of_child, c_path_expr_of_child): Likewise.
	(c_value_of_child, c_type_of_child): Likewise.
	(c_value_of_variable, cplus_number_of_children): Likewise.
	(cplus_class_num_children, cplus_name_of_variable): Likewise.
	(cplus_name_of_child, cplus_path_expr_of_child): Likewise.
	(cplus_value_of_child, cplus_type_of_child): Likewise.
	(cplus_value_of_variable, java_number_of_children): Likewise.
	(java_name_of_variable, java_name_of_child): Likewise.
	(java_path_expr_of_child, java_value_of_child): Likewise.
	(java_type_of_child, java_value_of_variable): Likewise.
	(ada_number_of_children, ada_name_of_variable): Likewise.
	(ada_name_of_child, ada_path_expr_of_child): Likewise.
	(ada_value_of_child, ada_type_of_child): Likewise.
	(ada_value_of_variable, ada_value_is_changeable_p): Likewise.
	(ada_value_has_mutated): Likewise.
	(struct language_specific): Move it to varobj.h.
	(CPLUS_FAKE_CHILD): Move it to varobj.h.
	(restrict_range): Rename it varobj_restrict_range.  Make it extern.
	Callers update.
	(get_path_expr_parent): Rename it to varobj_get_path_expr_parent.
	Make it extern.
	(is_anonymous_child): Move it to c-varobj.c and rename to
	varobj_is_anonymous_child.  Caller update.
	(get_type): Move it to c-varobj.c.
	(get_value_type): Rename it varobj_get_value_type.  Make it
	extern.
	(get_target_type): Move it gdbtypes.c.
	(varobj_formatted_print_options): New function.
	(value_get_print_value): Rename it to
	varobj_value_get_print_value and make it extern.
	(varobj_value_is_changeable_p): Make it extern.
	(adjust_value_for_child_access): Move it to c-varobj.c.
	(default_value_is_changeable_p): Rename it to
	varobj_default_value_is_changeable_p.  Make it extern.
	(c_number_of_children, c_name_of_variable): Move it to c-varobj.c
	(c_name_of_child, c_path_expr_of_child): Likewise.
	(c_value_of_child, c_type_of_child): Likewise.
	(c_value_of_variable, cplus_number_of_children): Likewise.
	(cplus_class_num_children, cplus_name_of_variable): Likewise.
	(cplus_name_of_child, cplus_path_expr_of_child): Likewise.
	(cplus_value_of_child, cplus_type_of_child): Likewise.
	(cplus_value_of_variable): Likewise.
	(java_number_of_children, java_name_of_variable): Move it to jv-varobj.c.
	(java_name_of_child, java_path_expr_of_child): Likewise.
	(java_value_of_child, java_type_of_child): Likewise.
	(java_value_of_variable): Likewise.
	(ada_number_of_children, ada_name_of_variable): Move it to ada-varobj.c.
	(ada_name_of_child, ada_path_expr_of_child): Likewise.
	(ada_value_of_child, ada_type_of_child): Likewise.
	(ada_value_of_variable, ada_value_is_changeable_p): Likewise.
	(ada_value_has_mutated): Likewise.
	* varobj.h (CPLUS_FAKE_CHILD): New macro, moved from varobj.c.
	(struct lang_varobj_ops): New.  Renamed by 'struct language_specific'.
	(c_varobj_ops, cplus_varobj_ops): Declare.
	(java_varobj_ops, ada_varobj_ops): Declare.
	(varobj_default_value_is_changeable_p): Declare.
	(varobj_value_is_changeable_p): Declare.
	(varobj_get_value_type, varobj_is_anonymous_child): Declare.
	(varobj_get_path_expr_parent): Declare.
	(varobj_value_get_print_value): Declare.
	(varobj_formatted_print_options): Declare.
	(varobj_restrict_range): Declare.
2013-10-17 13:28:37 +00:00
Yao Qi bb5ce47a22 gdb/
* varobj.c (struct varobj): Move most of the fields to
	varobj.h.
	(struct varobj_dynamic): New struct.
	(varobj_get_display_hint) [HAVE_PYTHON]: Adjust.
	(varobj_has_more): Likewise.
	(dynamic_varobj_has_child_method): Likewise.
	(update_dynamic_varobj_children): Likewise.
	(varobj_get_num_children): Likewise.
	(varobj_list_children, varobj_pretty_printed_p): Likewise.
	(install_new_value_visualizer): Likewise.
	(install_new_value_visualizer, install_new_value): Likewise.
	(varobj_update, new_variable, free_variable): Likewise.
	(my_value_of_variable, value_get_print_value): Likewise.
	(install_visualizer): Change the type of parameter 'var' to
	'struct varobjd_dynamic *'.  Callers update.
	* varobj.h (struct varobj): Moved from varobj.c.
	(struct varobj) <dynamic>: New field.
2013-10-14 08:16:45 +00:00
Yao Qi 1cc47d81c9 gdb/
* varobj.h: Add comments to enum varobj_languages.
2013-10-06 03:28:57 +00:00
Yao Qi c573f27374 gdb/
* varobj.c (varobj_format_string): Remove "unknown".
	(languages): Remove the first element.
	* varobj.h (enum varobj_languages): Remove vlang_c.
2013-10-01 13:40:27 +00:00
Joel Brobecker 8acc9f485b Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:41:43 +00:00
Joel Brobecker c5a5708100 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:28:28 +00:00
Jean-Charles Delay 40591b7d64 gdb/
* varobj.h (varobj_languages): Add vlang_ada definition to the list
	of supported languages.
	* varobj.c: Add top definitions and basic implementation of the
	following callbacks: ada_number_of_children, ada_name_of_variable,
	ada_name_of_child, ada_path_expr_of_child, ada_value_of_root,
	ada_value_of_child, ada_type_of_child, ada_value_of_variable.
	(languages): Register Ada-specific callbacks.
	(variable_language): Add the Ada case in the language setter switch.
2011-07-18 09:21:43 +00:00
Pierre Muller 2021ad3a8c Fix ARI warning about function names in first column.
Put prototype declaration on same line as return type.
	* objc-exp.y: Ditto.
	* p-exp.y: Ditto.
	* python/py-stopevent.h: Ditto.
	For long function names, split parameters to allow function name
	on same line as return type.
	* solib-pa64.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	For long function declaration, use single line.
	* hppa-tdep.h: Ditto.
	* inferior.h: Ditto.
2011-03-14 16:55:04 +00:00
Michael Snyder 581e13c188 2011-01-11 Michael Snyder <msnyder@vmware.com>
* ui-file.c: Comment cleanup, mostly periods and spaces.
	* ui-file.h: Ditto.
	* ui-out.c: Ditto.
	* ui-out.h: Ditto.
	* utils.c: Ditto.
	* v850-tdep.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* value.h: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vax-tdep.c: Ditto.
	* vec.c: Ditto.
	* vec.h: Ditto.
	* version.h: Ditto.
	* windows-nat.c: Ditto.
	* windows-tdep.c: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xml-support.c: Ditto.
	* xstormy16-tdep.c: Ditto.
	* xtensa-tdep.c: Ditto.
	* xtensa-tdep.h: Ditto.
2011-01-12 01:23:29 +00:00
Michael Snyder 3e43a32aaa 2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns.
	* arch-utils.c: Ditto.
	* arch-utils.h: Ditto.
	* ax-gdb.c: Ditto.
	* ax-general.c: Ditto.
	* bcache.c: Ditto.
	* blockframe.c: Ditto.
	* breakpoint.c: Ditto.
	* buildsym.c: Ditto.
	* c-lang.c: Ditto.
	* c-typeprint.c: Ditto.
	* charset.c: Ditto.
	* coffread.c: Ditto.
	* command.h: Ditto.
	* corelow.c: Ditto.
	* cp-abi.c: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* dbug-rom.c: Ditto.
	* dbxread.c: Ditto.
	* defs.h: Ditto.
	* dfp.c: Ditto.
	* dfp.h: Ditto.
	* dictionary.c: Ditto.
	* disasm.c: Ditto.
	* doublest.c: Ditto.
	* dwarf2-frame.c: Ditto.
	* dwarf2expr.c: Ditto.
	* dwarf2loc.c: Ditto.
	* dwarf2read.c: Ditto.
	* elfread.c: Ditto.
	* eval.c: Ditto.
	* event-loop.c: Ditto.
	* event-loop.h: Ditto.
	* exceptions.h: Ditto.
	* exec.c: Ditto.
	* expprint.c: Ditto.
	* expression.h: Ditto.
	* f-lang.c: Ditto.
	* f-valprint.c: Ditto.
	* findcmd.c: Ditto.
	* frame-base.c: Ditto.
	* frame-unwind.c: Ditto.
	* frame-unwind.h: Ditto.
	* frame.c: Ditto.
	* frame.h: Ditto.
	* gcore.c: Ditto.
	* gdb-stabs.h: Ditto.
	* gdb_assert.h: Ditto.
	* gdb_dirent.h: Ditto.
	* gdb_obstack.h: Ditto.
	* gdbcore.h: Ditto.
	* gdbtypes.c: Ditto.
	* gdbtypes.h: Ditto.
	* inf-ttrace.c: Ditto.
	* infcall.c: Ditto.
	* infcmd.c: Ditto.
	* inflow.c: Ditto.
	* infrun.c: Ditto.
	* inline-frame.h: Ditto.
	* language.c: Ditto.
	* language.h: Ditto.
	* libunwind-frame.c: Ditto.
	* libunwind-frame.h: Ditto.
	* linespec.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-nat.h: Ditto.
	* linux-thread-db.c: Ditto.
	* machoread.c: Ditto.
	* macroexp.c: Ditto.
	* macrotab.c: Ditto.
	* main.c: Ditto.
	* maint.c: Ditto.
	* mdebugread.c: Ditto.
	* memattr.c: Ditto.
	* minsyms.c: Ditto.
	* monitor.c: Ditto.
	* monitor.h: Ditto.
	* objfiles.c: Ditto.
	* objfiles.h: Ditto.
	* osabi.c: Ditto.
	* p-typeprint.c: Ditto.
	* p-valprint.c: Ditto.
	* parse.c: Ditto.
	* printcmd.c: Ditto.
	* proc-events.c: Ditto.
	* procfs.c: Ditto.
	* progspace.c: Ditto.
	* progspace.h: Ditto.
	* psympriv.h: Ditto.
	* psymtab.c: Ditto.
	* record.c: Ditto.
	* regcache.c: Ditto.
	* regcache.h: Ditto.
	* remote-fileio.c: Ditto.
	* remote.c: Ditto.
	* ser-mingw.c: Ditto.
	* ser-tcp.c: Ditto.
	* ser-unix.c: Ditto.
	* serial.c: Ditto.
	* serial.h: Ditto.
	* solib-frv.c: Ditto.
	* solib-irix.c: Ditto.
	* solib-osf.c: Ditto.
	* solib-pa64.c: Ditto.
	* solib-som.c: Ditto.
	* solib-sunos.c: Ditto.
	* solib-svr4.c: Ditto.
	* solib-target.c: Ditto.
	* solib.c: Ditto.
	* somread.c: Ditto.
	* source.c: Ditto.
	* stabsread.c: Ditto.
	* stabsread.c: Ditto.
	* stack.c: Ditto.
	* stack.h: Ditto.
	* symfile-mem.c: Ditto.
	* symfile.c: Ditto.
	* symfile.h: Ditto.
	* symmisc.c: Ditto.
	* symtab.c: Ditto.
	* symtab.h: Ditto.
	* target-descriptions.c: Ditto.
	* target-memory.c: Ditto.
	* target.c: Ditto.
	* target.h: Ditto.
	* terminal.h: Ditto.
	* thread.c: Ditto.
	* top.c: Ditto.
	* tracepoint.c: Ditto.
	* tracepoint.h: Ditto.
	* ui-file.c: Ditto.
	* ui-file.h: Ditto.
	* ui-out.h: Ditto.
	* user-regs.c: Ditto.
	* user-regs.h: Ditto.
	* utils.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vec.h: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xcoffsolib.h: Ditto.
	* xml-syscall.c: Ditto.
	* xml-tdesc.c: Ditto.
2011-01-05 22:22:53 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Tom Tromey 0cc7d26fe4 gdb
* varobj.h (varobj_update_result_t) <new>: New field.
	(varobj_get_child_range, varobj_set_child_range): Declare.
	(varobj_list_children): Update.
	(varobj_enable_pretty_printing, varobj_has_more)
	(varobj_pretty_printed_p): Declare.
	* varobj.c (pretty_printing): New global.
	(varobj_enable_pretty_printing): New function.
	(struct varobj_root) <from, to, constructor, child_iter,
	saved_item>: New fields.
	(varobj_create): Don't call install_default_visualizer.
	(instantiate_pretty_printer): Don't use value_copy.
	(varobj_has_more): New function.
	(restrict_range): New function.
	(install_dynamic_child): Likewise.
	(dynamic_varobj_has_child_method): Likewise.
	(update_dynamic_varobj_children): Remove 'new_and_unchanged'
	argument; add 'new', 'unchanged', 'from', and 'to' arguments.
	Rewrite.
	(varobj_get_num_children): Call update_dynamic_varobj_children.
	(varobj_list_children): Add 'from' and 'to' arguments.  Ignore
	result of update_dynamic_varobj_children.  Don't call
	install_default_visualizer.  Restrict result range.
	(varobj_add_child): Don't call install_default_visualizer.
	(varobj_pretty_printed_p): New function.
	(install_visualizer): Rewrite.  Move earlier in file.
	(install_default_visualizer): Likewise.
	(construct_visualizer): New function.
	(install_new_value_visualizer): Likewise.
	(install_new_value): Don't call release_value.  Special case
	pretty-printed objects.  Use value_incref.  Rearrange "changed"
	logic.
	(varobj_get_child_range): New function.
	(varobj_set_child_range): Likewise.
	(varobj_set_visualizer): Rewrite.
	(varobj_update): Rewrite pretty-printing logic.
	(new_variable): Initialize new fields.
	(free_variable): Destroy new fields.
	(value_of_root): Copy 'from' and 'to'.
	(my_value_of_variable): Handle pretty-printers.
	(value_get_print_value): Rework pretty-printing logic.
	(cplus_describe_child): Don't use release_value.
	* mi/mi-cmds.h (mi_cmd_enable_pretty_printing)
	(mi_cmd_var_set_update_range): Declare.
	* mi/mi-cmds.c (mi_cmds): Add enable-pretty-printing and
	var-set-update-range.
	* mi/mi-cmd-var.c (print_varobj): Update.  Emit "dynamic"
	attribute.
	(mi_cmd_var_create): Emit "has_more" attribute.
	(mi_cmd_var_set_format): Plug memory leak.
	(mi_print_value_p): Replace 'type' argument with 'var'.  Handle
	pretty-printed varobjs.
	(mi_cmd_var_list_children): Accept 'from' and 'to' arguments.
	Emit "has_more" attribute.
	(mi_cmd_var_evaluate_expression): Plug memory leak.
	(mi_cmd_var_assign): Likewise.
	(varobj_update_one): Likewise.  Emit "dynamic", "has_more", and
	"new_children" attributes.
	(mi_cmd_enable_pretty_printing): New function.
	(mi_cmd_var_set_update_range): Likewise.
gdb/doc
	* gdb.texinfo (GDB/MI Variable Objects): Document
	-enable-pretty-printing, -var-set-update-range, dynamic varobjs.
	Expand -var-update documentation.
gdb/testsuite
	* lib/mi-support.exp (mi_create_varobj): Update.
	(mi_create_floating_varobj): Likewise.
	(mi_create_dynamic_varobj): New proc.
	(mi_varobj_update): Update.
	(mi_varobj_update_with_type_change): Likewise.
	(mi_varobj_update_kv_helper): New proc.
	(mi_varobj_update_dynamic_helper): Rewrite.
	(mi_varobj_update_dynamic): New proc.
	(mi_list_varobj_children): Update.
	(mi_list_varobj_children_range): Add 'from' and 'to' arguments.
	* gdb.python/python-prettyprint.py (pp_outer): New class.
	(pp_nullstr): Likewise.
	(lookup_function): Register new printers.
	* gdb.python/python-prettyprint.c (struct substruct): New type.
	(struct outerstruct): Likewise.
	(substruct_test): New function.
	(struct nullstr): New type.
	(string_1, string_2): New globals.
	(main): Add new tests.
	* gdb.python/python-mi.exp: Added regression tests.
	* gdb.mi/mi2-var-display.exp: Update.
	* gdb.mi/mi2-var-cmd.exp: Update.
	* gdb.mi/mi2-var-child.exp: Update.
	* gdb.mi/mi2-var-block.exp: Update.
	* gdb.mi/mi-var-invalidate.exp: Update.
	* gdb.mi/mi-var-display.exp: Update.
	* gdb.mi/mi-var-cmd.exp: Update.
	* gdb.mi/mi-var-child.exp: Update.
	* gdb.mi/mi-var-block.exp: Update.
	* gdb.mi/mi-break.exp: Update.
	* gdb.mi/gdb701.exp: Update.
2009-09-15 18:51:26 +00:00
Jan Kratochvil 54333c3bf8 gdb/
Replace public function varobj_list by all_root_varobjs iterator.
	* mi/mi-cmd-var.c (struct mi_cmd_var_update, mi_cmd_var_update_iter):
	New.
	(mi_cmd_var_update): Replace the varobj_list call by all_root_varobjs.
	Remove the variables rootlist, cr.  New variable data.
	* varobj.c (rootcount, varobj_list): Remove.
	(install_variable, uninstall_variable): Remove the rootcount updates.
	(all_root_varobjs): New function.
	(varobj_invalidate): Use the all_root_varobjs call.  Move the code to...
	(varobj_invalidate_iter): ... a new function.
	* varobj.h (varobj_list): Remove the prototype.
	(all_root_varobjs): New prototype.
2009-07-30 13:12:54 +00:00
Tom Tromey b631324398 gdb
2009-05-27  Vladimir Prus  <vladimir@codesourcery.com>
	    Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* mi/mi-main.c (mi_cmd_list_features): List "python" feature.
	* varobj.h (varobj_set_visualizer): Declare.
	(varobj_get_display_hint): Likewise.
	(varobj_update_result_t) <children_changed, value_installed>: New
	fields.
	* mi/mi-cmds.c (mi_cmds): Add var-set-visualizer.
	* mi/mi-cmds.h (mi_cmd_var_set_visualizer,
	mi_cmd_var_set_child_range): Declare.
	* mi/mi-cmd-var.c (mi_cmd_var_set_visualizer): New function.
	(mi_cmd_var_list_children): Emit display hint.
	(varobj_update_one): Emit display hint.  Handle dynamic children.
	* python/python.c (GdbMethods): Add "default_visualizer".
	* python/python-internal.h (apply_varobj_pretty_printer,
	gdbpy_get_varobj_pretty_printer, gdbpy_get_display_hint):
	Declare.
	(gdbpy_default_visualizer): Likewise.
	* varobj.c: Include python.h, python-internal.h.
	(PyObject): New typedef.
	(struct varobj) <children_requested, pretty_printer>: New fields.
	(varobj_create): Call install_default_visualizer.
	(instantiate_pretty_printer): New function.
	(varobj_set_display_format): Update.
	(varobj_get_display_hint): New function.
	(update_dynamic_varobj_children): New function.
	(varobj_get_num_children): Handle dynamic children.
	(varobj_list_children): Likewise.
	(install_new_value): Likewise.
	(varobj_add_child): New function.
	(install_visualizer): Likewise.
	(install_default_visualizer): Likewise.
	(varobj_set_visualizer): Likewise.
	(varobj_update): Handle dynamic children.
	(create_child): Use create_child_with_value.
	(create_child_with_value): New function.
	(value_get_print_value): Call pretty printer.  Add value_formatter
	argument.
	(c_value_of_variable): Update.
	(varobj_invalidate): Always free all_rootvarobj.
	* python/python-prettyprint.c (apply_varobj_pretty_printer): New
	function.
	(gdbpy_get_varobj_pretty_printer): Likewise.
	(gdbpy_default_visualizer): Likewise.

gdb/doc

2009-05-27  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (GDB/MI Miscellaneous Commands): Document "python"
	feature.
	(GDB/MI Variable Objects): Document -var-set-visualizer.

gdb/testsuite

2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* lib/mi-support.exp (mi_varobj_update_dynamic): New proc.
	(mi_child_regexp): Likewise.
	(mi_list_varobj_children_range): Likewise.
	(mi_get_features): Likewise.
	(mi_list_varobj_children): Rewrite.
	* gdb.python/python-mi.exp: New file.
2009-05-28 01:09:20 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Vladimir Prus f7f9ae2c16 Refactor varobj_update interface.
* varobj.c (varobj_update): Report changes as vector.  Also
        return not just a list of varobj, but a list of special structures
        that tell what exactly has changed.
        * varobj.h (enum varobj_update_error): Rename to
        varobj_scope_status.
        (struct varobj_update_result_t): New.
        (varobj_update): Adjust prototype.
        * mi/mi-cmd-var.c: Adjust for changes.
2008-05-28 12:06:36 +00:00
Marc Khouzam de051565df gdb/ChangeLog
2008-04-09  Marc Khouzam  <marc.khouzam@ericsson.com>

        * mi/mi-cmd-var.c: Include "mi-getopt.h".
        (mi_parse_format): New.  Factored out from mi_cmd_var_set_format.
        (mi_cmd_var_set_format): Use new mi_parse_format.
        (mi_cmd_var_evaluate_expression): Support for -f option to specify
        format.
        * Makefile.in (mi-cmd-var.o): Update dependencies.

        * varobj.h (varobj_get_formatted_value): Declare.
        * varobj.c (my_value_of_variable): Added format parameter.
        (cplus_value_of_variable): Likewise.
        (java_value_of_variable): Likewise.
        (c_value_of_variable): Likewise.  Evaluate expression based
        on format parameter.
        (struct language_specific): Add format parameter to function member
        *value_of_variable.
        (varobj_get_formatted_value): New.
        (varobj_get_value): Added format parameter to method call.

gdb/doc/ChangeLog
2008-04-09  Marc Khouzam  <marc.khouzam@ericsson.com>

        * gdb.texinfo (GDB/MI Variable Objects): Add anchor to
        -var-set-format.  Add -f option to -var-evaluate-expression.

gdb/testsuite/ChangeLog
2008-04-09  Marc Khouzam  <marc.khouzam@ericsson.com>

        * gdb.mi/mi2-var-display.exp: Added tests for the new -f
        option of -var-evaluate-expression.
        * gdb.mi/mi2-var-display.exp: Likewise.
2008-04-09 13:29:55 +00:00
Vladimir Prus 5a413362ba * varobj.h (varobj_floating_p): Declare.
* varobj.c (varobj_floating_p): New.
	* mi/mi-cmd-var.c (mi_cmd_var_update): When passed
	'@' as the name, update all floating varobjs.
2008-03-26 14:51:28 +00:00
Vladimir Prus c5b48eacfa * varobj.c (struct varobj_root): New component thread_id.
(varobj_get_thread_id, check_scope): New functions.
        (c_value_of_root): Use check_scope.  Switch to the
	proper thread if necessary.

        * varobj.h (varobj_get_thread_id): New extern.

        * mi/mi-cmd-var.c (print_varobj): Add thread-id field.
2008-03-24 17:33:30 +00:00
Vladimir Prus d56d46f5c7 Use vector for varobj_list_children interface.
* gdb/varobj.c (varobj_list_children): Return vector
        of varobjs.
        * gdb/varobj.h (varobj_list_children): Adjust
        prototype.
        (varobj_p): Declare.  Declare vector thereof.
        * mi/mi-cmd-var.c (mi_cmd_var_list_children): Adjust
        for varobj_list_children change.
	* Makefile.in (varobj_h): Update dependencies.
2008-01-30 07:17:31 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00
Nick Roberts c203027e27 Add extern for varobj_editable_p. 2007-11-20 19:54:58 +00:00
Vladimir Prus 02142340a0 Implement -var-info-path-expression.
* mi/mi-cmds.h (mi_cmd_var_info_path_expression):
	Declare.
	* mi/mi-cmds.c (mi_cmds): Register var-info-path-expression.
	* mi/mi-cmd-var.c (mi_cmd_var_info_path_expression): New.
	* varobj.c (struct varobj): New field 'path_expr'.
	(c_path_expr_of_child, cplus_path_expr_of_child)
	(java_path_expr_of_child): New.
	(struct language_specific): New field path_expr_of_child.
	(varobj_create): Initialize the path_expr field.
	(varobj_get_path_expr): New.
	(new_variable): Initialize the path_expr field.
	(free_variable): Free the path_expr field.
	(adjust_value_for_children_access): New parameter
	WAS_TYPE.
	(c_number_of_children): Adjust.
	(c_describe_child): New parameter CFULL_EXPRESSION.
	Compute full expression.
	(c_value_of_child, c_type_of_child): Adjust.
	(cplus_number_of_children): Adjust.
	(cplus_describe_child): New parameter CFULL_EXPRESSION.
	Compute full expression.
	(cplus_name_of_child, cplus_value_of_child)
	(cplus_type_of_child): Adjust.
	* varobj.h (varobj_get_path_expr): Declare.
2007-08-31 18:52:05 +00:00
Joel Brobecker a9762ec78a Switch the license of all .c files to GPLv3.
Switch the license of all .h files to GPLv3.
        Switch the license of all .cc files to GPLv3.
2007-08-23 18:08:50 +00:00
Vladimir Prus 25d5ea921b * varobj.h (varobj_set_frozen): New
(varobj_get_frozen): New.
        (varobj_update): New parameter explicit.
        * varobj.c (struct varobj): New fields frozen
        and not_fetched.
        (varobj_set_frozen, varobj_get_frozen): New.
        (install_new_value): Don't fetch values for
        frozen variable object, or children thereof.  Allow
        a frozen variable object to have non-fetched value.
        (varobj_update): Allow updating child variables.
        Don't traverse frozen children.
        (new_variable): Initialize the frozen field.
        (c_value_of_variable): Return NULL for frozen
        variable without any value yet.
        * mi/mi-cmd-var.c (varobj_update_one): New parameter
        'explicit'.
        (mi_cmd_var_create): Output the 'frozen' field,
        as soon as testsuite is adjusted to expect that field.
        (mi_cmd_var_set_frozen): New.
        (mi_cmd_var_update): Pass the 'explicit' parameter to
        varobj_update_one.
        * mi/mi-cmds.c (mi_cmds): Register '-var-set-frozen'.
        * mi/mi-cmds.h (mi_cmd_var_set_frozen): Declare.
2007-04-14 09:51:30 +00:00
Nick Roberts 6d28409d4a (enum varobj_update_error): Delete WRONG_PARAM value. 2007-02-27 22:01:10 +00:00