aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-lang.h
AgeCommit message (Collapse)AuthorFilesLines
2023-01-20gdb: move frame_info_ptr to frame.{c,h}Simon Marchi1-0/+1
A patch later in this series will make frame_info_ptr access some fields internal to frame_info, which we don't want to expose outside of frame.c. Move the frame_info_ptr class to frame.h, and the definitions to frame.c. Remove frame-info.c and frame-info.h. Change-Id: Ic5949759e6262ea0da6123858702d48fe5673fea Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-01-20gdb: move compile_instance to compile/compile.hSimon Marchi1-0/+1
struct compile_instance needs to be visible to users, since we use std::unique<compile_instance>. language.c and c-lang.c currently includes compile-internal.h for this reason, which kind of defeats the purpose of having an "internal" header file. Change-Id: Iedffe5f1173b3de7bdc1be533ee2a68e6f6c549f Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-12-01Add name canonicalization for CTom Tromey1-0/+5
PR symtab/29105 shows a number of situations where symbol lookup can result in the expansion of too many CUs. What happens is that lookup_signed_typename will try to look up a type like "signed int". In cooked_index_functions::expand_symtabs_matching, when looping over languages, the C++ case will canonicalize this type name to be "int" instead. Then this method will proceed to expand every CU that has an entry for "int" -- i.e., nearly all of them. A crucial component of this is that the caller, objfile::lookup_symbol, does not do this canonicalization, so when it tries to find the symbol for "signed int", it fails -- causing the loop to continue. This patch fixes the problem by introducing name canonicalization for C. The idea here is that, by making C and C++ agree on the canonical name when a symbol name can have multiple spellings, we avoid the bad behavior in objfile::lookup_symbol (and any other such code -- I don't know if there is any). Unlike C++, C only has a few situations where canonicalization is needed. And, in particular, due to the lack of overloading (thus avoiding any issues in linespec) and due to the way c-exp.y works, I think that no canonicalization is needed during symbol lookup -- only during symtab construction. This explains why lookup_name_info is not touched. The stabs reader is modified on a "best effort" basis. The DWARF reader needed one small tweak in dwarf2_name to avoid a regression in dw2-unusual-field-names.exp. I think this is adequately explained by the comment, but basically this is a scenario that should not occur in real code, only the gdb test suite. lookup_signed_typename is simplified. It used to search for two different type names, but now gdb can search just for the canonical form. gdb.dwarf2/enum-type.exp needed a small tweak, because the canonicalizer turns "unsigned integer" into "unsigned int integer". It seems better here to use the correct C type name. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105 Tested-by: Simon Marchi <simark@simark.ca> Reviewed-by: Andrew Burgess <aburgess@redhat.com>
2022-10-10Remove c_printstrTom Tromey1-8/+0
This renames c_printstr, removing a layer of indirection.
2022-10-10Remove c_emit_charTom Tromey1-3/+0
This renames c_emit_char, removing a layer of indirection.
2022-05-10Always pass an explicit language down to c_type_printPedro Alves1-8/+9
The next patch will want to do language->print_type(type, ...), to print a type in a given language, avoiding a dependency on the current language. That doesn't work correctly currently, however, because most language implementations of language_defn::print_type call c_print_type without passing down the language. There are two overloads of c_print_type, one that takes a language, and one that does not. The one that does not uses the current language, defeating the point of calling language->print_type()... This commit removes the c_print_type overload that does not take a language, and adjusts the codebase throughout to always pass down a language. In most places, there's already an enum language handy. language_defn::print_type implementations naturally pass down this->la_language. In a couple spots, like in ada-typeprint.c and rust-lang.c there's no enum language handy, but the code is written for a specific language, so we just hardcode the language. In gnuv3_print_method_ptr, I wasn't sure whether we could hardcode C++ here, and we don't have an enum language handy, so I made it use the current language, just like today. Can always be improved later. Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-03-08Remove union exp_elementTom Tromey1-2/+0
This removes union exp_element functions that either create such elements or walk them. struct expression no longer holds exp_elements. A couple of language_defn methods are also removed, as they are obsolete. Note that this patch also removes the print_expression code. The only in-tree caller of this was from dump_prefix_expression, which is only called when expression debugging is enabled. Implementing this would involve a fair amount of code, and it seems to me that prefix dumping is preferable anyway, as it is unambiguous. So, I have not reimplemented this feature. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * value.h (evaluate_subexp_with_coercion): Don't declare. * parse.c (exp_descriptor_standard): Remove. (expr_builder::expr_builder, expr_builder::release): Update. (expression::expression): Remove size_t parameter. (expression::~expression): Simplify. (expression::resize): Remove. (write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym) (write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile) (write_exp_elt_longcst, write_exp_elt_floatcst) (write_exp_elt_type, write_exp_elt_intern, write_exp_string) (write_exp_string_vector, write_exp_bitstring): Remove. * p-lang.h (class pascal_language) <opcode_print_table, op_print_tab>: Remove. * p-lang.c (pascal_language::op_print_tab): Remove. * opencl-lang.c (class opencl_language) <opcode_print_table>: Remove. * objc-lang.c (objc_op_print_tab): Remove. (class objc_language) <opcode_print_table>: Remove. * m2-lang.h (class m2_language) <opcode_print_table, op_print_tab>: Remove. * m2-lang.c (m2_language::op_print_tab): Remove. * language.h (struct language_defn) <post_parser, expression_ops, opcode_print_table>: Remove. * language.c (language_defn::expression_ops) (auto_or_unknown_language::opcode_print_table): Remove. * go-lang.h (class go_language) <opcode_print_table, op_print_tab>: Remove. * go-lang.c (go_language::op_print_tab): Remove. * f-lang.h (class f_language) <opcode_print_table>: Remove <op_print_tab>: Remove. * f-lang.c (f_language::op_print_tab): Remove. * expression.h (union exp_element): Remove. (struct expression): Remove size_t parameter from constructor. <resize>: Remove. <first_opcode>: Update. <nelts, elts>: Remove. (EXP_ELEM_TO_BYTES, BYTES_TO_EXP_ELEM): Remove. (evaluate_subexp_standard, print_expression, op_string) (dump_raw_expression): Don't declare. * expprint.c (print_expression, print_subexp) (print_subexp_funcall, print_subexp_standard, op_string) (dump_raw_expression, dump_subexp, dump_subexp_body) (dump_subexp_body_funcall, dump_subexp_body_standard): Remove. (dump_prefix_expression): Update. * eval.c (evaluate_subexp): Remove. (evaluate_expression, evaluate_type): Update. (evaluate_subexpression_type): Remove. (fetch_subexp_value): Remove "pc" parameter. Update. (extract_field_op, evaluate_struct_tuple, evaluate_funcall) (evaluate_subexp_standard, evaluate_subexp_for_address) (evaluate_subexp_with_coercion, evaluate_subexp_for_sizeof) (evaluate_subexp_for_cast): Remove. (parse_and_eval_type): Update. * dtrace-probe.c (dtrace_probe::compile_to_ax): Update. * d-lang.c (d_op_print_tab): Remove. (class d_language) <opcode_print_table>: Remove. * c-lang.h (c_op_print_tab): Don't declare. * c-lang.c (c_op_print_tab): Remove. (class c_language, class cplus_language, class asm_language, class minimal_language) <opcode_print_table>: Remove. * breakpoint.c (update_watchpoint, watchpoint_check) (watchpoint_exp_is_const, watch_command_1): Update. * ax-gdb.h (union exp_element): Don't declare. * ax-gdb.c (const_var_ref, const_expr, maybe_const_expr) (gen_repeat, gen_sizeof, gen_expr_for_cast, gen_expr) (gen_expr_binop_rest): Remove. (gen_trace_for_expr, gen_eval_for_expr, gen_printf): Update. * ada-lang.c (ada_op_print_tab): Remove. (class ada_language) <post_parser, opcode_print_table>: Remove.
2021-03-08Remove now-unused C evaluator codeTom Tromey1-6/+1
Now that the C parser has switched to the new style, there is no need for the old C evaluation code. This affects some other languages that were relying on the C code. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * go-lang.c (go_language::expression_ops): Don't declare. * go-lang.h (class go_language) <expression_ops>: Remove. * opencl-lang.c (evaluate_subexp_opencl, exp_descriptor_opencl): Remove. (class opencl_language) <expression_ops>: Remove. * d-lang.c (class d_language) <expression_ops>: Remove. * c-lang.h (evaluate_subexp_c, exp_descriptor_c): Don't declare. * c-lang.c (evaluate_subexp_c, exp_descriptor_c): Remove. (class c_language, class cplus_language, class asm_language) (class minimal_language) <expression_ops>: Remove.
2021-02-05Return unique_ptr from language_defn::get_compile_contextTom Tromey1-10/+8
This changes language_defn::get_compile_context to return a unique_ptr. This makes the ownership transfer clear. gdb/ChangeLog 2021-02-05 Tom Tromey <tom@tromey.com> * compile/compile-c-support.c (get_compile_context) (c_get_compile_context, cplus_get_compile_context): Change return type. * language.c (language_defn::get_compile_instance): New method. * language.h (language_defn::get_compile_instance): Change return type. No longer inline. * c-lang.c (c_language::get_compile_instance): Change return type. (cplus_language::get_compile_instance): Change return type. * c-lang.h (c_get_compile_context, cplus_get_compile_context): Change return type. * compile/compile.c (compile_to_object): Update.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-23gdb: rename c_printchar as language_defn::printcharAndrew Burgess1-2/+0
This commit removes the global function c_printchar and moves the implementation into language_defn::printchar. There should be no user visible changes after this commit. gdb/ChangeLog: * c-lang.c (c_printchar): Rename to... (language_defn::printchar): ...this. * c-lang.h (c_printchar): Delete declaration. * language.c (language_defn::printchar): Delete this implementation. Is now implemented in c-lang.c.
2020-11-25Do not include parser-defs.h from c-lang.hTom Tromey1-1/+0
While working on another series, I noticed that c-lang.h does not need to include parser-defs.h. This patch makes this change, and fixes up the two .c files that needed this include. Tested by rebuilding. gdb/ChangeLog 2020-11-25 Tom Tromey <tom@tromey.com> * d-lang.c: Include parser-defs.h. * rust-lang.c: Include parser-defs.h. * c-lang.h: Do not include parser-defs.h.
2020-06-17gdb: Convert language la_watch_location_expression field to a methodAndrew Burgess1-3/+0
This commit changes the language_data::la_watch_location_expression function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_watch_location_expression): Rename to ada_language::watch_location_expression. (ada_language_data): Delete la_watch_location_expression initializer. (ada_language::watch_location_expression): New member function, implementation from ada_watch_location_expression. * breakpoint.c (watch_command_1): Update call to watch_location_expression. * c-lang.c (c_watch_location_expression): Rename to language_defn::watch_location_expression. (c_language_data): Delete la_watch_location_expression initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * c-lang.h (c_watch_location_expression): Delete declaration. * d-lang.c (d_language_data): Delete la_watch_location_expression initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (language_defn::watch_location_expression): Member function implementation from c_watch_location_expression. (unknown_language_data): Delete la_watch_location_expression initializer. (auto_language_data): Likewise. * language.h (language_data): Delete la_watch_location_expression field. (language_defn::watch_location_expression): Declare new member function. * m2-lang.c (m2_language_data): Delete la_watch_location_expression initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_watch_location_expression): Rename to rust_language::watch_location_expression. (rust_language_data): Delete la_watch_location_expression initializer. (rust_language::watch_location_expression): New member function, implementation from rust_watch_location_expression.
2020-06-17gdb: Convert language la_compute_program field to a methodAndrew Burgess1-2/+2
This commit changes the language_data::la_compute_program function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Delete la_compute_program initializer. * c-lang.c (c_language_data): Likewise. (c_language::compute_program): New member function. (cplus_language_data): Delete la_compute_program initializer. (cplus_language::compute_program): New member function. (asm_language_data): Delete la_compute_program initializer. (minimal_language_data): Likewise. * c-lang.h (c_compute_program): Update comment. (cplus_compute_program): Likewise. * compile/compile-c-support.c (c_compute_program): Likewise. (cplus_compute_program): Likewise. * compile/compile.c (compile_to_object): Update call to la_compute_program. * d-lang.c (d_language_data): Delete la_compute_program initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_compute_program field. (language_defn::compute_program): New member function. * m2-lang.c (m2_language_data): Delete la_compute_program initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-06-02gdb: Convert language la_get_compile_instance field to a methodAndrew Burgess1-2/+2
This commit changes the language_data::la_get_compile_instance function pointer member variable into a member function of language_defn. Unlike previous commits converting fields of language_data to member function in language_defn, this field is NULL for some languages. As a result I had to change the API slightly so that the base language_defn class provides an implementation. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Delete la_get_compile_instance initializer. * c-lang.c (class compile_instance): Declare. (c_language_data): Delete la_get_compile_instance initializer. (c_language::get_compile_instance): New member function. (cplus_language_data): Delete la_get_compile_instance initializer. (cplus_language::get_compile_instance): New member function. (asm_language_data): Delete la_get_compile_instance initializer. (minimal_language_data): Likewise. * c-lang.h (c_get_compile_context): Update comment. (cplus_get_compile_context): Update comment. * compile/compile.c (compile_to_object): Update calls, don't rely on function pointer being NULL. * d-lang.c (d_language_data): Delete la_get_compile_instance initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_get_compile_instance field. (language_defn::get_compile_instance): New member function. * m2-lang.c (m2_language_data): Delete la_get_compile_instance initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-03-13Remove val_printTom Tromey1-20/+0
We can finally remove val_print and various helper functions that are no longer needed. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * value.h (val_print): Don't declare. * valprint.h (val_print_array_elements) (val_print_scalar_formatted, generic_val_print): Don't declare. * valprint.c (generic_val_print_array): Take a struct value. (generic_val_print_ptr, generic_val_print_memberptr) (generic_val_print_bool, generic_val_print_int) (generic_val_print_char, generic_val_print_complex) (generic_val_print): Remove. (generic_value_print): Update. (do_val_print): Remove unused parameters. Don't call la_val_print. (val_print): Remove. (common_val_print): Update. Don't call value_check_printable. (val_print_scalar_formatted, val_print_array_elements): Remove. * rust-lang.c (rust_val_print): Remove. (rust_language_defn): Update. * p-valprint.c (pascal_val_print): Remove. (pascal_value_print_inner): Update. (pascal_object_print_val_fields, pascal_object_print_val): Remove. (pascal_object_print_static_field): Update. * p-lang.h (pascal_val_print): Don't declare. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-valprint.c (m2_print_unbounded_array, m2_val_print): Remove. * m2-lang.h (m2_val_print): Don't declare. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_val_print>: Remove. * language.c (unk_lang_value_print_inner): Rename. Change argument types. (unknown_language_defn, auto_language_defn): Update. * go-valprint.c (go_val_print): Remove. * go-lang.h (go_val_print): Don't declare. * go-lang.c (go_language_defn): Update. * f-valprint.c (f_val_print): Remove. * f-lang.h (f_value_print): Don't declare. * f-lang.c (f_language_defn): Update. * d-valprint.c (d_val_print): Remove. * d-lang.h (d_value_print): Don't declare. * d-lang.c (d_language_defn): Update. * cp-valprint.c (cp_print_value_fields) (cp_print_value_fields_rtti, cp_print_value): Remove. (cp_print_static_field): Update. * c-valprint.c (c_val_print_array, c_val_print_ptr) (c_val_print_struct, c_val_print_union, c_val_print_int) (c_val_print_memberptr, c_val_print): Remove. * c-lang.h (c_val_print_array, cp_print_value_fields) (cp_print_value_fields_rtti): Don't declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-valprint.c (ada_val_print_ptr, ada_val_print_num): Remove. (ada_val_print_enum): Take a struct value. (ada_val_print_flt, ada_val_print_array, ada_val_print_1) (ada_val_print): Remove. (ada_value_print_1): Update. (printable_val_type): Remove. * ada-lang.h (ada_val_print): Don't declare. * ada-lang.c (ada_language_defn): Update.
2020-03-13Introduce cp_print_value_fields and c_value_print_structTom Tromey1-0/+5
This adds cp_print_value_fields and c_value_print_struct, value-based analogues of the corresponding val-printing functions. Note that the Modula-2 printing code also calls cp_print_val_fields, and so is updated to call the function function. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * m2-valprint.c (m2_value_print_inner): Use cp_print_value_fields. * cp-valprint.c (cp_print_value_fields): New function. * c-valprint.c (c_value_print_struct): New function. (c_value_print_inner): Use c_value_print_struct. * c-lang.h (cp_print_value_fields): Declare.
2020-03-13Introduce c_value_print_innerTom Tromey1-0/+5
This introduces c_value_print_inner, which implements the la_value_print_inner method for the C family of languages. In this patch, it is just a simple wrapper of c_val_print. However, subsequent patches will convert it to use the value API. The transformation is done this way to make each patch easier to review. Future patches will apply this same treatment to other languages as well. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * opencl-lang.c (opencl_language_defn): Use c_value_print_inner. * objc-lang.c (objc_language_defn): Use c_value_print_inner. * c-valprint.c (c_value_print_inner): New function. * c-lang.h (c_value_print_inner): Declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Use c_value_print_inner.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-10-07Move declaration of vtbl_ptr_name to the header.Christian Biesinger1-0/+6
There are conflicting comments about whether this was introduced in GCC 2.4.5 or GCC 2.6 and I don't know which one is correct... gdb/ChangeLog: 2019-10-07 Christian Biesinger <cbiesinger@google.com> * c-lang.h (vtbl_ptr_name): Declare. * cp-valprint.c (vtbl_ptr_name): Remove "extern" now that we get it from the header. * stabsread.c (define_symbol): Remove declaration of vtbl_ptr_name.
2019-07-09Rename common to gdbsupportTom Tromey1-1/+1
This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-04-29gdb: Introduce new language field la_is_string_type_pAndrew Burgess1-0/+5
This commit is preparation work for the next commit, and by itself makes no user visible change to GDB. I've split this work into a separate commit in order to make code review easier. This commit adds a new field 'la_is_string_type_p' to the language struct, this predicate will return true if a type is a string type for the given language. Some languages already have a "is this a string" predicate that I was able to reuse, while for other languages I've had to add a new predicate. In this case I took inspiration from the value printing code for that language - what different conditions would result in printing something as a string. A default "is this a string" method has also been added that looks for TYPE_CODE_STRING, this is the fallback I've used for a couple of languages. In this commit I add the new field and initialise it for each language, however at this stage the new field is never used. gdb/ChangeLog: * ada-lang.c (ada_language_defn): Initialise new field. * c-lang.c (c_is_string_type_p): New function. (c_language_defn): Initialise new field. (cplus_language_defn): Initialise new field. (asm_language_defn): Initialise new field. (minimal_language_defn): Initialise new field. * c-lang.h (c_is_string_type_p): Declare new function. * d-lang.c (d_language_defn): Initialise new field. * f-lang.c (f_is_string_type_p): New function. (f_language_defn): Initialise new field. * go-lang.c (go_is_string_type_p): New function. (go_language_defn): Initialise new field. * language.c (default_is_string_type_p): New function. (unknown_language_defn): Initialise new field. (auto_language_defn): Initialise new field. * language.h (struct language_defn) <la_is_string_type_p>: New member variable. (default_is_string_type_p): Declare new function. * m2-lang.c (m2_language_defn): Initialise new field. * objc-lang.c (objc_language_defn): Initialise new field. * opencl-lang.c (opencl_language_defn): Initialise new field. * p-lang.c (pascal_is_string_type_p): New function. (pascal_language_defn): Initialise new field. * rust-lang.c (rust_is_string_type_p): New function. (rust_language_defn): Initialise new field.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-10-03Use unsigned as base type for some enumsTom Tromey1-1/+1
-fsanitize=undefined complains about using operator~ on various enum types that are used with DEF_ENUM_FLAGS_TYPE. This patch fixes these problems by explicitly setting the base type for these enums to unsigned. It also adds a static assert to enum_flags to ensure that future enums used this way have an unsigned underlying type. gdb/ChangeLog 2018-10-03 Tom Tromey <tom@tromey.com> * common/enum-flags.h (enum_flags::operator~): Add static assert. * symfile-add-flags.h (enum symfile_add_flag): Use unsigned as base type. * objfile-flags.h (enum objfile_flag): Use unsigned as base type. * gdbtypes.h (enum type_instance_flag_value): Use unsigned as base type. * c-lang.h (enum c_string_type_values): Use unsigned as base type. * btrace.h (enum btrace_thread_flag): Use unsigned as base type.
2018-08-29C++ compile supportKeith Seitz1-0/+19
This patch adds *basic* support for C++ to the compile feature. It does most simple type conversions, including everything that C compile does and your basic "with-classes" type of C++. I've written a new compile-support.exp support file which adds a new test facility for automating and simplifying "compile print" vs "compile code" testing. See testsuite/lib/compile-support.exp and CompileExpression for more on that. The tests use this facility extensively. This initial support has several glaring omissions: - No template support at all I have follow-on patches for this, but they add much complexity to this "basic" support. Consequently, they will be submitted separately. - Cannot print functions The code template needs tweaking, and I simply haven't gotten to it yet. - So-called "special function" support is not included Using constructors, destructors, operators, etc will not work. I have follow-on patches for that, but they require some work because of the recent churn in symbol searching. - There are several test suite references to "compile/1234" bugs. I will file bugs and update the test suite's bug references before pushing these patches. The test suite started as a copy of the original C-language support, but I have written tests to exercise the basic functionality of the plug-in. I've added a new option for outputting debug messages for C++ type-conversion ("debug compile-cplus-types"). gdb/ChangeLog: * Makefile.in (SUBDIR_GCC_COMPILE_SRCS): Add compile-cplus-symbols.c and compile-cplus-types.c. (HFILES_NO_SRCDIR): Add gcc-cp-plugin.h. * c-lang.c (cplus_language_defn): Set C++ compile functions. * c-lang.h (cplus_get_compile_context, cplus_compute_program): Declare. * compile/compile-c-support.c: Include compile-cplus.h. (load_libcompile): Templatize. (get_compile_context): "New" function. (c_get_compile_context): Use get_compile_context. (cplus_get_compile_context): New function. (cplus_push_user_expression, cplus_pop_user_expression) (cplus_add_code_header, cplus_add_input, cplus_compile_program) (cplus_compute_program): Define new structs/functions. * compile/compile-cplus-symmbols.c: New file. * compile/compile-cplus-types.c: New file. * compile/compile-cplus.h: New file. * compile/compile-internal.h (debug_compile_oracle, GCC_TYPE_NONE): Declare. * compile/compile-object-load.c (get_out_value_type): Use strncmp_iw when comparing symbol names. (compile_object_load): Add mst_bss and mst_data. * compile/compile.c (_initialize_compile): Remove -Wno-implicit-function-declaration from `compile_args'. * compile/gcc-cp-plugin.h: New file. * NEWS: Mention C++ compile support and new debug options. gdb/testsuite/ChangeLog: * gdb.compile/compile-cplus-anonymous.cc: New file. * gdb.compile/compile-cplus-anonymous.exp: New file. * gdb.compile/compile-cplus-array-decay.cc: New file. * gdb.compile/compile-cplus-array-decay.exp: New file. * gdb.compile/compile-cplus-inherit.cc: New file. * gdb.compile/compile-cplus-inherit.exp: New file. * gdb.compile/compile-cplus-member.cc: New file. * gdb.compile/compile-cplus-member.exp: New file. * gdb.compile/compile-cplus-method.cc: New file. * gdb.compile/compile-cplus-method.exp: New file. * gdb.compile/compile-cplus-mod.c: "New" file. * gdb.compile/compile-cplus-namespace.cc: New file. * gdb.compile/compile-cplus-namespace.exp: New file. * gdb.compile/compile-cplus-nested.cc: New file. * gdb.compile/compile-cplus-nested.exp: New file. * gdb.compile/compile-cplus-print.c: "New" file. * gdb.compile/compile-cplus-print.exp: "New" file. * gdb.compile/compile-cplus-virtual.cc: New file. * gdb.compile/compile-cplus-virtual.exp: New file. * gdb.compile/compile-cplus.c: "New" file. * gdb.compile/compile-cplus.exp: "New" file. * lib/compile-support.exp: New file. doc/ChangeLog: * gdb.texinfo (Compiling and injecting code in GDB): Document set/show "compile-oracle" and "compile-cplus-types" commands.
2018-08-10Change compile_instance/compile_c_instance into classesKeith Seitz1-2/+2
This patch changes structs compile_instance and compile_c_instance into classes. Because of the nature of the change, there are a number of unavoidably mechanical changes buried in here, such as turning variable access of the POD struct into method calls, removing the struct keyword, and changing access of the plugin from "c_plugin->operation()" to "plugin ().operation ()". There is one "non-trivial" change associated with this patch, though. The type cache and symbol error maps have been moved into the base class, believing these facilities would be used other language implementations. [They are indeed re-used by C++.] gdb/ChangeLog: * compile/compile-c-support.c (c_get_compile_context): Use `new' instead of `new_compile_instance'. * compile/compile-c-symbols.c (compile_instance::insert_symbol_error): Update description. If the symbol error map is not initialized, create it. (generate_c_for_for_one_symbol): Do not check/initialize the symbol error map. * compile/compile-c-types.c (compile_c_instance): Make a class. Update all callers. (compile_instance::compile_instance): Initialize the type cache. (get_cached_type): New function. (insert_type): Update description. (compile_c_instance::m_default_cflags): Define. (convert_type): Update description. Use get_cached_type. (delete_instance): Moved to destructor. (new_compile_instance): Moved to constructor. * compile/compile-c.h (compile_c_instance): Make class inheriting from compile_instance. <base>: Remove field. <type_map, symbol_err_map>: Move to base class. <c_plugin>: Rename to `m_plugin' and remove pointer type. * compile/compile-internal.h (compile_instance): Make class. <type_map_t, symbol_err_map_t>: Define. <fe>: Rename to `m_gcc_fe'. <scope, block, gcc_target_options>: Add `m_' prefix. <m_type_map, m_symbol_err_map>: New fields, moved from compile_c_instance. <destroy>: Remove. (convert_type, new_compile_instance): Remove. * compile/compile.c (cleanup_compile_instance): Remove. (compile_to_object): Use unique_ptr to eliminate cleanups. (compile_instance::set_print_callback, compile_instance::version) (compile_instance::set_verbose) (compile_instance::set_driver_filename) (compile_instance::set_triplet_regexp) (compile_instance::set_arguments) (compile_instance::set_source_file) (compile_instance::compile): Define.
2018-06-18Remove la_errorTom Tromey1-2/+0
While working on the parser code, I noticed that yyerror is exported from each parser. It is used by this code in parse.c: TRY { if (lang->la_parser (&ps)) lang->la_error (NULL); } However, it seems to me that la_error will never be called here, because in every case, la_parser throws an exception on error -- each implementation of yyerror just calls error. So, this patch removes la_error and makes all the yyerror functions static. This is handy primarily because it makes it simpler to make the expression parsers pure. Tested by the buildbot. gdb/ChangeLog 2018-06-18 Tom Tromey <tom@tromey.com> * rust-lang.h (rust_yyerror): Don't declare. * rust-lang.c (rust_language_defn): Update. * rust-exp.y (yyerror): Now static. * parse.c (parse_exp_in_context_1): Update. * p-lang.h (p_yyerror): Don't declare. * p-lang.c (p_language_defn): Update. * p-exp.y (yyerror): Now static. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-lang.h (m2_yyerror): Don't declare. * m2-lang.c (m2_language_defn): Update. * m2-exp.y (yyerror): Now static. * language.h (struct language_defn) <la_error>: Remove. * language.c (unk_lang_error): Remove. (unknown_language_defn, auto_language_defn): Remove. * go-lang.h (go_yyerror): Don't declare. * go-lang.c (go_language_defn): Update. * go-exp.y (yyerror): Now static. * f-lang.h (f_yyerror): Don't declare. * f-lang.c (f_language_defn): Update. * f-exp.y (yyerror): Now static. * d-lang.h (d_yyerror): Don't declare. * d-lang.c (d_language_defn): Update. * d-exp.y (yyerror): Now static. * c-lang.h (c_yyerror): Don't declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * c-exp.y (yyerror): Now static. * ada-lang.h (ada_yyerror): Don't declare. * ada-lang.c (ada_language_defn): Update. * ada-exp.y (yyerror): Now static.
2018-06-01Thread language through c_type_print_argsTom Tromey1-0/+7
Currently dwarf2read.c will pass the CU's language to c_type_print_args -- but this doesn't affect all aspects of type printing, because some code in c-typeprint.c refers to current_language. This patch threads the language through more of the type printing code, adding an overload to c_type_print. Some uses of current_language remain, but now they are only in top-level functions. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_compute_name): Pass CU's language to c_print_type. * c-typeprint.c (c_print_type_1): Add "language" parameter. (c_print_type): Update. (c_print_type): New overload. (c_type_print_varspec_prefix, c_type_print_args) (c_type_print_varspec_suffix, c_print_type_no_offsets) (c_type_print_base_struct_union, c_type_print_base_1) (cp_type_print_method_args): Add "language" parameter. (c_type_print_base): Update. * c-lang.h (c_print_type): Add new overload.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-05-19Use watchpoint's language when re-parsing expressionTom Tromey1-0/+3
PR rust/21484 notes that watch -location does not work with Rust: (gdb) watch -location a syntax error in expression, near `) 0x00007fffffffe0f4'. update_watchpoint tries to tell gdb that the new expression it creates has C syntax: /* The above expression is in C. */ b->language = language_c; However, update_watchpoint doesn't actually use this language when re-parsing the expression. Originally I was going to fix this by saving and restoring the language in update_watchpoint, but this regressed gdb.dlang/watch-loc.exp, because the constructed expression actually has D syntax (specifically the name is not parseable by C). Next I looked at directly constructing an expression, and not relying on the parser at all; but it seemed to me that upon a re-set, we'd want to reparse the type, and there is no existing API to do this correctly. So, in the end I made a hook to let each language choose what expression to use. I made all the languages other than Rust use the C expression, because that is the status quo ante. However, this is probably not truly correct. After this patch, at least, it is easy to correct by someone who knows the language(s) in question. Regtested by the buildbot. ChangeLog 2017-05-19 Tom Tromey <tom@tromey.com> PR rust/21484: * rust-lang.c (exp_descriptor_rust): New function. (rust_language_defn): Use it. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_watch_location_expression>: New member. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * go-lang.c (go_language_defn): Update. * f-lang.c (f_language_defn): Update. * d-lang.c (d_language_defn): Update. * c-lang.h (c_watch_location_expression): Declare. * c-lang.c (c_watch_location_expression): New function. (c_language_defn, cplus_language_defn, asm_language_defn) (minimal_language_defn): Use it. * breakpoint.c (watch_command_1): Call la_watch_location_expression. * ada-lang.c (ada_language_defn): Update. testsuite/ChangeLog 2017-05-19 Tom Tromey <tom@tromey.com> PR rust/21484: * gdb.rust/watch.exp: New file. * gdb.rust/watch.rs: New file.
2017-04-05-Wwrite-strings: The RestPedro Alves1-2/+2
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-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
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.
2016-11-11Remove parameter valaddr from c print functionsYao Qi1-1/+1
This patch removes parameter valaddr from some c print functions. gdb: 2016-11-11 Yao Qi <yao.qi@linaro.org> * c-lang.h (cp_print_value_fields): Update declaration. * cp-valprint.c (cp_print_value): Update declaration. (cp_print_value_fields): Remove parameter valaddr. Callers updated. (cp_print_value): Likewise.
2016-11-08Remove parameter valaddr from la_val_printYao Qi1-4/+4
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.
2016-11-08Use ui_file_as_string in gdb/compile/Pedro Alves1-7/+7
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.
2016-06-24Support structure offsets that are 512K or larger.David Taylor1-2/+2
GDB computes structure byte offsets using a 32 bit integer. And, first it computes the offset in bits and then converts to bytes. The result is that any offset that if 512K bytes or larger overflows. This patch changes GDB to use LONGEST for such calculations. PR gdb/17520 Structure offset wrong when 1/4 GB or greater. * c-lang.h: Change all parameters, variables, and struct or union members used as struct or union fie3ld offsets from int to LONGEST. * c-valprint.c: Likewise. * cp-abi.c: Likewise. * cp-abi.h: Likewise. * cp-valprint.c: Likewise. * d-valprint.c: Likewise. * dwarf2loc.c: Likewise. * eval.c: Likewise. * extension-priv.h: Likewise. * extension.c: Likewise. * extension.h: Likewise. * findvar.c: Likewise. * gdbtypes.h: Likewise. * gnu-v2-abi.c: Likewise. * gnu-v3-abi.c: Likewise. * go-valprint.c: Likewise. * guile/guile-internal.h: Likewise. * guile/scm-pretty-print.c: Likewise. * jv-valprint.c Likewise. * opencl-lang.c: Likewise. * p-lang.h: Likewise. * python/py-prettyprint.c: Likewise. * python/python-internal.h: Likewise. * spu-tdep.c: Likewise. * typeprint.c: Likewise. * valarith.c: Likewise. * valops.c: Likewise. * valprint.c: Likewise. * valprint.h: Likewise. * value.c: Likewise. * value.h: Likewise. * p-valprint.c: Likewise. * c-typeprint.c (c_type_print_base): When printing offset, use plongest, not %d. * gdbtypes.c (recursive_dump_type): Ditto.
2016-04-22Centralize yacc interface names remapping (yyparse, yylex, yyerror, etc)Pedro Alves1-1/+1
This factors out all the yy-variables remapping to a single file, instead of each parser having to do the same, with different prefixes. With this, a parser just needs to define the prefix they want and include yy-remap.h, which does the dirty job. Note this renames the c_error, ada_error, etc. functions. Writing the remapping pattern as: #define yyerror GDB_YY_REMAP (error) instead of: #define yyerror GDB_YY_REMAP (yyerror) would have avoided the renaming. However, that would be problematic if we have a macro 'foo' in scope, when we write: #define yyfoo GDB_YY_REMAP (foo) as that would expand 'foo'. The c_yyerror etc. naming end ups indicating that this is a yacc related function more clearly, so feels like a good change, anyway. gdb/ChangeLog: 2016-04-22 Pedro Alves <palves@redhat.com> * ada-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * ada-lang.c (ada_language_defn): Adjust. * ada-lang.h (ada_error): Rename to ... (ada_yyerror): ... this. * c-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust. * c-lang.h (c_error): Rename to ... (c_yyerror): ... this. * d-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * d-lang.c (d_language_defn): Adjust. * d-lang.h (d_error): Rename to ... (d_yyerror): ... this. * f-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * f-lang.c (f_language_defn): Adjust. * f-lang.h (f_error): Rename to ... (f_yyerror): ... this. * go-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * go-lang.c (go_language_defn): Adjust. * go-lang.h (go_error): Rename to ... (go_yyerror): ... this. * jv-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * jv-lang.c (java_language_defn): Adjust. * jv-lang.h (java_error): Rename to ... (java_yyerror): ... this. * m2-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * m2-lang.c (m2_language_defn): Adjust. * m2-lang.h (m2_error): Rename to ... (m2_yyerror): ... this. * objc-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-exp.y: Remove all yy symbol remappings. (GDB_YY_REMAP_PREFIX): Define. Include "yy-remap.h". * p-lang.c (pascal_language_defn): Adjust. * p-lang.h (pascal_error): Rename to ... (pascal_yyerror): ... this. * yy-remap.h: New file.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-11-17Convert c_string_type to an enum flags typeSimon Marchi1-1/+4
c_string_type contains values meant to be OR'ed together (even though some bits are mutually exclusive), so it makes sense to make it an enum flags type. gdb/ChangeLog: 2015-11-17 Simon Marchi <simon.marchi@ericsson.com> * c-exp.y (exp): Adjust, change enum c_string_type to c_string_type. (parse_string_or_char): Likewise. * c-lang.c (charset_for_string_type): Likewise. (classify_type): Likewise. (c_printchar): Likewise. (c_printstr): Likewise. (evaluate_subexp_c): Likewise. And change cast to enum c_string_type_values. * c-lang.h: Include "common/enum_flags.h". (enum c_string_type): Rename to... (enum c_string_type_values): ...this. (c_string_type): Define new enum flags type.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-12the "compile" commandTom Tromey1-0/+19
This final patch adds the new "compile" command and subcommands, and all the machinery needed to make it work. A shared library supplied by gcc is used for all communications with gcc. Types and most aspects of symbols are provided directly by gdb to the compiler using this library. gdb provides some information about the user's code using plain text. Macros are emitted this way, and DWARF location expressions (and bounds for VLA) are compiled to C code. This hybrid approach was taken because, on the one hand, it is better to provide global declarations and such on demand; but on the other hand, for local variables, translating DWARF location expressions to C was much simpler than exporting a full compiler API to gdb -- the same result, only easier to implement, understand, and debug. In the ordinary mode, the user's expression is wrapped in a dummy function. After compilation, gdb inserts the resulting object code into the inferior, then calls this function. Access to local variables is provided by noting which registers are used by location expressions, and passing a structure of register values into the function. Writes to registers are supported by copying out these values after the function returns. This approach was taken so that we could eventually implement other more interesting features based on this same infrastructure; for example, we're planning to investigate inferior-side breakpoint conditions. gdb/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * NEWS: Update. * symtab.h (struct symbol_computed_ops) <generate_c_location>: New field. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_get_compile_instance, la_compute_program>: New fields. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * jv-lang.c (java_language_defn): Update. * go-lang.c (go_language_defn): Update. * f-lang.c (f_language_defn): Update. * dwarf2loc.h (dwarf2_compile_property_to_c): Declare. * dwarf2loc.c (dwarf2_compile_property_to_c) (locexpr_generate_c_location, loclist_generate_c_location): New functions. (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update. * defs.h (enum compile_i_scope_types): New. (enum command_control_type) <compile_control>: New constant. (struct command_line) <control_u>: New field. * d-lang.c (d_language_defn): Update. * compile/compile.c: New file. * compile/compile-c-support.c: New file. * compile/compile-c-symbols.c: New file. * compile/compile-c-types.c: New file. * compile/compile.h: New file. * compile/compile-internal.h: New file. * compile/compile-loc2c.c: New file. * compile/compile-object-load.c: New file. * compile/compile-object-load.h: New file. * compile/compile-object-run.c: New file. * compile/compile-object-run.h: New file. * cli/cli-script.c (multi_line_command_p, print_command_lines) (execute_control_command, process_next_line) (recurse_read_control_structure): Handle compile_control. * c-lang.h (c_get_compile_context, c_compute_program): Declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-lang.c (ada_language_defn): Update. * Makefile.in (SUBDIR_GCC_COMPILE_OBS, SUBDIR_GCC_COMPILE_SRCS): New variables. (SFILES): Add SUBDIR_GCC_COMPILE_SRCS. (HFILES_NO_SRCDIR): Add compile.h. (COMMON_OBS): Add SUBDIR_GCC_COMPILE_OBS. (INIT_FILES): Add SUBDIR_GCC_COMPILE_SRCS. (compile.o, compile-c-types.o, compile-c-symbols.o) (compile-object-load.o, compile-object-run.o, compile-loc2c.o) (compile-c-support.o): New targets. gdb/doc/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Altering): Update. (Compiling and Injecting Code): New node. gdb/testsuite/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * configure.ac: Add gdb.compile/. * configure: Regenerate. * gdb.compile/Makefile.in: New file. * gdb.compile/compile-ops.exp: New file. * gdb.compile/compile-ops.c: New file. * gdb.compile/compile-tls.c: New file. * gdb.compile/compile-tls.exp: New file. * gdb.compile/compile-constvar.S: New file. * gdb.compile/compile-constvar.c: New file. * gdb.compile/compile-mod.c: New file. * gdb.compile/compile-nodebug.c: New file. * gdb.compile/compile-setjmp-mod.c: New file. * gdb.compile/compile-setjmp.c: New file. * gdb.compile/compile-setjmp.exp: New file. * gdb.compile/compile-shlib.c: New file. * gdb.compile/compile.c: New file. * gdb.compile/compile.exp: New file. * lib/gdb.exp (skip_compile_feature_tests): New proc.
2014-03-27Remove `expout*' globals from parser-defs.hSergio Durigan Junior1-1/+2
This commit removes the "expout*" globals from our parser code, turning them into a structure that is passed when an expression needs to be evaluated. This is the initial step to make our parser less "globalized". This is mostly a mechanical patch, which creates a structure containing the "expout*" globals and then modify all the functions that handle them in order to take the structure as argument. It is big, and has been reviewed at least 4 times, so I think everything is covered. Below you can see the message links from the discussions: - First attempt: <https://sourceware.org/ml/gdb-patches/2012-01/msg00522.html> Message-ID: <m3k44s7qej.fsf@gmail.com> - Second attempt: <https://sourceware.org/ml/gdb-patches/2012-06/msg00054.html> Message-Id: <1338665528-5932-1-git-send-email-sergiodj@redhat.com> - Third attempt: <https://sourceware.org/ml/gdb-patches/2014-01/msg00949.html> Message-Id: <1390629467-27139-1-git-send-email-sergiodj@redhat.com> - Fourth (last) attempt: <https://sourceware.org/ml/gdb-patches/2014-03/msg00546.html> Message-Id: <1395463432-29750-1-git-send-email-sergiodj@redhat.com> gdb/ 2014-03-27 Sergio Durigan Junior <sergiodj@redhat.com> Remove some globals from our parser. * language.c (unk_lang_parser): Add "struct parser_state" argument. * language.h (struct language_defn) <la_parser>: Likewise. * parse.c (expout, expout_size, expout_ptr): Remove variables. (initialize_expout): Add "struct parser_state" argument. Rewrite function to use the parser state. (reallocate_expout, write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile, write_exp_elt_longcst, write_exp_elt_dblcst, write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern, write_exp_string, write_exp_string_vector, write_exp_bitstring, write_exp_msymbol, mark_struct_expression, write_dollar_variable): Likewise. (parse_exp_in_context_1): Use parser state. (insert_type_address_space): Add "struct parser_state" argument. Use parser state. (increase_expout_size): New function. * parser-defs.h: Forward declare "struct language_defn" and "struct parser_state". (expout, expout_size, expout_ptr): Remove extern declarations. (parse_gdbarch, parse_language): Rewrite macro declarations to accept the parser state. (struct parser_state): New struct. (initialize_expout, reallocate_expout, write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst, write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern, write_exp_string, write_exp_string_vector, write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile, write_exp_msymbol, write_dollar_variable, mark_struct_expression, insert_type_address_space): Add "struct parser_state" argument. (increase_expout_size): New function. * utils.c (do_clear_parser_state): New function. (make_cleanup_clear_parser_state): Likewise. * utils.h (make_cleanup_clear_parser_state): New function prototype. * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Update calls to write_exp* in order to pass the parser state. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. (stap_parse_single_operand): Likewise. (stap_parse_argument_1): Likewise. (stap_parse_argument): Use parser state. * stap-probe.h: Include "parser-defs.h". (struct stap_parse_info) <pstate>: New field. * c-exp.y (parse_type): Rewrite to use parser state. (yyparse): Redefine to c_parse_internal. (pstate): New global variable. (parse_number): Add "struct parser_state" argument. (write_destructor_name): Likewise. (type_exp): Update calls to write_exp* and similars in order to use parser state. (exp1, exp, variable, qualified_name, space_identifier, typename, typebase): Likewise. (write_destructor_name, parse_number, lex_one_token, classify_name, classify_inner_name, c_parse): Add "struct parser_state" argument. Update function to use parser state. * c-lang.h: Forward declare "struct parser_state". (c_parse): Add "struct parser_state" argument. * ada-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to ada_parse_internal. (pstate): New variable. (write_int, write_object_renaming, write_var_or_type, write_name_assoc, write_exp_op_with_string, write_ambiguous_var, type_int, type_long, type_long_long, type_float, type_double, type_long_double, type_char, type_boolean, type_system_address): Add "struct parser_state" argument. (exp1, primary, simple_exp, relation, and_exp, and_then_exp, or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix, var_or_type, aggregate, aggregate_component_list, positional_list, others, component_group, component_associations): Update calls to write_exp* and similar functions in order to use parser state. (ada_parse, write_var_from_sym, write_int, write_exp_op_with_string, write_object_renaming, find_primitive_type, write_selectors, write_ambiguous_var, write_var_or_type, write_name_assoc, type_int, type_long, type_long_long, type_float, type_double, type_long_double, type_char, type_boolean, type_system_address): Add "struct parser_state" argument. Adjust function to use parser state. * ada-lang.c (parse): Likewise. * ada-lang.h: Forward declare "struct parser_state". (ada_parse): Add "struct parser_state" argument. * ada-lex.l (processInt, processReal): Likewise. Adjust all calls to both functions. * f-exp.y (parse_type, parse_f_type): Rewrite macros to use parser state. (yyparse): Redefine macro to f_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp, subrange, typebase): Update calls to write_exp* and similars in order to use parser state. (parse_number): Adjust code to use parser state. (yylex): Likewise. (f_parse): New function. * f-lang.h: Forward declare "struct parser_state". (f_parse): Add "struct parser_state" argument. * jv-exp.y (parse_type, parse_java_type): Rewrite macros to use parser state. (yyparse): Redefine macro for java_parse_internal. (pstate): New variable. (push_expression_name, push_expression_name, insert_exp): Add "struct parser_state" argument. (type_exp, StringLiteral, Literal, PrimitiveType, IntegralType, FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess, FuncStart, MethodInvocation, ArrayAccess, PostfixExpression, PostIncrementExpression, PostDecrementExpression, UnaryExpression, PreIncrementExpression, PreDecrementExpression, UnaryExpressionNotPlusMinus, CastExpression, MultiplicativeExpression, AdditiveExpression, ShiftExpression, RelationalExpression, EqualityExpression, AndExpression, ExclusiveOrExpression, InclusiveOrExpression, ConditionalAndExpression, ConditionalOrExpression, ConditionalExpression, Assignment, LeftHandSide): Update calls to write_exp* and similars in order to use parser state. (parse_number): Ajust code to use parser state. (yylex): Likewise. (java_parse): New function. (push_variable): Add "struct parser_state" argument. Adjust code to user parser state. (push_fieldnames, push_qualified_expression_name, push_expression_name, insert_exp): Likewise. * jv-lang.h: Forward declare "struct parser_state". (java_parse): Add "struct parser_state" argument. * m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use parser state. (yyparse): Redefine macro to m2_parse_internal. (pstate): New variable. (type_exp, exp, fblock, variable, type): Update calls to write_exp* and similars to use parser state. (yylex): Likewise. (m2_parse): New function. * m2-lang.h: Forward declare "struct parser_state". (m2_parse): Add "struct parser_state" argument. * objc-lang.c (end_msglist): Add "struct parser_state" argument. * objc-lang.h: Forward declare "struct parser_state". (end_msglist): Add "struct parser_state" argument. * p-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to pascal_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp1, exp, qualified_name, variable): Update calls to write_exp* and similars in order to use parser state. (parse_number, yylex): Adjust code to use parser state. (pascal_parse): New function. * p-lang.h: Forward declare "struct parser_state". (pascal_parse): Add "struct parser_state" argument. * go-exp.y (parse_type): Rewrite macro to use parser state. (yyparse): Redefine macro to go_parse_internal. (pstate): New variable. (parse_number): Add "struct parser_state" argument. (type_exp, exp1, exp, variable, type): Update calls to write_exp* and similars in order to use parser state. (parse_number, lex_one_token, classify_name, yylex): Adjust code to use parser state. (go_parse): Likewise. * go-lang.h: Forward declare "struct parser_state". (go_parse): Add "struct parser_state" argument.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-10-02Constification of parse_linespec and fallout:Keith Seitz1-1/+1
https://sourceware.org/ml/gdb-patches/2013-09/msg01017.html https://sourceware.org/ml/gdb-patches/2013-09/msg01018.html https://sourceware.org/ml/gdb-patches/2013-09/msg01019.html https://sourceware.org/ml/gdb-patches/2013-09/msg01020.html
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-2/+1
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.
2012-11-12 * ada-lang.c (user_select_syms, ada_print_subexp): Pass flagsTom Tromey1-2/+4
to type-printing functions. * ada-lang.h (ada_print_type): Add argument. * ada-typeprint.c (print_array_type, print_variant_clauses, print_variant_part, print_selected_record_field_types, print_record_field_types, print_unchecked_union_type, print_func_type, ada_print_type): Add flags argument. (ada_print_typedef): Update. * c-exp.y (OPERATOR conversion_type_id): Update. * c-lang.h (c_print_type, c_type_print_base): Update. * c-typeprint.c (c_print_type, c_type_print_varspec_prefix, c_type_print_modifier, c_type_print_args, c_type_print_varspec_suffix, c_type_print_base): Add flags argument. * cp-valprint.c (cp_print_class_member): Update. * dwarf2read.c (dwarf2_compute_name): Update. * f-lang.h (f_print_type): Add argument. * f-typeprint.c (f_print_type): Add flags argument. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update. * go-lang.h (go_print_type): Add argument. * go-typeprint.c (go_print_type): Add flags argument. * jv-lang.h (java_print_type): Add argument. * jv-typeprint.c (java_type_print_base, java_print_type): Add flags argument. * language.c (unk_lang_print_type): Add flags argument. * language.h (struct language_defn) <la_print_type>: Add flags argument. (LA_PRINT_TYPE): Likewise. * m2-lang.h (m2_print_type): Add argument. * m2-typeprint.c (m2_print_type, m2_range, m2_typedef, m2_array, m2_pointer, m2_ref, m2_procedure, m2_long_set, m2_unbounded_array, m2_record_fields): Add flags argument. * p-lang.h (pascal_print_type, pascal_type_print_base, pascal_type_print_varspec_prefix): Add argument. * p-typeprint.c (pascal_print_type, pascal_type_print_varspec_prefix, pascal_print_func_args, pascal_type_print_varspec_suffix, pascal_type_print_base): Add flags argument. * symmisc.c (print_symbol): Update. * typeprint.c (type_print_raw_options, default_ptype_flags): New globals. (type_print): Update. * typeprint.h (struct type_print_options): New. (type_print_raw_options): Declare. (c_type_print_varspec_suffix, c_type_print_args): Add argument.
2012-03-01 * valprint.c (val_print): Update.Tom Tromey1-5/+5
* p-valprint (pascal_val_print): Return void. * p-lang.h (pascal_val_print): Return void. * m2-valprint.c (m2_val_print): Return void. * m2-lang.h (m2_val_print): Return void. * language.h (struct language_defn) <la_val_print>: Return void. * language.c (unk_lang_val_print): Return void. * jv-valprint.c (java_val_print): Return void. * jv-lang.h (java_val_print): Return void. * f-valprint.c (f_val_print): Return void. * f-lang.h (f_val_print): Return void. * d-valprint.c (d_val_print): Return void. (dynamic_array_type): Update. * d-lang.h (d_val_print): Return void. * c-valprint.c (c_val_print): Return void. * c-lang.h (c_val_print): Return void. * ada-valprint.c (ada_vada_val_print, ada_val_print_1): Return void. * ada-lang.h (ada_val_print): Return void.
2012-03-01 * value.h (value_print): Return void.Tom Tromey1-2/+2
* valprint.c (value_print): Return void. * p-valprint.c (pascal_value_print): Return void. * p-lang.h (pascal_value_print): Return void. * language.h (struct language_defn) <la_value_print>: Return void. * language.c (unk_lang_value_print): Return void. * jv-valprint.c (java_value_print): Return void. * jv-lang.h (java_value_print): Return void. * f-valprint.c (c_value_print): Don't declare. Include c-lang.h. * c-valprint.c (c_value_print): Return void. * c-lang.h (c_value_print): Return void. * ada-valprint.c (ada_value_print): Return void. * ada-lang.h (ada_value_print): Return void.