aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2019-05-14[gdb/doc] Fix "maint info selftests" command index entryTom de Vries2-1/+6
Currently, the entry for the command "maint info selftests" in the Command, Variable, and Function Index is listed at '"', rather than next to the other "maint info" commands. Fix this by removing the superfluous quoting in the @kindex entry. gdb/doc/ChangeLog: 2019-05-14 Tom de Vries <tdevries@suse.de> * gdb.texinfo (Maintenance Commands): Remove superfluous quoting on command index entry for "maint info selftests".
2019-05-12Fix two langauge -> language typosSimon Marchi3-2/+8
2019-05-11Document the GDB 8.3 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 8.3 released.
2019-05-10Fix GDB build when using --disable-gdbmiSimon Marchi7-32/+39
Since commit b4be1b064860 ("Fix MI output for multi-location breakpoints") we get this error when building with --disable-gdbmi: CXXLD gdb /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:6358: error: undefined reference to 'mi_multi_location_breakpoint_output_fixed(ui_out*)' This is due to breakpoint.c using a function defined in mi/mi-main.c, even though mi/mi-main.c isn't included in the build. To fix it, use the flags feature of ui_out. mi_ui_out has the new fix_multi_location_breakpoint_output flag set for versions >= 3. Also, move the global variable fix_multi_location_breakpoint_output to breakpoint.c, so it can be read there even when we build without MI. I renamed it to fix_multi_location_breakpoint_output_globally so it doesn't clash with the new enumerator. gdb/ChangeLog: * breakpoint.h (fix_multi_location_breakpoint_output_globally): New variable declaration. * breakpoint.c (fix_multi_location_breakpoint_output_globally): New variable. (print_one_breakpoint): Use ui_out::test_flags and new global variable to compute use_fixed_output. * mi/mi-main.h (mi_multi_location_breakpoint_output_fixed): Remove. * mi/mi-main.c (fix_multi_location_breakpoint_output): Remove. (mi_multi_location_breakpoint_output_fixed): Remove. (mi_cmd_fix_multi_location_breakpoint_output): Adjust to set the new variable. * mi/mi-out.c (mi_ui_out::mi_ui_out): Set fix_multi_location_breakpoint_output flag if version >= 3. * ui-out.h (enum ui_out_flag) <fix_multi_location_breakpoint_output>: New enumerator.
2019-05-10cc-with-tweaks: show dwz stderr and verify resultSimon Marchi2-2/+36
When running the gdb.base/index-cache.exp test case with the cc-with-dwz-m board, I noticed that the final executable didn't actually contain a .gnu_debugaltlink section with the name of the external dwz file: $ readelf --debug-dump=links testsuite/outputs/gdb.base/index-cache/index-cache * empty * Running dwz by hand, I realized it's because dwz complains that the output .debug_info section is empty and fails: $ gcc ~/src/binutils-gdb/gdb/testsuite/gdb.base/index-cache.c -g3 -O0 -o a && cp a b $ dwz -m foo a b dwz: foo: .debug_info section not present $ echo $? 1 This is because index-cache.c is trivial (just an empty main) and dwz doesn't find anything to factor out to the dwz file. [1] I think that cc-with-tweaks should fail in this scenario: if the user asks for an external dwz file to be generated (the -m flag), then it should be an error if cc-with-tweaks doesn't manage to produce an executable with the proper link to this external dwz file. Otherwise, the test runs with a regular non-dwzified executable, which gives a false sense of security about whether the feature under test works with dwzified executables. So this patch adds checks for that after invoking dwz. It also removes the 2>&1 to allow the error message to be printed like so: Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/index-cache.exp ... gdb compile failed, dwz: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.dwz: .debug_info section not present - In the -m case (multi-file compression), we check if the expected output file exists. - In the -z case (single-file compression), we check if the file contents has changed. This should catch cases where dwz doesn't modify the file because it's not worth it. It was chosen not to check for dwz's exit code, as it is not very reliable up to dwz 0.12. With this patch, fewer tests will pass than before with the cc-with-dwz and cc-with-dwz-m boards, but those were false positives anyway, as the test ran with regular executables. [1] Note that dwz has been patched by Tom de Vries to work correctly in this case, so we can use dwz master to run the test: https://sourceware.org/git/?p=dwz.git;a=commit;h=08becc8b33453b6d013a65e7eeae57fc1881e801 gdb/ChangeLog: * contrib/cc-with-tweaks.sh: Validate dwz's work.
2019-05-10Document lazy computation for pretty-printer "children" methodTom Tromey2-0/+11
I found out recently that some users didn't know that the Python pretty-printers "children" method should compute its result lazily. This has been a good idea since the earliest days, but wasn't mentioned in the docs. This patch adds some text to this effect. gdb/doc/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * python.texi (Pretty Printing API): Mention lazy computation for "children".
2019-05-10Add completion for Ada catch commandsTom Tromey4-2/+31
This patch adds a completion function to the "catch exception" and "catch handlers" commands. Tested on x86-64 Fedora 29; reviewed off-list by Joel. gdb/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * ada-lang.c (catch_ada_completer): New function. (_initialize_ada_language): Use it. gdb/testsuite/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * gdb.ada/info_exc.exp: Add "complete" test.
2019-05-10Minor "catch" documentation improvementsTom Tromey2-8/+14
This patch makes a few minor improvements to the catchpoint documentation: * "catch exception" and "catch handlers" now mention the argument in the @item. * "catch exception unhandled" is moved to be closer to "catch exception", rather than after "catch handlers". * "catch load" and "catch unload" now wrap the argument in @var. gdb/doc/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * gdb.texinfo (Set Catchpoints): Add text for parameter to "catch exception" and "catch handlers". Move "catch exception unhandled" text. Use @var for "catch load" and "catch unload"
2019-05-10Two minor constificationsTom Tromey5-4/+14
I noticed a couple of spots where a "char *" was used where a "const char *" made more sense. This patch fixes both of them. Tested by rebuilding. gdb/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * thread.c (print_thread_info): Make "requested_threads" const. * gdbthread.h (print_thread_info): Make "requested_threads" const. * ada-tasks.c (print_ada_task_info): Make "taskno_str" const. * ada-lang.h (print_ada_task_info): Make "taskno_str" const.
2019-05-09[gdb/testsuite] Fix gdb.arch/amd64-tailcall-self.STom de Vries2-12/+17
The test-case gdb.arch/amd64-tailcall-self.exp fails here: ... if ![runto b] { return -1 } ... like: ... (gdb) file build/gdb/testsuite/outputs/gdb.arch/amd64-tailcall-self/\ amd64-tailcall-self Reading symbols from build/gdb/testsuite/outputs/gdb.arch/\ amd64-tailcall-self/amd64-tailcall-self... Dwarf Error: Cannot find DIE at 0x1f5 referenced from DIE at 0x107 [in \ module build/gdb/testsuite/outputs/gdb.arch/amd64-tailcall-self/\ amd64-tailcall-self] ... The problem is that in amd64-tailcall-self.S, CU-relative references are assigned .debug_info section relative values. [ This is similar to the problem fixed by "Fix gdb.arch/amd64-entry-value-paramref.S". ] Fix this by assigning CU-relative references instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-05-09 Tom de Vries <tdevries@suse.de> * gdb.arch/amd64-tailcall-self.S: Make DW_FORM_ref4 references CU-relative.
2019-05-09[gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.STom de Vries2-13/+18
The file gdb.arch/amd64-entry-value-paramref.S contains a DIE for function bar: ... DIE29: .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram) .ascii "bar\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc) .byte 0x15 # DW_AT_decl_line .long DIE45 # DW_AT_type .byte 0x1 # DW_AT_inline ... which refers to DIE45: ... DIE45: .uleb128 0x4 # (DIE (0x45) DW_TAG_base_type) .byte 0x4 # DW_AT_byte_size .byte 0x5 # DW_AT_encoding .ascii "int\0" # DW_AT_name ... using a form DW_FORM_ref4: ... .uleb128 0x2 # (abbrev code) .uleb128 0x2e # (TAG: DW_TAG_subprogram) .byte 0x1 # DW_children_yes ... .uleb128 0x49 # (DW_AT_type) .uleb128 0x13 # (DW_FORM_ref4) ... However, the DW_FORM_ref4 is a CU-relative reference, while using a label for the value will result in a section-relative value. So, if linked in object files contain dwarf info and are placed in the .debug_info section before the compilation units generated from amd64-entry-value-paramref.S, then the referenced type is at 0x108: ... <1><108>: Abbrev Number: 4 (DW_TAG_base_type) <109> DW_AT_byte_size : 4 <10a> DW_AT_encoding : 5 (signed) <10b> DW_AT_name : int ... but the reference will point to a non-existing DIE at 0x1cf: ... <1><f0>: Abbrev Number: 2 (DW_TAG_subprogram) <f1> DW_AT_name : bar <f5> DW_AT_decl_file : 1 <f6> DW_AT_decl_line : 21 <f7> DW_AT_type : <0x1cf> <fb> DW_AT_inline : 1 (inlined) ... which happens to cause a GDB internal error described in PR23270 - "GDB internal error: dwarf2read.c:18656: internal-error: could not find partial DIE 0x1b7 in cache". Fix the invalid DWARF by making the reference value CU-relative: ... - .long DIE45 # DW_AT_type + .long DIE45 - .Ldebug_info0 # DW_AT_type ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-05-09 Tom de Vries <tdevries@suse.de> * gdb.arch/amd64-entry-value-paramref.S: Make DW_FORM_ref4 references CU-relative.
2019-05-08Convert gdbtypes.c to type-safe registry APITom Tromey2-5/+10
This changes gdbtypes.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * gdbtypes.c (objfile_type_data): Change type. (objfile_type, _initialize_gdbtypes): Update.
2019-05-08Convert dwarf2-frame.c to type-safe registry APITom Tromey2-7/+12
This changes dwarf2-frame.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * dwarf2-frame.c (dwarf2_frame_objfile_data): Change type. (dwarf2_frame_find_fde, dwarf2_build_frame_info) (_initialize_dwarf2_frame): Update.
2019-05-08Convert objc-lang.c to type-safe registry APITom Tromey2-13/+9
This changes objc-lang.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * objc-lang.c (objc_objfile_data): Change type. (find_methods): Update. (_initialize_objc_lang): Remove.
2019-05-08Convert stabsread.c to type-safe registry APITom Tromey2-6/+10
This changes stabsread.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * stabsread.c (rs6000_builtin_type_data): Change type. (rs6000_builtin_type, _initialize_stabsread): Update.
2019-05-08Remove mips_pdr_dataTom Tromey2-4/+5
mips_pdr_data is unused, so this patch removes it. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * mips-tdep.c (mips_pdr_data): Remove. (_initialize_mips_tdep): Update.
2019-05-08Convert hppa-tdep.c to type-safe registry APITom Tromey2-10/+13
This changes hppa-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * hppa-tdep.c (hppa_objfile_priv_data): Change type. (hppa_init_objfile_priv_data, read_unwind_info) (find_unwind_entry, _initialize_hppa_tdep): Update.
2019-05-08Convert elfread.c to type-safe registry APITom Tromey2-10/+15
This changes elfread.c to use the type-safe registry API. This also fixes a potential memory leak, by changing the hash table so that it is no longer allocated on an obstack. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * elfread.c (elf_objfile_gnu_ifunc_cache_data): Change type. (elf_gnu_ifunc_record_cache): Update. Don't allocate hash table on obstack. (elf_gnu_ifunc_resolve_by_cache, _initialize_elfread): Update.
2019-05-08Convert mdebugread.c to type-safe registry APITom Tromey2-6/+10
This changes mdebugread.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * mdebugread.c (basic_type_data): Change type. (basic_type, _initialize_mdebugread): Update.
2019-05-08Add a noop deleterTom Tromey2-0/+11
This adds a no-op deleter, which is used in subsequent patches. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * common/gdb_unique_ptr.h (struct noop_deleter): New.
2019-05-08Convert nto-tdep.c to type-safe registry APITom Tromey3-35/+14
This changes nto-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * nto-tdep.c (nto_inferior_data_reg): Change type. (nto_inferior_data): Update. (nto_inferior_data_cleanup, nto_new_inferior_data) (_initialize_nto_tdep): Remove. * nto-tdep.h (struct nto_inferior_data): Add initializers.
2019-05-08Convert ada-lang.c to type-safe registry APITom Tromey2-47/+27
This changes ada-lang.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * ada-lang.c (struct ada_inferior_data): Add initializers. (ada_inferior_data): Change type. (ada_inferior_data_cleanup): Remove. (get_ada_inferior_data, ada_inferior_exit) (struct ada_pspace_data): Add initializers, destructor. (ada_pspace_data_handle): Change type. (get_ada_pspace_data): Update. (ada_pspace_data_cleanup): Remove.
2019-05-08Convert coffread.c to type-safe registry APITom Tromey2-26/+20
This changes coffread.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * coffread.c (struct coff_symfile_info): Add initializers. (coff_objfile_data_key): Move lower. Change type. (coff_symfile_init, coff_symfile_read, _initialize_coffread): Update. (coff_free_info): Remove.
2019-05-08Convert fbsd-tdep.c to type-safe registry APITom Tromey2-22/+17
This changes fbsd-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * fbsd-tdep.c (struct fbsd_pspace_data): Add initializers. (fbsd_pspace_data_handle): Move lower. Change type. (get_fbsd_pspace_data): Update. (fbsd_pspace_data_cleanup): Remove. (_initialize_fbsd_tdep): Update.
2019-05-08Convert ada-tasks.c to type-safe registry APITom Tromey2-45/+25
This changes ada-tasks.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * ada-tasks.c (ada_tasks_pspace_data_handle): Change type. (get_ada_tasks_pspace_data): Update. (ada_tasks_pspace_data_cleanup): Remove. (_initialize_tasks): Update. (ada_tasks_inferior_data_handle): Change type. (get_ada_tasks_inferior_data): Update. (ada_tasks_inferior_data_cleanup): Remove. (struct ada_tasks_pspace_data): Add initializers.
2019-05-08Convert probes to type-safe registry APITom Tromey8-53/+64
This changes the probes code in elfread.c to use the type-safe registry API. While doing this, I saw that the caller of get_probes owns the probes, so I went through the code and changed the vectors to store unique_ptrs, making the ownership relationship more clear. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * symfile.h (struct sym_probe_fns) <sym_get_probes>: Change type. * symfile-debug.c (debug_sym_get_probes): Change type. * stap-probe.c (handle_stap_probe): (stap_static_probe_ops::get_probes): Change type. * probe.h (class static_probe_ops) <get_probes>: Change type. * probe.c (class any_static_probe_ops) <get_probes>: Change type. (parse_probes_in_pspace): Update. (find_probes_in_objfile, find_probe_by_pc, collect_probes): Update. (any_static_probe_ops::get_probes): Change type. * elfread.c (elfread_data): New typedef. (probe_key): Change type. (elf_get_probes): Likewise. Update. (probe_key_free): Remove. (_initialize_elfread): Update. * dtrace-probe.c (class dtrace_static_probe_ops) <get_probes>: Change type. (dtrace_process_dof_probe, dtrace_process_dof) (dtrace_static_probe_ops::get_probe): Change type.
2019-05-08Convert xcoffread.c to type-safe registry APITom Tromey2-36/+32
This changes xcoffread.c to use the type-safe registry API. It also renames coff_symfile_info to xcoff_symfile_info, to avoid any possible ODR violation. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * xcoffread.c (struct xcoff_symfile_info): Rename from coff_symfile_info. Add initializers. (xcoff_objfile_data_key): Move lower. Change type. (XCOFF_DATA): Rewrite. (xcoff_free_info): Remove. (xcoff_symfile_init, _initialize_xcoffread, read_xcoff_symtab) (read_symbol, read_symbol_lineno, find_linenos, init_stringtab) (xcoff_initial_scan): Update.
2019-05-08Convert solib-svr4.c to type-safe registry APITom Tromey2-44/+45
This changes solib-svr4y.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * solib-svr4.c (struct svr4_info): Add initializers and destructor. <probes_table>: Now an htab_up. (solib_svr4_pspace_data): Change type. (free_probes_table): Simplify. (~svr4_info): Rename from svr4_pspace_data_cleanup. (get_svr4_info, probes_table_htab_remove_objfile_probes) (probes_table_remove_objfile_probes, register_solib_event_probe) (solib_event_probe_at, svr4_update_solib_event_breakpoint) (_initialize_svr4_solib): Update.
2019-05-08Convert remote.c to type-safe registry APITom Tromey2-22/+13
This changes remote.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * remote.c (remote_pspace_data): Change type. (remote_pspace_data_cleanup): Remove. (get_remote_exec_file, set_pspace_remote_exec_file) (_initialize_remote): Update.
2019-05-08Convert breakpoint.c to type-safe registry APITom Tromey2-19/+11
This changes breakpoint.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * breakpoint.c (breakpoint_objfile_key): Change type. (get_breakpoint_objfile_data): Update. (free_breakpoint_objfile_data): Remove. (_initialize_breakpoint): Update.
2019-05-08Convert linux-tdep.c to type-safe registry APITom Tromey2-31/+16
This changes linux-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * linux-tdep.c (struct linux_info): Add initializers. (linux_inferior_data): Move. Change type. (invalidate_linux_cache_inf): Update. (linux_inferior_data_cleanup): Remove. (get_linux_inferior_data, _initialize_linux_tdep): Update.
2019-05-08Convert auxv.c to type-safe registry APITom Tromey2-30/+12
This changes auxv.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * auxv.c (auxv_inferior_data): Move. Change type. (auxv_inferior_data_cleanup): Remove. (invalidate_auxv_cache_inf): Rewrite. (get_auxv_inferior_data, _initialize_auxv): Update.
2019-05-08Convert symfile-debug.c to type-safe registry APITom Tromey2-69/+57
This changes symfile-debug.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * symfile-debug.c (struct debug_sym_fns_data): Add initializers. (symfile_debug_objfile_data_key): Change type. (symfile_debug_installed, debug_qf_has_symbols) (debug_qf_find_last_source_symtab) (debug_qf_forget_cached_source_info) (debug_qf_map_symtabs_matching_filename, debug_qf_lookup_symbol) (debug_qf_print_stats, debug_qf_dump) (debug_qf_expand_symtabs_for_function) (debug_qf_expand_all_symtabs) (debug_qf_expand_symtabs_with_fullname) (debug_qf_map_matching_symbols) (debug_qf_expand_symtabs_matching) (debug_qf_find_pc_sect_compunit_symtab) (debug_qf_map_symbol_filenames) (debug_qf_find_compunit_symtab_by_address, debug_sym_get_probes) (debug_sym_new_init, debug_sym_init, debug_sym_read) (debug_sym_read_psymbols, debug_sym_finish, debug_sym_offsets) (debug_sym_read_linetable, debug_sym_relocate): Update. (symfile_debug_free_objfile): Remove. (install_symfile_debug_logging, _initialize_symfile_debug): Update.
2019-05-08Convert dwarf2_per_objfile to type-safe registry APITom Tromey3-38/+18
This changes dwarf2_per_objfile to use the type-safe registry API. This also changes dwarf2_per_objfile not to be allocated on an obstack. It seemed clearer to me to simply allocate it on the heap; and I didn't see a drawback from doing so. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * dwarf2read.h (struct dwarf2_per_objfile): Don't inherit from allocate_on_obstack. * dwarf2read.c (dwarf2_objfile_data_key): Change type. (get_dwarf2_per_objfile): Update. (set_dwarf2_per_objfile): Remove. (dwarf2_has_info, dwarf2_get_section_info): Update. (dwarf2_free_objfile): Remove. (_initialize_dwarf2_read): Update.
2019-05-08Convert auto-load.c to type-safe registry APITom Tromey2-38/+36
This changes auto-load.c to use the type-safe registry API. It also changes a couple of types to "bool", removing uses of "FALSE". gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * auto-load.c (struct auto_load_pspace_info): Add destructor and initializers. <unsupported_script_warning_printed, script_not_found_warning_printed>: Now bool. (auto_load_pspace_data): Change type. (~auto_load_pspace_info): Rename from auto_load_pspace_data_cleanup. (get_auto_load_pspace_data, init_loaded_scripts_info) (clear_section_scripts, maybe_print_unsupported_script_warning) (maybe_print_script_not_found_warning, _initialize_auto_load): Update.
2019-05-08Convert objfiles.c to type-safe registry APITom Tromey2-42/+28
This changes objfiles.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * objfiles.c (objfile_pspace_info): Add destructor and initializers. (objfiles_pspace_data): Change type. (~objfile_pspace_info): Rename from objfiles_pspace_data_cleanup. (get_objfile_pspace_data): Update. (objfiles_bfd_data): Change type. (get_objfile_bfd_data): Update. (objfile_bfd_data_free, _initialize_objfiles): Remove.
2019-05-08Convert break-catch-syscall.c to type-safe registry APITom Tromey2-20/+13
This changes break-catch-syscall.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * break-catch-syscall.c (catch_syscall_inferior_data): Move. Change type. (get_catch_syscall_inferior_data): Update. (catch_syscall_inferior_data_cleanup): Remove. (_initialize_break_catch_syscall): Update.
2019-05-08Convert inflow to type-safe registry APITom Tromey2-37/+27
This changes inflow.c to use the type-safe registry API. This fixes a latent bug in swap_terminal_info, which previously said: terminal_info *info_a = (terminal_info *) inferior_data (a, inflow_inferior_data); terminal_info *info_b = (terminal_info *) inferior_data (a, inflow_inferior_data); ... both of which examine 'a'. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * inflow.c (struct terminal_info): Add destructor and initializers. (inflow_inferior_data): Change type. (~terminal_info): Rename from inflow_inferior_data_cleanup. (get_inflow_inferior_data, inflow_inferior_exit) (swap_terminal_info, _initialize_inflow): Update.
2019-05-08Convert target dcache to type-safe registry APITom Tromey3-27/+25
This changes the target dcache to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * target-dcache.c (target_dcache_cleanup): Remove. (target_dcache_aspace_key): Change type. (target_dcache_init_p, target_dcache_invalidate) (target_dcache_get, target_dcache_get_or_init) (_initialize_target_dcache): Update. * dcache.h (struct dcache_deleter): New.
2019-05-08Convert symbol_cache to type-safe registry APITom Tromey2-54/+34
This changes the symbol_cache to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * symtab.c (struct symbol_cache): Add destructor and initializers. (symbol_cache_key): Move. Change type. (make_symbol_cache, free_symbol_cache): Remove. (get_symbol_cache): Update. (symbol_cache_cleanup): Remove. (ALL_PSPACES, symbol_cache_flush) (maintenance_print_symbol_cache) (maintenance_print_symbol_cache_statistics, _initialize_symtab): Update.
2019-05-08Convert main_info to type-safe registry APITom Tromey2-29/+23
This changes main_info to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * symtab.c (struct main_info): Add destructor and initializers. (main_progspace_key): Move. Change type. (get_main_info): Update. (main_info_cleanup): Remove. (_initialize_symtab): Update.
2019-05-08Add a type-safe C++ interface to a registryTom Tromey2-6/+66
This changes DECLARE_REGISTRY to add a type-safe interface. This interface is a C++ class that handles the details of registering a key, and provides various useful methods, including policy-based cleanup. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * registry.h (DECLARE_REGISTRY): Define the _key class.
2019-05-08gdb: Merge two 'New commands' sections in NEWS fileAndrew Burgess2-9/+11
Commit 2e62ab400ff9 added a second 'New commands' section to the NEWS file, this commit merges the two together. gdb/ChangeLog: * NEWS: Merge two 'New commands' sections.
2019-05-08When debugging a mixed Ada/C program using this scenario:Xavier Roirand8-31/+207
- set print frame-arguements all - an Ada function named pck.call_me calls a C function named break_me - you put a breakpoint in break_me and the program reaches this breakpoint. Now display the backtrace: (gdb) bt #0 break_me () at [...] #1 0x000000000040243e in pck.call_me ( s={P_ARRAY = 0x7fffffffe21c, P_BOUNDS = 0x41e6e8}) at [...] whereas we should expect: (gdb) bt #0 break_me () at [...] #1 0x000000000040243e in pck.call_me (s="test") at [...] The problem is that GDB prints the S parameter in the pck.call_me Ada function using the current language, so the C one, because the program is stopped in a C function, whereas it should use the pck.call_me frame one. This behavior is ok when user manually changes the language but it's not the right one when language is auto. This patch fixes this problem so now when using auto language, all Ada frame arguments are printed using Ada like syntax when the frame is part of Ada code, even if the program is stopped in a frame using a different language. If the user explicitly sets a language (using "set language ...") then no change here, all the Ada frame arguments are printed using this language. gdb/ChangeLog: * ada-valprint.c (ada_val_print_gnat_array): Remove language parameter and use Ada language definition instead. (ada_val_print_ptr): Remove unused language parameter. (ada_val_print_num): Remove language parameter and use Ada language definition instead. (ada_val_print_enum, ada_val_print_flt): Remove unused language parameter. (ada_val_print_struct_union, ada_val_print_ref): Remove language parameter and use Ada language definition instead. (ada_val_print_1): Update all ada_val_print_xxx calls. Remove language parameter. (ada_val_print): Update ada_val_print_1 call. gdb/testsuite/ChangeLog: * gdb.ada/frame_arg_lang.exp: New testcase. * gdb.ada/frame_arg_lang/bla.adb: New file. * gdb.ada/frame_arg_lang/pck.ads: New file. * gdb.ada/frame_arg_lang/pck.adb: New file. * gdb.ada/frame_arg_lang/foo.c: New file. Tested on x86_64-linux, no regressions.
2019-05-08Change some remote.c globals to "static"Tom Tromey2-3/+9
I noticed a three globals in remote.c that could be static. This patch makes this change. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * remote.c (remote_hw_watchpoint_limit) (remote_hw_watchpoint_length_limit, remote_hw_breakpoint_limit): Now static.
2019-05-08Move "watchdog" to remote.cTom Tromey4-28/+34
The "watchdog" global is only used in remote.c, so this patch moves it there and makes it static. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * maint.c (_initialize_maint_cmds): Move initialization code to remote.c. (watchdog, show_watchdog): Move to remote.c. * remote.c (watchdog, show_watchdog): Move from maint.c. Make "watchdog" static. (_initialize_remote): Move initialization code from maint.c. * defs.h (watchdog): Don't declare.
2019-05-08Move interpreter_p declaration to main.hTom Tromey5-3/+12
This moves the interpreter_p declaration from defs.h to main.h. I think this makes more sense, as it is defined in main.c. Also, this declaration was in the wrong place -- between a comment and the things the comment described. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * tui/tui-interp.c: Include main.h. * interps.c: Include main.h. * main.h (interpreter_p): Declare. * defs.h (interpreter_p): Don't declare.
2019-05-08Don't declare read_unsigned_leb128 in defs.hTom Tromey4-4/+9
I noticed that read_unsigned_leb128 is declared in defs.h. There's no reason this should be here, so this patch moves it to dwarf2read.h. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * dwarf2loc.c: Include dwarf2read.h. * defs.h (read_unsigned_leb128): Don't declare. * dwarf2read.h (read_unsigned_leb128): Declare.
2019-05-08Fix build problem in fputs_maybe_filteredTom Tromey2-1/+6
When merging commit 99f20f ("Fix style bug when paging") to master, I had to make some changes to get it to compile again. Unfortunately, I must not have added these to the index at the correct time, because they were not committed. This patch fixes the problem. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * utils.c (fputs_maybe_filtered): Call can_emit_style_escape as a method.
2019-05-08Fix style bug when pagingTom Tromey2-3/+26
Philippe pointed out a styling bug that would occur in some conditions when paging: https://sourceware.org/ml/gdb-patches/2019-04/msg00101.html I was finally able to reproduce this, and this patch fixes the bug. The problem occurred when text overflowed the line, causing a pagination prompt, but when no wrap column had been set. In this case, the current style was reset to show the prompt, but then not reset back to the previously applied style before emitting the rest of the line. The fix is to record the applied style in this case, and re-apply it afterward -- but only if the pager prompt was emitted, something that the existing style.exp pointed out on the first, more naive, version of the patch. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * utils.c (fputs_maybe_filtered): Reset style after paging, even when no wrap column is set.