summaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
Commit message (Collapse)AuthorAgeFilesLines
* New GDB/MI commands to catch Ada exceptionsJoel Brobecker2013-10-111-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces two new GDB/MI commands implementing the equivalent of the "catch exception" and "catch assert" GDB/CLI commands. gdb/ChangeLog: * breakpoint.h (init_ada_exception_breakpoint): Add parameter "enabled". * breakpoint.c (init_ada_exception_breakpoint): Add parameter "enabled". Set B->ENABLE_STATE accordingly. * ada-lang.h (ada_exception_catchpoint_kind): Move here from ada-lang.c. (create_ada_exception_catchpoint): Add declaration. * ada-lang.c (ada_exception_catchpoint_kind): Move to ada-lang.h. (create_ada_exception_catchpoint): Make non-static. Add new parameter "disabled". Use it in call to init_ada_exception_breakpoint. (catch_ada_exception_command): Add parameter "enabled" in call to create_ada_exception_catchpoint. (catch_assert_command): Likewise. * mi/mi-cmds.h (mi_cmd_catch_assert, mi_cmd_catch_exception): Add declarations. * mi/mi-cmds.c (mi_cmds): Add the "catch-assert" and "catch-exception" commands. * mi/mi-cmd-catch.c: Add #include "ada-lang.h". (mi_cmd_catch_assert, mi_cmd_catch_exception): New functions.
* Add "ada_" prefix to enum ada_exception_catchpoint_kindJoel Brobecker2013-10-111-70/+70
| | | | | | | | | | | | | This is in preparation for making that type public, in order to be able to use make create_ada_exception_catchpoint public as well, making it usable from the GDB/MI implementation. gdb/ChangeLog: * ada-lang.c (enum ada_exception_catchpoint_kind): Renames "enum exception_catchpoint_kind". Replace the "ex_" prefix of all its enumerates with "ada_". Update the rest of this file throughout.
* Rework a bit Ada exception catchpoint support (in prep for GDB/MI)Joel Brobecker2013-10-111-50/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks a bit how the different steps required to insert an Ada exception catchpoints are organized. They used to be: 1. Call a "decode" function which does: 1.a. Parse the command and its arguments 1.b. Create a SAL & OPS from some of those arguments 2. Call create_ada_exception_catchpoint using SAL as well as some of the arguments extracted above. The bulk of the change consists in integrating step (1.b) into step (2) in order to turn create_ada_exception_catchpoint into a function whose arguments are all user-level concepts. This paves the way from a straightforward implementation of the equivalent commands in the GDB/MI interpreter. gdb/ChangeLog: * ada-lang.c (ada_decode_exception_location): Delete. (create_ada_exception_catchpoint): Remove arguments "sal", "addr_string" and "ops". Add argument "ex_kind" instead. Adjust implementation accordingly, calling ada_exception_sal to get the entities it no longer gets passed as arguments. Document the function's arguments. (catch_ada_exception_command): Use catch_ada_exception_command_split instead of ada_decode_exception_location, and update call to create_ada_exception_catchpoint. (catch_ada_assert_command_split): Renames ada_decode_assert_location. Remove parameters "addr_string" and "ops", and now returns void. Adjust implementation accordingly. Update the function documentation. (catch_assert_command): Use catch_ada_assert_command_split instead of ada_decode_assert_location. Update call to create_ada_exception_catchpoint.
* [Ada] psymbol search failure due to comparison function discrepancyJoel Brobecker2013-10-081-7/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upon trying to print the value of a variant record, a user noticed the following problem: (gdb) print rt warning: Unknown upper bound, using 1. warning: Unknown upper bound, using 1. $1 = (a => ((a1 => (4), a2 => (4)), (a1 => (8), a2 => (8)))) The expected output is: (gdb) print rt $1 = (a => ((a1 => (4, 4), a2 => (8, 8)), (a1 => (4, 4), a2 => (8, 8)))) The problems comes from the fact that components "a1" and "a2" are defined as arrays whose upper bound is dynamic. To determine the value of that upper bound, GDB relies on the GNAT encoding and searches for the parallel ___U variable. Unfortunately, the search fails while doing a binary search inside the partial symtab of the unit where the array and its bound (and therefore the parallel ___U variable) are defined. It fails because partial symbols are sorted using strcmp_iw_ordered, while Ada symbol lookups are performed using a different comparison function (ada-lang.c:compare_names). The two functions are supposed to be compatible, but a change performed in April 2011 modified strcmp_iw_ordered, introducing case-sensitivity issues. As a result, the two functions would now disagree when passed the following two arguments: string1="common__inner_arr___SIZE_A_UNIT" string2="common__inner_arr__T4s___U" The difference starts at "_SIZE_A_UNIT" vs "T4s___U". So, it's mostly a matter of comparing '_' with 'T'. On the one hand, strcmp_iw_ordered would return -1, while compare_names returned 11. The change that made all the difference is that strcmp_iw_ordered now performs a case-insensitive comparison, and only resorts to case-sentitive comparison if the first comparison finds an equality. This changes everything, because while 'T' (84) and 't' (116) are on opposite sides of '_' (95). This patch aims at restoring the compatibility between the two functions, by adding case-sensitivity handling in the Ada comparison function. gdb/ChangeLog: * ada-lang.c (compare_names_with_case): Renamed from compare_names, adding a new parameter "casing" and its handling. New function documentation. (compare_names): New function, implemented using compare_names_with_case.
* [Ada] Remove unnecessary ada_exception_sal advance declaration.Joel Brobecker2013-10-081-3/+0
| | | | | | gdb/ChangeLog: * ada-lang.c (ada_exception_sal): Remove advance declaration.
* wrong "catch exception" error message when finding trampoline msym.Joel Brobecker2013-10-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When building the program with the shared GNAT runtime, the debugger is unable to insert Ada exception catchpoints until that runtime has been mapped to memory. In other words, we expect the user to start the program first, before attempting to insert that catchpoint. The detection mechanism that tries to provide some useful tips to the user fails when the program itself contains a trampoline symbol matching the symbol that the catchpoint is trying to use. This results in the following error message: (gdb) catch exception Your Ada runtime appears to be missing some debugging information. Cannot insert Ada exception catchpoint in this configuration. Instead, we expected the following error message: (gdb) catch exception Unable to insert catchpoint. Try to start the program first. gdb/ChangeLog: * ada-lang.c (ada_has_this_exception_support): Ignore mst_solib_trampoline minimal symbols.
* * symfile.h (struct quick_symbol_functions): Reorg arg list ofDoug Evans2013-09-251-4/+4
| | | | | | map_matching_symbols so objfile is first. All uses updated. * dwarf2read.c (dw2_map_matching_symbols): Update signature. * psymtab.c (map_matching_symbols_psymtab): Update signature.
* Code cleanup: Add objfile_name accessorJan Kratochvil2013-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gdb/ 2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com> Code cleanup: Add objfile_name accessor function. * ada-lang.c (is_known_support_routine): Use objfile_name. * auto-load.c (source_gdb_script_for_objfile) (auto_load_objfile_script): Likewise. * coffread.c (coff_symtab_read, read_one_sym): Likewise. * dbxread.c (dbx_symfile_read): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. * dwarf2loc.c (locexpr_describe_location_piece): Likewise. * dwarf2read.c (dwarf2_get_dwz_file, dwarf2_read_index) (dw2_symtab_iter_next, dw2_expand_symtabs_matching) (lookup_dwp_signatured_type, lookup_dwo_unit) (dwarf2_build_psymtabs_hard, scan_partial_symbols, process_queue) (fixup_go_packaging, process_imported_unit_die, dwarf2_physname) (read_import_statement, create_dwo_cu, open_and_init_dwp_file) (lookup_dwo_cutu, read_call_site_scope, dwarf2_ranges_read) (dwarf2_record_block_ranges, read_common_block, read_typedef) (read_subrange_type, load_partial_dies, read_partial_die) (read_addr_index_1, read_str_index, dwarf_decode_lines_1) (die_containing_type, build_error_marker_type, lookup_die_type) (follow_die_ref_or_sig, follow_die_ref, dwarf2_fetch_die_loc_sect_off) (dwarf2_fetch_constant_bytes, follow_die_sig, get_signatured_type) (get_DW_AT_signature_type, write_psymtabs_to_index) (save_gdb_index_command): Likewise. * elfread.c (find_separate_debug_file_by_buildid, elf_symfile_read): Likewise. * expprint.c (dump_subexp_body_standard): Likewise. * gdbtypes.c (type_name_no_tag_or_error): Likewise. * jit.c (jit_object_close_impl): Use the objfile field name renamed to original_name. * linux-thread-db.c (try_thread_db_load_from_pdir_1): New variable obj_name, use objfile_name for it, use the variable. (try_thread_db_load_from_pdir, has_libpthread, thread_db_new_objfile): Use objfile_name. * machoread.c (macho_symtab_read, macho_check_dsym) (macho_symfile_relocate): Likewise. * maint.c (maintenance_translate_address): Likewise. * minidebug.c (find_separate_debug_file_in_section): Likewise. * minsyms.c (install_minimal_symbols): Likewise. * objfiles.c (allocate_objfile): Use the objfile field name renamed to original_name. (filter_overlapping_sections): Use objfile_name. (objfile_name): New function. * objfiles.h (struct objfile): Rename field name to original_name. (objfile_name): New prototype. * printcmd.c (sym_info, address_info): Use objfile_name. * probe.c (parse_probes, collect_probes, compare_probes) (info_probes_for_ops): Likewise. * progspace.c (clone_program_space): Likewise. * psymtab.c (require_partial_symbols, dump_psymtab, allocate_psymtab) (maintenance_info_psymtabs): Likewise. * python/py-auto-load.c (gdbpy_load_auto_script_for_objfile) (source_section_scripts): Likewise. * python/py-objfile.c (objfpy_get_filename): Likewise. * python/py-progspace.c (pspy_get_filename): Likewise. * solib-aix.c (solib_aix_get_toc_value): Likewise. * solib-som.c (match_main, som_solib_section_offsets): Likewise. * solib.c (solib_read_symbols): Likewise. * stabsread.c (scan_file_globals): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (symbol_file_clear, separate_debug_file_exists) (find_separate_debug_file_by_debuglink): Likewise. (reread_symbols): Likewise. Use the objfile field name renamed to original_name. (allocate_symtab): Use objfile_name. * symmisc.c (print_symbol_bcache_statistics, print_objfile_statistics) (dump_objfile, dump_msymbols, dump_symtab_1) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs): Likewise. * target.c (target_translate_tls_address, target_info): Likewise. * xcoffread.c (xcoff_initial_scan): Make variable name const. Use objfile_name.
* remove msymbol_objfileTom Tromey2013-08-051-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is another patch in my ongoing series to "split" objfile to share more read-only data across inferiors. See http://sourceware.org/gdb/wiki/ObjfileSplitting When symbols are finally shared, there will be no back-link from the symbol to its containing objfile, because there may be more than one such objfile. So, all such back-links must be removed. One hidden back-link is the msymbol_objfile function. Since (eventually) a symbol may appear in more than one objfile, trying to look up the objfile given just a symbol cannot work. This patch removes msymbol_objfile in favor of using a bound minimal symbol. It introduces a new function to make this conversion simpler in some spots. The bonus of this patch is that using msymbol_objfile is slower than simply looking up the owning objfile in the first place. Built and regtested on x86-64 Fedora 18. * ada-exp.y (write_var_or_type): Use bound_minimal_symbol. * ada-lang.c (ada_lookup_simple_minsym): Return bound_minimal_symbol. * ada-lang.h (ada_lookup_simple_minsym): Update. * c-exp.y (variable): Use lookup_bound_minimal_symbol. * f-exp.y (variable): Use lookup_bound_minimal_symbol. * go-exp.y (variable): Use lookup_bound_minimal_symbol. * jv-exp.y (push_expression_name): Use lookup_bound_minimal_symbol. * m2-exp.y (variable): Use lookup_bound_minimal_symbol. * minsyms.c (msymbol_objfile): Remove. (lookup_minimal_symbol_internal): New function, from lookup_minimal_symbol. (lookup_minimal_symbol): Rewrite using lookup_minimal_symbol_internal. (lookup_bound_minimal_symbol): New function. * minsyms.h (msymbol_objfile): Remove. (lookup_bound_minimal_symbol): Declare. * p-exp.y (variable): Use lookup_bound_minimal_symbol. * parse.c (write_exp_msymbol): Change parameter to a bound_minimal_symbol. (write_dollar_variable): Use lookup_bound_minimal_symbol. * parser-defs.h (write_exp_msymbol): Update. * printcmd.c (address_info): Use lookup_bound_minimal_symbol. * symfile.c (simple_read_overlay_table): Use lookup_bound_minimal_symbol. * symtab.c (skip_prologue_sal): Don't use msymbol_objfile. (search_symbols): Likewise. (print_msymbol_info): Take a bound_minimal_symbol argument. (symtab_symbol_info, rbreak_command): Update. * symtab.h (struct symbol_search) <msymbol>: Change type to bound_minimal_symbol. * valops.c (find_function_in_inferior): Use lookup_bound_minimal_symbol. * value.c (value_fn_field): Use lookup_bound_minimal_symbol.
* ada-lang.c:coerce_unspec_val_to_type: Preserve laziness.Joel Brobecker2013-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ada-lang.c:coerce_unspec_val_to_type does: if (value_lazy (val) || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) result = allocate_value_lazy (type); else { result = allocate_value (type); memcpy (value_contents_raw (result), value_contents (val), TYPE_LENGTH (type)); } set_value_component_location (result, val); set_value_bitsize (result, value_bitsize (val)); set_value_bitpos (result, value_bitpos (val)); set_value_address (result, value_address (val)); set_value_optimized_out (result, value_optimized_out (val)); Notice that before value_optimized_out was made to auto-fetch lazy values, VAL would end up still lazy if it was lazy on entry. It's not really a problem here if VAL is lazy, and VAL->optimized_out is 0, because RESULT is also left lazy. IOW, this just wants to copy the VAL->optimized_out flag to RESULT->optimized_out, nothing else. As a side-effect of the change in value_optimized_out, the following testcase now regresses. Consider: type Small is range -64 .. 63; for Small'Size use 7; type Arr is array (1..10) of Small; pragma Pack (Arr); type Arr_Ptr is access Arr; An_Arr_Ptr : Arr_Ptr := new Arr'(10, 20, 30, 40, 50, 60, 62, 63, -23, 42); Trying to print one element of An_Arr_Ptr yields: (gdb) p an_arr_ptr(3) Cannot access memory at address 0x0 The patch adds the value_optimized_out_const function for that, allowing us to avoid trying to fetch a value at a dummy address. (I found this out by grepping for set_value_optimized_out and trying to convert the uses I found to instead allocate the value with allocate_optimized_out_value.) Tested on x86_64 Fedora 17. gdb/ 2013-07-09 Pedro Alves <palves@redhat.com> * ada-lang.c (coerce_unspec_val_to_type): Use value_optimized_out_const. * value.c (value_optimized_out_const): New function. * value.h (value_optimized_out_const): New declaration.
* * ada-lang.c (is_known_support_routine): Add explicit free ofKeith Seitz2013-05-221-7/+19
| | | | | | | | | | | | | | | 'func_name' from find_frame_funname. (ada_unhandled_exception_name_addr_from_raise): Add cleanups for func_name from find_frame_funname. * python/py-frame.c (frapy_name): Add explicit free of 'name' from find_frame_funname. * stack.c (find_frame_funname): Add comment explaining that funcp must be freed by the caller. Return copy of symbol names instead of pointers. (print_frame): Add a cleanup for 'funname' from find_frame_funname. * stack.h (find_frame_funname): Remove "const" from 'funname' parameter.
* [Ada] Fix cleanup leak in ada-lang.c:old_renaming_is_invisibleJoel Brobecker2013-05-211-4/+12
| | | | | | gdb/ChangeLog: * ada-lang.c (old_renaming_is_invisible): Fix cleanup leak.
* Missing do_cleanups in ada_make_symbol_completion_list.Joel Brobecker2013-05-161-0/+2
| | | | | | | | | | | | | | | | | | | | | This results in an internal-warning when trying the completion when in Ada mode: (gdb) b simple<TAB> /[...]/cleanups.c:265: internal-warning: restore_my_cleanups has found a stale cleanup A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) gdb/ChangeLog: * ada-lang.c (ada_make_symbol_completion_list): Make sure all cleanups are done before returning from this function. gdb/testsuite/ChangeLog: * gdb.ada/complete.exp: Add test verifying completion using the "tab" key.
* * ada-lang.c (ada_value_primitive_packed_val): Don'tTom Tromey2013-05-061-1/+0
| | | | | | | call value_incref. * value.c (set_value_parent): Incref the new parent and decref the old parent. (value_copy, value_primitive_field): Use set_value_parent.
* -Wpointer-sign: ada-lang.c, ada-tasks.c.Pedro Alves2013-04-191-1/+2
| | | | | | | | | | | We're reading strings using the target memory access routines, which work with raw bytes, so we need a couple casts. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * ada-lang.c (print_it_exception): Add cast to gdb_byte *. * ada-tasks.c (read_fat_string_value): Likewise.
* -Wpointer-sign: char -> gdb_byte.Pedro Alves2013-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Wpointer-sign catches all these cases across the codebase that should be using gdb_byte for raw target bytes. I think these are all obvious, hence I've collapsed into a single patch. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change type to gdb_byte[]. (aarch64_breakpoint_from_pc): Change return type to gdb_byte *. * ada-lang.c (ada_value_assign): Use gdb_byte. * alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[]. (alphanbsd_sigtramp_offset): Use gdb_byte. * arm-linux-tdep.c (arm_linux_arm_le_breakpoint) (arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint) (eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint) (arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint) (arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[]. * arm-tdep.c (arm_stub_unwind_sniffer) (arm_displaced_init_closure): Use gdb_byte. (arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint) (arm_default_thumb_le_breakpoint) (arm_default_thumb_be_breakpoint): Change type to gdb_byte[]. * arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint, thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *. * arm-wince-tdep.c (arm_wince_le_breakpoint) (arm_wince_thumb_le_breakpoint): Change type to gdb_byte[]. * armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint) (arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint) (arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[]. * armobsd-tdep.c (arm_obsd_thumb_le_breakpoint) (arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[]. * cris-tdep.c (push_stack_item, cris_push_dummy_call) (cris_store_return_value, cris_extract_return_value): Use gdb_byte. (constraint): Change type of parameter to char * from signed char*. Use gdb_byte. * dwarf2loc.c (read_pieced_value, write_pieced_value): Change type of local buffer to gdb_byte *. * dwarf2read.c (read_index_from_section): Use gdb_byte. (create_dwp_hash_table): Change type of locals to gdb_byte *. (add_address_entry): Change type of local buffer to gdb_byte[]. * frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr) (frv_push_dummy_call): Use gdb_byte. * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code) (hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide) (hppa_hpux_supply_save_state): Use gdb_byte. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_convert_code_addr_to_fptr): Use gdb_byte. * ia64-tdep.c (extract_bit_field, replace_bit_field) (slotN_contents, replace_slotN_contents): Change type of parameter to gdb_byte *. (fetch_instruction, ia64_pseudo_register_write) (ia64_register_to_value, ia64_value_to_register) (ia64_extract_return_value, ia64_store_return_value) (ia64_push_dummy_call): Use gdb_byte. * m32c-tdep.c (m32c_return_value): Remove cast. * m68hc11-tdep.c (m68hc11_pseudo_register_write) (m68hc11_push_dummy_call, m68hc11_store_return_value): Use gdb_byte. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte. * mn10300-tdep.c (mn10300_store_return_value) (mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use gdb_byte. * moxie-tdep.c (moxie_process_readu): Use gdb_byte. (moxie_process_record): Remove casts. * ppc-ravenscar-thread.c (supply_register_at_address) (ppc_ravenscar_generic_store_registers): Use gdb_byte. * ravenscar-thread.c (get_running_thread_id): Use gdb_byte. * remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte. * remote-mips.c (mips_xfer_memory): Use gdb_byte. * remote.c (compare_sections_command): Use gdb_byte. * score-tdep.c (score7_free_memblock): Change type of parameter to gdb_byte *. * sh-tdep.c (sh_justify_value_in_reg): Change return type to gdb_byte *. Use gdb_byte. (sh_push_dummy_call_fpu): Use gdb_byte. (sh_extract_return_value_nofpu, sh_extract_return_value_fpu) (sh_store_return_value_nofpu, sh_store_return_value_fpu) (sh_register_convert_to_virtual, sh_register_convert_to_raw): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte. * sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte. (sh64_store_return_value, sh64_register_convert_to_virtual): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh64_pseudo_register_write): Use gdb_byte. * solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'. * solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte buffer. (irix_current_sos): Use gdb_byte. * solib-som.c (som_current_sos): Use gdb_byte. * sparc-ravenscar-thread.c (supply_register_at_address) (sparc_ravenscar_generic_store_registers): Use gdb_byte. * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'. * spu-tdep.c (spu_get_overlay_table): Use gdb_byte. * tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to 'gdb_byte *'. * tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to 'gdb_byte *'. * tracepoint.c (tfile_fetch_registers): Use gdb_byte. * xstormy16-tdep.c (xstormy16_extract_return_value) (xstormy16_store_return_value): Change parameter type to 'gdb_byte *'. Adjust. (xstormy16_push_dummy_call): Use gdb_byte. * xtensa-tdep.c (xtensa_scan_prologue, call0_ret) (call0_analyze_prologue, execute_code): Use gdb_byte.
* * ada-lang.c (ada_decode_symbol): Check and set 'ada_mangled'.Tom Tromey2013-04-081-17/+15
| | | | | | | | | | | | | | | | | | | | | | | Use symbol's obstack, not an objfile. * coffread.c (process_coff_symbol): Update. * dwarf2read.c (fixup_go_packaging, new_symbol_full): Update. * jv-lang.c (add_class_symbol): Update. * mdebugread.c (new_symbol): Update. * minsyms.c (prim_record_minimal_symbol_full) (terminate_minimal_symbol_table): Update. * psymtab.c (add_psymbol_to_bcache): Clear entire symbol. Update. * stabsread.c (define_symbol, read_enum_type): Update. * symtab.c (symbol_set_demangled_name, symbol_get_demangled_name): Handle Ada specially. (symbol_set_language): Add 'obstack' argument. (symbol_set_names): Update. (symbol_natural_name, symbol_demangled_name): Always use ada_decode_symbol. * symtab.h (struct general_symbol_info) <language_specific::obstack>: New field. <ada_mangled>: New field. (SYMBOL_SET_LANGUAGE): Add 'obstack' argument. (symbol_set_language): Update.
* Constify strings in tracepoint.c, lookup_cmd and the completers.Pedro Alves2013-03-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
* More invalid pointer to pointer conversions.Pedro Alves2013-03-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a follow up to: http://sourceware.org/ml/gdb-patches/2013-03/msg00449.html In a nutshell, casts between 'char **' <-> 'unsigned char **' and 'char **' <-> 'const char **' are invalid. I grepped for "\*\*) &" and found these. There's another one in demangle.c, but I've split fixing that one to a separate patch. I think the ada_decode_symbol change is perhaps the one that could be surprising. The function's description has this comment, which makes things much clearer: The GSYMBOL parameter is "mutable" in the C++ sense: logically const, but nevertheless modified to a semantically equivalent form when a decoded name is cached in it. */ const char * ada_decode_symbol (const struct general_symbol_info *gsymbol) With that out of the way, I think the patch ends up being pretty obvious. Tested on x86_64 Fedora 17. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_decode_symbol): Cast away constness of GSYMBOL rather than casting 'const char * const *' to 'const char **'. * ada-lex.l (processInt): Make "trailer" local const. Remove 'const char **' cast. * arm-linux-tdep.c (arm_stap_parse_special_token): Add 'char *' locals, and use those as strtol output pointer, instead than doing invalid casts to from 'const char **' to 'char **'. (_initialize_demangle): Remove cast. * i386-tdep.c (i386_stap_parse_special_token): : Add 'char *' locals, and use those as strtol output pointer, instead than doing invalid casts to from 'const char **' to 'char **'. * solib-dsbt.c (dsbt_get_initial_loadmaps): Remove 'gdb_byte**' casts. * stap-probe.c (stap_parse_register_operand) (stap_parse_single_operand): Likewise.
* * ada-lang.c (ada_read_renaming_var_value): Pass constKeith Seitz2013-03-121-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
* * ada-lang.c (ada_lookup_symbol_list_worker): New function, contentsDoug Evans2013-03-051-44/+69
| | | | | | | | | | | | | | | | | | | of old ada_lookup_symbol_list. In !full_search case, don't search superblocks. (ada_lookup_symbol_list): Delete arg full_search, all callers updated. Call ada_lookup_symbol_list_worker. (ada_iterate_over_symbols): Call ada_lookup_symbol_list_worker. * ada-lang.h (ada_lookup_symbol_list): Update. * language.h (language_defn): Update comment for la_iterate_over_symbols. * linespec.c (iterate_over_file_blocks): New function. (iterate_over_all_matching_symtabs): Call it. (lookup_prefix_sym): Ditto. (get_current_search_block): New function. (get_search_block): Delete. (find_label_symbols): Call get_current_search_block. (add_matching_symbols_to_info): Call iterate_over_file_blocks. * symtab.c (iterate_over_symbols): Don't search superblocks.
* gdb/Jan Kratochvil2013-02-031-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
* 2013-02-01 Aleksandar Ristovski <aristovski@qnx.com>Aleksandar Ristovski2013-02-011-3/+0
| | | | | | * ada-lang.c (assign_aggregate): Remove unused 'is_array_aggregate'. Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00732.html
* * ada-lang.h (ada_decode_symbol): Make return type const.Tom Tromey2013-01-241-3/+3
| | | | * ada-lang.c (ada_decode_symbol): Likewise.
* * symfile.h (obsavestring): Don't declare.Tom Tromey2013-01-211-2/+2
| | | | | | | | | | | | | | | * symfile.c (obsavestring): Remove. * ada-exp.y: Use obstack_copy0, not obsavestring. * ada-lang.c: Use obstack_copy0, not obsavestring. * coffread.c: Use obstack_copy0, not obsavestring. * cp-namespace.c: Use obstack_copy0, not obsavestring. * dbxread.c: Use obstack_copy0, not obsavestring. * dwarf2read.c: Use obstack_copy0, not obsavestring. * jit.c: Use obstack_copy0, not obsavestring. * mdebugread.c: Use obstack_copy0, not obsavestring. * psymtab.c: Use obstack_copy0, not obsavestring. * stabsread.c: Use obstack_copy0, not obsavestring. * xcoffread.c: Use obstack_copy0, not obsavestring.
* Fixes for solaris compilerAnthony Green2013-01-091-1/+1
|
* Update years in copyright notice for the GDB files.Joel Brobecker2013-01-011-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.
* gdb/Jan Kratochvil2012-12-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ada-lang.c (is_known_support_routine): New variable fullname. Use access call to verify the symtab_to_fullname result. * breakpoint.c (print_breakpoint_location, update_static_tracepoint): Remove NULL check of symtab_to_fullname result. * cli/cli-cmds.c (edit_command): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * python/py-symtab.c (stpy_fullname): Likewise. * source.c (symtab_to_fullname): Update function comment. Rename variable r to fd, move it to inner block. Always provide non-NULL result. (print_source_lines_base): Remove NULL check of symtab_to_fullname result. * stack.c (print_frame): Likewise. * symtab.c (iterate_over_some_symtabs, find_line_symtab, sources_info): Likewise. * tracepoint.c (print_one_static_tracepoint_marker): Likewise. gdb/doc/ * gdb.texinfo (GDB/MI Data Manipulation) (fullname): Make it always present. (GDB/MI File Commands) (-file-list-exec-source-files): Make the fullname output always present. gdb/testsuite/ * gdb.mi/mi-fullname-deleted.exp: New file.
* * ada-lang.c (ada_make_symbol_completion_list): Add 'code'Tom Tromey2012-12-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument, assertion. * c-exp.y (typebase): Add completion productions. * completer.c (expression_completer): Handle tag completion. * expression.h (parse_expression_for_completion): Add argument. * f-lang.c (f_make_symbol_completion_list): Add 'code' argument. * language.h (struct language_defn) <la_make_symbol_completion_list>: Add 'code' argument. * parse.c (expout_tag_completion_type, expout_completion_name): New globals. (mark_struct_expression): Add assertion. (mark_completion_tag): New function. (parse_exp_in_context): Initialize new globals. (parse_expression_for_completion): Add 'code' argument. Handle tag completion. * parser-defs.h (mark_completion_tag): Declare. * symtab.c (default_make_symbol_completion_list_break_on): Add 'code' argument. Update. (default_make_symbol_completion_list): Add 'code' argument. (make_symbol_completion_list): Update. (make_symbol_completion_type): New function. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list): Update. (make_symbol_completion_type): Declare. testsuite * gdb.base/break1.c (enum some_enum, union some_union): New. (some_enum_global, some_union_global, some_value): New globals. * gdb.base/completion.exp: Add tag completion tests.
* * ada-exp.y (write_object_renaming, write_var_or_type)Tom Tromey2012-12-031-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (write_ambiguous_var, write_var_from_sym): Make blocks const. * ada-lang.c (replace_operator_with_call) (find_old_style_renaming_symbol): Make blocks const. * ada-lang.h (ada_find_renaming_symbol): Update. (struct ada_symbol_info) <block>: Now const. * breakpoint.c (watch_command_1): Update. * breakpoint.h (struct watchpoint) <exp_valid_block, cond_exp_valid_block>: Now const. * c-exp.y (classify_inner_name, classify_name): Make block argument const. * expprint.c (print_subexp_standard) <OP_VAR_VALUE>: Make 'b' const. * expression.h (innermost_block, parse_exp_1): Update. (union exp_element) <block>: Now const. * gdbtypes.c (lookup_template_type, lookup_enum, lookup_union) (lookup_struct): Make block argument const. * gdbtypes.h (lookup_template_type): Update. * go-exp.y (classify_name, classify_packaged_name) (package_name_p): Make block argument const. * objc-lang.c (lookup_struct_typedef): Make block argument const. * objc-lang.h (lookup_struct_typedef): Update. * parse.c (parse_exp_in_context, parse_exp_1) (write_exp_elt_block): Make block arguments const. (expression_context_block, innermost_block): Now const. * parser-defs.h (write_exp_elt_block): Update. (expression_context_block, innermost_block, block_found): Now const. * printcmd.c (struct display) <block>: Now const. * symtab.h (lookup_struct, lookup_union, lookup_enum): Update. * valops.c (address_of_variable): Make block argument const. * value.h (value_of_variable): Update. * varobj.c (struct varobj_root) <valid_block>: Now const.
* Strip interface tags from visible fieldsJerome Guitton2012-11-291-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | The following Ada type: type Circle is new Shape and Drawable with record Center : Point; Radius : Natural; end record; ...is displayed as follow in GDB: (gdb) ptype circle type = new classes.shape with record V51s: ada.tags.interface_tag; center: classes.point; radius: natural; end record V51s is an internal field that is of no interest for the user. It should not be displayed. gdb/ChangeLog: * ada-lang.c (ada_is_interface_tag): New function. (ada_is_ignored_field): Add interface tags to the list of ignored fields.
* Full view of interface-wide typesJerome Guitton2012-11-291-21/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For displaying the full view of a class-wide object, GDB relies on the assumption that this view will have the same address as the address of the object. In the case of simple inheritance, this assumption is correct; the proper type is deduced by decoding the tag of the object and converting the result to this full-view type. Consider for example an abstract class Shape, a child Circle which implements an interface Drawable, and the corresponding following objects: My_Circle : Circle := ((1, 2), 3); My_Shape : Shape'Class := Shape'Class (My_Circle); My_Drawable : Drawable'Class := Drawable'Class (My_Circle); To display My_Shape, the debugger first extracts the tag (an internal field, usually the first one of the record): (gdb) p my_shape'address $2 = (system.address) 0x8063e28 (gdb) x/x my_shape'address 0x8063e28 <classes__my_shape>: 0x08059ec4 Then the type specific data and the expanded name of the tag is read from there: (gdb) p my_shape'tag $3 = (access ada.tags.dispatch_table) 0x8059ec4 (classes.circle) To get the full view, the debugger converts to the corresponding type: (gdb) p {classes.circle}0x8063e28 $4 = (center => (x => 1, y => 2), radius => 3) Now, in the case of multiple inheritance, the assumption does not hold anymore. The address that we have usually points to some place lower. The offset to the original address is saved in the field Offset_To_Top of the metadata that are above the tag, at address obj'tag - 8. In the case of my_shape, this offset is 0: (gdb) x/x my_shape'tag - 8 0x8059ebc <classes__circleT+12>: 0x00000000 ...but in the case of an interface-wide object, it is not null: (gdb) x/x my_drawable'tag - 8 0x8063b28 <classes__classes__circle_classes__drawable1T56s+12>: 0x00000004 (gdb) p {classes.circle}(my_drawable'address - 4) $7 = (center => (x => 1, y => 2), radius => 3) The following change handles this relocation in the most common cases. Remaining cases that are still to be investigated are signaled by comments. gdb/ChangeLog: * ada-lang.h (ada_tag_value_at_base_address): New function declaration. * ada-lang.c (is_ada95_tag, ada_tag_value_at_base_address): New functions. (ada_to_fixed_type_1, ada_evaluate_subexp): Let ada_tag_base_address relocate the class-wide value if need be. (ada_value_struct_elt, ada_value_ind, ada_coerce_ref): Let ada_tag_value_at_base_address relocate the class-wide access/ref before dereferencing it. * ada-valprint.c (ada_val_print_1): Relocate to base address before displaying the content of an interface-wide ref. gdb/testsuite/ChangeLog: * gdb.ada/ptype_tagged_param.exp: Adjust expected output in ptype test.
* Handle other cases than EVAL_NORMAL in the default caseJerome Guitton2012-11-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In the evaluation of an expression in Ada mode, the default case unwraps the argument unconditionally. For an object of a variant record type, this unwrapping builds a fixed type from the specification of the variant type and the actual values of the object's discriminants. It means that unwrapping needs the "proper" value for the object, not just a zero value with the proper type. When not in EVAL_NORMAL, we cannot assume that the evaluation returns such a proper value; it may well return a zero value of the appropriate type e.g in EVAL_AVOID_SIDE_EFFECTS. It is wrong to try to unwrap in that case. In particular, a problem shows up when using expression of the form {VARIANT_TYPE}OBJ. GDB first evaluates this expression in EVAL_AVOID_SIDE_EFFECTS to compute the type, the evaluation of OBJ in most cases returns a zero value of its type, and as UNOP_MEMVAL is mapped to the default case its evaluation ends up trying to read memory around address 0. gdb/ChangeLog: * ada-lang.c (ada_evaluate_subexp): Unwrap only in EVAL_NORMAL.
* * ada-lang.c (user_select_syms): Use SYMBOL_SYMTAB.Tom Tromey2012-11-261-1/+1
| | | | | | * dwarf2read.c (dw2_find_symbol_file, fixup_go_packaging): Use SYMBOL_SYMTAB. * skip.c (skip_info): Use SYMBOL_SYMTAB.
* * ada-lang.c (user_select_syms, ada_print_subexp): Pass flagsTom Tromey2012-11-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [Ada] use lbasename when testing if file is part of Ada runtime.Joel Brobecker2012-10-241-1/+1
| | | | | | | | | | | | | | | | | We use a list of regular expressions to match a symtab filenames against the names of the files in the Ada runtime. These regular expressions do assume that the filename is a basename, however. So make sure to evaluate these regular expressions against the symtab's filename. Without this patch, we run into problems when the Ada runtime was built using a project file (through gprbuild). gdb/ChangeLog: * ada-lang.c (is_known_support_routine): Use lbasename when matching the symtab's filename against known_runtime_file_name_patterns.
* [Ada] Allow assignment to wide string.Joel Brobecker2012-10-241-3/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following variable declaration... Www : Wide_String := "12345"; ... this patch allows the following assignment to work: (gdb) set variable www := "qwert" Without this patch, the debugger rejects the assignment because the size of the array elements are different: (gdb) set www := "asdfg" Incompatible types in assignment (on the lhs, we have an array of 2-bytes elements, and on the rhs, we have a standard 1-byte string). gdb/ChangeLog: * ada-lang.c (ada_same_array_size_p): New function. (ada_promote_array_of_integrals): New function. (coerce_for_assign): Add handling of arrays where the elements are integrals of a smaller size than the size of the target array element type. gdb/testsuite/ChangeLog: * gdb.ada/set_wstr: New testcase.
* [Ada] Pointers to unconstrained arrays inside variant record.Joel Brobecker2012-10-241-14/+24
| | | | | | | | | | | | gdb/ChangeLog: * ada-lang.c (ada_template_to_fixed_record_type_1): Do not strip typedef layer when computing the fixed type's field type, only when computing its size. gdb/testsuite/ChangeLog: * gdb.ada/unc_arr_ptr_in_var_rec: New testcase.
* crash printing optimized out variant typeJoel Brobecker2012-09-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assuming the following declarations: type Discriminants_Record (A : Integer; B : Boolean) is record C : Float; end record; Z : Discriminants_Record := (A => 1, B => False, C => 2.0); If variable Z is not used, and the compiler optimizes it out, GDB would crash as follow: (gdb) print Z /[...]/gdb/valops.c:1121: internal-error: Unexpected lazy value type. This is because the ada-lang module forgot to set the optimized_out flag in the value returned by ada_evaluate_subexp during the value's "fixing" process. Later on, when trying to print the resulting value, GDB finds that the value is still lazily allocated, and thus tries to fetch it. But this is not allowed for not_lval values, hence the internal error. gdb/ChangeLog: * ada-lang.c (coerce_unspec_val_to_type): Make sure that the optimized_out flag is preserved. gdb/testsuite/ChangeLog: * gdb.ada/optim_drec: New testcase.
* * auto-load.c (_initialize_auto_load): Update.Tom Tromey2012-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * solib-svr4.c (_initialize_svr4_solib): Update * solib-dsbt.c (_initialize_dsbt_solib): Update. * solib-darwin.c (_initialize_darwin_solib): Update. * registry.h: New file. * python/py-progspace.c (gdbpy_initialize_pspace): Update. * python/py-inferior.c (gdbpy_initialize_inferior): Update. * progspace.h: Include registry.h. Use DECLARE_REGISTRY. (register_program_space_data_with_cleanup) (register_program_space_data, program_space_alloc_data) (clear_program_space_data, set_program_space_data) (program_space_data): Don't declare. * progspace.c: Use DEFINE_REGISTRY. (struct program_space_data, struct program_space_data_registration, struct program_space_data_registry, program_space_data_registry) (register_program_space_data_with_cleanup) (register_program_space_data, program_space_alloc_data) (program_space_free_data, clear_program_space_data) (set_program_space_data, program_space_data): Remove. * objfiles.h: Include registry.h. Use DECLARE_REGISTRY. (struct objfile) <data, num_data>: Replace with REGISTRY_FIELDS. (register_objfile_data_with_cleanup, register_objfile_data) (clear_objfile_data, set_objfile_data, objfile_data): Don't declare. * objfiles.c: Use DEFINE_REGISTRY. (struct objfile_data, struct objfile_data_registration, struct objfile_data_registry, objfile_data_registry) (register_objfile_data_with_cleanup, register_objfile_data) (objfile_alloc_data, objfile_free_data, clear_objfile_data) (set_objfile_data, objfile_data): Remove. (_initialize_objfiles): Update. * jit.c (_initialize_jit): Update. * inflow.c (_initialize_inflow): Update. * inferior.h: Include registry.h. Use DECLARE_REGISTRY. (struct inferior) <data, num_data>: Replace with REGISTRY_FIELDS. (register_inferior_data_with_cleanup, register_inferior_data) (clear_inferior_data, set_inferior_data, inferior_data): Don't declare. * inferior.c: Use DEFINE_REGISTRY. (struct inferior_data, struct inferior_data_registration, struct inferior_data_registry, inferior_data_registry) (register_inferior_data_with_cleanup, register_inferior_data) (inferior_alloc_data, inferior_free_data clear_inferior_data) (set_inferior_data, inferior_data): Remove. * auxv.c (_initialize_auxv): Update. * ada-lang.c (_initialize_ada_language): Update. * breakpoint.c (_initialize_breakpoint): Update. * i386-nat.c (i386_use_watchpoints): Update.
* PR c++/13356Keith Seitz2012-08-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gdbtypes.c (strict_type_checking): New variable. (show_strict_type_checking): New function. (rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS if strict type checking is disabled. (_initialize_gdbtypes): Add "check type" subcommand. * gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct. PR c++/13356 * gdb.base/default.exp: Update all "check type" tests. * gdb.base/help.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.cp/converts.cc (foo1_type_check): New function. (foo2_type_check): New function. (foo3_type_check): New function. (main): Call new functions. * converts.exp: Add tests for integer-to-pointer conversions with/without strict type-checking. PR c++/13356 * gdb.texinfo (Type and Range Checking): Remove warning. Remove spurious commas. Update text and examples for re-implementation of set/show check type. (C and C++ Type and Range Checks): Likewise. * language.h (type_mode): Remove. (type_check): Remove. (struct language_defn): Remove la_type_check. (STRICT_TYPE): Remove unused macro. (type_error): Remove. * language.c (set_type_range_case): Renamed to ... (set_range_case): ... this. Update all callers. Remove type_mode/type_check. (type_mode): Remove. (type_check): Remove. (show_type_command): Remove. (set_type_command): Remove. (language_info): Remove type checking output. (type_error): Remove unused function. (range_error): Update comment. (unknown_language_defn): Remove la_type_check. (auto_language_defn): Likewise. (local_language_defn): Likewise. (_initialize_language): Remove "check type" subcommand. * ada-lang.c (ada_language_defn): Remove la_type_check. * c-lang.c (c_language_defn): Likewise. (cplus_language_defn): Likewise. (asm_language_defn): Likewise. (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. * jv-lang.c (java_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.
* PR macros/7961:Tom Tromey2012-06-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * varobj.c (varobj_create): Update. (varobj_set_value): Update. * tracepoint.c (validate_actionline): Update. (encode_actions_1): Update. * parse.c (parse_exp_1): Add 'pc' argument. (parse_exp_in_context): Add 'pc' argument. Change how expression_context_pc is set. (parse_expression): Update. (parse_field_expression): Update. * expression.h (parse_exp_1): Update. * eval.c (parse_to_comma_and_eval): Update. * breakpoint.c (set_breakpoint_condition): Update. (update_watchpoint): Update. (init_breakpoint_sal): Update (find_condition_and_thread): Update. (watch_command_1): Update. (update_breakpoint_locations): Update. * ada-lang.c (ada_read_renaming_var_value): Update. (create_excep_cond_exprs): Update. testsuite * gdb.base/macscp1.c (macscp_expr): Add breakpoint comment. * gdb.base/macscp.exp (maybe_kfail): Add test for macro scope.
* gdb:qiyao2012-06-241-2/+1
| | | | | | | | | | * corefile.c (write_memory_with_notification): New. * gdbcore.h: Declare write_memory_with_notification. * ada-lang.c (ada_value_assign): Replace 'write_memory' and 'observer_notify_memory_changed' with 'write_memory_with_notification'. * valops.c (value_assign): Likewise. * python/py-inferior.c (infpy_write_memory): Call 'write_memory_with_notification'.
* * ada-lang.c (ada_make_symbol_completion_list): Return a VEC.Tom Tromey2012-06-131-22/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * breakpoint.c (catch_syscall_completer): Return a VEC. * cli/cli-cmds.c (complete_command): Update. * cli/cli-decode.c (complete_on_cmdlist): Return a VEC. (complete_on_enum): Likewise. * command.h: Include gdb_vecs.h. (completer_ftype): Change return type. (complete_on_cmdlist, complete_on_enum): Likewise. * completer.c (noop_completer, filename_completer) (location_completer): Return a VEC. (add_struct_fields): Remove 'nextp' argument. Change 'output' to a VEC. (expression_completer, complete_line_internal, complete_line) (command_completer): Return a VEC. (gdb_completion_word_break_characters, line_completion_function): Update. * completer.h: Include gdb_vecs.h. (complete_line, noop_completer, filename_completer) (expression_completer, location_completer, command_completer): Update. * f-lang.c (f_word_break_characters): Return a VEC. * interps.c (interpreter_completer): Return a VEC. * language.h (struct language_defn) <la_make_symbol_completion_list>: Return a VEC. * python/py-cmd.c (cmdpy_completer): Return a VEC. * symtab.c (free_completion_list): Take a VEC. (return_val_size, return_val_index): Remove. (return_val): Now a VEC. (completion_list_add_name): Update. (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_list_fn, make_file_symbol_completion_list): Return a VEC. (add_filename_to_list): Update. (struct add_partial_filename_data) <list_used, list_alloced>: Remove. <list>: Now a VEC. (maybe_add_partial_symtab_filename): Update. (make_source_files_completion_list): Return a VEC. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_list_fn, make_file_symbol_completion_list) (make_source_files_completion_list): Update.
* * gdb/ada-lang.c (standard_lookup): Prevent uninitialized variablemgretton2012-05-311-1/+2
| | | | warning.
* PR c++/7173:Tom Tromey2012-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | * gnu-v3-abi.c (gnuv3_baseclass_offset): Return early for Java types. * value.h (value_cast_pointers): Update. * valops.c (value_cast_pointers): Add 'subclass_check' argument. (value_cast): Update. (update_search_result): New function. (do_search_struct_field): New, from search_struct_field. Check for ambiguous results. (search_struct_field): Rewrite. * infcall.c (value_arg_coerce): Update. * eval.c (evaluate_subexp_standard) <STRUCTOP_MEMBER>: Use value_cast_pointers. * ada-lang.c (ada_convert_actual): Update. testsuite * gdb.cp/inherit.exp (test_print_mi_members): Expect errors. Remove kfails. (test_print_mi_member_types): Likewise.
* 2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com>sergiodj2012-05-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: * avr-tdep.c: * ax-gdb.c: * bfin-linux-tdep.c: * breakpoint.c: * c-valprint.c: * cli/cli-cmds.c: * coffread.c: * cp-support.c: * cris-tdep.c: * dwarf2-frame-tailcall.c: * dwarf2-frame.c: * dwarf2expr.c: * dwarf2loc.c: * dwarf2read.c: * elfread.c: * eval.c: * expprint.c: * f-valprint.c: * frv-tdep.c: * h8300-tdep.c: * hppa-hpux-tdep.c: * hppa-tdep.c: * hppanbsd-tdep.c: * i386-nto-tdep.c: * i386-tdep.c: * i387-tdep.c: * ia64-tdep.c: * jit.c: * linespec.c: * linux-tdep.c: * lm32-tdep.c: * m2-valprint.c: * m32c-tdep.c: * m32r-rom.c: * m32r-tdep.c: * m68k-tdep.c: * m68klinux-tdep.c: * mi/mi-main.c: * microblaze-tdep.c: * mips-linux-tdep.c: * mips-tdep.c: * mn10300-tdep.c: * p-valprint.c: * parse.c: * ppc-linux-tdep.c: * ppc-sysv-tdep.c: * printcmd.c: * python/py-finishbreakpoint.c: * python/py-inferior.c: * python/py-infthread.c: * python/py-type.c: * python/python.c: * remote-fileio.c: * remote-m32r-sdi.c: * remote-mips.c: * reverse.c: * rl78-tdep.c: * rs6000-aix-tdep.c: * rs6000-tdep.c: * s390-tdep.c: * score-tdep.c: * sh64-tdep.c: * skip.c: * solib-darwin.c: * solib-dsbt.c: * solib-frv.c: * sparc-tdep.c: * spu-multiarch.c: * spu-tdep.c: * stack.c: * symfile.c: * symtab.c: * tic6x-tdep.c: * tracepoint.c: * v850-tdep.c: * valarith.c: * valprint.c: * value.c: * xcoffread.c: * xtensa-tdep.c: * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: Delete unused variables.
* * tracepoint.c (scope_info): Update.Tom Tromey2012-05-101-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * symtab.c (lookup_block_symbol, iterate_over_symbols) (find_pc_sect_symtab, search_symbols) (default_make_symbol_completion_list_break_on) (make_file_symbol_completion_list): Update. * symmisc.c (dump_symtab_1): Update. * stack.c (print_frame_args, iterate_over_block_locals) (print_frame_labels, iterate_over_block_arg_vars): Update. * python/py-block.c (block_object) <dict>: Remove. <block>: New field. <iter>: Change type. (blpy_iter): Update. (blpy_block_syms_iternext): Update. * psymtab.c (map_block): Use block iterators. * objfiles.c (objfile_relocate1): Use ALL_DICT_SYMBOLS. * mi/mi-cmd-stack.c (list_args_or_locals): Update. * mdebugread.c (parse_symbol, mylookup_symbol): Update. * infrun.c (check_exception_resume): Update. * cp-support.c (make_symbol_overload_list_block): Update. * coffread.c (patch_opaque_types): Update. * buildsym.c (finish_block, end_symtab): Use ALL_DICT_SYMBOLS. * block.h (struct block_iterator): New. (block_iterator_first, block_iterator_next, block_iter_name_first) (block_iter_name_next, block_iter_match_first) (block_iter_match_next): Declare. (ALL_BLOCK_SYMBOLS): Redefine. * block.c (block_iterator_first, block_iterator_next) (block_iter_name_first, block_iter_name_next) (block_iter_match_first, block_iter_match_next): New functions. * ada-lang.c (ada_add_block_symbols) (ada_make_symbol_completion_list): Use block iterator.
* Add proper handling for internal functions and STT_GNU_IFUNC symbols in Ada ↵Paul N. Hilfinger2012-04-211-1/+18
| | | | | | | | | | | | | | mode. The code for handling calls to internal functions (esp., Python functions) and for handling STT_GNU_IFUNC had not been added to the Ada expression evaluator. This change adapts them from eval.c. gdb/Changelog: * ada-lang.c (ada_evaluate_subexp): Add cases for TYPE_CODE_INTERNAL_FUNCTION and for TYPE_GNU_IFUNC, following their treatment in eval.c.
* gdb/Jan Kratochvil2012-04-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR symtab/7259: * ada-exp.y (convert_char_literal): Use TYPE_FIELD_ENUMVAL. * ada-lang.c (ada_discrete_type_high_bound) (ada_discrete_type_low_bound): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (ada_identical_enum_types_p): Use TYPE_FIELD_ENUMVAL. (pos_atr, value_val_atr): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * ada-typeprint.c (print_enum_type): Change variable lastval to LONGEST. Use TYPE_FIELD_ENUMVAL. * ada-valprint.c (print_optional_low_bound, ada_print_scalar) (ada_val_print_1): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * c-typeprint.c (c_type_print_base): Move variable lastval to inner block, change it to LONGEST. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * coffread.c (coff_read_enum_type): Use SET_FIELD_ENUMVAL. * dwarf2read.c (process_enumeration_scope): Likewise. * gdb-gdb.py (TypeFlagsPrinter): Use field.enumval instead of field.bitpos. (class StructMainTypePrettyPrinter): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.c (get_discrete_bounds): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (recursive_dump_type): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (copy_type_recursive): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.h (enum field_loc_kind): New FIELD_LOC_KIND_ENUMVAL. (struct main_type.flds_bnds.fields.loc): Adjust bitpos comment. New field enumval. (struct main_type.flds_bnds.bields): Adjust loc_kind and bitsize to accommodate enumval. (struct call_site): Adjust loc_kind to accommodate enumval. (FIELD_ENUMVAL, FIELD_ENUMVAL_LVAL, SET_FIELD_ENUMVAL) (TYPE_FIELD_ENUMVAL): New macros. * m2-typeprint.c (m2_enum): Use TYPE_FIELD_ENUMVAL. * mdebugread.c (parse_symbol): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * p-typeprint.c (pascal_type_print_base): Likewise. * python/lib/gdb/printing.py (class FlagEnumerationPrinter): Use enumval. * python/lib/gdb/types.py (make_enum_dict): Likewise. * python/py-type.c (convert_field): New variable addrstring. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (check_types_equal): Support also FIELD_LOC_KIND_ENUMVAL. * stabsread.c (read_enum_type): Use SET_FIELD_ENUMVAL. * typepint.c (print_type_scalar): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * valprint.c (generic_val_print): Likewise. gdb/testsuite/ PR symtab/7259: * gdb.base/enumval.c: New test case. * gdb.base/enumval.exp: New test case. * gdb.python/py-type.exp (test_enums): Use field.enumval instead of field.bitpos.