aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
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.
2019-05-08Correctly handle non-C-style arrays in c_get_stringTom Tromey4-4/+48
A user here noticed that the Python Value.string method did not work for Ada arrays. I tracked this down to an oddity in value_as_address -- namely, it calls coerce_array, but that function will not force array coercion when the language has c_style_arrays=false, as Ada does. This patch fixes the problem by changing c_get_string so that arrays take the "in GDB's memory" branch. The actual patch is somewhat more complicated than you might think, because the caller can request more array elements than the type allows. This is normal when the type is using the C struct hack. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * c-lang.c (c_get_string): Handle non-C-style arrays. gdb/testsuite/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * gdb.python/py-value.exp (test_value_in_inferior): Add Ada test.
2019-05-08Change ptype/o to print bit offsetTom Tromey6-42/+40
Consider this short C example: struct inner { unsigned x; unsigned y : 3; unsigned z : 3; }; struct outer { unsigned char o : 3; struct inner i __attribute__ ((packed)); }; When I use "ptype/o" on this, I get: (gdb) ptype/o struct outer /* offset | size */ type = struct outer { /* 0: 5 | 1 */ unsigned char o : 3; /* XXX 5-bit hole */ /* 1 | 8 */ struct inner { /* 1 | 4 */ unsigned int x; /* 5:29 | 4 */ unsigned int y : 3; /* 5:26 | 4 */ unsigned int z : 3; /* XXX 2-bit padding */ /* XXX 3-byte padding */ /* total size (bytes): 8 */ } i; /* total size (bytes): 9 */ } In the location of "o" ("0: 5"), the "5" means "there are 5 bits left relative to the size of the underlying type. I find this very difficult to follow. On irc, Sergio said that this choice came because it is what pahole does. However, I think it's not very useful, and maybe is just an artifact of the way that DW_AT_bit_offset was defined in DWARF 3. This patch changes ptype/o to print the offset of a bitfield in a more natural way, that is, using the bit number according to the platform's bit numbering. With this patch, the output is now: (gdb) ptype/o struct outer /* offset | size */ type = struct outer { /* 0: 0 | 1 */ unsigned char o : 3; /* XXX 5-bit hole */ /* 1 | 8 */ struct inner { /* 1 | 4 */ unsigned int x; /* 5: 0 | 4 */ unsigned int y : 3; /* 5: 3 | 4 */ unsigned int z : 3; /* XXX 2-bit padding */ /* XXX 3-byte padding */ /* total size (bytes): 8 */ } i; /* total size (bytes): 9 */ } This is better, IMO, because now the "offset" of a bitfield is consistent with the offset of an ordinary member, referring to its offset from the start of the structure. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * typeprint.c (print_offset_data::update): Print the bit offset, not the number of bits remaining. gdb/doc/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * gdb.texinfo (Symbols): Document change to ptype/o. gdb/testsuite/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * gdb.base/ptype-offsets.exp: Update tests.
2019-05-08Fix ptype/o comment formattingTom Tromey5-253/+266
I noticed that ptype/o will print: /* 3: 3 | 1 */ signed char a4 : 2; /* XXX 3-bit hole */ That is, "*/" at the end of the "hole" message does not line up with the other comment ends. I thought it would be a bit nicer if this did line up, so I fixed it. Then, to my surprise, I found that I could not make ptype-offsets.exp fail. I still am not sure why it doesn't fail, but changing the tests to use string_to_regexp and changing the quoting helped. This in turn showed that some of the existing test cases were wrong, so I've also updated them here. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * typeprint.c (print_offset_data::maybe_print_hole): Add extra padding at end of comment. gdb/testsuite/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * gdb.base/ptype-offsets.exp: Use string_to_regexp. Fix test cases. * gdb.base/ptype-offsets.cc (struct abc) <my_int_type>: Now "short".
2019-05-08Fix VLA printing for AdaTom Tromey5-2/+111
While looking at a different Ada problem, I found that printing a record containing a VLA did not work properly. I tracked the problem down to dwarf2_evaluate_property trying, and failing, to compare two types that differed only in qualifiers. This patch changes dwarf2_evaluate_property to ignore qualifiers when comparing types. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * dwarf2loc.c (dwarf2_evaluate_property) <PROP_ADDR_OFFSET>: Compare main types. gdb/testsuite/ChangeLog 2019-05-08 Tom Tromey <tromey@adacore.com> * gdb.ada/vla.exp: New file. * gdb.ada/vla/vla.adb: New file.
2019-05-07[gdb/testsuite] Fix ls_host return in index-cache.expTom de Vries2-1/+5
When adding a debug print here in index-cache.exp: ... proc_with_prefix test_cache_disabled { cache_dir } { lassign [ls_host $cache_dir] ret files_before + puts "before: '$files_before'" + exit ... we have: ... files_before: '' ... When further adding: ... proc_with_prefix test_cache_disabled { cache_dir } { + exec touch $cache_dir/foo.1 $cache_dir/foo.2 $cache_dir/foo.3 ... we have: ... files_before: 'foo.1' ... while we're expecting file_before to contain foo.[123]. Fix this by making the return statement in ls_host return a list rather than a string (in accordance with the ls_host documentation), after which we have: ... files_before: 'foo.1 foo.2 foo.3' ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-05-07 Tom de Vries <tdevries@suse.de> * gdb.base/index-cache.exp (ls_host): Fix return statement.
2019-05-07[gdb/testsuite] Fix .debug_aranges in watch-loc.cTom de Vries2-1/+10
When running gdb.dlang/watch-loc.exp with target board cc-with-debug-names, we run into: ... FAIL: gdb.dlang/watch-loc.exp: disassemble _Dmain (GDB internal error) ... in more detail: ... (gdb) disassemble _Dmain gdb/dwarf2read.c:5293: internal-error: \ compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, \ bound_minimal_symbol, CORE_ADDR, obj_section*, int): \ Assertion `result != NULL' failed. ... The problem is that the .debug_aranges section in watch-loc.c contains a debug_info_offset which is set to 0: ... asm ( " .pushsection .debug_aranges,\"\",%progbits\n" " .4byte .Laranges_end - .Laranges_start\n" ".Laranges_start:\n" " .2byte 0x2\n" " .4byte 0\n" ... while the compilation unit at offset 0 in the .debug_section in the executable is in fact not the compilation unit generated from watch-loc-dw.S. [ Note: this is a non-trivial test-case. The file watch-loc-dw.S contains a .debug_info section, but not an .debug_aranges section or any actual code. The file watch-loc.c contains code and a .debug_aranges section, but no other debug section. So, the intent for the .debug_aranges section in watch-loc.c is to refer to a compilation unit in the .debug_info section in watch-loc-dw.S. ] This happens when linked in object files contain dwarf info and are placed in the .debug_info section before the compilation units generated from watch-loc.c and watch-loc-dw.S. Fix this by defining the debug_info_offset field using a label .Lcu1_begin that defines the start of an empty .debug_section compilation unit: ... asm ( + " .pushsection .debug_info,\"\",%progbits\n" + ".Lcu1_begin:" + " .popsection\n" " .pushsection .debug_aranges,\"\",%progbits\n" " .4byte .Laranges_end - .Laranges_start \n" ".Laranges_start:\n" " .2byte 0x2\n" - " .4byte 0\n" + " .4byte .Lcu1_begin\n" ... which during linking merges with the start of the .debug_info section of watch-loc-dw.S. Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names. gdb/testsuite/ChangeLog: 2019-05-07 Tom de Vries <tdevries@suse.de> PR testsuite/24522 * gdb.dlang/watch-loc.c: Fix debug_info_offset in .debug_aranges section.
2019-05-07[gdb/testsuite] Fix .debug_aranges in dw2-case-insensitive-debug.STom de Vries2-1/+7
When running gdb.dwarf2/dw2-case-insensitive.exp with target board cc-with-debug-names, we run into: ... FAIL: gdb.dwarf2/dw2-case-insensitive.exp: regexp case-sensitive off \ (GDB internal error) ... in more detail: ... (gdb) info functions fUnC_lang gdb/dwarf2read.c:5293: internal-error: \ compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, \ bound_minimal_symbol, CORE_ADDR, obj_section*, int): \ Assertion `result != NULL' failed. ... The problem is that the .debug_aranges section in dw2-case-insensitive-debug.S contains a debug_info_offset which is set to 0: ... .section .debug_aranges,"",@progbits .4byte .Laranges_end - .Laranges_start .Laranges_start: .2byte 0x2 .4byte 0 ... while the compilation unit at offset 0 in the .debug_section of the executable is in fact not the compilation unit generated from dw2-case-insensitive-debug.S. This happens when linked in object files contain dwarf info and are placed in the .debug_info section before the compilation unit generated from dw2-case-insensitive-debug.S. Fix this by defining the debug_info_offset field using the label .Lcu1_begin that defines the start of the compilation unit: ... - .4byte 0 + .4byte .Lcu1_begin ... Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names. gdb/testsuite/ChangeLog: 2019-05-07 Tom de Vries <tdevries@suse.de> PR testsuite/24522 * gdb.dwarf2/dw2-case-insensitive-debug.S: Fix debug_info_offset in .debug_aranges section.