aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
AgeCommit message (Collapse)AuthorFilesLines
2018-11-01arm-pikeos: software single stepJerome Guitton1-0/+1
On ARM, PikeOS does not support hardware single step, causing various semi-random errors when trying to next/step over some user code. So this patch changes this target to use software-single-step instead. The challenge is that, up to now, the PikeOS target was in all respects identical to a baremetal target as far as GDB was concerned, meaning we were using the baremetal osabi for this target too. This is no longer possible, and we need to introduce a new OSABI variant. Unfortunately, there isn't anything in the object file that would allow us to differentiate between the two platforms. So we have to rely on a heuristic instead, where we look for some known symbols that are required in a PikeOS application (these symbols are expected to be defined by the default linker script, and correspond to routines used to allocate the application stack). For the long run, the hope is that the stub implementation provided by PikeOS is enhanced so that it includes vContSupported+ to the $qSupported query, and then that the reply to the "vCont?" query only return support for "continue" operations (thus exclusing "step" operations). We could then use that information to reliably determine at connection time that the target does not support single-stepping and therefore automatically turn software single-stepping automatically based on it. gdb/ChangeLog: * defs.h (enum gdb_osabi): Add GDB_OSABI_PIKEOS. * osabi.c (gdb_osabi_names): Add name for GDB_OSABI_PIKEOS. * arm-pikeos-tdep.c: New file. * configure.tgt: Add arm-pikeos-tdep.o to the case of ARM embedded system. * Makefile.in (ALL_TARGET_OBS): Add arm-pikeos-tdep.o. Tested on arm-pikeos and arm-elf using AdaCore's testsuite. We also evaluated it on armhf-linux as a cross platform.
2018-09-18Add a new 'info proc files' subcommand of 'info proc'.John Baldwin1-0/+3
This command displays a list of open file descriptors. gdb/ChangeLog: * defs.h (enum info_proc_what) [IP_FILES]: New value. * infcmd.c (info_proc_cmd_files): New function. (_initialize_infcmd): Register 'info proc files' command.
2018-08-17Remove "repeat" argument from command_line_inputTom Tromey1-1/+1
After the previous patch, all callers pass 0 as the repeat argument to command_line_input. So, this patch removes it. gdb/ChangeLog 2018-08-16 Tom Tromey <tom@tromey.com> * top.c (read_command_file): Update. (command_line_input): Remove "repeat" argument. * ada-lang.c (get_selections): Update. * linespec.c (decode_line_2): Update. * defs.h (command_line_input): Remove argument. * cli/cli-script.c (read_next_line): Update. * python/py-gdb-readline.c: Update.
2018-06-07Change build_address_symbolic to return std::stringTom Tromey1-9/+0
This changes two out parameters of build_address_symbolic to be std::string, and updates the callers. This allows removing some cleanups. This patch also moves the declaration of build_address_symbolic out of defs.h. I think that many things in defs.h should be elsewhere instead. In this case, I moved the declaration to valprint.h, becuase there is no "printcmd.h" -- but perhaps it would be better to introduce that instead. Tested by the buildbot. gdb/ChangeLog 2018-06-07 Tom Tromey <tom@tromey.com> * valprint.h (build_address_symbolic): Declare. * printcmd.c (print_address_symbolic): Update. (build_address_symbolic): Change "name" and "filename" to std::string. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Update. * defs.h (build_address_symbolic): Remove declaration.
2018-04-07Make "set osabi none" really work (PR 22980)Simon Marchi1-2/+1
I was looking for a way to reproduce easily PR 22979 by doing this: (gdb) set architecture i386:x86-64 (gdb) set osabi none However, I noticed that even though I did "set osabi none", the gdbarch gdb created was for Linux: (gdb) set debug arch 1 (gdb) set architecture i386:x86-64 ... (gdb) set osabi none gdbarch_find_by_info: info.bfd_arch_info i386:x86-64 gdbarch_find_by_info: info.byte_order 1 (little) gdbarch_find_by_info: info.osabi 4 (GNU/Linux) <--- Wrong? gdbarch_find_by_info: info.abfd 0x0 gdbarch_find_by_info: info.tdep_info 0x0 gdbarch_find_by_info: Previous architecture 0x1e6fd30 (i386:x86-64) selected gdbarch_update_p: Architecture 0x1e6fd30 (i386:x86-64) unchanged This is because the value GDB_OSABI_UNKNOWN has an unclear role, sometimes meaning "no osabi" and sometimes "please selected automatically". Doing "set osabi none" sets the requested osabi to GDB_OSABI_UNKNOWN, in which case gdbarch_info_fill overrides it with a value from the target description, or the built-in default osabi. This means that it's impossible to force GDB not to use an osabi with "set osabi". Since my GDB's built-in default osabi is Linux, it always falls back to GDB_OSABI_LINUX. To fix it, I introduced GDB_OSABI_NONE, which really means "I don't want any osabi". GDB_OSABI_UNKNOWN can then be used only for "not set yet, please auto-detect". GDB_OSABI_UNINITIALIZED now seems unnecessary since it overlaps with GDB_OSABI_UNKNOWN, so I think it can be removed and gdbarch_info::osabi can be initialized to GDB_OSABI_UNKNOWN. gdb/ChangeLog: PR gdb/22980 * defs.h (enum gdb_osabi): Remove GDB_OSABI_UNINITIALIZED, add GDB_OSABI_NONE. * arch-utils.c (gdbarch_info_init): Don't set info->osabi. * osabi.c (gdb_osabi_names): Add "unknown" entry. gdb/testsuite/ChangeLog: PR gdb/22980 * gdb.base/osabi.exp: New file.
2018-03-19Convert observers to C++Tom Tromey1-1/+1
This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2018-03-08Remove MAX_REGISTER_SIZE defineAlan Hayward1-5/+0
gdb/ * defs.h: Remove MAX_REGISTER_SIZE. * regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE asserts. * python/py-unwind.c (pyuw_sniffer): Likewise.
2018-02-28Create new common/pathstuff.[ch]Sergio Durigan Junior1-4/+0
This commit moves the path manipulation routines found on utils.c to a new common/pathstuff.c, and updates the Makefile.in's accordingly. The routines moved are "gdb_realpath", "gdb_realpath_keepfile" and "gdb_abspath". This will be needed because gdbserver will have to call "gdb_abspath" on my next patch, which implements a way to expand the path of the inferior provided by the user in order to allow specifying just the binary name when starting gdbserver, like: $ gdbserver :1234 a.out With the recent addition of the startup-with-shell feature on gdbserver, this scenario doesn't work anymore if the user doesn't have the current directory listed in the PATH variable. I had to do a minor adjustment on "gdb_abspath" because we don't have access to "tilde_expand" on gdbserver, so now the function is using "gdb_tilde_expand" instead. Otherwise, the code is the same. Regression tested on the BuildBot, without regressions. gdb/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (COMMON_SFILES): Add "common/pathstuff.c". (HFILES_NO_SRCDIR): Add "common/pathstuff.h". * auto-load.c: Include "common/pathstuff.h". * common/common-def.h (current_directory): Move here. * common/gdb_tilde_expand.c (gdb_tilde_expand_up): New function. * common/gdb_tilde_expand.h (gdb_tilde_expand_up): New prototype. * common/pathstuff.c: New file. * common/pathstuff.h: New file. * compile/compile.c: Include "common/pathstuff.h". * defs.h (current_directory): Move to "common/common-defs.h". * dwarf2read.c: Include "common/pathstuff.h". * exec.c: Likewise. * guile/scm-safe-call.c: Likewise. * linux-thread-db.c: Likewise. * main.c: Likewise. * nto-tdep.c: Likewise. * objfiles.c: Likewise. * source.c: Likewise. * symtab.c: Likewise. * utils.c: Include "common/pathstuff.h". (gdb_realpath): Move to "common/pathstuff.c". (gdb_realpath_keepfile): Likewise. (gdb_abspath): Likewise. * utils.h (gdb_realpath): Move to "common/pathstuff.h". (gdb_realpath_keepfile): Likewise. (gdb_abspath): Likewise. gdb/gdbserver/ChangeLog: 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add "$(srcdir)/common/pathstuff.c". (OBJS): Add "pathstuff.o". * server.c (current_directory): New global variable. (captured_main): Initialize "current_directory".
2018-02-14Move some declarations to source.hTom Tromey1-27/+0
I noticed a few declarations in defs.h that really could be put into source.h. I think it's generally preferable to something out of defs.h unless it is needed by most of the files in gdb. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solib.c: Include source.h. * nto-tdep.c: Include source.h. * mi/mi-cmd-env.c: Include source.h. * infcmd.c: Include source.h. * exec.c: Include source.h. * defs.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): Move declarations... * source.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): ...here.
2018-02-13Use enum flags for flags passed to openpSimon Marchi1-4/+10
gdb/ChangeLog: * defs.h (enum openp_flags): New enum. (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH): Move to enum openp_flags. (openp_flags): New enum flags. (openp): Change parameter type to openp_flags. * source.c (openp): Change parameter type to openp_flags. * cli/cli-cmds.c (find_and_open_script): Use openp_flags. * dwarf2read.c (try_open_dwop_file): Use openp_flags.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-11Unbreak build for non-ELF portsPedro Alves1-6/+0
As reported at <https://sourceware.org/ml/gdb-patches/2017-12/msg00229.html>, this commit: ~~~~ commit abccd1e7b7a37385159610ca4e0bc2632a547e9a Author: Jan Kratochvil <jan.kratochvil@redhat.com> AuthorDate: Fri Dec 8 22:44:11 2017 +0000 Change dwarf2_initialize_objfile's return value dwarf2_initialize_objfile was returning boolean whether it is psymtabs or .gdb_index while now it needs to return also whether it is .debug_names. ~~~~ breaks non-ELF-target builds: dwarf2read.o: In function `dwarf2_initialize_objfile(objfile*)': /home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6486: undefined reference to `elf_sym_fns_gdb_index' /home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6490: undefined reference to `elf_sym_fns_debug_names' /home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6495: undefined reference to `elf_sym_fns_lazy_psyms' collect2: error: ld returned 1 exit status Makefile:1920: recipe for target 'gdb' failed because gdb/elfread.c is not included in the gdb build unless bfd also includes elf support. Fix this by reverting the patch mentioned above and at the same time re-adding .debug_names support by adding a new output parameter to dwarf2_initialize_objfile to indicate the index variant in use. We can reuse the new dw_index_kind enum in dwarf2read.c for that. gdb/ChangeLog: 2017-12-11 Pedro Alves <palves@redhat.com> * defs.h (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index) (elf_sym_fns_debug_names): Move to elfread.c. * dwarf2read.c (dwarf2_initialize_objfile): Return a boolean instead of a sym_fns and add 'index_kind' output parameter. Fill the latter in with the index variant kind if using an index. (enum dw_index_kind): Moved to symfile.h. * elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_debug_names) (elf_sym_fns_lazy_psyms): Move from defs.h. (elf_symfile_read): Adjust to new dwarf2_initialize_objfile interface. * symfile.h (enum class dw_index_kind): New, moved from dwarf2read.c. (dwarf2_initialize_objfile): Change prototype.
2017-12-08DWARF-5: .debug_names index consumerJan Kratochvil1-0/+1
Some testcases needed to be updated as they were missing .debug_aranges. While that does not matter for no-index (as GDB builds the mapping internally during dwarf2_build_psymtabs_hard) and neither for .gdb_index (as GDB uses that internally built mapping which it stores into .gdb_index) it does matter for .debug_names as that simply assumes existing .debug_aranges from GCC. gdb/ChangeLog: 2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * defs.h (elf_sym_fns_debug_names): New declaration. * dwarf2read.c: Include "hash_enum.h". (mapped_debug_names): New. (struct dwarf2_per_objfile): Add debug_names, debug_aranges and debug_names_table. (dwarf2_elf_names): Add ".debug_names" and ".debug_aranges". (struct dwz_file): Add debug_names. (dwarf2_per_objfile::locate_sections): Handle debug_names and debug_aranges. (locate_dwz_sections): Handle debug_names. (create_signatured_type_table_from_debug_names) (create_addrmap_from_aranges): New. (dwarf2_read_index): Update function comment. (dwarf5_augmentation): Moved up. (read_debug_names_from_section, create_cus_from_debug_names_list) (create_cus_from_debug_names, dwarf2_read_debug_names): New. (dwarf5_djb_hash): Moved up. (dw2_debug_names_iterator): New. (read_indirect_string_at_offset): New declaration. (mapped_debug_names::namei_to_name) (dw2_debug_names_iterator::find_vec_in_debug_names) (dw2_debug_names_iterator::next, dw2_debug_names_lookup_symbol) (dw2_debug_names_dump, dw2_debug_names_expand_symtabs_for_function) (dw2_debug_names_expand_symtabs_matching, dwarf2_debug_names_functions): New. (dwarf2_initialize_objfile): Return also elf_sym_fns_debug_names. (debug_names::djb_hash): Rename it to dwarf5_djb_hash. (debug_names::build): Update djb_hash caller. (write_debug_names): Move out and rename augmentation to dwarf5_augmentation. * elfread.c (elf_sym_fns_debug_names): New. * psymtab.h (dwarf2_debug_names_functions): New declaration. * symfile.h (struct dwarf2_debug_sections): Add debug_names and debug_aranges. * xcoffread.c (dwarf2_xcoff_names): Add debug_names and debug_aranges. gdb/testsuite/ChangeLog: 2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * gdb.base/maint.exp (check for .gdb_index): Check also for .debug_names. * gdb.dlang/watch-loc.c (.debug_aranges): New. * gdb.dwarf2/dw2-case-insensitive-debug.S: Likewise. * gdb.dwarf2/gdb-index.exp (check if index present, .gdb_index used) (.gdb_index used after symbol reloading): Support also .debug_names. * gdb.mi/dw2-ref-missing-frame-func.c (.debug_aranges): New.
2017-12-08Change dwarf2_initialize_objfile's return valueJan Kratochvil1-0/+5
dwarf2_initialize_objfile was returning boolean whether it is psymtabs or .gdb_index while now it needs to return also whether it is .debug_names. gdb/ChangeLog 2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com> * defs.h (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move here declarations from elfread.c. (dwarf2_initialize_objfile): Change return value. * elfread.c (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move these declarations to defs.h. (elf_symfile_read): Adjust dwarf2_initialize_objfile caller. * symfile.h (dwarf2_initialize_objfile): Change return type.
2017-11-07Constify execute_commandTom Tromey1-1/+1
This constifies execute_command and fixes up the callers. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * event-top.h (command_handler): Constify. * record-full.c (cmd_record_full_start): Update. * thread.c (thread_apply_all_command): Update. * printcmd.c (eval_command): Update. * mi/mi-main.c (mi_execute_cli_command): Update. (mi_execute_async_cli_command): Update. * tui/tui-stack.c (tui_update_command): Update. * cli/cli-interp.c (safe_execute_command): Constify. * record.c (record_start): Update. (record_start, record_stop, cmd_record_start): Update. * record-btrace.c (cmd_record_btrace_bts_start): Update. (cmd_record_btrace_pt_start): Update. (cmd_record_btrace_start): Update. (cmd_record_btrace_start): Update. * reverse.c (exec_reverse_once): Update. * python/python.c (execute_gdb_command): Don't copy the command. * event-top.c (command_line_handler): Update. (command_handler): Constify. * defs.h (deprecated_call_command_hook): Constify. * cli/cli-script.h (execute_user_command): Constify. * cli/cli-script.c (execute_user_command): Constify. (execute_cmd_pre_hook, execute_cmd_post_hook): Constify. (enum command_control_type): Update. * main.c (catch_command_errors): Remove non-const overload. (catch_command_errors_ftype): Remove. * python/py-cmd.c (cmdpy_function): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * cli/cli-dump.c (call_dump_func): Constify. * cli/cli-decode.c (do_const_cfunc): Constify. (do_sfunc): Constify. (cmd_func): Constify. * gdbcmd.h (execute_command, execute_command_to_string): Constify. * top.h (execute_command): Constify. * top.c (execute_command): Constify. (execute_command_to_string): Constify. (deprecated_call_command_hook): Constify. * command.h (cmd_func): Constify. * cli/cli-decode.h (struct cmd_list_element) <func>: Constify.
2017-11-07Constify add_path and friendsTom Tromey1-3/+3
This constifies add_path, mod_path, and directory_switch. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * source.c (directory_switch, mod_path, add_path): Constify. * defs.h (add_path, mod_path, directory_switch): Constify. * mi/mi-cmd-env.c (env_mod_path): Constify.
2017-09-27Constify some commands in exec.c, plus symbol_file_commandTom Tromey1-1/+1
Note that this commit also changes deprecated_file_changed_hook -- not used in the tree, but Insight will require a (presumably minor) change. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * symfile.c (symbol_file_command): Constify. * gdbcore.h (deprecated_file_changed_hook): Constify. * exec.c (deprecated_file_changed_hook, exec_file_command) (file_command): Constify. * defs.h (symbol_file_command): Constify.
2017-09-23Removed unused declarationTom Tromey1-6/+0
An earlier patch of mine removed make_cleanup_override_quit_handler, but neglected to remove the declaration. This patch removes it. Tested by rebuilding. I'm committing this as obvious. ChangeLog 2017-09-23 Tom Tromey <tom@tromey.com> * defs.h (make_cleanup_override_quit_handler): Don't declare.
2017-09-04Move command lines types/declarations to cli-script.hSimon Marchi1-74/+0
I think it would make more sense if the types and function declarations related to command lines were in cli-script.h rather than defs.h, since the related function definitions are in cli-script.c. I had to add a few includes here and there. I also had to rename the "lines" parameter of command_lines_deleter::operator(), because ncurses has a "#define lines ..." that was interfering when cli-script.h is included by some TUI source files that also include ncurses header files. gdb/ChangeLog: * cli/cli-script.h (enum misc_command_type): Move from defs.h. (enum command_control_type): Likewise. (struct command_line): Likewise. (free_command_lines): Likewise. (struct command_lines_deleter): Likewise. (command_line_up): Likewise. (read_command_lines): Likewise. (read_command_lines_1): Likewise. * defs.h (enum misc_command_type): Move to cli/cli-script.h. (enum command_control_type): Likewise. (struct command_line): Likewise. (free_command_lines): Likewise. (struct command_lines_deleter): Likewise. (command_line_up): Likewise. (read_command_lines): Likewise. (read_command_lines_1): Likewise. * breakpoint.h: Include cli/cli-script.h. * extension-priv.h: Likewise. * gdbcmd.h: Likewise.
2017-07-20Make language_def O(1)Pedro Alves1-1/+2
Profiling GDB with the rest of series applied, I saw calls to language_def showing up high in some runs. The problem is that language_def is O(N) currently, since walk the languages vector each time to find the matching language_defn. IMO, the add_language mechanism is pointless, because "enum language" implies the core of GDB needs to know about all languages anyway. So simply make the languages vector array be an array where each element's index is the corresponding enum language enumerator. Note that "local_language_defn" is gone along the way. It's just a copy of "auto", so the new code simply maps one to the other. One fewer place to update when we need to change the language vector... Also, a while ago the output of "set language" was made out of order as side effect of some other change. While I was at it, I made them sorted again. gdb/ChangeLog: 2017-07-20 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_language_defn): Make extern. (_initialize_ada_language): Remove add_language call. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Make extern. (_initialize_c_language): Delete. * completer.c (compare_cstrings): Delete, moved to utils.h. * d-lang.c (d_language_defn): Make extern. (_initialize_d_language): Remove add_language calls. * defs.h (enum language): Add comment. * f-lang.c (f_language_defn): Make extern. (_initialize_f_language): Remove add_language call. * go-lang.c (go_language_defn): Make extern. (_initialize_go_language): Remove add_language call. * language.c: Include <algorithm>. (languages): Redefine as const array. (languages_size, languages_allocsize, DEFAULT_ALLOCSIZE): Delete. (set_language_command): Handle "local". Use for-range loop. (set_language): Remove loop. (language_enum): Rewrite. (language_def, language_str): Remove loops. (add_language): Delete. (add_set_language_command): New, based on add_languages. (skip_language_trampoline): Adjust. (local_language_defn): Delete. (language_gdbarch_post_init): Adjust. (_initialize_language): Remove add_language calls. Call add_set_language_command. * language.h (add_language): Delete. (auto_language_defn) (unknown_language_defn, minimal_language_defn, ada_language_defn) (asm_language_defn, c_language_defn, cplus_language_defn) (d_language_defn, f_language_defn, go_language_defn) (m2_language_defn, objc_language_defn, opencl_language_defn) (pascal_language_defn, rust_language_defn): Declare. * m2-lang.c (m2_language_defn): Make extern. (_initialize_m2_language): Remove add_language call. * objc-lang.c (objc_language_defn): Make extern. (_initialize_objc_language): Remove add_language call. * opencl-lang.c (opencl_language_defn): Make extern. (_initialize_opencl_language): Remove add_language call. * p-lang.c (pascal_language_defn): Make extern. (_initialize_pascal_language): Delete. * rust-lang.c (rust_language_defn): Make extern. (_initialize_rust_language): Delete. * utils.h (compare_cstrings): New static inline function. gdb/testsuite/ChangeLog: 2017-07-20 Pedro Alves <palves@redhat.com> * gdb.base/default.exp (set language): Adjust expected output.
2017-06-16extract/store integer function templateYao Qi1-8/+39
This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-05-26Add regcache raw_supply_integer and raw_collect_integer.Alan Hayward1-1/+4
Use these to replace instances of MAX_REGISTER_SIZE. * defs.h (copy_integer_to_size): New declaration. * findvar.c (copy_integer_to_size): New function. (do_cint_test): New selftest function. (copy_integer_to_size_test): Likewise. (_initialize_findvar): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_reg): Use raw_supply_integer. (mips_fbsd_collect_reg): Use raw_collect_integer. * mips-linux-tdep.c (supply_32bit_reg): Use raw_supply_integer. (mips64_fill_gregset): Use raw_collect_integer (mips64_fill_fpregset): Use raw_supply_integer. * regcache.c (regcache::raw_supply_integer): New function. (regcache::raw_collect_integer): Likewise. * regcache.h: (regcache::raw_supply_integer): New declaration. (regcache::raw_collect_integer): Likewise.
2017-04-12Introduce command_line_upTom Tromey1-7/+21
This introduces command_line_up, a unique_ptr for command_line objects, and changes many places to use it. This removes a number of cleanups. Command lines are funny in that sometimes they are reference counted. Once there is more C++-ification of some of the users, perhaps all of these can be changed to use shared_ptr instead. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (actions_command): Update. * python/python.c (python_command, python_interactive_command): Update. * mi/mi-cmd-break.c (mi_cmd_break_commands): Update. * guile/guile.c (guile_command): Update. * defs.h (read_command_lines, read_command_lines_1): Return command_line_up. (command_lines_deleter): New struct. (command_line_up): New typedef. * compile/compile.c (compile_code_command) (compile_print_command): Update. * cli/cli-script.h (get_command_line, copy_command_lines): Return command_line_up. (make_cleanup_free_command_lines): Remove. * cli/cli-script.c (get_command_line, read_command_lines_1) (copy_command_lines): Return command_line_up. (while_command, if_command, read_command_lines, define_command) (document_command): Update. (do_free_command_lines_cleanup, make_cleanup_free_command_lines): Remove. * breakpoint.h (breakpoint_set_commands): Change type of "commands". * breakpoint.c (breakpoint_set_commands): Change type of "commands". Update. (do_map_commands_command, update_dprintf_command_list) (create_tracepoint_from_upload): Update.
2017-04-05-Wwrite-strings: The RestPedro Alves1-3/+4
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-02-20DWARF-5 basic functionalityJan Kratochvil1-0/+4
this is a kitchen-sink patch for everything that did not fit into its own patch. DWO is not yet implemented. gdb/ChangeLog 2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com> * defs.h (read_unsigned_leb128): New declaration. * dwarf2loc.c (decode_debug_loclists_addresses): New function. (decode_debug_loc_dwo_addresses): Update DEBUG_LOC_* to DW_LLE_*. (dwarf2_find_location_expression): Call also decode_debug_loclists_addresses. Handle DWARF-5 ULEB128 length. * dwarf2loc.h (dwarf2_version): New declaration. * dwarf2read.c (struct dwarf2_per_objfile): Add loclists, line_str, rnglists. (dwarf2_elf_names): Add .debug_loclists, .debug_line_str, .debug_rnglists. (struct dwop_section_names): Add loclists_dwo. (dwop_section_names): Add .debug_loclists.dwo. (struct comp_unit_head): Add unit_type, signature, type_offset_in_tu. (struct dwarf2_per_cu_data): Add dwarf_version. (struct dwo_sections): Add loclists. (struct attr_abbrev): Add implicit_const. (read_indirect_line_string): New declaration. (read_unsigned_leb128): Delete declaration. (rcuh_kind): New definition. (read_and_check_comp_unit_head): Change parameter is_debug_types_section to section_kind. (dwarf2_locate_sections): Handle loclists, line_str and rnglists. (read_comp_unit_head): Change parameter abfd to section, add parameter section_kind. Handle DWARF-5. (error_check_comp_unit_head): Accept also DWARF version 5. (read_and_check_comp_unit_head): Change parameter is_debug_types_section to section_kind. (read_and_check_type_unit_head): Delete function. (read_abbrev_offset): Handle DWARF-5. (create_debug_type_hash_table): Add parameter section_kind. Process only DW_UT_type. Use signature and type_offset_in_tu from struct comp_unit_head. (create_debug_types_hash_table): Update create_debug_type_hash_table caller. (create_all_type_units): Call create_debug_type_hash_table. (read_cutu_die_from_dwo, init_cutu_and_read_dies): Change read_and_check_type_unit_head caller to read_and_check_comp_unit_head caller. (skip_one_die): Handle DW_FORM_implicit_const. (dwarf2_rnglists_process): New function. (dwarf2_ranges_process): Call dwarf2_rnglists_process for DWARF-5. (abbrev_table_read_table): Handle DW_FORM_implicit_const. (read_attribute_value): Handle DW_FORM_implicit_const, DW_FORM_line_strp. (read_attribute): Handle DW_FORM_implicit_const. (read_indirect_string_at_offset_from): New function from read_indirect_string_at_offset. (read_indirect_string_at_offset): Call read_indirect_string_at_offset_from. (read_indirect_line_string_at_offset): New function. (read_indirect_string): New function comment. (read_indirect_line_string): New function. (read_unsigned_leb128): Make it global. (dwarf2_string_attr): Handle DWARF-5. (add_include_dir_stub, read_formatted_entries): New functions. (dwarf_decode_line_header, dump_die_shallow, cu_debug_loc_section): Handle DWARF-5. (per_cu_header_read_in): Update read_comp_unit_head caller. (dwarf2_version): New function. * symfile.h (struct dwarf2_debug_sections): Add loclists, line_str and rnglists. * xcoffread.c (dwarf2_xcoff_names): Update struct dwarf2_debug_sections fields. gdb/testsuite/ChangeLog 2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.dwarf2/dw2-error.exp (file $testfile): Update expected string.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-12-09gdb: Remove support for obsolete OSABIs and a.outPedro Alves1-7/+3
gdb/ChangeLog: 2016-12-09 Pedro Alves <palves@redhat.com> * Makefile.in (ALL_TARGET_OBS): Remove vax-obsd-tdep.o. * alpha-fbsd-tdep.c (_initialize_alphafbsd_tdep): Adjust. * alpha-nbsd-tdep.c: Move comment to _initialize_alphanbsd_tdep. (alphanbsd_core_osabi_sniffer): Delete. (_initialize_alphanbsd_tdep): No longer handle a.out. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Adjust. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Adjust. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Adjust. * amd64-obsd-tdep.c (amd64obsd_supply_regset) (amd64obsd_combined_regset) (amd64obsd_iterate_over_regset_sections, amd64obsd_core_init_abi): Delete. (_initialize_amd64obsd_tdep): Don't handle a.out. * arm-nbsd-nat.c (struct md_core, fetch_core_registers) (arm_netbsd_core_fns): Delete. (_initialize_arm_netbsd_nat): Don't register arm_netbsd_core_fns. * arm-nbsd-tdep.c (arm_netbsd_aout_init_abi) (arm_netbsd_aout_osabi_sniffer): Delete. (_initialize_arm_netbsd_tdep): Don't handle a.out. * arm-obsd-tdep.c (armobsd_core_osabi_sniffer): Delete. (_initialize_armobsd_tdep): Don't handle a.out. * arm-tdep.c (arm_gdbarch_init): Remove bfd_target_aout_flavour case. * breakpoint.c (disable_breakpoints_in_unloaded_shlib): Remove SunOS a.out handling. * configure.tgt (vax-*-netbsd* | vax-*-knetbsd*-gnu): Remove vax-obsd-tdep.o from gdb_target_objs. (vax-*-openbsd*): Likewise. (*-*-freebsd*): Adjust default gdb_osabi. (*-*-openbsd*): Likewise. * dbxread.c (block_address_function_relative): Delete. (dbx_symfile_read): Remove reference to block_address_function_relative. (dbx_symfile_read): Don't call read_dbx_dynamic_symtab. (read_dbx_dynamic_symtab): Delete. (process_one_symbol): Remove references to block_address_function_relative. * defs.h (GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_NETBSD_AOUT): Remove. (GDB_OSABI_FREEBSD_ELF): Rename to ... (GDB_OSABI_FREEBSD): ... this. (GDB_OSABI_NETBSD_ELF): Rename to ... (GDB_OSABI_NETBSD): ... this. (GDB_OSABI_OPENBSD_ELF): Rename to ... (GDB_OSABI_OPENBSD): ... this. (GDB_OSABI_HPUX_ELF, GDB_OSABI_HPUX_SOM): Remove. * fbsd-tdep.c: Adjust comment. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Adjust. * hppa-obsd-tdep.c (GDB_OSABI_NETBSD_CORE): Delete. (hppaobsd_core_osabi_sniffer): Delete. (_initialize_hppabsd_tdep): Don't handle a.out. * hppa-tdep.c (hppa_stub_frame_unwind_cache): Don't handle GDB_OSABI_HPUX_SOM. (hppa_gdbarch_init): Likewise. * i386-bsd-tdep.c (i386bsd_aout_osabi_sniffer) (i386bsd_core_osabi_sniffer, _initialize_i386bsd_tdep): Delete. * i386-fbsd-tdep.c (i386fbsdaout_init_abi): Delete. Merge bits with ... (i386fbsd_init_abi): ... this. (_initialize_i386fbsd_tdep): Don't handle a.out. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Adjust. * i386-obsd-tdep.c (i386obsd_aout_supply_regset) (i386obsd_aout_gregset) (i386obsd_aout_iterate_over_regset_sections): Delete. (i386obsd_init_abi): Merge with i386obsd_elf_init_abi. (i386obsd_aout_init_abi): Delete. (_initialize_i386obsd_tdep): Don't handle a.out. * m68k-bsd-tdep.c (m68kobsd_sigtramp_cache_init) (m68kobsd_sigtramp): Delete. (m68kbsd_init_abi): Merge with ... (m68kbsd_elf_init_abi): ... this, and delete it. (m68kbsd_aout_init_abi): Delete. (m68kbsd_aout_osabi_sniffer, m68kbsd_core_osabi_sniffer): Delete. (_initialize_m68kbsd_tdep): Don't handle a.out. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Adjust. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Adjust. * osabi.c (gdb_osabi_names): Remove "a.out" entries. Drop "ELF" suffixes. Remove "HP-UX" entries. (generic_elf_osabi_sniff_abi_tag_sections): Adjust. (generic_elf_osabi_sniffer): No longer handle GDB_OSABI_HPUX_ELF. Adjust. (_initialize_ppcfbsd_tdep): Adjust. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Adjust. * ppc-obsd-tdep.c (GDB_OSABI_NETBSD_CORE) (ppcobsd_core_osabi_sniffer): Delete. (_initialize_ppcobsd_tdep): Don't handle a.out. * rs6000-tdep.c (rs6000_gdbarch_init): Adjust. * sh-nbsd-tdep.c (GDB_OSABI_NETBSD_CORE) (shnbsd_core_osabi_sniffer): Delete. (_initialize_shnbsd_tdep): Don't handle a.out. * solib.c (clear_solib): Don't handle SunOS/a.out. * sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Make extern. (sparc32nbsd_aout_init_abi): Delete. (sparc32nbsd_elf_init_abi): Merged into sparc32nbsd_init_abi. (sparcnbsd_aout_osabi_sniffer): Delete. (GDB_OSABI_NETBSD_CORE, sparcnbsd_core_osabi_sniffer): Delete. (_initialize_sparcnbsd_tdep): No longer handle a.out. * sparc-obsd-tdep.c (sparc32obsd_init_abi) (_initialize_sparc32obsd_tdep): Adjust. * sparc-tdep.h (sparc32nbsd_elf_init_abi): Rename to ... (sparc32nbsd_init_abi): ... this. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Adjust. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Adjust. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Adjust. * stabsread.c: Update comment. * symmisc.c (print_objfile_statistics): Don't mention "a.out" in output. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Adjust. * vax-obsd-tdep.c: Delete file.
2016-11-23gdb: Use C++11 std::chronoPedro Alves1-14/+0
This patch fixes a few problems with GDB's time handling. #1 - It avoids problems with gnulib's C++ namespace support On MinGW, the struct timeval that should be passed to gnulib's gettimeofday replacement is incompatible with libiberty's timeval_sub/timeval_add. That's because gnulib also replaces "struct timeval" with its own definition, while libiberty expects the system's. E.g., in code like this: gettimeofday (&prompt_ended, NULL); timeval_sub (&prompt_delta, &prompt_ended, &prompt_started); timeval_add (&prompt_for_continue_wait_time, &prompt_for_continue_wait_time, &prompt_delta); That's currently handled in gdb by not using gnulib's gettimeofday at all (see common/gdb_sys_time.h), but that #undef hack won't work with if/when we enable gnulib's C++ namespace support, because that mode adds compile time warnings for uses of ::gettimeofday, which are hard errors with -Werror. #2 - But there's an elephant in the room: gettimeofday is not monotonic... We're using it to: a) check how long functions take, for performance analysis b) compute when in the future to fire events in the event-loop c) print debug timestamps But that's exactly what gettimeofday is NOT meant for. Straight from the man page: ~~~ The time returned by gettimeofday() is affected by discontinuous jumps in the system time (e.g., if the system administrator manually changes the system time). If you need a monotonically increasing clock, see clock_gettime(2). ~~~ std::chrono (part of the C++11 standard library) has a monotonic clock exactly for such purposes (std::chrono::steady_clock). This commit switches to use that instead of gettimeofday, fixing all the issues mentioned above. gdb/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add common/run-time-clock.c. (HFILES_NO_SRCDIR): Add common/run-time-clock.h. (COMMON_OBS): Add run-time-clock.o. * common/run-time-clock.c, common/run-time-clock.h: New files. * defs.h (struct timeval, print_transfer_performance): Delete declarations. * event-loop.c (struct gdb_timer) <when>: Now a std::chrono::steady_clock::time_point. (create_timer): use std::chrono::steady_clock instead of gettimeofday. Use new instead of malloc. (delete_timer): Use delete instead of xfree. (duration_cast_timeval): New. (update_wait_timeout): Use std::chrono::steady_clock instead of gettimeofday. * maint.c: Include <chrono> instead of "gdb_sys_time.h", <time.h> and "timeval-utils.h". (scoped_command_stats::~scoped_command_stats) (scoped_command_stats::scoped_command_stats): Use std::chrono::steady_clock instead of gettimeofday. Use user_cpu_time_clock instead of get_run_time. * maint.h: Include "run-time-clock.h" and <chrono>. (scoped_command_stats): <m_start_cpu_time>: Now a user_cpu_time_clock::time_point. <m_start_wall_time>: Now a std::chrono::steady_clock::time_point. * mi/mi-main.c: Include "run-time-clock.h" and <chrono> instead of "gdb_sys_time.h" and <sys/resource.h>. (rusage): Delete. (mi_execute_command): Use new instead of XNEW. (mi_load_progress): Use std::chrono::steady_clock instead of gettimeofday. (timestamp): Rewrite in terms of std::chrono::steady_clock, user_cpu_time_clock and system_cpu_time_clock. (timeval_diff): Delete. (print_diff): Adjust to use std::chrono::steady_clock, user_cpu_time_clock and system_cpu_time_clock. * mi/mi-parse.h: Include "run-time-clock.h" and <chrono> instead of "gdb_sys_time.h". (struct mi_timestamp): Change fields types to std::chrono::steady_clock::time_point, user_cpu_time_clock::time and system_cpu_time_clock::time_point, instead of struct timeval. * symfile.c: Include <chrono> instead of <time.h> and "gdb_sys_time.h". (struct time_range): New. (generic_load): Use std::chrono::steady_clock instead of gettimeofday. (print_transfer_performance): Replace timeval parameters with a std::chrono::steady_clock::duration parameter. Adjust. * utils.c: Include <chrono> instead of "timeval-utils.h", "gdb_sys_time.h", and <time.h>. (prompt_for_continue_wait_time): Now a std::chrono::steady_clock::duration. (defaulted_query, prompt_for_continue): Use std::chrono::steady_clock instead of gettimeofday/timeval_sub/timeval_add. (reset_prompt_for_continue_wait_time): Use std::chrono::steady_clock::duration instead of struct timeval. (get_prompt_for_continue_wait_time): Return a std::chrono::steady_clock::duration instead of struct timeval. (vfprintf_unfiltered): Use std::chrono::steady_clock instead of gettimeofday. Use std::string. Use '.' instead of ':'. * utils.h: Include <chrono>. (get_prompt_for_continue_wait_time): Return a std::chrono::steady_clock::duration instead of struct timeval. gdb/gdbserver/ChangeLog: 2016-11-23 Pedro Alves <palves@redhat.com> * debug.c: Include <chrono> instead of "gdb_sys_time.h". (debug_vprintf): Use std::chrono::steady_clock instead of gettimeofday. Use '.' instead of ':'. * tracepoint.c: Include <chrono> instead of "gdb_sys_time.h". (get_timestamp): Use std::chrono::steady_clock instead of gettimeofday.
2016-10-31MIPS: Remove remains of IRIX OS ABI supportMaciej W. Rozycki1-1/+0
Complement commit 3831839c089c ("Delete IRIX support") and remove dead MIPS target IRIX OS ABI support code. gdb/ * defs.h (gdb_osabi): Remove GDB_OSABI_IRIX enum value. * osabi.c (gdb_osabi_names): Remove "Irix" entry. * mips-tdep.c (mips_irix_reg_names): Remove. (mips_register_type): Remove GDB_OSABI_IRIX code. (mips_pseudo_register_type): Likewise. (mips_breakpoint_from_pc): Likewise. (mips_gdbarch_init): Likewise.
2016-10-25Fix gdb C++ compilation on Solaris (PR build/20712)Rainer Orth1-10/+0
gdb 7.12 doesn't compile as C++ (tried with g++ 4.9) on Solaris (tried 10 and 12, sparc and x86). The following patch (relative to the 7.12 release, though I expect most if not all issues to be present on trunk, too) fixes this. Only a few of the changes bear explanation: * Initially, compilation failed whereever defs.h. was included: In file included from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:0: /vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:630:33: error: 'double atof(const char*)' conflicts with a previous declaration extern double atof (const char *); /* X3.159-1989 4.10.1.1 */ ^ In file included from /usr/include/stdlib.h:17:0, from build-gnulib/import/stdlib.h:36, from /vol/src/gnu/gdb/gdb-7.12/gdb/common/common-defs.h:32, from /vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:28, from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19: /vol/gcc-4.9/lib/gcc/i386-pc-solaris2.10/4.9.0/include-fixed/iso/stdlib_iso.h:119:15: note: previous declaration 'double std::atof(const char*)' extern double atof(const char *); ^ This is due to this gem in gdb/defs.h which seems to have been present like forever: #ifndef atof extern double atof (const char *); /* X3.159-1989 4.10.1.1 */ #endif In the Solaris headers, the appropriate functions are in namespace std, thus the conflict. I've wrapped the defs.h declaration in !__cplusplus to avoid this; perhaps it can go completely instead. * All the casts are necessary to appease g++ and should be pretty obvious. * The sol-thread.c changes are here to handle /vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c: In function 'void _initialize_sol_thread()': /vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1252:36: error: invalid conversion from 'void*' to 'void (*)(int)' [-fpermissive] if (!(p_##X = dlsym (dlhandle, #X))) \ ^ /vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1255:3: note: in expansion of macro 'resolve' resolve (td_log); ^ and are modeled after linux-thread-db.c (try_thread_db_load_1). The patch allowed both 32 and 64-bit C++ builds on sparc-sun-solaris2.10 and i386-pc-solaris2.10 to complete. The resulting binary hasn't seen more than a smoke test (invoke it on itself, b main, run) yet. When investigating the failure to detect -static-libstdc++ support (more below), I found two more issues which only show up with -Werror: /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function 'ssd* proc_get_LDT_entry(procinfo*, int)': /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2487:19: error: variable 'old_chain' set but not used [-Werror=unused-but-set-variable] struct cleanup *old_chain = NULL; ^ Unless I'm mistaken, you need to run do_cleanups on every return from the function. Afterwards, I ran a 32-bit compilation, which (after adding --disable-largefile to avoid In file included from /usr/include/sys/procfs.h:28:0, from /vol/src/gnu/gdb/gdb/local/gdb/i386-sol2-nat.c:23: /usr/include/sys/old_procfs.h:39:2: error: #error "Cannot use procfs in the large file compilation environment" #error "Cannot use procfs in the large file compilation environment" ^ and two more instances) revealed /vol/src/gnu/gdb/gdb/local/gdb/top.c: In function 'void gdb_safe_append_history()': /vol/src/gnu/gdb/gdb/local/gdb/top.c:1170:59: error: format '%d' expects argument of type 'int', but argument 3 has type 'pid_t {aka long int}' [-Werror=format=] = xstrprintf ("%s-gdb%d~", history_filename, getpid ()); ^ Fixed by casting pid_t to long and printing it as such.
2016-10-06Remove Java supportTom Tromey1-4/+3
This patch removes the Java support from gdb. gcj has not seen much development or use for years now, and was recently removed from GCC. This patch changes gdb to follow; in the unlikely event that there are still users using gcj, they can continue to use an older gdb to debug. Or, they can debug in C++ mode. Built and regtested on x86-64 Fedora 24. 2016-10-06 Tom Tromey <tom@tromey.com> * MAINTAINERS: Remove Java test maintainer. * varobj.h (java_varobj_ops): Don't declare. * valprint.h (struct value_print_options) <pascal_static_field_print>: Update comment. * utils.c (producer_is_gcc): Remove java reference. * symtab.h (struct general_symbol_info): Remove java references. (SYMBOL_SEARCH_NAME): Likewise. * objfiles.c (allocate_objfile): Update comment. * linespec.c (find_linespec_symbols): Remove java references. * gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_baseclass_offset): Remove java references. * gdbtypes.h (struct cplus_struct_type) <is_java>: Remove. (TYPE_CPLUS_REALLY_JAVA): Remove. * c-varobj.c (enum vsections): Update comment. * symtab.c (symbol_set_language, symbol_set_names) (symbol_natural_name, symbol_demangled_name) (demangle_for_lookup, symbol_matches_domain) (default_make_symbol_completion_list_break_on_1): Remove java references. (JAVA_PREFIX, JAVA_PREFIX_LEN): Remove. * psymtab.c (match_partial_symbol, psymtab_search_name) (lookup_partial_symbol): Remove java references. * dwarf2read.c (find_slot_in_mapped_hash): Remove java references. (add_partial_symbol, dwarf2_compute_name, dwarf2_physname) (dwarf2_add_member_fn, is_vtable_name, read_structure_type) (process_structure_scope, read_subroutine_type) (read_subrange_type, load_partial_dies) (new_symbol_full, determine_prefix, typename_concat) (dwarf2_name): Remove java references. (set_cu_language): Treat Java as C++. * c-typeprint.c (c_type_print_args): Remove java reference. * defs.h (enum language) <language_java>: Remove. * Makefile.in (SFILES, HFILES_NO_SRCDIR, COMMON_OBS, YYFILES) (YYOBJ, local-maintainer-clean): Don't mention java files. * jv-exp.y, jv-lang.c, jv-lang.h, jv-typeprint.c, jv-valprint.c, jv-varobj.c: Remove. 2016-10-06 Tom Tromey <tom@tromey.com> * guile.texi (Types In Guile): Remove Java mentions. * python.texi (Types In Python): Remove Java mentions. * gdb.texinfo (Address Locations, Supported Languages) (Index Section Format): Remove Java mentions. 2016-10-06 Tom Tromey <tom@tromey.com> * gdb.compile/compile.exp: Change java tests to rust. * gdb.base/setshow.exp: Change java tests to rust. * gdb.base/default.exp: Remove java from language list. * README (Examples): Update language example. * gdb.python/py-lookup-type.exp (test_lookup_type): Remove java test. * lib/gdb.exp (skip_java_tests): Remove. * lib/java.exp: Remove. * gdb.java: Remove.
2016-10-03Emit inferior, thread and frame selection events to all UIsAntoine Tremblay1-0/+16
With this patch, when an inferior, thread or frame is explicitly selected by the user, notifications will appear on all CLI and MI UIs. When a GDB console is integrated in a front-end, this allows the front-end to follow a selection made by the user ont he CLI, and it informs the user about selection changes made behind the scenes by the front-end. This patch addresses PR gdb/20487. In order to communicate frame changes to the front-end, this patch adds a new field to the =thread-selected event for the selected frame. The idea is that since inferior/thread/frame can be seen as a composition, it makes sense to send them together in the same event. The vision would be to eventually send the inferior information as well, if we find that it's needed, although the "=thread-selected" event would be ill-named for that job. Front-ends need to handle this new field if they want to follow the frame selection changes that originate from the console. The format of the frame attribute is the same as what is found in the *stopped events. Here's a detailed example for each command and the events they generate: thread ------ 1. CLI command: thread 1.3 MI event: =thread-selected,id="3",frame={...} 2. MI command: -thread-select 3 CLI event: [Switching to thread 1.3 ...] 3. MI command (CLI-in-MI): thread 1.3 MI event/reply: &"thread 1.3\n" ~"#0 child_sub_function () ... =thread-selected,id="3",frame={level="0",...} ^done frame ----- 1. CLI command: frame 1 MI event: =thread-selected,id="3",frame={level="1",...} 2. MI command: -stack-select-frame 1 CLI event: #1 0x00000000004007f0 in child_function... 3. MI command (CLI-in-MI): frame 1 MI event/reply: &"frame 1\n" ~"#1 0x00000000004007f9 in ..." =thread-selected,id="3",frame={level="1"...} ^done inferior -------- Inferior selection events only go from the console to MI, since there's no way to select the inferior in pure MI. 1. CLI command: inferior 2 MI event: =thread-selected,id="3" Note that if the user selects an inferior that is not started or exited, the MI doesn't receive a notification. Since there is no threads to select, the =thread-selected event does not apply... 2. MI command (CLI-in-MI): inferior 2 MI event/reply: &"inferior 2\n" ~"[Switching to inferior 2 ...]" =thread-selected,id="4",frame={level="0"...} ^done Internal implementation detail: this patch makes it possible to suppress notifications caused by a CLI command, like what is done in mi-interp.c. This means that it's now possible to use the add_com_suppress_notification function to register a command with some event suppressed. It is used to implement the select-frame command in this patch. The function command_notifies_uscc_observer was added to extract the rather complicated logical expression from the if statement. It is also now clearer what that logic does: if the command used by the user already notifies the user_selected_context_changed observer, there is not need to notify it again. It therefore protects again emitting the event twice. No regressions, tested on ubuntu 14.04 x86 with target boards unix and native-extended-gdbserver. gdb/ChangeLog: YYYY-MM-DD Antoine Tremblay <antoine.tremblay@ericsson.com> YYYY-MM-DD Simon Marchi <simon.marchi@ericsson.com> PR gdb/20487 * NEWS: Mention new frame field of =thread-selected event. * cli/cli-decode.c (add_cmd): Initialize c->suppress_notification. (add_com_suppress_notification): New function definition. (cmd_func): Set and restore the suppress_notification flag. * cli/cli-deicode.h (struct cmd_list_element) <suppress_notification>: New field. * cli/cli-interp.c (cli_suppress_notification): New global variable. (cli_on_user_selected_context_changed): New function. (_initialize_cli_interp): Attach to user_selected_context_changed observer. * command.h (struct cli_suppress_notification): New structure. (cli_suppress_notification): New global variable declaration. (add_com_suppress_notification): New function declaration. * defs.h (enum user_selected_what_flag): New enum. (user_selected_what): New enum flag type. * frame.h (print_stack_frame_to_uiout): New function declaration. * gdbthread.h (print_selected_thread_frame): New function declaration. * inferior.c (print_selected_inferior): New function definition. (inferior_command): Remove printing of inferior/thread/frame switch notifications, notify user_selected_context_changed observer. * inferior.h (print_selected_inferior): New function declaration. * mi/mi-cmds.c (struct mi_cmd): Add user_selected_context suppression to stack-select-frame and thread-select commands. * mi/mi-interp.c (struct mi_suppress_notification) <user_selected_context>: Initialize. (mi_user_selected_context_changed): New function definition. (_initialize_mi_interp): Attach to user_selected_context_changed. * mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply. (mi_execute_command): Handle notification suppression. Notify user_selected_context_changed observer on thread change instead of printing event directly. Don't send it if command already sends the notification. (command_notifies_uscc_observer): New function. (mi_cmd_execute): Don't handle notification suppression. * mi/mi-main.h (struct mi_suppress_notification) <user_selected_context>: New field. * stack.c (print_stack_frame_to_uiout): New function definition. (select_frame_command): Notify user_selected_context_changed observer. (frame_command): Call print_selected_thread_frame if there's no frame change or notify user_selected_context_changed observer if there is. (up_command): Notify user_selected_context_changed observer. (down_command): Likewise. (_initialize_stack): Suppress user_selected_context notification for command select-frame. * thread.c (thread_command): Notify user_selected_context_changed if the thread has changed, print thread info directly if it hasn't. (do_captured_thread_select): Do not print thread switch event. (print_selected_thread_frame): New function definition. * tui/tui-interp.c (tui_on_user_selected_context_changed): New function definition. (_initialize_tui_interp): Attach to user_selected_context_changed observer. gdb/doc/ChangeLog: PR gdb/20487 * gdb.texinfo (Context management): Update mention of frame change notifications. (gdb/mi Async Records): Document frame field in =thread-select event. * observer.texi (GDB Observers): New user_selected_context_changed observer. gdb/testsuite/ChangeLog: PR gdb/20487 * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt =thread-select-event check.
2016-09-16gdb: Use std::min and std::max throughoutPedro Alves1-7/+0
Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-07-26PR python/20190 - compute TLS symbol without a frameTom Tromey1-0/+19
PR python/20190 arose from an exception I noticed when trying to use the Python unwinder for Spider Monkey in Firefox. The problem is that the unwinder wants to examine the value of a thread-local variable. However, sympy_value rejects this because symbol_read_needs_frame returns true for a TLS variable. This problem arose once before, though in a different context: https://sourceware.org/bugzilla/show_bug.cgi?id=11803 At the time Pedro and Daniel pointed out a simpler way to fix that bug (see links in 20190 if you are interested); but for this new bug I couldn't think of a similar fix and ended up implementing Daniel's other suggestion: https://sourceware.org/ml/gdb-patches/2010-07/msg00393.html That is, this patch makes it possible to detect whether a symbol needs a specific frame, or whether it just needs the inferior to have registers. Built and regtested on x86-64 Fedora 24. 2016-07-26 Tom Tromey <tom@tromey.com> * symtab.c (register_symbol_computed_impl): Update. PR python/20190: * value.h (symbol_read_needs): Declare. (symbol_read_needs_frame): Add comment. * symtab.h (struct symbol_computed_ops) <read_variable>: Update comment. <get_symbol_read_needs>: Rename. Change return type. * findvar.c (symbol_read_needs): New function. (symbol_read_needs_frame): Rewrite. (default_read_var_value): Use symbol_read_needs. * dwarf2loc.c (struct symbol_needs_baton): Rename. <needs>: Renamed from needs_frame. Changed type. (needs_frame_read_addr_from_reg, symbol_needs_get_reg_value) (symbol_needs_read_mem, symbol_needs_frame_base) (symbol_needs_frame_cfa, symbol_needs_tls_address) (symbol_needs_dwarf_call): Rename. (needs_dwarf_reg_entry_value): Update. (symbol_needs_ctx_funcs, dwarf2_loc_desc_get_symbol_read_needs): Rename and update. (locexpr_get_symbol_read_needs, loclist_symbol_needs): Likewise. (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update. * defs.h (enum symbol_needs_kind): New. 2016-07-26 Tom Tromey <tom@tromey.com> PR python/20190: * gdb.threads/tls.exp (check_thread_local): Add python symbol test.
2016-06-23Move logic out of symbol_find_demangled_nameTom Tromey1-4/+14
This patch moves most of the demangling logic out of symbol_find_demangled_name into the various language_defn objects. The simplest way to do this seemed to be to add a new method to language_defn. This is shame given the existing la_demangle, but given Ada's unusual needs, and the differing demangling options between languages, la_demangle didn't seem to fit. In order to make this work, I made enum language order-sensitive. This helps preserve the current ordering of demangling operations. 2016-06-23 Tom Tromey <tom@tromey.com> * symtab.c (symbol_find_demangled_name): Loop over languages and use language_sniff_from_mangled_name. * rust-lang.c (rust_sniff_from_mangled_name): New function. (rust_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_sniff_from_mangled_name): New function. (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_sniff_from_mangled_name>: New field. (language_sniff_from_mangled_name): Declare. * language.c (language_sniff_from_mangled_name): New function. (unknown_language_defn, auto_language_defn, local_language_defn): Update. * jv-lang.c (java_sniff_from_mangled_name): New function. (java_language_defn): Use it. * go-lang.c (go_sniff_from_mangled_name): New function. (go_language_defn): Use it. * f-lang.c (f_language_defn): Update. * defs.h (enum language): Reorder. * d-lang.c (d_sniff_from_mangled_name): New function. (d_language_defn): Use it. * cp-support.h (gdb_sniff_from_mangled_name): Declare. * cp-support.c (gdb_sniff_from_mangled_name): New function. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-lang.c (ada_sniff_from_mangled_name): New function. (ada_language_defn): Use it.
2016-06-21Make stdin be per UIPedro Alves1-1/+3
This commit makes each UI have its own "stdin" stream pointer. This is used to determine whether the "from_tty" argument to execute_command, etc. should be true. Related, this commit makes input_from_terminal_p take an UI parameter, and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only returns info on gdb's own main/primary terminal (the real stdin). However, the places that call input_from_terminal_p really want to know is whether the command came from an interactive tty. This patch thus renames input_from_terminal_p to input_interactive_p for clarity, and then makes input_interactive_p check for "set interactive" itself, along with ISATTY, instead of calling gdb_has_a_terminal. Actually, quit_force wants to call input_interactive_p _after_ stdin is closed, we can't call ISATTY that late. So instead we save the result of ISATTY in a field of the UI. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-script.c (read_next_line): Adjust to per-UI stdin. (read_command_lines): Use input_interactive_p instead of input_from_terminal_p. * defs.h (struct ui): Forward declare. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this. * event-top.c (stdin_event_handler): Pass 0 as from_tty argument to quit_command. (command_handler): Adjust to per-UI stdin. (handle_line_of_input): Adjust to per-UI stdin and use input_interactive_p instead of ISATTY and input_from_terminal_p. (gdb_readline_no_editing_callback): Adjust to per-UI stdin. (command_line_handler): Always pass true as "from_tty" parameter of handle_line_of_input and execute_command. (async_sigterm_handler): Pass 0 as from_tty argument to quit_command. * inflow.c (interactive_mode, show_interactive_mode): Moved to ... (gdb_has_a_terminal): Don't check interactive_mode here. (_initialize_inflow): Don't install "set interactive-mode" here. * main.c (captured_command_loop): Adjust to per-UI stdin. * mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI stdin. * top.c (new_ui): Save the stdin stream and whether it's a tty. (dont_repeat): Adjust to per-UI stdin. (command_line_input): Adjust to per-UI stdin and to use input_interactive_p. (quit_force): Write history if any UI supports interactive input. (interactive_mode, show_interactive_mode): Move here, from inflow.c. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this, and check the "interactive_mode" global instead of calling gdb_has_a_terminal. (_initialize_top): Install "set interactive-mode" here. * top.h (struct ui) <stdin_stream, input_interactive_p>: New fields. * utils.c (quit): Pass 0 as from_tty argument to quit_force. (defaulted_query): Adjust to per-UI stdin and to use input_interactive_p.
2016-05-17Add support for the Rust languageTom Tromey1-0/+1
This patch adds support for the Rust language. 2016-05-17 Tom Tromey <tom@tromey.com> Manish Goregaokar <manishsmail@gmail.com> * symtab.c (symbol_find_demangled_name): Handle Rust. * symfile.c (init_filename_language_table): Treat ".rs" as Rust. * std-operator.def (STRUCTOP_ANONYMOUS, OP_RUST_ARRAY): New constants. * rust-lang.h: New file. * rust-lang.c: New file. * rust-exp.y: New file. * dwarf2read.c (read_file_scope): Add Rust producer sniffing. (dwarf2_compute_name, read_func_scope, read_structure_type) (read_base_type, read_subrange_type, set_cu_language) (new_symbol_full, determine_prefix): Handle Rust. * defs.h (enum language) <language_rust>: New constant. * Makefile.in (SFILES): Add rust-exp.y, rust-lang.c. (COMMON_OBS): Add rust-exp.o, rust-lang.o. 2016-05-17 Tom Tromey <tom@tromey.com> * gdb.base/default.exp (set language): Add rust.
2016-04-12Eliminate immediate_quitPedro Alves1-7/+4
This finally gets rid of immediate_quit (and surrounding infrustruture), as nothing sets it anymore. gdb_call_async_signal_handler was only necessary in order to handle immediate_quit. We can just call mark_async_signal_handler directly on all hosts now. In turn, we can clean up mingw-hdep.c's gdb_select a bit, as sigint_event / sigint_handler is no longer needed. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> * defs.h: Update comments on SIGINT handling. (immediate_quit): Delete declaration. * event-loop.c (call_async_signal_handler): Delete. * event-loop.h (call_async_signal_handler): Delete declaration. (mark_async_signal_handler): Update comments. (gdb_call_async_signal_handler): Delete declaration. * event-top.c (handle_sigint): Call mark_async_signal_handler instead of gdb_call_async_signal_handler. * exceptions.c (prepare_to_throw_exception): Remove reference to immediate_quit. (exception_fprintf): Remove comments about immediate_quit. * mingw-hdep.c (sigint_event, sigint_handler): Delete. (gdb_select): Don't wait on sigint_event. (gdb_call_async_signal_handler): Delete. (_initialize_mingw_hdep): Delete. * posix-hdep.c (gdb_call_async_signal_handler): Delete. * utils.c (immediate_quit): Delete.
2016-04-12target remote: Don't rely on immediate_quit (introduce quit handlers)Pedro Alves1-4/+30
remote.c is the last user of immediate_quit. It's relied on to immediately break the initial remote connection sync up, if the user does Ctrl-C, assuming that was because the target isn't responding. At that stage, since the connection isn't synced yet, disconnecting is the only safe thing to do. This commit reworks that, to not rely on throwing from the SIGINT signal handler. So, this commit: - Introduces the concept of a "quit handler". This is used to override what does the QUIT macro do when the quit flag is set. - Makes the "struct serial" reachar / write code call QUIT in the partial read/write loops, so the current quit handler is invoked whenever a serial->read_prim / serial->write_prim returns EINTR. - Makes the "struct serial" reachar / write code call interruptible_select instead of gdb_select, so that QUITs are detected in a race-free manner. - Stops remote.c from setting immediate_quit during the initial connection. - Instead, we install a custom quit handler whenever we're calling into the serial code. This custom quit handler knows to immediately throw a quit when we're in the initial connection setup, and otherwise defer handling the quit/Ctrl-C request to later, when we're safely out of a packet command/response sequence. This also is what is now responsible for handling "double Ctrl-C because target connection is stuck/wedged." - remote.c no longer installs a specialized SIGINT handlers, and instead re-uses the quit flag. Since we want to rely on the QUIT macro, the SIGINT handler must also set the quit. And the easiest is just to not install custom SIGINT handler in remote.c. Let the standard SIGINT handler do its job of setting the quit flag. Centralizing SIGINT handlers seems like a good thing to me, anyway. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> * defs.h (quit_handler_ftype, quit_handler) (make_cleanup_override_quit_handler, default_quit_handler): New. (QUIT): Adjust comments. * event-top.c (default_quit_handler): New function. (quit_handler): New global. (struct quit_handler_cleanup_data): New. (restore_quit_handler, restore_quit_handler_dtor) (make_cleanup_override_quit_handler): New. (async_request_quit): Call QUIT. * remote.c (struct remote_state) <got_ctrlc_during_io>: New field. (async_sigint_remote_twice_token, async_sigint_remote_token): Delete. (remote_close): Update comments. (remote_start_remote): Don't set immediate_quit. Set starting_up earlier. (remote_serial_quit_handler, remote_unpush_and_throw): New functions. (remote_open_1): Clear got_ctrlc_during_io. Set remote_async_terminal_ours_p unconditionally. (async_initialize_sigint_signal_handler) (async_handle_remote_sigint, async_handle_remote_sigint_twice) (remote_check_pending_interrupt, async_remote_interrupt) (async_remote_interrupt_twice) (async_cleanup_sigint_signal_handler, ofunc) (sync_remote_interrupt, sync_remote_interrupt_twice): Delete. (remote_terminal_inferior, remote_terminal_ours): Remove async checks. (remote_wait_as): Don't install a SIGINT handler in sync mode. (readchar, remote_serial_write): Override the quit handler with remote_serial_quit_handler. (getpkt_or_notif_sane_1): Don't call QUIT. (initialize_remote_ops): Don't install remote_check_pending_interrupt. (_initialize_remote): Don't create async_sigint_remote_token and async_sigint_remote_twice_token. * ser-base.c (ser_base_wait_for): Call QUIT and use interruptible_select. (ser_base_write): Call QUIT. * ser-go32.c (dos_readchar, dos_write): Call QUIT. * ser-unix.c (wait_for): Don't use VTIME. Always take the gdb_select path, but call QUIT and interruptible_select. * utils.c (maybe_quit): Call the current quit handler. Don't call target_check_pending_interrupt. (defaulted_query, prompt_for_continue): Override the quit handler with the default quit handler.
2016-04-12Eliminate clear_quit_flagPedro Alves1-2/+0
Nothing calls this anymore. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> * defs.h (clear_quit_flag): Remove declaration. * extension-priv.h (struct extension_language_ops) <clear_quit_flag>: Remove field and update comments. * extension.c (clear_quit_flag): Delete. * guile/guile.c (guile_extension_ops): Adjust. * python/python.c (python_extension_ops): Adjust. (gdbpy_clear_quit_flag): Delete.
2016-04-12Introduce interruptible_selectPedro Alves1-0/+11
We have places where we call a blocking gdb_select expecting that a Ctrl-C will unblock it. However, if the Ctrl-C is pressed just before gdb_select, the SIGINT handler runs before gdb_select, and thus gdb_select won't return. For example gdb_readline_no_editing: QUIT; /* Wait until at least one byte of data is available. Control-C can interrupt gdb_select, but not fgetc. */ FD_ZERO (&readfds); FD_SET (fd, &readfds); if (gdb_select (fd + 1, &readfds, NULL, NULL, NULL) == -1) and stdio_file_read: /* For the benefit of Windows, call gdb_select before reading from the file. Wait until at least one byte of data is available. Control-C can interrupt gdb_select, but not read. */ { fd_set readfds; FD_ZERO (&readfds); FD_SET (stdio->fd, &readfds); if (gdb_select (stdio->fd + 1, &readfds, NULL, NULL, NULL) == -1) return -1; } return read (stdio->fd, buf, length_buf); This is a race classically fixed with either the self-pipe trick, or by blocking SIGINT and then using pselect instead of select. Blocking SIGINT most of the time would mean that check_quit_flag (and thus QUIT) would need to do a syscall every time it is called, which sounds best avoided, since QUIT is called in many loops. Thus we take the self-pipe trick route (wrapped in a serial event). Instead of having all places that need this manually add an extra file descriptor to the set of gdb_select's watched file descriptors, we introduce a wrapper, interruptible_select, that does that. The Windows version of gdb_select actually does not suffer from this, because mingw-hdep.c:gdb_call_async_signal_handler sets a Windows event that gdb_select always waits on. So this patch can be seen as generalization of that technique. We can't remove that extra event from mingw-hdep.c until we get rid of immediate_quit though. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> * defs.h: Extend QUIT-related comments to mention interruptible_select. (quit_serial_event_set, quit_serial_event_clear): Declare. * event-top.c: Include "ser-event.h" and "gdb_select.h". (quit_serial_event): New global. (async_init_signals): Make quit_serial_event. (quit_serial_event_set, quit_serial_event_clear) (quit_serial_event_fd, interruptible_select): New functions. * extension.c (set_quit_flag): Set the quit serial event. (check_quit_flag): Clear the quit serial event. * gdb_select.h (interruptible_select): New declaration. * guile/scm-ports.c (ioscm_input_waiting): Use interruptible_select instead of gdb_select. * top.c (gdb_readline_no_editing): Likewise. * ui-file.c (stdio_file_read): Likewise.
2016-03-09gdb_readline -> gdb_readline_no_editingPedro Alves1-2/+0
Name this such that it's clearer that this is not a wrapper for the real readline, but instead a replacement that provides no command line editing features. gdb/ChangeLog: 2016-03-09 Pedro Alves <palves@redhat.com> * defs.h (gdb_readline): Delete declaration. * top.c (gdb_readline): Rename to ... (gdb_readline_no_editing): ... this, and make static.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-08-25remote: allow aborting long operations (e.g., file transfers)Pedro Alves1-11/+9
Currently, when remote debugging, if you type Ctrl-C just while the target stopped for an internal event, and GDB is busy doing something that takes a while (e.g., fetching chunks of a shared library off of the target, with vFile, to process ELF headers and debug info), the Ctrl-C is lost. The patch hooks up the QUIT macro to a new target method that lets the target react to the double-Ctrl-C before the event loop is reached, which allows reacting to a double-Ctrl-C even when GDB is busy doing some long operation and not waiting for a stop reply. That end result is: (gdb) c Continuing. ^C ^C Interrupted while waiting for the program. Give up waiting? (y or n) y Quit (gdb) info threads Id Target Id Frame * 1 Thread 11673 0x00007ffff7deb240 in _dl_debug_state () from target:/lib64/ld-linux-x86-64.so.2 (gdb) If, however, GDB is waiting for a stop reply (because the target has been resumed, with e.g., vCont;c), but the target isn't responding, we now get: (gdb) c Continuing. ^C ^C The target is not responding to interrupt requests. Stop debugging it? (y or n) y Disconnected from target. (gdb) info threads No threads. This offers to disconnect, because when we're waiting for a stop reply, there's nothing else we can send the target other than an interrupt request. And if that doesn't work, there's nothing else we can do. The Ctrl-C is presently lost because until we get to a user-visible stop, the SIGINT handler that is installed is the one that forwards the interrupt to the remote side, with the \003 "packet" [1]. But, gdbserver ignores an interrupt request if the program is stopped. Still, even if it didn't, the server can only report back a stop-because-of-SIGINT when the program is next resumed. And it may take a while to actually re-resume the target. [1] - In the old sync days, the remote target would react to a double-Ctrl-C by asking users whether they wanted to give up waiting and disconnect. The code is still there, but it it isn't reacheable on most hosts, which support serial connections in async mode (probably only DJGPP doesn't). Even then, in sync mode, remote.c's SIGINT handler is only installed while the target is resumed, and is removed as soon as the target sends back a stop reply. That means that a Ctrl-C just while GDB is processing an internal event can end up with an odd "Quit" at the prompt instead of "Program stopped by SIGINT". In contrast, in async mode, remote.c's SIGINT handler is set up as long as target_terminal_inferior or target_terminal_ours_for_output are in effect (IOW, until we get a user-visible stop and call target_terminal_ours), so the user shouldn't get back a spurious Quit. However, it's still desirable to be able to interrupt a long-running GDB operation, if GDB takes a while to re-resume the target or get back to the event loop. Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * defs.h (maybe_quit): Declare. (QUIT): Now calls maybe_quit. * event-loop.c (clear_async_signal_handler) (async_signal_handler_is_marked): New functions. * event-loop.h (async_signal_handler_is_marked) (clear_async_signal_handler): New declarations. * remote.c (remote_check_pending_interrupt): New function. (interrupt_query): Use make_cleanup_restore_target_terminal. No longer check whether the target is async. If waiting for a stop reply, and a Ctrl-C as been sent to the target, offer to disconnect, and throw TARGET_CLOSE_ERROR instead of a quit. Otherwise do not disconnect and throw a quit. (_initialize_remote): Install remote_check_pending_interrupt as to_check_pending_interrupt. * target.c (target_check_pending_interrupt): New function. * target.h (struct target_ops) <to_check_pending_interrupt>: New field. (target_check_pending_interrupt): New declaration. * utils.c (maybe_quit): New function. * target-delegates.c: Regenerate.
2015-08-15Use macros for some enum bit field sizes.Doug Evans1-0/+5
gdb/ChangeLog: * defs.h (LANGUAGE_BITS): Define. * psympriv.h (partial_symbol) <domain>: Use SYMBOL_DOMAIN_BITS. (partial_symbol) <aclass>: Use SYMBOL_ACLASS_BITS. * symtab.h (general_symbol_info> <language>: Usage LANGUAGE_BITS. (minimal_symbol_type): Add nr_minsym_types. (MINSYM_TYPE_BITS): Define. (minimal_symbol) <type>: Use MINSYM_TYPE_BITS. (domain_enum_tag): Add NR_DOMAINS. (SYMBOL_DOMAIN_BITS): Change from 4 to 3. (SYMBOL_ACLASS_BITS): Define from 6 to 5.
2015-07-08tui: replace deprecated_register_changed_hook with observerPatrick Palka1-1/+0
This is a straightforward replacement of the TUI's use of the aforementioned hook with the register_changed observer. Since this was the only user of the hook, this patch also removes the hook. gdb/ChangeLog: * defs.h (deprecated_register_changed_hook): Remove prototype. * interps.c (clear_iterpreter_hooks): Remove reference to deprecated_register_changed_hook. * top.c (deprecated_register_changed_hook): Remove prototype. * valops.c (value_assign): Remove reference to deprecated_register_changed_hook. * tui/tui-hooks.c (tui_register_changed): Add parameter "frame". Add comment documenting the function. (tui_register_changed_observer): Define. (tui_install_hooks): Remove reference to deprecated_register_changed_hook. Set tui_register_changed_observer. (tui_remove_hooks): Remove reference to deprecated_register_changed_hook. Unset tui_register_changed_observer.
2015-06-15Move utility functions to common/Jan Kratochvil1-19/+0
gdb/ChangeLog 2015-06-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Move utility functions to common/. * cli/cli-utils.c (skip_spaces, skip_spaces_const, skip_to_space_const): Move defs to common/common-utils.c. * cli/cli-utils.h (skip_spaces, skip_spaces_const, skip_to_space) (skip_to_space_const): Move decls to common/common-utils.h. * common/common-defs.h: Move include of common-types.h before common-utils.h. * common/common-utils.c: Include host-defs.h and ctype.h. (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move from utils.c. (skip_spaces, skip_spaces_const, skip_to_space_const): Move from cli/cli-utils.c. * common/common-utils.h (strtoulst): Move decl from utils.h. (skip_spaces, skip_spaces_const, skip_to_space, skip_to_space_const): Move from cli/cli-utils.h. * common/host-defs.h: Include limits.h. (TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved from defs.h. (skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h. * defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to common/common-utils.h. * utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int) (strtoulst): Move to common/common-utils.c. * utils.h (strtoulst): Moved decl to common/common-utils.h.
2015-05-16compile: New 'compile print'Jan Kratochvil1-0/+9
It is planned the existing GDB command 'print' will be able to evaluate its expressions using the compiler. There will be some option to choose between the existing GDB evaluation and the compiler evaluation. But as an intermediate step this patch provides the expression printing feature as a new command. I can imagine it could be also called 'maintenance compile print' as in the future one should be able to use its functionality by the normal 'print' command. There was a discussion with Eli about the command name: https://sourceware.org/ml/gdb-patches/2015-03/msg00880.html As there were no other comments yet I haven't renamed it yet, before there is some confirmation about settlement on the final name. Support for the GDB '@' operator to create arrays has been submitted for GCC: [gcc patch] libcc1: '@' GDB array operator https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01451.html gdb/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> Phil Muldoon <pmuldoon@redhat.com> * NEWS (Changes since GDB 7.9): Add compile print. * compile/compile-c-support.c (add_code_header, add_code_footer) (c_compute_program): Add COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE. * compile/compile-internal.h (COMPILE_I_PRINT_OUT_ARG_TYPE) (COMPILE_I_PRINT_OUT_ARG, COMPILE_I_EXPR_VAL, COMPILE_I_EXPR_PTR_TYPE): New. * compile/compile-object-load.c: Include block.h. (get_out_value_type): New function. (compile_object_load): Handle COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE. Set compile_module's OUT_VALUE_ADDR and OUT_VALUE_TYPE. * compile/compile-object-load.h (struct compile_module): Add fields out_value_addr and out_value_type. * compile/compile-object-run.c: Include valprint.h and compile.h. (struct do_module_cleanup): Add fields out_value_addr and out_value_type. (do_module_cleanup): Handle COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE. (compile_object_run): Propagate out_value_addr and out_value_type. Pass OUT_VALUE_ADDR. * compile/compile.c: Include valprint.h. (compile_print_value, compile_print_command): New functions. (eval_compile_command): Handle failed COMPILE_I_PRINT_ADDRESS_SCOPE. (_initialize_compile): Update compile code help text. Install compile_print_command. * compile/compile.h (compile_print_value): New prototype. * defs.h (enum compile_i_scope_types): Add COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE. gdb/doc/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Compiling and Injecting Code): Add compile print. gdb/testsuite/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile-print.c: New file. * gdb.compile/compile-print.exp: New file.
2015-05-16compile: Distribute scope, add scope_dataJan Kratochvil1-0/+1
Provide a way to access current 'scope' during the do_module_cleanup stage and associate more data with it. gdb/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> * cli/cli-script.c (execute_control_command): Update eval_compile_command caller. * compile/compile-object-load.c (compile_object_load): Add parameters scope and scope_data. Set them. * compile/compile-object-load.h (struct compile_module): Add fields scope and scope_data. (compile_object_load): Add parameters scope and scope_data. * compile/compile-object-run.c (struct do_module_cleanup): Add fields scope and scope_data. (compile_object_run): Propagate the fields scope and scope_data. * compile/compile.c (compile_file_command, compile_code_command): Update eval_compile_command callers. (eval_compile_command): Add parameter scope_data. Pass it plus scope. * compile/compile.h (eval_compile_command): Add parameter scope_data. * defs.h (struct command_line): Add field scope_data.
2015-05-06Get rid of deprecated_init_ui_hookJoel Brobecker1-5/+0
This hook is no longer used, and can therefore be eliminated. gdb/ChangeLog: * defs.h (deprecated_init_ui_hook): Delete. Remove associated comment. * top.c (deprecated_init_ui_hook): Delete. (gdb_init): Remove handling of deprecated_init_ui_hook. * interps.c (clear_interpreter_hooks): Remove handling of deprecated_init_ui_hook. * main.c (captured_main): Update comment.