aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-10-13regcache_raw and use it in to_{fetch,store}_registersusers/qiyao/regcache-split-3Yao Qi30-169/+184
This patch adds a new class regcache_raw, between reg_buffer and regcache in the class hierarchy. Also use it in target_ops to_{fetch,store}_registers methods, because target_ops accesses raw registers. (pseudo registers are abstracted by gdbarch). gdb: 2017-10-03 Yao Qi <yao.qi@linaro.org> : * aarch32-linux-nat.c (aarch32_gp_regcache_supply): - (aarch32_gp_regcache_supply): + (aarch32_gp_regcache_supply): (aarch32_gp_regcache_collect): - (aarch32_gp_regcache_collect): + (aarch32_gp_regcache_collect): (aarch32_vfp_regcache_supply): - (aarch32_vfp_regcache_supply): + (aarch32_vfp_regcache_supply): (aarch32_vfp_regcache_collect): - (aarch32_vfp_regcache_collect): + * aarch32-linux-nat.h: * aarch64-linux-nat.c (aarch64_get_debug_reg_state): (fetch_gregs_from_thread): - (fetch_gregs_from_thread): + (fetch_gregs_from_thread): (store_gregs_to_thread): - (store_gregs_to_thread): + (store_gregs_to_thread): (fetch_fpregs_from_thread): - (fetch_fpregs_from_thread): + (fetch_fpregs_from_thread): (store_fpregs_to_thread): - (store_fpregs_to_thread): + (store_fpregs_to_thread): (aarch64_linux_fetch_inferior_registers): * arch-utils.c (default_addressable_memory_unit_size): * arch-utils.h (extern const char *default_gnu_triplet_regexp): * arm-linux-tdep.c (static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = {): (arm_linux_supply_gregset): (arm_linux_collect_gregset): (supply_nwfpe_register): - (supply_nwfpe_register): + (supply_nwfpe_register): (collect_nwfpe_register): - (collect_nwfpe_register): + (collect_nwfpe_register): (arm_linux_supply_nwfpe): (arm_linux_collect_nwfpe): (arm_linux_supply_vfp): * arm-linux-tdep.h (void arm_linux_collect_gregset): * corelow.c (core_detach): (get_core_register_section): - (get_core_register_section): + (get_core_registers_cb): * gdbarch.c (set_gdbarch_fast_tracepoint_valid_at): (gdbarch_guess_tracepoint_registers): - (gdbarch_guess_tracepoint_registers): + * gdbarch.h (extern void set_gdbarch_fast_tracepoint_valid_at): * gdbarch.sh (m;int;fast_tracepoint_valid_at;CORE_ADDR addr, char **msg;addr, msg;;default_fas): * gdbcore.h (struct core_fns): * inf-child.c (store_waitstatus): (inf_child_fetch_inferior_registers): (inf_child_post_attach): * inf-ptrace.c (static CORE_ADDR): (inf_ptrace_fetch_register): - (inf_ptrace_fetch_register): + (inf_ptrace_fetch_register): (inf_ptrace_fetch_registers): (inf_ptrace_store_register): - (inf_ptrace_store_register): + (inf_ptrace_store_register): * record-btrace.c (record_btrace_remove_breakpoint): (record_btrace_fetch_registers): (record_btrace_store_registers): * record-full.c (static void record_full_save): (record_full_reg_alloc): - (record_full_reg_alloc): + (record_full_get_loc): (record_full_arch_list_add_reg): - (record_full_arch_list_add_reg): + (record_full_supports_stopped_by_hw_breakpoint): (record_full_registers_change): - (record_full_registers_change): + (record_full_registers_change): (record_full_core_kill): (record_full_core_fetch_registers): (record_full_core_prepare_to_store): * record-full.h: * regcache.c (regcache_register_size): (regcache::regcache): (regcache::arch): (regcache_get_ptid): - (regcache_get_ptid): + (class regcache_invalidator): (public:): (public:): (get_regcache_arch): - (get_regcache_arch): + (regcache_dup): (regcache_register_status): - (regcache_register_status): + (reg_buffer::set_register_status): (regcache_invalidate): - (regcache_invalidate): + (registers_changed): (regcache_raw_update): - (regcache_raw_update): + (regcache_raw_update): (regcache::raw_update): (regcache_raw_read): - (regcache_raw_read): + (regcache_raw_read_signed): (regcache_raw_write_signed): (regcache_raw_write): (reg_buffer::raw_supply_zeroed): (regcache_raw_collect): - (regcache_raw_collect): + (reg_buffer::transfer_regset): (reg_buffer::supply_regset): (regcache_write_pc): * regcache.h (struct regcache;): (extern struct regcache *get_thread_arch_aspace_regcache): (extern enum register_status): (extern void regcache_write_pc): (enum): (private:): (public:): (public:): (public:): (public:): (private:): * regset.h (struct regcache;): * remote.c (static int getpkt_or_notif_sane): (remote_wait): (fetch_register_using_p): - (fetch_register_using_p): + (send_g_packet): (process_g_packet): - (process_g_packet): + (process_g_packet): (fetch_registers_using_g): - (fetch_registers_using_g): + (set_remote_traceframe): (remote_fetch_registers): (remote_prepare_to_store): - (remote_prepare_to_store): + (remote_prepare_to_store): (store_register_using_P): - (store_register_using_P): + (store_register_using_P): (store_registers_using_G): - (store_registers_using_G): + (store_registers_using_G): * s390-linux-tdep.c (s390_write_pc): * target-debug.h: * target-delegates.c (debug_wait): (delegate_fetch_registers): - (delegate_fetch_registers): + (tdefault_fetch_registers): - (tdefault_fetch_registers): + (debug_fetch_registers): - (debug_fetch_registers): + (delegate_store_registers): - (delegate_store_registers): + (tdefault_store_registers): - (tdefault_store_registers): + (debug_store_registers): - (debug_store_registers): + (delegate_prepare_to_store): - (delegate_prepare_to_store): + (tdefault_prepare_to_store): - (tdefault_prepare_to_store): + (debug_prepare_to_store): - (debug_prepare_to_store): + * target.c (target_options_to_string): (target_fetch_registers): - (target_fetch_registers): + (target_fetch_registers): (target_store_registers): - (target_store_registers): + * target.h (struct target_ops): (extern ptid_t default_target_wait): * tracefile-tfile.c (traceframe_find_block_type): * tracefile.c (trace_save_ctf): (tracefile_fetch_registers): - (tracefile_fetch_registers): + * tracefile.h (extern struct trace_file_writer *tfile_trace_file_writer_new):
2017-10-13Simplify {supply,fill}_{g,fp}regsetYao Qi2-21/+21
{supply,fill}_{g,fp}regset methods need only to access reg_buffer, instead of regcache, so this patch change parameter type to reg_buffer. Only works for aarch64 native gdb: 2017-10-02 Yao Qi <yao.qi@linaro.org> : * aarch64-linux-nat.c (aarch64_linux_store_inferior_registers): (fill_gregset): - (fill_gregset): + (supply_gregset): - (supply_gregset): + (supply_gregset): (fill_fpregset): - (fill_fpregset): + (supply_fpregset): - (supply_fpregset): + * gregset.h (struct regcache;):
2017-10-13Move more supply and collect methods to reg_bufferYao Qi2-20/+19
This patch moves more supply and collect methods to class reg_buffer gdb: 2017-09-22 Yao Qi <yao.qi@linaro.org> : * regcache.c (reg_buffer::raw_collect_integer): (regcache_supply_regset): (regcache_collect_regset): * regcache.h (public:): (public:): (private:):
2017-10-13Remove MAX_REGISTER_SIZE in record-full.cYao Qi2-11/+12
This patch changes record_full_core_regbuf from "gdb_byte *" to reg_buffer. As a result, MAX_REGISTER_SIZE is removed. gdb: 2017-09-22 Yao Qi <yao.qi@linaro.org> : * record-full.c (struct record_full_core_buf_entry): (record_full_core_open_1): (record_full_close): (record_full_core_fetch_registers): (record_full_core_store_registers): * regcache.h (public:):
2017-10-13New class reg_bufferYao Qi2-87/+139
This patch splits regcache, moves part of it to reg_buffer, which is a buffer to hold register contents, and also their status. reg_buffer may or may not hold pseudo registers. Class reg_buffer has methods supply and collect. gdb: 2017-09-22 Yao Qi <yao.qi@linaro.org> : * regcache.c (regcache_descr): (regcache_register_size): (get_regcache_aspace): (regcache::save): (regcache::save): (regcache::restore): (regcache_register_status): (regcache::get_register_status): (regcache::invalidate): (regcache::raw_update): (regcache::raw_read): (regcache::cooked_read): (regcache::cooked_read_value): (regcache_raw_set_cached_value): (regcache_raw_supply): (regcache::raw_supply): (regcache::raw_supply_integer): (regcache_raw_collect): (regcache::raw_collect): * regcache.h (typedef struct cached_reg): (public:): (public:): (protected:): (private:):
2017-10-13Simplify xfer_partYao Qi2-20/+14
Since xfer_part is already a class method, and only {raw,cooked}_{read,write} are passed to it. We can remove these two arguments, but add a bool argument is_raw, indicating raw registers or cooked registers are accessed. gdb: 2017-10-03 Yao Qi <yao.qi@linaro.org> : * regcache.c (typedef void): (regcache::xfer_part): (regcache::xfer_part): (enum register_status): (regcache::raw_write_part): (enum register_status): (regcache::cooked_write_part): (regcache_raw_supply): - (regcache_raw_supply): + (aarch32_gp_regcache_supply): - (aarch32_gp_regcache_supply): + (aarch32_gp_regcache_supply): (aarch32_gp_regcache_collect): - (aarch32_gp_regcache_collect): + (aarch32_gp_regcache_collect): (aarch32_vfp_regcache_supply): - (aarch32_vfp_regcache_supply): + (aarch32_vfp_regcache_supply): (aarch32_vfp_regcache_collect): - (aarch32_vfp_regcache_collect): + (aarch64_get_debug_reg_state): (fetch_gregs_from_thread): - (fetch_gregs_from_thread): + (fetch_gregs_from_thread): (store_gregs_to_thread): - (store_gregs_to_thread): + (store_gregs_to_thread): (fetch_fpregs_from_thread): - (fetch_fpregs_from_thread): + (fetch_fpregs_from_thread): (store_fpregs_to_thread): - (store_fpregs_to_thread): + (store_fpregs_to_thread): (aarch64_linux_fetch_inferior_registers): (default_addressable_memory_unit_size): (extern const char *default_gnu_triplet_regexp): (static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = {): (arm_linux_supply_gregset): (arm_linux_collect_gregset): (supply_nwfpe_register): - (supply_nwfpe_register): + (supply_nwfpe_register): (collect_nwfpe_register): - (collect_nwfpe_register): + (collect_nwfpe_register): (arm_linux_supply_nwfpe): (arm_linux_collect_nwfpe): (arm_linux_supply_vfp): (void arm_linux_collect_gregset): (core_detach): (get_core_register_section): - (get_core_register_section): + (get_core_registers_cb): (set_gdbarch_fast_tracepoint_valid_at): (gdbarch_guess_tracepoint_registers): - (gdbarch_guess_tracepoint_registers): + (extern void set_gdbarch_fast_tracepoint_valid_at): (m;int;fast_tracepoint_valid_at;CORE_ADDR addr, char **msg;addr, msg;;default_fas): (struct core_fns): (store_waitstatus): (inf_child_fetch_inferior_registers): (inf_child_post_attach): (static CORE_ADDR): (inf_ptrace_fetch_register): - (inf_ptrace_fetch_register): + (inf_ptrace_fetch_register): (inf_ptrace_fetch_registers): (inf_ptrace_store_register): - (inf_ptrace_store_register): + (inf_ptrace_store_register): (record_btrace_remove_breakpoint): (record_btrace_fetch_registers): (record_btrace_store_registers): (static void record_full_save): (record_full_reg_alloc): - (record_full_reg_alloc): + (record_full_get_loc): (record_full_arch_list_add_reg): - (record_full_arch_list_add_reg): + (record_full_supports_stopped_by_hw_breakpoint): (record_full_registers_change): - (record_full_registers_change): + (record_full_registers_change): (record_full_core_kill): (record_full_core_fetch_registers): (record_full_core_prepare_to_store): (regcache_register_size): (regcache::regcache): (regcache::arch): (regcache_get_ptid): - (regcache_get_ptid): + (class regcache_invalidator): (public:): (public:): (get_regcache_arch): - (get_regcache_arch): + (regcache_dup): (regcache_register_status): - (regcache_register_status): + (reg_buffer::set_register_status): (regcache_invalidate): - (regcache_invalidate): + (registers_changed): (regcache_raw_update): - (regcache_raw_update): + (regcache_raw_update): (regcache::raw_update): (regcache_raw_read): - (regcache_raw_read): + (regcache_raw_read_signed): (regcache_raw_write_signed): (regcache_raw_write): (reg_buffer::raw_supply_zeroed): (regcache_raw_collect): - (regcache_raw_collect): + (reg_buffer::transfer_regset): (reg_buffer::supply_regset): (regcache_write_pc): (struct regcache;): (extern struct regcache *get_thread_arch_aspace_regcache): (extern enum register_status): (extern void regcache_write_pc): (enum): (private:): (public:): (public:): (public:): (public:): (private:): (struct regcache;): (static int getpkt_or_notif_sane): (remote_wait): (fetch_register_using_p): - (fetch_register_using_p): + (send_g_packet): (process_g_packet): - (process_g_packet): + (process_g_packet): (fetch_registers_using_g): - (fetch_registers_using_g): + (set_remote_traceframe): (remote_fetch_registers): (remote_prepare_to_store): - (remote_prepare_to_store): + (remote_prepare_to_store): (store_register_using_P): - (store_register_using_P): + (store_register_using_P): (store_registers_using_G): - (store_registers_using_G): + (store_registers_using_G): (s390_write_pc): (debug_wait): (delegate_fetch_registers): - (delegate_fetch_registers): + (tdefault_fetch_registers): - (tdefault_fetch_registers): + (debug_fetch_registers): - (debug_fetch_registers): + (delegate_store_registers): - (delegate_store_registers): + (tdefault_store_registers): - (tdefault_store_registers): + (debug_store_registers): - (debug_store_registers): + (delegate_prepare_to_store): - (delegate_prepare_to_store): + (tdefault_prepare_to_store): - (tdefault_prepare_to_store): + (debug_prepare_to_store): - (debug_prepare_to_store): + (target_options_to_string): (target_fetch_registers): - (target_fetch_registers): + (target_fetch_registers): (target_store_registers): - (target_store_registers): + (struct target_ops): (extern ptid_t default_target_wait): (traceframe_find_block_type): (trace_save_ctf): (tracefile_fetch_registers): - (tracefile_fetch_registers): + (extern struct trace_file_writer *tfile_trace_file_writer_new):
2017-10-11Automatic date update in version.inGDB Administrator1-1/+1
2017-10-10x86: Set GOT refcount to 1H.J. Lu3-6/+12
Since x86 check_relocs is called after opening all inputs and garbage collection, they never see the removed sections. There is no need for incrementing GOT refcount. But since PLT refcount is also used in /* Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. */ else if (htab->elf.dynamic_sections_created && (h->plt.refcount > eh->func_pointer_refcount || eh->plt_got.refcount > 0)) { we must increment it. * elf32-i386.c (elf_i386_check_relocs): Set GOT refcount to 1 instead of incrementing it. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
2017-10-10get_integer_valueof: Don't output value in test nameSimon Marchi2-1/+5
The get_integer_valueof outputs the value it has read as part of the test name. This causes test names to vary from run to run, and adds some noise when diffing test results. e.g.: -PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (28770) +PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (32238) This patch removes that, since it's probably not very useful. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_integer_valueof): Don't output read value in test name.
2017-10-10Bump dwarf-mode version numberTom Tromey2-1/+5
Bump the dwarf-mode version number, so it can be installed by package.el users who installed an earlier verision. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Bump to version 1.4.
2017-10-10Asynchronous insertion for dwarf-mode.elTom Tromey2-16/+68
I was recently examining a very large .debug file. I tried to use dwarf-mode, but it blocked Emacs for a very long time while reading output. This patch changes dwarf-mode to run the objdump process asynchronously. This way, I can still do other things in Emacs while waiting for the dumping to finish. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf--process, dwarf--deletion-region): New defvar. (dwarf--check-running, dwarf--sentinel, dwarf--invoke) (dwarf--filter): New functions. (dwarf-do-insert-substructure, dwarf-do-refresh): Call dwarf--check-running, dwarf--invoke. (dwarf-browse): Initialize new variables.
2017-10-10Set lexical-binding in dwarf-modeTom Tromey2-1/+5
Emacs has had lexical binding for a while, and it's a good practice to use it; so enable it in dwarf-mode.el. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Set lexical-binding.
2017-10-10Bind keys in dwarf-mode-map definitionTom Tromey2-2/+11
It's bad Emacs style to define keys from a top-level form. Instead, one should define a mode map separately and binding keys in the definition. This lets users completely override the map by defining it before loading the mode. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf-mode-map): New defvar.
2017-10-10Eliminate catch_exceptions/catch_exceptions_with_msgPedro Alves17-426/+175
This patch gets rid of catch_exceptions / catch_exceptions_with_msg. The latter is done mostly by getting rid of the three remaining vestigial libgdb wrapper functions, which are really pointless nowadays. This results in a good number of simplifications. (I checked that Insight doesn't use those functions.) The gdb.mi/mi-pthreads.exp change is necessary because this actually fixes a bug, IMO -- the patch stops MI's -thread-select causing output on the CLI stream. I.e., before: -thread-select 123456789 &"Thread ID 123456789 not known.\n" ^error,msg="Thread ID 123456789 not known." (gdb) After: -thread-select 123456789 ^error,msg="Thread ID 123456789 not known." (gdb) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_breakpoint): New. * breakpoint.h (print_breakpoint): Declare. * common/common-exceptions.h (enum return_reason): Remove references to catch_exceptions. * exceptions.c (catch_exceptions, catch_exceptions_with_msg): Delete. * exceptions.h (catch_exceptions_ftype, catch_exceptions) (catch_exception_ftype, catch_exceptions_with_msg): Delete. * gdb.h: Delete. * gdbthread.h (thread_select): Declare. * mi/mi-cmd-break.c: Don't include gdb.h. (breakpoint_notify): Use print_breakpoint. * mi/mi-cmd-catch.c: Don't include gdb.h. * mi/mi-interp.c: Don't include gdb.h. (mi_print_breakpoint_for_event): New. (mi_breakpoint_created, mi_breakpoint_modified): Use mi_print_breakpoint_for_event. * mi/mi-main.c: Don't include gdb.h. (mi_cmd_thread_select): Parse the global thread ID here. Use thread_select instead of gdb_thread_select. (mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead of using gdb_list_thread_ids. * remote-fileio.c (do_remote_fileio_request): Change type. Reply FILEIO_ENOSYS here. (remote_fileio_request): Use TRY/CATCH instead of catch_exceptions. * symfile-mem.c (struct symbol_file_add_from_memory_args) (symbol_file_add_from_memory_wrapper): Delete. (add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions. * thread.c: Don't include gdb.h. (do_captured_list_thread_ids, gdb_list_thread_ids): Delete. (thread_alive): Use thread_select. (do_captured_thread_select): Delete, parts salvaged as ... (thread_select): ... this new function. (gdb_thread_select): Delete. gdb/testsuite/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't expect CLI output.
2017-10-10Eliminate catch_errorsPedro Alves21-306/+284
If you want to use catch_errors with a function with parameters, then currently you have to manually write a "capture" struct wrapping the arguments and marshall/unmarshall that. https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed adjusting catch_errors to use gdb::function_view, which would allow passing lambdas with automatic captures. However, it seems like using TRY/CATCH directly instead ends up producing clearer and easier to debug code. This is what this commit does. Note that removing catch_errors exposes further cleanup opportunities around no longer having to follow catch_errors callback type, and also removes a few cleanups. I didn't do anything to save/restore current_uiout because I think that should be the responsibility of the code that changes current_uiout in the first place. (Another approach could be to make catch_errors a variadic template like: template<typename Function, typename... Args> int catch_errors (const char *errstring, return_mask mask, Function &&func, Args... args); and then with: extern void function_with_args (int, int); extern void function_with_no_args (); calls to the above functions would be wrapped like this: catch_errors ("some error happened", RETURN_MASK_ERROR, function_with_args, arg1, arg2); catch_errors ("some error happened", RETURN_MASK_ERROR, function_with_no_args); but I'm thinking that that doesn't improve much if at all either.) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (breakpoint_cond_eval): Change return type to bool and reverse logic. (WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE): No longer macros. Instead ... (enum wp_check_result): They're now values of this new enumeration. (watchpoint_check): Change return type to wp_check_result and parameter type to bpstat. (bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors. (bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of catch_errors. Reverse logic of watchpoint_check call. (breakpoint_re_set_one): Now returns void and takes a breakpoint pointer as parameter. (breakpoint_re_set): Use TRY/CATCH instead of catch_errors. * common/common-exceptions.c (throw_exception_sjlj): Update comments to avoid mentioning catch_errors. * exceptions.c (catch_errors): Delete. * exceptions.h: Update comments to avoid mentioning catch_errors. (catch_errors_ftype, catch_errors): Delete. * infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors. (hook_stop_stub): Delete. (restore_selected_frame): Change return type to void, and parameter type to const frame_id &. (restore_infcall_control_state): Use TRY/CATCH instead of catch_errors. * main.c (captured_command_loop): Return void and remove parameter. Remove references to catch_errors. (captured_main): Use TRY/CATCH instead of catch_errors. * objc-lang.c (objc_submethod_helper_data) (find_objc_msgcall_submethod_helper): Delete. (find_objc_msgcall_submethod): Use TRY/CATCH instead of catch_errors. * record-full.c (record_full_message): Return void. (record_full_message_args, record_full_message_wrapper): Delete. (record_full_message_wrapper_safe): Return bool and use TRY/CATCH instead of catch_errors. * solib-aix.c (solib_aix_open_symbol_file_object): Change parameter type to int. * solib-darwin.c (open_symbol_file_object): Ditto. * solib-dsbt.c (open_symbol_file_object): Ditto. * solib-frv.c (open_symbol_file_object): Ditto. * solib-svr4.c (open_symbol_file_object): Ditto. * solib-target.c (solib_target_open_symbol_file_object): Ditto. * solib.c (update_solib_list): Use TRY/CATCH instead of catch_errors. * solist.h (struct target_so_ops) <open_symbol_file_object>: Change type. * symmisc.c (struct print_symbol_args): Remove. (dump_symtab_1): Use TRY/CATCH instead of catch_errors. (print_symbol): Change type. * windows-nat.c (handle_load_dll, handle_unload_dll): Return void and remove parameters. (catch_errors): New. (get_windows_debug_event): Adjust. gdb/testsuite/ChangeLog: 2017-10-10 Pedro Alves <palves@redhat.com> * lib/selftest-support.exp (selftest_setup): Update for captured_command_loop's prototype change.
2017-10-10[ARM] PR ld/21402, only override the symbol dynamic decision on undefined ↵Renlin Li6-21/+31
weak symbol. Similar as aarch64 backend, arm backend only overrides the decision on undefined weak symbols. arm backend part already emits necessary relative relocation for this case. bfd/ PR ld/21402 * elf32-arm.c (allocate_dynrelocs_for_symbol): Only make undefined weak symbols into dynamic. ld/ PR ld/21402 * testsuite/ld-arm/tls-app.d: Update address. * testsuite/ld-arm/tls-app.r: Remove relocations. * testsuite/ld-arm/unresolved-1-dyn.d: Update.
2017-10-10Improve the speed of the --dwarf-start option by skipping processing of any ↵Nick Clifton2-0/+14
comp unit that ends before the specified start address. PR 22249 * dwarf.c (process_debug_info): Skip any comp unit that ends before dwarf_start_die.
2017-10-09riscv: Cache the max alignment of output sectionsH.J. Lu2-1/+24
Cache the max alignment of output sections instead of scanning all output sections for each input section, which can take a very long time if there are millions of input/output sections. PR ld/22274 * elfnn-riscv.c (riscv_elf_link_hash_table): Add max_alignment. (riscv_elf_link_hash_table_create): Initialize max_alignment to (bfd_vma) -1. (_bfd_riscv_relax_section): Cache the max alignment of output sections if possible.
2017-10-10Prepare powerpc64 for late check_relocsAlan Modra2-59/+90
check_relocs was setting up some data used by the --gc-sections gc_mark_hook. If we change ld to run check_relocs after gc_sections that data needs to be set up elsewhere. Done by this patch in the backend check_directives function (ppc64_elf_before_check_relocs). * elf64-ppc.c (ppc64_elf_before_check_relocs): Set sec_type for .opd whenever .opd is present and non-zero size. Move code setting abiversion to/from output file earlier. Only set u.opd.func_sec when --gc-sections. Read relocs and set up u.opd.func_sec values here.. (ppc64_elf_check_relocs): ..rather than here. Simplify opd section tests. (ppc64_elf_edit_opd): Don't set sec_type for .opd here.
2017-10-10Correct ld/Makefile earmelfb_fuchsia dependenciesAlan Modra3-2/+7
There were two copies of earmelf_fuchsia.c dependencies. * Makefile.am (earmelfb_fuchsia.c): Rename rule from earmelf_fuchsia.c. * Makefile.in: Regenerate.
2017-10-10Automatic date update in version.inGDB Administrator1-1/+1
2017-10-09Remove free_splay_tree cleanupTom Tromey3-16/+56
One spot in gdb uses a cleanup to free a splay tree. This patch introduces a unique_ptr specialization for this case. ChangeLog 2017-10-09 Tom Tromey <tom@tromey.com> * mi/mi-main.c (free_splay_tree): Remove. (list_available_thread_groups): Use splay_tree_up. * common/gdb_splay_tree.h: New file.
2017-10-09Remove "do_nothing"Tom Tromey2-6/+6
The do_nothing function in mi-main.c is used as a splay tree key-deleting function; but NULL serves the same purpose and is used elsewhere in gdb. This patch removes the unneeded function. ChangeLog 2017-10-09 Tom Tromey <tom@tromey.com> * mi/mi-main.c (do_nothing): Remove. (list_available_thread_groups): Update.
2017-10-09mn10300: Don't free cached internal symbol tableH.J. Lu2-1/+6
Since ELF linker may cache internal symbol table in init_reloc_cookie, we should check if it is cached, before free it. * elf-m10300.c (mn10300_elf_check_relocs): Don't free cached isymbuf.
2017-10-09bfin: Don't create .interp section for info->nointerpH.J. Lu2-1/+6
Don't create the .interp section with "ld --no-dynamic-linker". This fixed: FAIL: PR ld/20828 forcibly exported symbol version without section GC FAIL: PR ld/20828 forcibly exported symbol version with section GC FAIL: readelf version information * elf32-bfin.c (bfin_size_dynamic_sections): Don't create the .interp section with "ld --no-dynamic-linker".
2017-10-09gdb.multi/multi-arch-exec.exp: Also test -m32 => -m64Pedro Alves2-46/+135
The gdb.multi/multi-arch-exec.exp testcase currently tests execing from -m64 to -m32, but does not test the other direction. For thoroughness, this commit fixes that. Without the fix in the previous commit for example ("Multi-arch exec, more register reading avoidance"), on x86_64 we would get different symptoms depending on "execing direction". Vis: Continuing. Truncated register 50 in remote 'g' packet Truncated register 50 in remote 'g' packet (gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture Vs: Continuing. Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip] Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip] (gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=2: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture gdb/testsuite/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> Test both arch1=>arch2 and arch2=>arch1. * gdb.multi/multi-arch-exec.exp (exec1, srcfile1, binfile1, exec2) (srcfile2, binfile2, march1, march2): Remove globals. Largely factored out to... (append_arch1_options, append_arch2_options, append_arch_options) (build_executables): New procedures. (do_test): New 'first_arch' parameter. Use it to define 'from_exec' local. (top level): Add new 'first_arch' testing axis.
2017-10-09Multi-arch exec, more register reading avoidancePedro Alves5-8/+73
As mentioned in commit bf93d7ba9931 ("Add thread after updating gdbarch when exec'ing"), we should avoid doing register reads after a process does an exec and before we've updated that inferior's gdbarch. Otherwise, we may interpret the registers using the wrong architecture. There's still (at least) one case where we still read registers post-exec with the pre-exec architecture. That's when infrun decides it needs to switch context to the exec'ing thread. I.e., if the exec event is processed at a time when the current thread is not already the exec'ing thread, then we get (with the test added by this commit): continue Continuing. Truncated register 50 in remote 'g' packet Truncated register 50 in remote 'g' packet (gdb) FAIL: gdb.multi/multi-arch-exec.exp: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture The fix is to avoid reading registers when switching context in this case. (I'd be nice to get rid of the constant stop_pc reading when switching threads, but that'd be a deeper change.) gdb/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>: Skip reading registers when switching context. gdb/testsuite/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch-exec.c: Include <pthread.h> and <assert.h>. (barrier): New. (thread_start, all_started): New functions. (main): Spawn new thread and wait until it is scheduled. * gdb.multi/multi-arch-exec.exp: Build $srcfile1 with the pthreads option. (do_test): Add 'selected_thread' parameter. Run to all_started instead of main. Explicitly set the breakpoint at main. Switch to the SELECTED_THREAD thread. (top level): Test handling the exec event with either the main thread or the second thread selected.
2017-10-09Use gdbarch_long_bit to determine layout of FreeBSD siginfo_t.John Baldwin3-4/+10
FreeBSD architectures are either ILP32 or LP64 resulting in two different layouts for siginfo_t. Previously, the 'bits_per_word' member of bfd_arch_info was used to determine the layout to use for a given FreeBSD architecture. However, mipsn32 architectures inherit from a 64-bit mips architecture where bits_per_word is 64. As a result, $_siginfo was not properly extracted from FreeBSD/mipsn32 core dumps. Fix this by using gdbarch_long_bit instead of 'bits_per_word' to determine if a FreeBSD architecture is ILP32 or LP64. gdb/ChangeLog: * fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit. (fbsd_convert_siginfo): Likewise. * fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise.
2017-10-09Don't try building gdb against guile-2.2Simon Marchi3-3/+8
GDB currently doesn't build with Guile 2.2 (see PR 21104). If one has both Guile 2.2 and 2.0 installed, GDB will pick up Guile 2.2 first and fail building. Until somebody does the work of adapting the GDB code to Guile 2.2, we should not try using it. This patch therefore removes it from configure. gdb/ChangeLog: * configure.ac (try_guile_versions): Remove guile-2.2. * configure: Regenerate.
2017-10-09S/390: Sync with latest POP - 3 new instructionsAndreas Krebbel6-1/+22
prno, tpei, and irbm are missing in the optable. gas/ChangeLog: 2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * testsuite/gas/s390/zarch-arch12.d (prno, tpei, irbm): New instructions added. * testsuite/gas/s390/zarch-arch12.s: Likewise. * testsuite/gas/s390/zarch-z13.d: Rename ppno to prno. opcodes/ChangeLog: 2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * s390-opc.txt (prno, tpei, irbm): New instructions added.
2017-10-09S/390: Sync with IBM z14 POP - SI_RD formatAndreas Krebbel3-4/+13
The recent POP adjusted a few of the instruction formats. This patch adjusts our optable accordingly. No user visible change - hopefully. opcodes/ChangeLog: 2017-10-09 Heiko Carstens <heiko.carstens@de.ibm.com> * s390-opc.c (INSTR_SI_RD): New macro. (INSTR_S_RD): Adjust example instruction. * s390-opc.txt (lpsw, ssm, ts): Change S_RD instruction format to SI_RD.
2017-10-09Fix automatic dependency trackingTom Tromey2-4/+10
Commit f38307f5 changed COMPILE.post and POSTCOMPILE to remove $(basename) from the dependency file name computation. However, it did not update the `-include' at the end of the Makefile.in; this in effect disabled automatic dependency tracking. This patch restores the $(basename) wrapper so that the dependency files are named "file.Po" rather than "file.o.Po". I also tested the non-gcc3 dependency mode, which pointed out that this case hadn't been working since the switch to C++. This is also fixed in this patch. Tested by rebuilding. ChangeLog 2017-10-09 Tom Tromey <tom@tromey.com> * Makefile.in (COMPILE.post, POSTCOMPILE): Restore $(basename). (COMPILE.pre): Use $(CXX).
2017-10-09Make cp_remove_params return a gdb::unique_xmalloc_ptrPedro Alves6-28/+35
Use the type system instead of callers needing to know how the returned string's memory is supposed to be managed. gdb/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * cp-support.c (cp_remove_params): Return a gdb::unique_xmalloc_ptr. Use bool. (overload_list_add_symbol): Adjust to use gdb::unique_xmalloc_ptr. * cp-support.h (cp_remove_params): Now returns a gdb::unique_xmalloc_ptr. * dwarf2read.c (find_slot_in_mapped_hash): Now returns bool. Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr. * psymtab.c (psymtab_search_name): Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr. (lookup_partial_symbol): Adjust to use gdb::unique_xmalloc_ptr. * stack.c (find_frame_funname): Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr.
2017-10-09Fix link time warning message when running the srec linker tests.Nick Clifton2-1/+3
* testsuite/ld-srec/srec.exp (run_srec_test): Set start address.
2017-10-09Fix compile time warning message when running the PR19874 linker test.Nick Clifton2-1/+6
PR ld/19874 * testsuite/ld-x86-64/pr19784c.c (bar): Change return type to void.
2017-10-09Add missing changelog entriesAndreas Krebbel1-0/+11
2017-10-09Fix gdb.base/print-file-var-main.c value check logicPedro Alves3-4/+11
Fix a typo introduced in commit c56e7c4390ed ("Make ctxobj.exp and print-file-var.exp work on all platforms."). This doesn't really affect the outcome of the testcase. I only noticed the typo because I stepped through the program manually. To avoid such problems if the test is extended, this moves the STOP marker until after the program self-validates the values. With the typo in place, this alone would have resulted in a test FAIL. I.e., it'd have caught the typo. gdb/testsuite/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * gdb.base/print-file-var-main.c: Fix get_version_2 value check logic. Move STOP marker after the value checks. * gdb.base/print-file-var.exp (continue to STOP marker): Tighten regexp.
2017-10-09ld: Don't allow '~' as the first char in symbol nameH.J. Lu6-2/+36
Don't allow '~' as the first character in symbol name in linker script. PR ld/22267 * ldlex.l (SYMBOLNAMECHAR1) New. (DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1. (EXPRESSION): Likewise. * testsuite/ld-scripts/expr.exp: Run pr22267. * testsuite/ld-scripts/pr22267.d: New file. * testsuite/ld-scripts/pr22267.s: Likewise. * testsuite/ld-scripts/pr22267.t: Likewise.
2017-10-09Replace nop in fill-1.s testcase.Andreas Krebbel1-1/+1
gas/ChangeLog: 2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * testsuite/gas/all/fill-1.s: Replace nop with .word 42
2017-10-09Enable .fill forward labelsAndreas Krebbel3-1/+8
gas/ChangeLog: 2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * read.c (s_fill): Invoke expression instead of get_known_segmented_expression. * testsuite/gas/all/fill-1.s: New testcase. * testsuite/gas/all/gas.exp: Run fill-1 testcase
2017-10-08Remove some cleanups from dwarf2read.cTom Tromey2-137/+76
This removes a number of cleanups from dwarf2read.c in a straightforward way. Note that some places in dwarf2read create dangling cleanups. I don't believe any of the changes in this patch interact with those spots. Regression tested by the buildbot. gdb/ChangeLog 2017-10-08 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_get_dwz_file): Use gdb::unique_xmalloc_ptr. (find_slot_in_mapped_hash): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Use std::string. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_cutu): Likewise. (inherit_abstract_dies): Use std::vector. (read_array_type): Likewise. (dwarf_decode_macros): Remove unused declaration. (unsigned_int_compar): Remove. (dwarf2_build_psymtabs_hard): Use scoped_restore. (psymtabs_addrmap_cleanup): Remove.
2017-10-08Remove cleanup from frame_prepare_for_snifferTom Tromey4-20/+27
Currently frame_prepare_for_sniffer returns a cleanup. This patch changes it to return void, and exposes frame_cleanup_after_sniffer to the caller. Normally I would write an RAII class for this sort of thing; but because there was just a single caller of frame_prepare_for_sniffer, and because this caller is already using try/catch, I thought it seemed ok to require explicit calls in this instance. Regression tested by the buildbot. gdb/ChangeLog 2017-10-08 Tom Tromey <tom@tromey.com> * frame-unwind.c (frame_unwind_try_unwinder): Update. * frame.h (frame_cleanup_after_sniffer): Declare. (frame_prepare_for_sniffer): Return void. * frame.c (frame_cleanup_after_sniffer): No longer static. Change type of argument. (frame_prepare_for_sniffer): Return void.
2017-10-08Remove make_cleanup_value_freeTom Tromey5-21/+25
This removes make_cleanup_value_free, in favor of a unique_ptr specialization. Regression tested by the buildbot. gdb/ChangeLog 2017-10-08 Tom Tromey <tom@tromey.com> * utils.h (make_cleanup_value_free): Remove. * utils.c (do_value_free, struct cleanup): Remove. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>: Use gdb_value_up. * value.h (struct value_deleter): New. (gdb_value_up): New typedef.
2017-10-08Change search_symbols to return std::vectorTom Tromey3-168/+98
This changes search_symbols to return a std::vector, replacing the previous linked list approach. This allows the removal of some cleanups, as well as the use of std::sort and std::unique, saving some code and extra allocations in sort_search_symbols_remove_dups. Regression tested by the buildbot. gdb/ChangeLog 2017-10-08 Tom Tromey <tom@tromey.com> * symtab.c (free_search_symbols, do_free_search_symbols_cleanup) (make_cleanup_free_search_symbols): Remove. (search_symbols): Return std::vector. (symbol_search::compare_search_syms): Now member of symbol_search. Change arguments. (sort_search_symbols_remove_dups): Change arguments. Rewrite. (symtab_symbol_info, rbreak_command): Update. * symtab.h (struct symbol_search) <next>: Remove. Add constructors. (symbol_search::operator<): New function. (symbol_search::operator==): New function. (search_symbols): Remove std::vector. (free_search_symbols, make_cleanup_free_search_symbols): Remove. (symbol_search::compare_search_syms): Declare.
2017-10-09PR22212, memory leak in nmAlan Modra2-0/+10
PR 22212 * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free funcinfo_hash_table and varinfo_hash_table.
2017-10-08sh: Dump dynamic relocation info to the map fileH.J. Lu2-1/+14
Dump dynamic relocation info to the map file when generating dynamic relocation in read-only section relocations if -Map is used. * elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation in read-only section with minfo. (sh_elf_size_dynamic_sections): Likewise.
2017-10-08sparc: Remove a strayed commentH.J. Lu2-2/+5
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Remove a strayed comment.
2017-10-09Automatic date update in version.inGDB Administrator1-1/+1
2017-10-08tilegx: Set this_hdr.sh_entsize only if section size > 0H.J. Lu2-9/+14
This fixes: /export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o sh: line 1: 9208 Segmentation fault (core dumped) /export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o 2>&1 FAIL: Common symbol override test * elfxx-tilegx.c (tilegx_elf_finish_dynamic_sections): Set this_hdr.sh_entsize only if section size > 0.
2017-10-08Reformat elf_x86_allocate_dynrelocsH.J. Lu2-2/+5
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Reformat.