Age | Commit message (Collapse) | Author | Files | Lines |
|
New in v3:
- Code cleanups based on reviews.
New in v2:
- Fixed misc problems based on reviews.
- Switched to using gdbarch_program_breakpoint_here_p as opposed to
gdbarch_insn_is_breakpoint.
- Fixed matching of brk instructions. Previously the mask was incorrect, which
was showing up as a few failures in the testsuite. Now it is clean.
- New testcase (separate patch).
- Moved program_breakpoint_here () to arch-utils.c and made it the default
implementation of gdbarch_program_breakpoint_here_p.
--
It was reported to me that program breakpoints (permanent ones inserted into
the code itself) other than the one GDB uses for AArch64 (0xd4200000) do not
generate visible stops when continuing, and GDB will continue spinning
infinitely.
This happens because GDB, upon hitting one of those program breakpoints, thinks
the SIGTRAP came from a delayed breakpoint hit...
(gdb) x/i $pc
=> 0x4005c0 <problem_function>: brk #0x90f
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 14198)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: proceed: resuming process 14198
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14198] at 0x4005c0
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14198.14198.0 [process 14198],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: delayed software breakpoint trap, ignoring
infrun: no stepping, continue
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14198] at 0x4005c0
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14198.14198.0 [process 14198],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: delayed software breakpoint trap, ignoring
infrun: no stepping, continue
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14198] at 0x4005c0
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14198.14198.0 [process 14198],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: delayed software breakpoint trap, ignoring
infrun: no stepping, continue
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14198] at 0x4005c0
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14198.14198.0 [process 14198],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: delayed software breakpoint trap, ignoring
infrun: no stepping, continue
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14198] at 0x4005c0
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14198.14198.0 [process 14198],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
...
... which is not the case.
If the program breakpoint is one GDB recognizes, then it will stop when it
hits it.
(gdb) x/i $pc
=> 0x4005c0 <problem_function>: brk #0x0
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 14193)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: proceed: resuming process 14193
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 14193] at 0x4005c0
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 14193.14193.0 [process 14193],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: random signal (GDB_SIGNAL_TRAP)
infrun: stop_waiting
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun: process 14193 not executing
infrun: stop_all_threads, pass=1, iterations=1
infrun: process 14193 not executing
infrun: stop_all_threads done
Program received signal SIGTRAP, Trace/breakpoint trap.
problem_function () at brk_0.c:7
7 asm("brk %0\n\t" ::"n"(0x0));
infrun: infrun_async(0)
Otherwise GDB will keep trying to resume the inferior and will keep
seeing the SIGTRAP's, without stopping.
To the user it appears GDB has gone into an infinite loop, interruptible only
by Ctrl-C.
Also, windbg seems to use a different variation of AArch64 breakpoint compared
to GDB. This causes problems when debugging Windows on ARM binaries, when
program breakpoints are being used.
The proposed patch creates a new gdbarch method (gdbarch_program_breakpoint_here_p)
that tells GDB whether the underlying instruction is a breakpoint instruction
or not.
This is more general than only checking for the instruction GDB uses as
breakpoint.
The existing logic is still preserved for targets that do not implement this
new gdbarch method.
The end result is like so:
(gdb) x/i $pc
=> 0x4005c0 <problem_function>: brk #0x90f
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 16417)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: proceed: resuming process 16417
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 16417] at 0x4005c0
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: 16417.16417.0 [process 16417],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: handle_inferior_event status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: stop_pc = 0x4005c0
infrun: random signal (GDB_SIGNAL_TRAP)
infrun: stop_waiting
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun: process 16417 not executing
infrun: stop_all_threads, pass=1, iterations=1
infrun: process 16417 not executing
infrun: stop_all_threads done
Program received signal SIGTRAP, Trace/breakpoint trap.
problem_function () at brk.c:7
7 asm("brk %0\n\t" ::"n"(0x900 + 0xf));
infrun: infrun_async(0)
gdb/ChangeLog:
2020-01-29 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (BRK_INSN_MASK): Define to 0xffe0001f.
(BRK_INSN_MASK): Define to 0xd4200000.
(aarch64_program_breakpoint_here_p): New function.
(aarch64_gdbarch_init): Set gdbarch_program_breakpoint_here_p hook.
* arch-utils.c (default_program_breakpoint_here_p): Moved from
breakpoint.c.
* arch-utils.h (default_program_breakpoint_here_p): Moved from
breakpoint.h
* breakpoint.c (bp_loc_is_permanent): Changed return type to bool and
call gdbarch_program_breakpoint_here_p.
(program_breakpoint_here): Moved to arch-utils.c, renamed to
default_program_breakpoint_here_p, changed return type to bool and
simplified.
* breakpoint.h (program_breakpoint_here): Moved prototype to
arch-utils.h, renamed to default_program_breakpoint_here_p and changed
return type to bool.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (program_breakpoint_here_p): New method.
* infrun.c (handle_signal_stop): Call
gdbarch_program_breakpoint_here_p.
|
|
gdb/ChangeLog:
Update copyright year range in all GDB files.
|
|
The documentation for make-breakpoint from the Guile API and the `spec'
variant of the gdb.Breakpoint constructor from the Python API state that
the format acceptable for location strings is the same as that accepted
by the break command. However, using the -probe qualifier at the
beginning of the location string causes a GDB internal error as it
attempts to decode a probe location in the wrong code path. Without this
functionality, there doesn't appear to be another way to set breakpoints
on probe points from Python or Guile scripts.
This patch introduces a new helper function that returns a
breakpoint_ops instance appropriate for a parsed location and updates
the Guile and Python bindings to use said function, rather than the
current hard-coded use of bkpt_breakpoint_ops. Since this logic is
duplicated in the handling of the `break' and `trace' commands, those
are also updated to call into the new helper function.
gdb/ChangeLog:
2019-12-10 George Barrett <bob@bob131.so>
Fix scripted probe breakpoints.
* breakpoint.c (tracepoint_probe_breakpoint_ops): Move
declaration forward.
(breakpoint_ops_for_event_location_type)
(breakpoint_ops_for_event_location): Add function definitions.
(break_command_1, trace_command): Use
breakpoint_ops_for_event_location.
* breakpoint.h (breakpoint_ops_for_event_location): Add function
declarations.
* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Use
breakpoint_ops_for_event_location.
* python/py-breakpoint.c (bppy_init): Use
breakpoint_ops_for_event_location.
gdb/testsuite/ChangeLog:
2019-12-10 George Barrett <bob@bob131.so>
Test scripted probe breakpoints.
* gdb.guile/scm-breakpoint.c (main): Add probe point.
* gdb.python/py-breakpoint.c (main): Likewise.
* gdb.guile/scm-breakpoint.exp (test_bkpt_probe): Add probe
specifier test.
* gdb.python/py-breakpoint.exp (test_bkpt_probe): Likewise.
|
|
rbreak_command_wrapper is unused, so remove it. And while at it, remove
other declarations around it.
gdb/ChangeLog:
* breakpoint.h (hbreak_command_wrapper, thbreak_command_wrapper,
rbreak_command_wrapper): Remove.
* symtab.c (rbreak_command_wrapper): Remove.
Change-Id: If9782f205e4913f8dfc5beeaa526544f25e099c6
|
|
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* aarch64-linux-tdep.c: Fix typos in comments.
* aarch64-tdep.c: Same.
* ada-lang.c: Same.
* amd64-nat.c: Same.
* arc-tdep.c: Same.
* arch/aarch64-insn.c: Same.
* block.c: Same.
* breakpoint.h: Same.
* btrace.h: Same.
* c-varobj.c: Same.
* cli/cli-decode.c: Same.
* cli/cli-script.c: Same.
* cli/cli-utils.h: Same.
* coff-pe-read.c: Same.
* coffread.c: Same.
* compile/compile-cplus-symbols.c: Same.
* compile/compile-object-run.c: Same.
* completer.c: Same.
* corelow.c: Same.
* cp-support.c: Same.
* demangle.c: Same.
* dwarf-index-write.c: Same.
* dwarf2-frame.c: Same.
* dwarf2-frame.h: Same.
* eval.c: Same.
* frame-base.h: Same.
* frame.h: Same.
* gdbcmd.h: Same.
* gdbtypes.h: Same.
* gnu-nat.c: Same.
* guile/scm-objfile.c: Same.
* i386-tdep.c: Same.
* i386-tdep.h: Same.
* infcall.c: Same.
* infcall.h: Same.
* linux-nat.c: Same.
* m68k-tdep.c: Same.
* macroexp.c: Same.
* memattr.c: Same.
* mi/mi-cmd-disas.c: Same.
* mi/mi-getopt.h: Same.
* mi/mi-main.c: Same.
* minsyms.c: Same.
* nat/aarch64-sve-linux-sigcontext.h: Same.
* objfiles.h: Same.
* ppc-linux-nat.c: Same.
* ppc-linux-tdep.c: Same.
* ppc-tdep.h: Same.
* progspace.h: Same.
* prologue-value.h: Same.
* python/py-evtregistry.c: Same.
* python/py-instruction.h: Same.
* record-btrace.c: Same.
* record-full.c: Same.
* remote.c: Same.
* rs6000-tdep.c: Same.
* ser-tcp.c: Same.
* sol-thread.c: Same.
* sparc-sol2-tdep.c: Same.
* sparc64-tdep.c: Same.
* stabsread.c: Same.
* symfile.c: Same.
* symtab.h: Same.
* target.c: Same.
* tracepoint.c: Same.
* tui/tui-data.h: Same.
* tui/tui-io.c: Same.
* tui/tui-win.c: Same.
* tui/tui.c: Same.
* unittests/rsp-low-selftests.c: Same.
* user-regs.h: Same.
* utils.c: Same.
* utils.h: Same.
* valarith.c: Same.
* valops.c: Same.
* valprint.c: Same.
* valprint.h: Same.
* value.c: Same.
* value.h: Same.
* varobj.c: Same.
* x86-nat.h: Same.
* xtensa-tdep.c: Same.
gdb/gdbserver/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* linux-aarch64-low.c: Fix typos in comments.
* linux-arm-low.c: Same.
* linux-low.c: Same.
* linux-ppc-low.c: Same.
* proc-service.c: Same.
* regcache.h: Same.
* server.c: Same.
* tracepoint.c: Same.
* win32-low.c: Same.
gdb/stubs/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* ia64vms-stub.c: Fix typos in comments.
* m32r-stub.c: Same.
* m68k-stub.c: Same.
* sh-stub.c: Same.
gdb/testsuite/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* gdb.base/bigcore.c: Fix typos in comments.
* gdb.base/ctf-ptype.c: Same.
* gdb.base/long_long.c: Same.
* gdb.dwarf2/dw2-op-out-param.S: Same.
* gdb.python/py-evthreads.c: Same.
* gdb.reverse/i387-stack-reverse.c: Same.
* gdb.trace/tfile.c: Same.
* lib/compiler.c: Same.
* lib/compiler.cc: Same.
Change-Id: I8573d84a577894270179ae30f46c48d806fc1beb
|
|
Removes vec.c and vec.h from the source tree, and remove all the
remaining includes of vec.h. There should be no user visible changes
after this commit.
I did have a few issues rebuilding GDB after applying this patch due
to cached dependencies, I found that running this command in the build
directory resolved my build issues without requiring a 'make clean':
rm -fr gdb/gdbserver/gdbsupport/.deps/
gdb/ChangeLog:
* Makefile.in: Remove references to vec.h and vec.c.
* aarch64-tdep.c: No longer include vec.h.
* ada-lang.c: Likewise.
* ada-lang.h: Likewise.
* arm-tdep.c: Likewise.
* ax.h: Likewise.
* breakpoint.h: Likewise.
* charset.c: Likewise.
* cp-support.h: Likewise.
* dtrace-probe.c: Likewise.
* dwarf2read.c: Likewise.
* extension.h: Likewise.
* gdb_bfd.c: Likewise.
* gdbsupport/gdb_vecs.h: Likewise.
* gdbsupport/vec.c: Remove.
* gdbsupport/vec.h: Remove.
* gdbthread.h: Likewise.
* guile/scm-type.c: Likewise.
* inline-frame.c: Likewise.
* machoread.c: Likewise.
* memattr.c: Likewise.
* memrange.h: Likewise.
* namespace.h: Likewise.
* nat/linux-btrace.h: Likewise.
* osdata.c: Likewise.
* parser-defs.h: Likewise.
* progspace.h: Likewise.
* python/py-type.c: Likewise.
* record-btrace.c: Likewise.
* rust-exp.y: Likewise.
* solib-target.c: Likewise.
* stap-probe.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.h: Likewise.
* varobj.c: Likewise.
* varobj.h: Likewise.
* xml-support.h: Likewise.
gdb/gdbserver/ChangeLog:
* Makefile.in: Remove references to vec.c.
Change-Id: I0c91d7170bf1b5e992a387fcd9fe4f2abe343bb5
|
|
This allows callers to pass in capturing lambdas. Also changes the return
type to bool.
gdb/ChangeLog:
2019-10-15 Christian Biesinger <cbiesinger@google.com>
* breakpoint.c (iterate_over_breakpoints): Change function pointer
to a gdb::function_view and return value to bool.
* breakpoint.h (iterate_over_breakpoints): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Update.
(pop_dummy_frame): Update.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Update.
(gdbscm_breakpoints): Update.
* python/py-breakpoint.c (build_bp_list): Update.
(gdbpy_breakpoints): Update.
* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
Update.
(bpfinishpy_handle_stop): Update.
(bpfinishpy_handle_exit): Update.
* solib-svr4.c (svr4_update_solib_event_breakpoint): Update.
(svr4_update_solib_event_breakpoints): Update.
Change-Id: Ia9de4deecae562a70a40f5cd49f5a74d64570251
|
|
gdb/ChangeLog:
* breakpoint.h (struct watchpoint) <val_valid>: Change type to
bool.
* breakpoint.c (update_watchpoint): Assign false instead of 0,
true instead of 1.
(breakpoint_init_inferior): Likewise.
(watchpoint_check): Likewise.
(watch_command_1): Likewise.
(invalidate_bp_value_on_memory_change): Likewise.
|
|
These int fields have been converted to bool, so their doc should say
"true" and not "nonzero".
gdb/ChangeLog:
* breakpoint.h (bp_location) <inserted, permanent, duplicate>:
Change "nonzero" to "true" in documentation.
|
|
This is for add_setshow_boolean_cmd as well as the gdb::option interface.
gdb/ChangeLog:
2019-09-17 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
(print_signatures): Likewise.
(trust_pad_over_xvs): Likewise.
* arch/aarch64-insn.c (aarch64_debug): Likewise.
* arch/aarch64-insn.h (aarch64_debug): Likewise.
* arm-linux-nat.c (arm_apcs_32): Likewise.
* arm-linux-tdep.c (arm_apcs_32): Likewise.
* arm-nbsd-nat.c (arm_apcs_32): Likewise.
* arm-tdep.c (arm_debug): Likewise.
(arm_apcs_32): Likewise.
* auto-load.c (debug_auto_load): Likewise.
(auto_load_gdb_scripts): Likewise.
(global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* auto-load.h (global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* breakpoint.c (disconnected_dprintf): Likewise.
(breakpoint_proceeded): Likewise.
(automatic_hardware_breakpoints): Likewise.
(always_inserted_mode): Likewise.
(target_exact_watchpoints): Likewise.
(_initialize_breakpoint): Update.
* breakpoint.h (target_exact_watchpoints): Change to bool.
* btrace.c (maint_btrace_pt_skip_pad): Likewise.
* cli/cli-cmds.c (trace_commands): Likewise.
* cli/cli-cmds.h (trace_commands): Likewise.
* cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument
to bool*.
* cli/cli-logging.c (logging_overwrite): Change to bool.
(logging_redirect): Likewise.
(debug_redirect): Likewise.
* cli/cli-option.h (option_def) <boolean>: Change return type to bool*.
(struct boolean_option_def) <get_var_address_cb_>: Change return type
to bool.
<boolean_option_def>: Update.
(struct flag_option_def): Change default type of Context to bool
from int.
<flag_option_def>: Change return type of var_address_cb_ to bool*.
* cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*.
(get_setshow_command_value_string): Likewise.
* cli/cli-style.c (cli_styling): Change to bool.
(source_styling): Likewise.
* cli/cli-style.h (source_styling): Likewise.
(cli_styling): Likewise.
* cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change
to bool.
* command.h (var_types): Update comment.
(add_setshow_boolean_cmd): Change int* var argument to bool*.
* compile/compile-cplus-types.c (debug_compile_cplus_types): Change to
bool.
(debug_compile_cplus_scopes): Likewise.
* compile/compile-internal.h (compile_debug): Likewise.
* compile/compile.c (compile_debug): Likewise.
(struct compile_options) <raw>: Likewise.
* cp-support.c (catch_demangler_crashes): Likewise.
* cris-tdep.c (usr_cmd_cris_version_valid): Likewise.
(usr_cmd_cris_dwarf2_cfi): Likewise.
* csky-tdep.c (csky_debug): Likewise.
* darwin-nat.c (enable_mach_exceptions): Likewise.
* dcache.c (dcache_enabled_p): Likewise.
* defs.h (info_verbose): Likewise.
* demangle.c (demangle): Likewise.
(asm_demangle): Likewise.
* dwarf-index-cache.c (debug_index_cache): Likewise.
* dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2read.c (check_physname): Likewise.
(use_deprecated_index_sections): Likewise.
(dwarf_always_disassemble): Likewise.
* eval.c (overload_resolution): Likewise.
* event-top.c (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* event-top.h (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* exec.c (write_files): Likewise.
* fbsd-nat.c (debug_fbsd_lwp): Likewise
(debug_fbsd_nat): Likewise.
* frame.h (struct frame_print_options) <print_raw_frame_arguments>:
Likewise.
(struct set_backtrace_options) <backtrace_past_main>: Likewise.
<backtrace_past_entry> Likewise.
* gdb-demangle.h (demangle): Likewise.
(asm_demangle): Likewise.
* gdb_bfd.c (bfd_sharing): Likewise.
* gdbcore.h (write_files): Likewise.
* gdbsupport/common-debug.c (show_debug_regs): Likewise.
* gdbsupport/common-debug.h (show_debug_regs): Likewise.
* gdbthread.h (print_thread_events): Likewise.
* gdbtypes.c (opaque_type_resolution): Likewise.
(strict_type_checking): Likewise.
* gnu-nat.c (gnu_debug_flag): Likewise.
* guile/scm-auto-load.c (auto_load_guile_scripts): Likewise.
* guile/scm-param.c (pascm_variable): Add boolval.
(add_setshow_generic): Update.
(pascm_param_value): Update.
(pascm_set_param_value_x): Update.
* hppa-tdep.c (hppa_debug): Change to bool..
* infcall.c (may_call_functions_p): Likewise.
(coerce_float_to_double_p): Likewise.
(unwind_on_signal_p): Likewise.
(unwind_on_terminating_exception_p): Likewise.
* infcmd.c (startup_with_shell): Likewise.
* inferior.c (print_inferior_events): Likewise.
* inferior.h (startup_with_shell): Likewise.
(print_inferior_events): Likewise.
* infrun.c (step_stop_if_no_debug): Likewise.
(detach_fork): Likewise.
(debug_displaced): Likewise.
(disable_randomization): Likewise.
(non_stop): Likewise.
(non_stop_1): Likewise.
(observer_mode): Likewise.
(observer_mode_1): Likewise.
(set_observer_mode): Update.
(sched_multi): Change to bool.
* infrun.h (debug_displaced): Likewise.
(sched_multi): Likewise.
(step_stop_if_no_debug): Likewise.
(non_stop): Likewise.
(disable_randomization): Likewise.
* linux-tdep.c (use_coredump_filter): Likewise.
(dump_excluded_mappings): Likewise.
* linux-thread-db.c (auto_load_thread_db): Likewise.
(check_thread_db_on_load): Likewise.
* main.c (captured_main_1): Update.
* maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt,
xx2_opt, boolean_opt>: Change to bool.
* maint-test-settings.c (maintenance_test_settings_boolean): Likewise.
* maint.c (maintenance_profile_p): Likewise.
(per_command_time): Likewise.
(per_command_space): Likewise.
(per_command_symtab): Likewise.
* memattr.c (inaccessible_by_default): Likewise.
* mi/mi-main.c (mi_async): Likewise.
(mi_async_1): Likewise.
* mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise.
* nat/fork-inferior.h (startup_with_shell): Likewise.
* nat/linux-namespaces.c (debug_linux_namespaces): Likewise.
* nat/linux-namespaces.h (debug_linux_namespaces): Likewise.
* nios2-tdep.c (nios2_debug): Likewise.
* or1k-tdep.c (or1k_debug): Likewise.
* parse.c (parser_debug): Likewise.
* parser-defs.h (parser_debug): Likewise.
* printcmd.c (print_symbol_filename): Likewise.
* proc-api.c (procfs_trace): Likewise.
* python/py-auto-load.c (auto_load_python_scripts): Likewise.
* python/py-param.c (union parmpy_variable): Add "bool boolval" field.
(set_parameter_value): Update.
(add_setshow_generic): Update.
* python/py-value.c (copy_py_bool_obj): Change argument from int*
to bool*.
* python/python.c (gdbpy_parameter_value): Cast to bool* instead of
int*.
* ravenscar-thread.c (ravenscar_task_support): Change to bool.
* record-btrace.c (record_btrace_target::store_registers): Update.
* record-full.c (record_full_memory_query): Change to bool.
(record_full_stop_at_limit): Likewise.
* record-full.h (record_full_memory_query): Likewise.
* remote-notif.c (notif_debug): Likewise.
* remote-notif.h (notif_debug): Likewise.
* remote.c (use_range_stepping): Likewise.
(interrupt_on_connect): Likewise.
(remote_break): Likewise.
* ser-tcp.c (tcp_auto_retry): Likewise.
* ser-unix.c (serial_hwflow): Likewise.
* skip.c (debug_skip): Likewise.
* solib-aix.c (solib_aix_debug): Likewise.
* spu-tdep.c (spu_stop_on_load_p): Likewise.
(spu_auto_flush_cache_p): Likewise.
* stack.c (struct backtrace_cmd_options) <full, no_filters, hide>:
Likewise.
(struct info_print_options) <quiet>: Likewise.
* symfile-debug.c (debug_symfile): Likewise.
* symfile.c (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symfile.h (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symtab.c (basenames_may_differ): Likewise.
(struct filename_partial_match_opts) <dirname, basename>: Likewise.
(struct info_print_options) <quiet, exclude_minsyms>: Likewise.
(struct info_types_options) <quiet>: Likewise.
* symtab.h (demangle): Likewise.
(basenames_may_differ): Likewise.
* target-dcache.c (stack_cache_enabled_1): Likewise.
(code_cache_enabled_1): Likewise.
* target.c (trust_readonly): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
(auto_connect_native_target): Likewise.
(target_stop_and_wait): Update.
(target_async_permitted): Change to bool.
(target_async_permitted_1): Likewise.
(may_write_registers_1): Likewise.
(may_write_memory_1): Likewise.
(may_insert_breakpoints_1): Likewise.
(may_insert_tracepoints_1): Likewise.
(may_insert_fast_tracepoints_1): Likewise.
(may_stop_1): Likewise.
* target.h (target_async_permitted): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
* thread.c (struct info_threads_opts) <show_global_ids>: Likewise.
(make_thread_apply_all_options_def_group): Change argument from int*
to bool*.
(thread_apply_all_command): Update.
(print_thread_events): Change to bool.
* top.c (confirm): Likewise.
(command_editing_p): Likewise.
(history_expansion_p): Likewise.
(write_history_p): Likewise.
(info_verbose): Likewise.
* top.h (confirm): Likewise.
(history_expansion_p): Likewise.
* tracepoint.c (disconnected_tracing): Likewise.
(circular_trace_buffer): Likewise.
* typeprint.c (print_methods): Likewise.
(print_typedefs): Likewise.
* utils.c (debug_timestamp): Likewise.
(sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* utils.h (sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* valops.c (overload_resolution): Likewise.
* valprint.h (struct value_print_options) <prettyformat_arrays,
prettyformat_structs, vtblprint, unionprint, addressprint, objectprint,
stop_print_at_null, print_array_indexes, deref_ref, static_field_print,
pascal_static_field_print, raw, summary, symbol_print, finish_print>:
Likewise.
* windows-nat.c (new_console): Likewise.
(cygwin_exceptions): Likewise.
(new_group): Likewise.
(debug_exec): Likewise.
(debug_events): Likewise.
(debug_memory): Likewise.
(debug_exceptions): Likewise.
(useshell): Likewise.
* windows-tdep.c (maint_display_all_tib): Likewise.
* xml-support.c (debug_xml): Likewise.
|
|
This changes breakpoint::filter to be a unique_xmalloc_ptr, removing
an explicit xfree, as well as a use of a "release" method.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* breakpoint.c (init_breakpoint_sal): Update.
(breakpoint): Update.
* breakpoint.h (struct breakpoint) <filter>: Now a
unique_xmalloc_ptr.
|
|
This includes changing the FILTER parameters of two functions
accordingly. I also tried to normalize the function comments to our
current standards.
gdb/ChangeLog:
* breakpoint.c (is_hardware_watchpoint): Remove
forward-declaration.
(is_masked_watchpoint): Change return type to bool.
(is_tracepoint): Likewise.
(is_breakpoint): Likewise.
(is_hardware_watchpoint): Likewise.
(is_watchpoint): Likewise.
(is_no_memory_software_watchpoint): Likewise.
(is_catchpoint): Likewise.
(breakpoint_1): Make FILTER parameter's return type bool.
is_masked_watchpoint): Change return type to bool.
(save_breakpoints): Make FILTER parameter's return type bool.
* breakpoint.h (is_breakpoint): Change return type to bool.
(is_watchpoint): Likewise.
(is_catchpoint): Likewise.
(is_tracepoint): Likewise.
|
|
Change return type to bool and adjust function comments.
gdb/ChangeLog:
* breakpoint.h (bpstat_explains_signal, bpstat_causes_stop,
bpstat_should_step): Return bool, adjust comments.
* breakpoint.c (bpstat_explains_signal, bpstat_causes_stop,
bpstat_should_step): Likewise.
|
|
gdb/ChangeLog:
* breakpoint.h (struct bpstat_what) <is_longjmp>: Change type to
bool.
(bpstat_what): Use false instead of 0.
|
|
This commit makes "maint info breakpoints" show the internal locations
of C++ exception catchpoints:
(gdb) info breakpoints
Num Type Disp Enb Address What
2 catchpoint keep y exception catch
With multiple locations:
(gdb) maint info breakpoints
Num Type Disp Enb Address What
2 catchpoint keep y exception catch
2.1 y 0x000000000040545f <__cxa_begin_catch+95> inf 1
2.2 y 0x00007ffff71dbe0f <__cxxabiv1::__cxa_begin_catch(void*)+95> inf 1
(gdb)
With a single location:
(gdb) maint info breakpoints 2
Num Type Disp Enb Address What
2 catchpoint keep y exception catch inf 1
2.1 y 0x00007ffff7bc0b7f <__cxa_begin_catch+95> inf 1
With no locations:
(gdb) maint info breakpoints 2
Num Type Disp Enb Address What
2 catchpoint keep y exception catch inf 1
Other catchpoints still show the same way, here a catch signal:
(gdb) info breakpoints
Num Type Disp Enb Address What
3 catchpoint keep y signal "<standard signals>"
(gdb) maint info breakpoints
Num Type Disp Enb Address What
3 catchpoint keep y signal "<standard signals>" inf 1
(gdb)
Note: I considered making the locations be printed from within
breakpoint_ops::print_one(), but gave up given the handling for the
broken MI v2 output:
/* The mi2 broken format: the main breakpoint tuple ends here, the locations
are outside. */
if (!use_fixed_output)
bkpt_tuple_emitter.reset ();
in print_one_breakpoint.
gdb/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* break-catch-throw.c (is_exception_catchpoint): New.
* breakpoint.c (print_one_breakpoint_location): New parameter
'raw_loc'. Handle it. Use
is_watchpoint/is_catchpoint/is_exception_catchpoint instead of
looking at the breakpoint's type.
(print_one_breakpoint): If handling "maint info breakpoints", also
print locations of exception catchpoints.
* breakpoint.h (is_exception_catchpoint): Declare.
|
|
Currently, with:
(gdb) catch catch
Catchpoint 1 (catch)
(gdb) catch throw
Catchpoint 2 (throw)
(gdb) catch rethrow
Catchpoint 3 (rethrow)
You get:
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000b122af exception catch
2 breakpoint keep y 0x0000000000b1288d exception throw
3 breakpoint keep y 0x0000000000b12931 exception rethrow
I think it doesn't make much sense usability-wise, to show a
catchpoint as a breakpoint. The fact that GDB sets a breakpoint at
some magic address in the C++ run time is an implementation detail,
IMO. And as seen in the previous patch, such a catchpoint can end up
with more than one location/address even, so showing a single address
isn't entirely accurate.
This commit hides the addresses from view, and makes GDB show
"catchpoint" for type as well:
(gdb) info breakpoints
Num Type Disp Enb Address What
1 catchpoint keep y exception catch
2 catchpoint keep y exception throw
3 catchpoint keep y exception rethrow
This comment in the code seems telling:
/* We need to reset 'type' in order for code in breakpoint.c to do
the right thing. */
cp->type = bp_breakpoint;
It kind of suggests that the reason catchpoints end up shown as
breakpoints was that it was easier to implement them that way, rather
than a desired property.
This commit fixes things up to make it possible to have bp_catch
breakpoints have software/hardware breakpoint locations, thus
eliminating the need for that hack:
- redo breakpoint_address_is_meaningful in terms of the location's
type rather than breakpoint type.
- teach bpstat_what about stepping over the catchpoint locations.
- install a allocate_location method for "catch catch/throw/rethrow",
one that forces the location type.
Note that this also reverts the gdb hunk from:
commit 2a8be20359dba9cc684fd3ffa222d985399f3b18
Commit: Tom Tromey <tom@tromey.com>
CommitDate: Sat Oct 6 22:17:45 2018 -0600
Fix Python gdb.Breakpoint.location crash
because now "catch throw" catchpoints hit the
if (obj->bp->type != bp_breakpoint)
Py_RETURN_NONE;
check above, and, adjusts the testcase to no longer expect to see the
catchpoint in the gdb.breakpoints() list.
(Note: might make sense to do the same to Ada exception catchpoints.)
gdb/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* break-catch-throw.c (print_one_exception_catchpoint): Skip the
"addr" field.
(allocate_location_exception_catchpoint): New.
(handle_gnu_v3_exceptions): Don't reset 'type' to bp_breakpoint.
(initialize_throw_catchpoint_ops): Install
allocate_location_exception_catchpoint as allocate_location
method.
* breakpoint.c (bpstat_what) <bp_catch>: Set action to
BPSTAT_WHAT_SINGLE if not stopping and the location's type is not
bp_loc_other.
(breakpoint_address_is_meaningful): Delete.
(bl_address_is_meaningful): New.
(breakpoint_locations_match): Adjust comment.
(bp_location_from_bp_type): New, factored out of...
(bp_location::bp_location(breakpoint *)): ... this.
(bp_location::bp_location(breakpoint *, bp_loc_type)): New,
factored out of...
(bp_location::bp_location(breakpoint *)): ... this. Reimplement.
(bp_loc_is_permanent): Use bl_address_is_meaningful instead of
breakpoint_address_is_meaningful.
(bp_locations_compare): Adjust comment.
(update_global_location_list): Use bl_address_is_meaningful
instead of breakpoint_address_is_meaningful.
* breakpoint.h (bp_location::bp_location(breakpoint *)): New
explicit.
(bp_location::bp_location(breakpoint *, bp_loc_type)): Declare.
* python/py-breakpoint.c (bppy_get_location): No longer check
whether location is null.
gdb/doc/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* gdb.texinfo (C++ Exception GDB/MI Catchpoint Commands): Adjust
examples to show type=catchpoint instead of type=breakpoint and an
address.
gdb/testsuite/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* gdb.cp/catch-multi-stdlib.exp: Adjust expected "info
breakpoints" output.
* gdb.cp/exception.exp: Adjust expected "info breakpoints" output.
* gdb.python/py-breakpoint.exp: No longer expect that "catch
throw" creates breakpoint.
* gdb.mi/mi-catch-cpp-exceptions.exp (setup_catchpoint): Expect
'type="catchpoint"'.
|
|
This is the next patch in the ongoing series to move gdbsever to the
top level.
This patch just renames the "common" directory. The idea is to do
this move in two parts: first rename the directory (this patch), then
move the directory to the top. This approach makes the patches a bit
more tractable.
I chose the name "gdbsupport" for the directory. However, as this
patch was largely written by sed, we could pick a new name without too
much difficulty.
Tested by the buildbot.
gdb/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* contrib/ari/gdb_ari.sh: Change common to gdbsupport.
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* gdbsupport: Rename from common.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES)
(HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to
gdbsupport.
* aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c,
amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c,
amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c,
amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c,
amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c,
arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c,
arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c,
arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c,
arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c,
auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h,
btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c,
charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c,
cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c,
coff-pe-read.c, command.h, compile/compile-c-support.c,
compile/compile-c.h, compile/compile-cplus-symbols.c,
compile/compile-cplus-types.c, compile/compile-cplus.h,
compile/compile-loc2c.c, compile/compile.c, completer.c,
completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c,
cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c,
darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c,
disasm.h, dtrace-probe.c, dwarf-index-cache.c,
dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c,
dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c,
event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c,
features/aarch64-core.c, features/aarch64-fpu.c,
features/aarch64-pauth.c, features/aarch64-sve.c,
features/i386/32bit-avx.c, features/i386/32bit-avx512.c,
features/i386/32bit-core.c, features/i386/32bit-linux.c,
features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c,
features/i386/32bit-segments.c, features/i386/32bit-sse.c,
features/i386/64bit-avx.c, features/i386/64bit-avx512.c,
features/i386/64bit-core.c, features/i386/64bit-linux.c,
features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c,
features/i386/64bit-segments.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/riscv/32bit-cpu.c,
features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c,
features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c,
features/riscv/64bit-fpu.c, features/tic6x-c6xp.c,
features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h,
findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h,
gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c,
gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c,
go32-nat.c, guile/guile.c, guile/scm-ports.c,
guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c,
i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c,
i386-linux-tdep.c, i386-tdep.c, i387-tdep.c,
ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c,
inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h,
inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h,
inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, location.c, machoread.c,
macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h,
mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c,
mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h,
minsyms.c, mips-linux-tdep.c, namespace.h,
nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h,
nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c,
nat/amd64-linux-siginfo.c, nat/fork-inferior.c,
nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c,
nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c,
nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h,
nat/linux-waitpid.c, nat/mips-linux-watch.c,
nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c,
nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c,
nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h,
obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c,
parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c,
procfs.c, producer.c, progspace.h, psymtab.h,
python/py-framefilter.c, python/py-inferior.c, python/py-ref.h,
python/py-type.c, python/python.c, record-btrace.c, record-full.c,
record.c, record.h, regcache-dump.c, regcache.c, regcache.h,
remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c,
riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c,
selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c,
ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c,
source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c,
stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h,
symtab.c, symtab.h, target-descriptions.c, target-descriptions.h,
target-memory.c, target.c, target.h, target/waitstatus.c,
target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c,
top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c,
tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h,
unittests/array-view-selftests.c,
unittests/child-path-selftests.c, unittests/cli-utils-selftests.c,
unittests/common-utils-selftests.c,
unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c,
unittests/format_pieces-selftests.c,
unittests/function-view-selftests.c,
unittests/lookup_name_info-selftests.c,
unittests/memory-map-selftests.c, unittests/memrange-selftests.c,
unittests/mkdir-recursive-selftests.c,
unittests/observable-selftests.c,
unittests/offset-type-selftests.c, unittests/optional-selftests.c,
unittests/parse-connection-spec-selftests.c,
unittests/ptid-selftests.c, unittests/rsp-low-selftests.c,
unittests/scoped_fd-selftests.c,
unittests/scoped_mmap-selftests.c,
unittests/scoped_restore-selftests.c,
unittests/string_view-selftests.c, unittests/style-selftests.c,
unittests/tracepoint-selftests.c, unittests/unpack-selftests.c,
unittests/utils-selftests.c, unittests/xml-utils-selftests.c,
utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c,
value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c,
xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c,
xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport.
gdb/gdbserver/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS)
(version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change
common to gdbsupport.
* ax.c, event-loop.c, fork-child.c, gdb_proc_service.h,
gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c,
inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c,
linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c,
linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c,
linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h,
nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c,
server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h,
thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change
common to gdbsupport.
|
|
... since nobody uses it.
gdb/ChangeLog:
* breakpoint.h (remove_breakpoints_inf): Change return type to
void, move function documentation here.
* breakpoint.c (remove_breakpoints_inf): Change return type to
void, move function documentation to header.
|
|
Adds some MI commands to catch C++ exceptions. The new commands are
-catch-throw, -catch-rethrow, and -catch-catch, these all correspond
to the CLI commands 'catch throw', 'catch rethrow', and 'catch catch'.
Each MI command takes two optional arguments, '-t' has the effect of
calling 'tcatch' instead of 'catch', for example:
(gdb)
-catch-throw -t
Is the same as:
(gdb) tcatch throw
There is also a '-r REGEXP' argument that can supply a regexp to match
against the exception type, so:
(gdb)
-catch-catch -r PATTERN
Is the same as:
(gdb) catch catch PATTERN
The change in print_mention_exception_catchpoint might seem a little
strange; changing the output from using ui_out::field_int and
ui_out::text to using ui_out::message.
The print_mention_exception_catchpoint is used as the 'print_mention'
method for the exception catchpoint breakpoint object. Most of the
other 'print_mention' methods (see breakpoint.c) use either
printf_filtered, of ui_out::message. Using field_int was causing an
unexpected field to be added to the MI output. Here's the output
without the change in print_mention_exception_catchpoint:
(gdb)
-catch-throw
^done,bkptno="1",bkpt={number="1",type="breakpoint",disp="keep",
enabled="y",addr="0x00000000004006c0",
what="exception throw",catch-type="throw",
thread-groups=["i1"],times="0"}
Notice the breakpoint number appears in both the 'bkptno' field, and
the 'number' field within the 'bkpt' tuple. Here's the output with
the change in print_mention_exception_catchpoint:
(gdb)
-catch-throw
^done,bkpt={number="1",type="breakpoint",disp="keep",
enabled="y",addr="0x00000000004006c0",
what="exception throw",catch-type="throw",
thread-groups=["i1"],times="0"}
gdb/ChangeLog:
* NEWS: Mention new MI commands.
* break-catch-throw.c (enum exception_event_kind): Move to
breakpoint.h.
(print_mention_exception_catchpoint): Output text as a single
message.
(catch_exception_command_1): Rename to...
(catch_exception_event): ...this, make non-static, update header
command, and change some parameter types.
(catch_catch_command): Update for changes to
catch_exception_command_1.
(catch_throw_command): Likewise.
(catch_rethrow_command): Likewise.
* breakpoint.c (enum exception_event_kind): Delete.
* breakpoint.h (enum exception_event_kind): Moved here from
break-catch-throw.c.
(catch_exception_event): Declare.
* mi/mi-cmd-catch.c (mi_cmd_catch_exception_event): New function.
(mi_cmd_catch_throw): New function.
(mi_cmd_catch_rethrow): New function.
(mi_cmd_catch_catch): New function.
* mi/mi-cmds.c (mi_cmds): Add 'catch-throw', 'catch-rethrow', and
'catch-catch' entries.
* mi/mi-cmds.h (mi_cmd_catch_throw): Declare.
(mi_cmd_catch_rethrow): Declare.
(mi_cmd_catch_catch): Declare.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new
node.
(C++ Exception GDB/MI Catchpoint Commands): New node to describe
new MI commands.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-catch-cpp-exceptions.cc: New file.
* gdb.mi/mi-catch-cpp-exceptions.exp: New file.
* lib/mi-support.exp (mi_expect_stop): Handle 'exception-caught'
as a stop reason.
|
|
Since commit
b4be1b064860 ("Fix MI output for multi-location breakpoints")
we get this error when building with --disable-gdbmi:
CXXLD gdb
/home/smarchi/src/binutils-gdb/gdb/breakpoint.c:6358: error: undefined reference to 'mi_multi_location_breakpoint_output_fixed(ui_out*)'
This is due to breakpoint.c using a function defined in mi/mi-main.c, even
though mi/mi-main.c isn't included in the build.
To fix it, use the flags feature of ui_out. mi_ui_out has the new
fix_multi_location_breakpoint_output flag set for versions >= 3. Also,
move the global variable fix_multi_location_breakpoint_output to
breakpoint.c, so it can be read there even when we build without MI. I
renamed it to fix_multi_location_breakpoint_output_globally so it
doesn't clash with the new enumerator.
gdb/ChangeLog:
* breakpoint.h (fix_multi_location_breakpoint_output_globally):
New variable declaration.
* breakpoint.c (fix_multi_location_breakpoint_output_globally):
New variable.
(print_one_breakpoint): Use ui_out::test_flags and new global
variable to compute use_fixed_output.
* mi/mi-main.h (mi_multi_location_breakpoint_output_fixed):
Remove.
* mi/mi-main.c (fix_multi_location_breakpoint_output): Remove.
(mi_multi_location_breakpoint_output_fixed): Remove.
(mi_cmd_fix_multi_location_breakpoint_output): Adjust to set the
new variable.
* mi/mi-out.c (mi_ui_out::mi_ui_out): Set
fix_multi_location_breakpoint_output flag if version >= 3.
* ui-out.h (enum ui_out_flag)
<fix_multi_location_breakpoint_output>: New enumerator.
|
|
Andreas Schwab and John Baldwin pointed out some bugs in the header
sorting patch; and I noticed that the output was not correct when
limited to a subset of files (a bug in my script).
So, I'm reverting the patch. I may try again after fixing the issues
pointed out.
gdb/ChangeLog
2019-04-05 Tom Tromey <tom@tromey.com>
Revert the header-sorting patch.
* ft32-tdep.c: Revert.
* frv-tdep.c: Revert.
* frv-linux-tdep.c: Revert.
* frame.c: Revert.
* frame-unwind.c: Revert.
* frame-base.c: Revert.
* fork-child.c: Revert.
* findvar.c: Revert.
* findcmd.c: Revert.
* filesystem.c: Revert.
* filename-seen-cache.h: Revert.
* filename-seen-cache.c: Revert.
* fbsd-tdep.c: Revert.
* fbsd-nat.h: Revert.
* fbsd-nat.c: Revert.
* f-valprint.c: Revert.
* f-typeprint.c: Revert.
* f-lang.c: Revert.
* extension.h: Revert.
* extension.c: Revert.
* extension-priv.h: Revert.
* expprint.c: Revert.
* exec.h: Revert.
* exec.c: Revert.
* exceptions.c: Revert.
* event-top.c: Revert.
* event-loop.c: Revert.
* eval.c: Revert.
* elfread.c: Revert.
* dwarf2read.h: Revert.
* dwarf2read.c: Revert.
* dwarf2loc.c: Revert.
* dwarf2expr.h: Revert.
* dwarf2expr.c: Revert.
* dwarf2-frame.c: Revert.
* dwarf2-frame-tailcall.c: Revert.
* dwarf-index-write.h: Revert.
* dwarf-index-write.c: Revert.
* dwarf-index-common.c: Revert.
* dwarf-index-cache.h: Revert.
* dwarf-index-cache.c: Revert.
* dummy-frame.c: Revert.
* dtrace-probe.c: Revert.
* disasm.h: Revert.
* disasm.c: Revert.
* disasm-selftests.c: Revert.
* dictionary.c: Revert.
* dicos-tdep.c: Revert.
* demangle.c: Revert.
* dcache.h: Revert.
* dcache.c: Revert.
* darwin-nat.h: Revert.
* darwin-nat.c: Revert.
* darwin-nat-info.c: Revert.
* d-valprint.c: Revert.
* d-namespace.c: Revert.
* d-lang.c: Revert.
* ctf.c: Revert.
* csky-tdep.c: Revert.
* csky-linux-tdep.c: Revert.
* cris-tdep.c: Revert.
* cris-linux-tdep.c: Revert.
* cp-valprint.c: Revert.
* cp-support.c: Revert.
* cp-namespace.c: Revert.
* cp-abi.c: Revert.
* corelow.c: Revert.
* corefile.c: Revert.
* continuations.c: Revert.
* completer.h: Revert.
* completer.c: Revert.
* complaints.c: Revert.
* coffread.c: Revert.
* coff-pe-read.c: Revert.
* cli-out.h: Revert.
* cli-out.c: Revert.
* charset.c: Revert.
* c-varobj.c: Revert.
* c-valprint.c: Revert.
* c-typeprint.c: Revert.
* c-lang.c: Revert.
* buildsym.c: Revert.
* buildsym-legacy.c: Revert.
* build-id.h: Revert.
* build-id.c: Revert.
* btrace.c: Revert.
* bsd-uthread.c: Revert.
* breakpoint.h: Revert.
* breakpoint.c: Revert.
* break-catch-throw.c: Revert.
* break-catch-syscall.c: Revert.
* break-catch-sig.c: Revert.
* blockframe.c: Revert.
* block.c: Revert.
* bfin-tdep.c: Revert.
* bfin-linux-tdep.c: Revert.
* bfd-target.c: Revert.
* bcache.c: Revert.
* ax-general.c: Revert.
* ax-gdb.h: Revert.
* ax-gdb.c: Revert.
* avr-tdep.c: Revert.
* auxv.c: Revert.
* auto-load.c: Revert.
* arm-wince-tdep.c: Revert.
* arm-tdep.c: Revert.
* arm-symbian-tdep.c: Revert.
* arm-pikeos-tdep.c: Revert.
* arm-obsd-tdep.c: Revert.
* arm-nbsd-tdep.c: Revert.
* arm-nbsd-nat.c: Revert.
* arm-linux-tdep.c: Revert.
* arm-linux-nat.c: Revert.
* arm-fbsd-tdep.c: Revert.
* arm-fbsd-nat.c: Revert.
* arm-bsd-tdep.c: Revert.
* arch-utils.c: Revert.
* arc-tdep.c: Revert.
* arc-newlib-tdep.c: Revert.
* annotate.h: Revert.
* annotate.c: Revert.
* amd64-windows-tdep.c: Revert.
* amd64-windows-nat.c: Revert.
* amd64-tdep.c: Revert.
* amd64-sol2-tdep.c: Revert.
* amd64-obsd-tdep.c: Revert.
* amd64-obsd-nat.c: Revert.
* amd64-nbsd-tdep.c: Revert.
* amd64-nbsd-nat.c: Revert.
* amd64-nat.c: Revert.
* amd64-linux-tdep.c: Revert.
* amd64-linux-nat.c: Revert.
* amd64-fbsd-tdep.c: Revert.
* amd64-fbsd-nat.c: Revert.
* amd64-dicos-tdep.c: Revert.
* amd64-darwin-tdep.c: Revert.
* amd64-bsd-nat.c: Revert.
* alpha-tdep.c: Revert.
* alpha-obsd-tdep.c: Revert.
* alpha-nbsd-tdep.c: Revert.
* alpha-mdebug-tdep.c: Revert.
* alpha-linux-tdep.c: Revert.
* alpha-linux-nat.c: Revert.
* alpha-bsd-tdep.c: Revert.
* alpha-bsd-nat.c: Revert.
* aix-thread.c: Revert.
* agent.c: Revert.
* addrmap.c: Revert.
* ada-varobj.c: Revert.
* ada-valprint.c: Revert.
* ada-typeprint.c: Revert.
* ada-tasks.c: Revert.
* ada-lang.c: Revert.
* aarch64-tdep.c: Revert.
* aarch64-ravenscar-thread.c: Revert.
* aarch64-newlib-tdep.c: Revert.
* aarch64-linux-tdep.c: Revert.
* aarch64-linux-nat.c: Revert.
* aarch64-fbsd-tdep.c: Revert.
* aarch64-fbsd-nat.c: Revert.
* aarch32-linux-nat.c: Revert.
|
|
This patch sorts the include files for the files [a-f]*.[chyl].
The patch was written by a script.
Tested by the buildbot.
I will follow up with patches to sort the remaining files, by sorting
a subset, testing them, and then checking them in.
gdb/ChangeLog
2019-04-05 Tom Tromey <tom@tromey.com>
* ft32-tdep.c: Sort headers.
* frv-tdep.c: Sort headers.
* frv-linux-tdep.c: Sort headers.
* frame.c: Sort headers.
* frame-unwind.c: Sort headers.
* frame-base.c: Sort headers.
* fork-child.c: Sort headers.
* findvar.c: Sort headers.
* findcmd.c: Sort headers.
* filesystem.c: Sort headers.
* filename-seen-cache.h: Sort headers.
* filename-seen-cache.c: Sort headers.
* fbsd-tdep.c: Sort headers.
* fbsd-nat.h: Sort headers.
* fbsd-nat.c: Sort headers.
* f-valprint.c: Sort headers.
* f-typeprint.c: Sort headers.
* f-lang.c: Sort headers.
* extension.h: Sort headers.
* extension.c: Sort headers.
* extension-priv.h: Sort headers.
* expprint.c: Sort headers.
* exec.h: Sort headers.
* exec.c: Sort headers.
* exceptions.c: Sort headers.
* event-top.c: Sort headers.
* event-loop.c: Sort headers.
* eval.c: Sort headers.
* elfread.c: Sort headers.
* dwarf2read.h: Sort headers.
* dwarf2read.c: Sort headers.
* dwarf2loc.c: Sort headers.
* dwarf2expr.h: Sort headers.
* dwarf2expr.c: Sort headers.
* dwarf2-frame.c: Sort headers.
* dwarf2-frame-tailcall.c: Sort headers.
* dwarf-index-write.h: Sort headers.
* dwarf-index-write.c: Sort headers.
* dwarf-index-common.c: Sort headers.
* dwarf-index-cache.h: Sort headers.
* dwarf-index-cache.c: Sort headers.
* dummy-frame.c: Sort headers.
* dtrace-probe.c: Sort headers.
* disasm.h: Sort headers.
* disasm.c: Sort headers.
* disasm-selftests.c: Sort headers.
* dictionary.c: Sort headers.
* dicos-tdep.c: Sort headers.
* demangle.c: Sort headers.
* dcache.h: Sort headers.
* dcache.c: Sort headers.
* darwin-nat.h: Sort headers.
* darwin-nat.c: Sort headers.
* darwin-nat-info.c: Sort headers.
* d-valprint.c: Sort headers.
* d-namespace.c: Sort headers.
* d-lang.c: Sort headers.
* ctf.c: Sort headers.
* csky-tdep.c: Sort headers.
* csky-linux-tdep.c: Sort headers.
* cris-tdep.c: Sort headers.
* cris-linux-tdep.c: Sort headers.
* cp-valprint.c: Sort headers.
* cp-support.c: Sort headers.
* cp-namespace.c: Sort headers.
* cp-abi.c: Sort headers.
* corelow.c: Sort headers.
* corefile.c: Sort headers.
* continuations.c: Sort headers.
* completer.h: Sort headers.
* completer.c: Sort headers.
* complaints.c: Sort headers.
* coffread.c: Sort headers.
* coff-pe-read.c: Sort headers.
* cli-out.h: Sort headers.
* cli-out.c: Sort headers.
* charset.c: Sort headers.
* c-varobj.c: Sort headers.
* c-valprint.c: Sort headers.
* c-typeprint.c: Sort headers.
* c-lang.c: Sort headers.
* buildsym.c: Sort headers.
* buildsym-legacy.c: Sort headers.
* build-id.h: Sort headers.
* build-id.c: Sort headers.
* btrace.c: Sort headers.
* bsd-uthread.c: Sort headers.
* breakpoint.h: Sort headers.
* breakpoint.c: Sort headers.
* break-catch-throw.c: Sort headers.
* break-catch-syscall.c: Sort headers.
* break-catch-sig.c: Sort headers.
* blockframe.c: Sort headers.
* block.c: Sort headers.
* bfin-tdep.c: Sort headers.
* bfin-linux-tdep.c: Sort headers.
* bfd-target.c: Sort headers.
* bcache.c: Sort headers.
* ax-general.c: Sort headers.
* ax-gdb.h: Sort headers.
* ax-gdb.c: Sort headers.
* avr-tdep.c: Sort headers.
* auxv.c: Sort headers.
* auto-load.c: Sort headers.
* arm-wince-tdep.c: Sort headers.
* arm-tdep.c: Sort headers.
* arm-symbian-tdep.c: Sort headers.
* arm-pikeos-tdep.c: Sort headers.
* arm-obsd-tdep.c: Sort headers.
* arm-nbsd-tdep.c: Sort headers.
* arm-nbsd-nat.c: Sort headers.
* arm-linux-tdep.c: Sort headers.
* arm-linux-nat.c: Sort headers.
* arm-fbsd-tdep.c: Sort headers.
* arm-fbsd-nat.c: Sort headers.
* arm-bsd-tdep.c: Sort headers.
* arch-utils.c: Sort headers.
* arc-tdep.c: Sort headers.
* arc-newlib-tdep.c: Sort headers.
* annotate.h: Sort headers.
* annotate.c: Sort headers.
* amd64-windows-tdep.c: Sort headers.
* amd64-windows-nat.c: Sort headers.
* amd64-tdep.c: Sort headers.
* amd64-sol2-tdep.c: Sort headers.
* amd64-obsd-tdep.c: Sort headers.
* amd64-obsd-nat.c: Sort headers.
* amd64-nbsd-tdep.c: Sort headers.
* amd64-nbsd-nat.c: Sort headers.
* amd64-nat.c: Sort headers.
* amd64-linux-tdep.c: Sort headers.
* amd64-linux-nat.c: Sort headers.
* amd64-fbsd-tdep.c: Sort headers.
* amd64-fbsd-nat.c: Sort headers.
* amd64-dicos-tdep.c: Sort headers.
* amd64-darwin-tdep.c: Sort headers.
* amd64-bsd-nat.c: Sort headers.
* alpha-tdep.c: Sort headers.
* alpha-obsd-tdep.c: Sort headers.
* alpha-nbsd-tdep.c: Sort headers.
* alpha-mdebug-tdep.c: Sort headers.
* alpha-linux-tdep.c: Sort headers.
* alpha-linux-nat.c: Sort headers.
* alpha-bsd-tdep.c: Sort headers.
* alpha-bsd-nat.c: Sort headers.
* aix-thread.c: Sort headers.
* agent.c: Sort headers.
* addrmap.c: Sort headers.
* ada-varobj.c: Sort headers.
* ada-valprint.c: Sort headers.
* ada-typeprint.c: Sort headers.
* ada-tasks.c: Sort headers.
* ada-lang.c: Sort headers.
* aarch64-tdep.c: Sort headers.
* aarch64-ravenscar-thread.c: Sort headers.
* aarch64-newlib-tdep.c: Sort headers.
* aarch64-linux-tdep.c: Sort headers.
* aarch64-linux-nat.c: Sort headers.
* aarch64-fbsd-tdep.c: Sort headers.
* aarch64-fbsd-nat.c: Sort headers.
* aarch32-linux-nat.c: Sort headers.
|
|
Philippe noticed a memory leak coming from ada_catchpoint_location --
it was not freeing the "function_name" member from its base class:
==14141== 114 bytes in 4 blocks are definitely lost in loss record 1,055 of 3,424
==14141== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==14141== by 0x405107: xmalloc (common-utils.c:44)
==14141== by 0x7563F9: xstrdup (xstrdup.c:34)
==14141== by 0x3B82B3: set_breakpoint_location_function(bp_location*, int) (breakpoint.c:7156)
==14141== by 0x3C112B: add_location_to_breakpoint(breakpoint*, symtab_and_line const*) (breakpoint.c:8609)
==14141== by 0x3C127A: init_raw_breakpoint(breakpoint*, gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (breakpoint.c:7187)
==14141== by 0x3C1B52: init_ada_exception_breakpoint(breakpoint*, gdbarch*, symtab_and_line, char const*, breakpoint_ops const*, int, int, int) (breakpoint.c:11262)
==14141== by 0x381C2E: create_ada_exception_catchpoint(gdbarch*, ada_exception_catchpoint_kind, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, int) (ada-lang.c:13255)
This patch fixes the problem by further C++-ifying bp_location. In
particular, bp_location_ops is now removed, and the "dtor" function
pointer is replaced with an ordinary destructor.
gdb/ChangeLog
2019-02-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
Tom Tromey <tromey@adacore.com>
* breakpoint.c (~bp_location): Rename from bp_location_dtor.
(bp_location_ops): Remove.
(base_breakpoint_allocate_location): Update.
(free_bp_location): Update.
* ada-lang.c (class ada_catchpoint_location)
<ada_catchpoint_location>: Remove ops parameter.
(ada_catchpoint_location_dtor): Remove.
(ada_catchpoint_location_ops): Remove.
(allocate_location_exception): Update.
* breakpoint.h (struct bp_location_ops): Remove.
(class bp_location) <bp_location>: Remove bp_location_ops
parameter.
<~bp_location>: Add destructor.
<ops>: Remove.
|
|
This changes all includes to use the form "common/filename.h" rather
than just "filename.h". This was written by a script.
gdb/ChangeLog
2019-01-25 Tom Tromey <tom@tromey.com>
* xtensa-linux-nat.c: Fix common/ includes.
* xml-support.h: Fix common/ includes.
* xml-support.c: Fix common/ includes.
* x86-linux-nat.c: Fix common/ includes.
* windows-nat.c: Fix common/ includes.
* varobj.h: Fix common/ includes.
* varobj.c: Fix common/ includes.
* value.c: Fix common/ includes.
* valops.c: Fix common/ includes.
* utils.c: Fix common/ includes.
* unittests/xml-utils-selftests.c: Fix common/ includes.
* unittests/utils-selftests.c: Fix common/ includes.
* unittests/unpack-selftests.c: Fix common/ includes.
* unittests/tracepoint-selftests.c: Fix common/ includes.
* unittests/style-selftests.c: Fix common/ includes.
* unittests/string_view-selftests.c: Fix common/ includes.
* unittests/scoped_restore-selftests.c: Fix common/ includes.
* unittests/scoped_mmap-selftests.c: Fix common/ includes.
* unittests/scoped_fd-selftests.c: Fix common/ includes.
* unittests/rsp-low-selftests.c: Fix common/ includes.
* unittests/parse-connection-spec-selftests.c: Fix common/
includes.
* unittests/optional-selftests.c: Fix common/ includes.
* unittests/offset-type-selftests.c: Fix common/ includes.
* unittests/observable-selftests.c: Fix common/ includes.
* unittests/mkdir-recursive-selftests.c: Fix common/ includes.
* unittests/memrange-selftests.c: Fix common/ includes.
* unittests/memory-map-selftests.c: Fix common/ includes.
* unittests/lookup_name_info-selftests.c: Fix common/ includes.
* unittests/function-view-selftests.c: Fix common/ includes.
* unittests/environ-selftests.c: Fix common/ includes.
* unittests/copy_bitwise-selftests.c: Fix common/ includes.
* unittests/common-utils-selftests.c: Fix common/ includes.
* unittests/cli-utils-selftests.c: Fix common/ includes.
* unittests/array-view-selftests.c: Fix common/ includes.
* ui-file.c: Fix common/ includes.
* tui/tui-io.c: Fix common/ includes.
* tracepoint.h: Fix common/ includes.
* tracepoint.c: Fix common/ includes.
* tracefile-tfile.c: Fix common/ includes.
* top.h: Fix common/ includes.
* top.c: Fix common/ includes.
* thread.c: Fix common/ includes.
* target/waitstatus.h: Fix common/ includes.
* target/waitstatus.c: Fix common/ includes.
* target.h: Fix common/ includes.
* target.c: Fix common/ includes.
* target-memory.c: Fix common/ includes.
* target-descriptions.c: Fix common/ includes.
* symtab.h: Fix common/ includes.
* symfile.c: Fix common/ includes.
* stap-probe.c: Fix common/ includes.
* spu-linux-nat.c: Fix common/ includes.
* sparc-nat.c: Fix common/ includes.
* source.c: Fix common/ includes.
* solib.c: Fix common/ includes.
* solib-target.c: Fix common/ includes.
* ser-unix.c: Fix common/ includes.
* ser-tcp.c: Fix common/ includes.
* ser-pipe.c: Fix common/ includes.
* ser-base.c: Fix common/ includes.
* selftest-arch.c: Fix common/ includes.
* s12z-tdep.c: Fix common/ includes.
* rust-exp.y: Fix common/ includes.
* rs6000-aix-tdep.c: Fix common/ includes.
* riscv-tdep.c: Fix common/ includes.
* remote.c: Fix common/ includes.
* remote-notif.h: Fix common/ includes.
* remote-fileio.h: Fix common/ includes.
* remote-fileio.c: Fix common/ includes.
* regcache.h: Fix common/ includes.
* regcache.c: Fix common/ includes.
* record-btrace.c: Fix common/ includes.
* python/python.c: Fix common/ includes.
* python/py-type.c: Fix common/ includes.
* python/py-inferior.c: Fix common/ includes.
* progspace.h: Fix common/ includes.
* producer.c: Fix common/ includes.
* procfs.c: Fix common/ includes.
* proc-api.c: Fix common/ includes.
* printcmd.c: Fix common/ includes.
* ppc-linux-nat.c: Fix common/ includes.
* parser-defs.h: Fix common/ includes.
* osdata.c: Fix common/ includes.
* obsd-nat.c: Fix common/ includes.
* nat/x86-linux.c: Fix common/ includes.
* nat/x86-linux-dregs.c: Fix common/ includes.
* nat/x86-dregs.h: Fix common/ includes.
* nat/x86-dregs.c: Fix common/ includes.
* nat/ppc-linux.c: Fix common/ includes.
* nat/mips-linux-watch.h: Fix common/ includes.
* nat/mips-linux-watch.c: Fix common/ includes.
* nat/linux-waitpid.c: Fix common/ includes.
* nat/linux-ptrace.h: Fix common/ includes.
* nat/linux-ptrace.c: Fix common/ includes.
* nat/linux-procfs.c: Fix common/ includes.
* nat/linux-personality.c: Fix common/ includes.
* nat/linux-osdata.c: Fix common/ includes.
* nat/linux-namespaces.c: Fix common/ includes.
* nat/linux-btrace.h: Fix common/ includes.
* nat/linux-btrace.c: Fix common/ includes.
* nat/fork-inferior.c: Fix common/ includes.
* nat/amd64-linux-siginfo.c: Fix common/ includes.
* nat/aarch64-sve-linux-ptrace.c: Fix common/ includes.
* nat/aarch64-linux.c: Fix common/ includes.
* nat/aarch64-linux-hw-point.h: Fix common/ includes.
* nat/aarch64-linux-hw-point.c: Fix common/ includes.
* namespace.h: Fix common/ includes.
* mips-linux-tdep.c: Fix common/ includes.
* minsyms.c: Fix common/ includes.
* mi/mi-parse.h: Fix common/ includes.
* mi/mi-main.c: Fix common/ includes.
* mi/mi-cmd-env.c: Fix common/ includes.
* memrange.h: Fix common/ includes.
* memattr.c: Fix common/ includes.
* maint.h: Fix common/ includes.
* maint.c: Fix common/ includes.
* main.c: Fix common/ includes.
* machoread.c: Fix common/ includes.
* location.c: Fix common/ includes.
* linux-thread-db.c: Fix common/ includes.
* linux-nat.c: Fix common/ includes.
* linux-fork.c: Fix common/ includes.
* inline-frame.c: Fix common/ includes.
* infrun.c: Fix common/ includes.
* inflow.c: Fix common/ includes.
* inferior.h: Fix common/ includes.
* inferior.c: Fix common/ includes.
* infcmd.c: Fix common/ includes.
* inf-ptrace.c: Fix common/ includes.
* inf-child.c: Fix common/ includes.
* ia64-linux-nat.c: Fix common/ includes.
* i387-tdep.c: Fix common/ includes.
* i386-tdep.c: Fix common/ includes.
* i386-linux-tdep.c: Fix common/ includes.
* i386-linux-nat.c: Fix common/ includes.
* i386-go32-tdep.c: Fix common/ includes.
* i386-fbsd-tdep.c: Fix common/ includes.
* i386-fbsd-nat.c: Fix common/ includes.
* guile/scm-type.c: Fix common/ includes.
* guile/guile.c: Fix common/ includes.
* go32-nat.c: Fix common/ includes.
* gnu-nat.c: Fix common/ includes.
* gdbthread.h: Fix common/ includes.
* gdbarch-selftests.c: Fix common/ includes.
* gdb_usleep.c: Fix common/ includes.
* gdb_select.h: Fix common/ includes.
* gdb_bfd.c: Fix common/ includes.
* gcore.c: Fix common/ includes.
* fork-child.c: Fix common/ includes.
* findvar.c: Fix common/ includes.
* fbsd-nat.c: Fix common/ includes.
* event-top.c: Fix common/ includes.
* event-loop.c: Fix common/ includes.
* dwarf2read.c: Fix common/ includes.
* dwarf2loc.c: Fix common/ includes.
* dwarf2-frame.c: Fix common/ includes.
* dwarf-index-cache.c: Fix common/ includes.
* dtrace-probe.c: Fix common/ includes.
* disasm-selftests.c: Fix common/ includes.
* defs.h: Fix common/ includes.
* csky-tdep.c: Fix common/ includes.
* cp-valprint.c: Fix common/ includes.
* cp-support.h: Fix common/ includes.
* cp-support.c: Fix common/ includes.
* corelow.c: Fix common/ includes.
* completer.h: Fix common/ includes.
* completer.c: Fix common/ includes.
* compile/compile.c: Fix common/ includes.
* compile/compile-loc2c.c: Fix common/ includes.
* compile/compile-cplus-types.c: Fix common/ includes.
* compile/compile-cplus-symbols.c: Fix common/ includes.
* command.h: Fix common/ includes.
* cli/cli-dump.c: Fix common/ includes.
* cli/cli-cmds.c: Fix common/ includes.
* charset.c: Fix common/ includes.
* build-id.c: Fix common/ includes.
* btrace.h: Fix common/ includes.
* btrace.c: Fix common/ includes.
* breakpoint.h: Fix common/ includes.
* breakpoint.c: Fix common/ includes.
* ax.h:
(enum agent_op): Fix common/ includes.
* ax-general.c (struct aop_map): Fix common/ includes.
* ax-gdb.c: Fix common/ includes.
* auxv.c: Fix common/ includes.
* auto-load.c: Fix common/ includes.
* arm-tdep.c: Fix common/ includes.
* arch/riscv.c: Fix common/ includes.
* arch/ppc-linux-common.c: Fix common/ includes.
* arch/i386.c: Fix common/ includes.
* arch/arm.c: Fix common/ includes.
* arch/arm-linux.c: Fix common/ includes.
* arch/arm-get-next-pcs.c: Fix common/ includes.
* arch/amd64.c: Fix common/ includes.
* arch/aarch64.c: Fix common/ includes.
* arch/aarch64-insn.c: Fix common/ includes.
* arch-utils.c: Fix common/ includes.
* amd64-windows-tdep.c: Fix common/ includes.
* amd64-tdep.c: Fix common/ includes.
* amd64-sol2-tdep.c: Fix common/ includes.
* amd64-obsd-tdep.c: Fix common/ includes.
* amd64-nbsd-tdep.c: Fix common/ includes.
* amd64-linux-tdep.c: Fix common/ includes.
* amd64-linux-nat.c: Fix common/ includes.
* amd64-fbsd-tdep.c: Fix common/ includes.
* amd64-fbsd-nat.c: Fix common/ includes.
* amd64-dicos-tdep.c: Fix common/ includes.
* amd64-darwin-tdep.c: Fix common/ includes.
* agent.c: Fix common/ includes.
* ada-lang.h: Fix common/ includes.
* ada-lang.c: Fix common/ includes.
* aarch64-tdep.c: Fix common/ includes.
gdb/gdbserver/ChangeLog
2019-01-25 Tom Tromey <tom@tromey.com>
* win32-low.c: Fix common/ includes.
* win32-i386-low.c: Fix common/ includes.
* tracepoint.c: Fix common/ includes.
* thread-db.c: Fix common/ includes.
* target.h: Fix common/ includes.
* symbol.c: Fix common/ includes.
* spu-low.c: Fix common/ includes.
* server.h: Fix common/ includes.
* server.c: Fix common/ includes.
* remote-utils.c: Fix common/ includes.
* regcache.h: Fix common/ includes.
* regcache.c: Fix common/ includes.
* nto-x86-low.c: Fix common/ includes.
* notif.h: Fix common/ includes.
* mem-break.h: Fix common/ includes.
* lynx-low.c: Fix common/ includes.
* lynx-i386-low.c: Fix common/ includes.
* linux-x86-tdesc-selftest.c: Fix common/ includes.
* linux-x86-low.c: Fix common/ includes.
* linux-low.c: Fix common/ includes.
* inferiors.h: Fix common/ includes.
* i387-fp.c: Fix common/ includes.
* hostio.c: Fix common/ includes.
* hostio-errno.c: Fix common/ includes.
* gdbthread.h: Fix common/ includes.
* gdbreplay.c: Fix common/ includes.
* fork-child.c: Fix common/ includes.
* event-loop.c: Fix common/ includes.
* ax.c:
(enum gdb_agent_op): Fix common/ includes.
|
|
This commit applies all changes made after running the gdb/copyright.py
script.
Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.
gdb/ChangeLog:
Update copyright year range in all GDB files.
|
|
Since commit
56bcdbea2bed ("Let gdb.execute handle multi-line commands")
trying to use a command like gdb.execute("show commands") in Python
fails. GDB ends up trying to run the "commands" command.
The reason is that GDB gets confused with the special "commands"
command. In process_next_line, the lookup_cmd_1 function returns the
cmd_list_element representing the "commands" sub-command of "show".
Lower, we check the cmd_list_element to see if it matches various
control commands by name, including the "commands" command. This is
where we wrongfully conclude that the executed command must be
"commands", when in reality it was "show commands".
The fix proposed in this patch removes the comparisons by name, instead
comparing the cmd_list_element object by pointer with the objects
created at initialization time.
Tested on the buildbot, though on a single builder (Fedora-x86_64-m64).
gdb/ChangeLog:
PR python/23669
* breakpoint.c (commands_cmd_element): New.
(_initialize_breakpoint): Assign commands_cmd_element.
* breakpoint.h (commands_cmd_element): New.
* cli/cli-script.c (while_cmd_element, if_command,
define_cmd_element): New.
(command_name_equals): Remove.
(process_next_line): Compare commands by pointer, not by name.
(_initialize_cli_script): Assign the various cmd_list_element
variables.
* compile/compile.c (compile_cmd_element): New.
(_initialize_compile): Assign compile_cmd_element.
* compile/compile.h (compile_cmd_element): New.
* guile/guile.c (guile_cmd_element): New.
(install_gdb_commands): Assign guile_cmd_element.
* guile/guile.h (guile_cmd_element): New.
* python/python.c (python_cmd_element): New.
(_initialize_python): Assign python_cmd_element.
* python/python.h (python_cmd_element): New.
* tracepoint.c (while_stepping_cmd_element): New.
(_initialize_tracepoint): Assign while_stepping_cmd_element.
* tracepoint.h (while_stepping_cmd_element): New.
gdb/testsuite/ChangeLog:
PR python/23669
* gdb.python/python.exp: Test gdb.execute("show commands").
|
|
This changes moribund_locations to use a std::vector rather than VEC.
I also noticed that moribund_locations is only used in breakpoint.c,
so now it is static as well.
It might be possible to make this code a bit simpler by using a
ref_ptr in moribund_locations; however, I have not done this.
Tested by the buildbot.
gdb/ChangeLog
2018-07-10 Tom Tromey <tom@tromey.com>
* breakpoint.c (moribund_locations): Now static and a
std::vector.
(breakpoint_init_inferior, moribund_breakpoint_here_p)
(build_bpstat_chain, update_global_location_list)
(breakpoint_retire_moribund): Update.
* breakpoint.h (bp_location_p): Remove typedef. Don't declare
VEC.
|
|
This removes a use of VEC from breakpoint.h, also removing the
now-unnecessary breakpoint_p typedef.
This patch fixes a latent memory leak in
find_matching_tracepoint_location, which neglected to free the vector
returned by all_tracepoints.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* tracepoint.c (process_tracepoint_on_disconnect, start_tracing)
(stop_tracing, tstatus_command)
(find_matching_tracepoint_location, merge_uploaded_tracepoints)
(print_one_static_tracepoint_marker): Update.
* breakpoint.c (static_tracepoints_here, all_tracepoints): Return
std::vector.
* breakpoint.h (breakpoint_p): Remove typedef. Don't declare
VEC.
(all_tracepoints, static_tracepoints_here): Return std::vector.
|
|
This is more preparation bits for multi-target support.
In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID. E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines. Or maybe we've loaded multiple
instances of the same core file. Etc.
To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively. I.e.,
each process_stratum instance has its own thread/process number space.
As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int. E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.
In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid. Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.
So that's what this patch does. In a bit more detail:
- Changes a number of functions and methods to take a thread_info or
inferior pointer instead of a ptid_t or int parameter.
- Changes a number of structure fields from ptid_t/int to inferior or
thread_info pointers.
- Uses the inferior_thread() function whenever possible instead of
inferior_ptid.
- Uses thread_info pointers directly when possible instead of the
is_running/is_stopped etc. routines that require a lookup.
- A number of functions are eliminated along the way, such as:
int valid_gdb_inferior_id (int num);
int pid_to_gdb_inferior_id (int pid);
int gdb_inferior_id_to_pid (int num);
int in_inferior_list (int pid);
- A few structures and places hold a thread_info pointer across
inferior execution, so now they take a strong reference to the
(refcounted) thread_info object to avoid the thread_info pointer
getting stale. This is done in enable_thread_stack_temporaries and
in the infcall.c code.
- Related, there's a spot in infcall.c where using a RAII object to
handle the refcount would be handy, so a gdb::ref_ptr specialization
for thread_info is added (thread_info_ref, in gdbthread.h), along
with a gdb_ref_ptr policy that works for all refcounted_object types
(in common/refcounted-object.h).
gdb/ChangeLog:
2018-06-21 Pedro Alves <palves@redhat.com>
* ada-lang.h (ada_get_task_number): Take a thread_info pointer
instead of a ptid_t. All callers adjusted.
* ada-tasks.c (ada_get_task_number): Likewise. All callers
adjusted.
(print_ada_task_info, display_current_task_id, task_command_1):
Adjust.
* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
inferior_thread.
(breakpoint_kind): Adjust.
(remove_breakpoints_pid): Rename to ...
(remove_breakpoints_inf): ... this. Adjust to take an inferior
pointer. All callers adjusted.
(bpstat_clear_actions): Use inferior_thread.
(get_bpstat_thread): New.
(bpstat_do_actions): Use it.
(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
to take a thread_info pointer. All callers adjusted.
(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
(breakpoint_re_set_thread): Use inferior_thread.
* breakpoint.h (struct inferior): Forward declare.
(bpstat_stop_status): Update.
(remove_breakpoints_pid): Delete.
(remove_breakpoints_inf): New.
* bsd-uthread.c (bsd_uthread_target::wait)
(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd): Adjust.
(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
inferior_thread.
* cli/cli-interp.c: Include "inferior.h".
* common/refcounted-object.h (struct
refcounted_object_ref_policy): New.
* compile/compile-object-load.c: Include gdbthread.h.
(store_regs): Use inferior_thread.
* corelow.c (core_target::close): Use current_inferior.
(core_target_open): Adjust to use first_thread_of_inferior and use
the current inferior.
* ctf.c (ctf_target::close): Adjust to use current_inferior.
* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
Take a thread_info pointer instead of a ptid_t.
* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
(dummy_frame_discard, register_dummy_frame_dtor): Take a
thread_info pointer instead of a ptid_t.
* elfread.c: Include "inferior.h".
(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
Use inferior_thread.
* eval.c (evaluate_subexp): Likewise.
* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
inferior_thread.
* gdb_proc_service.h (struct thread_info): Forward declare.
(struct ps_prochandle) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
'thread' parameter. All implementations and callers adjusted.
* gdbthread.h (thread_info) <set_running>: New method.
(delete_thread, delete_thread_silent): Take a thread_info pointer
instead of a ptid.
(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_live_thread_of_process): Delete, replaced by ...
(any_live_thread_of_inferior): ... this new function. All callers
adjusted.
(switch_to_thread, switch_to_no_thread): Declare.
(is_executing): Delete.
(enable_thread_stack_temporaries): Update comment.
<enable_thread_stack_temporaries>: Take a thread_info pointer
instead of a ptid_t. Incref the thread.
<~enable_thread_stack_temporaries>: Decref the thread.
<m_ptid>: Delete
<m_thr>: New.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Take a thread_info pointer instead of a ptid_t. All callers
adjusted.
* infcall.c (get_call_return_value): Use inferior_thread.
(run_inferior_call): Work with thread pointers instead of ptid_t.
(call_function_by_hand_dummy): Work with thread pointers instead
of ptid_t. Use thread_info_ref.
* infcmd.c (proceed_thread_callback): Access thread's state
directly.
(ensure_valid_thread, ensure_not_running): Use inferior_thread,
access thread's state directly.
(continue_command): Use inferior_thread.
(info_program_command): Use find_thread_ptid and access thread
state directly.
(proceed_after_attach_callback): Use thread state directly.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(exit_inferior): Take an inferior pointer instead of a pid. All
callers adjusted.
(exit_inferior_silent): New.
(detach_inferior): Delete.
(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
(gdb_inferior_id_to_pid, in_inferior_list): Delete.
(detach_inferior_command, kill_inferior_command): Use
find_inferior_id instead of valid_gdb_inferior_id and
gdb_inferior_id_to_pid.
(inferior_command): Use inferior and thread pointers.
* inferior.h (struct thread_info): Forward declare.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(detach_inferior): Delete declaration.
(exit_inferior, exit_inferior_silent): Take an inferior pointer
instead of a pid. All callers adjusted.
(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
(valid_gdb_inferior_id): Delete.
* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
(struct displaced_step_inferior_state) <pid>: Delete, replaced by
...
<inf>: ... this new field.
<step_ptid>: Delete, replaced by ...
<step_thread>: ... this new field.
(get_displaced_stepping_state): Take an inferior pointer instead
of a pid. All callers adjusted.
(displaced_step_in_progress_any_inferior): Adjust.
(displaced_step_in_progress_thread): Take a thread pointer instead
of a ptid_t. All callers adjusted.
(displaced_step_in_progress, add_displaced_stepping_state): Take
an inferior pointer instead of a pid. All callers adjusted.
(get_displaced_step_closure_by_addr): Adjust.
(remove_displaced_stepping_state): Take an inferior pointer
instead of a pid. All callers adjusted.
(displaced_step_prepare_throw, displaced_step_prepare)
(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
All callers adjusted.
(start_step_over): Adjust.
(infrun_thread_ptid_changed): Remove bit updating ptids in the
displaced step queue.
(do_target_resume): Adjust.
(fetch_inferior_event): Use inferior_thread.
(context_switch, get_inferior_stop_soon): Take an
execution_control_state pointer instead of a ptid_t. All callers
adjusted.
(switch_to_thread_cleanup): Delete.
(stop_all_threads): Use scoped_restore_current_thread.
* inline-frame.c: Include "gdbthread.h".
(inline_state) <inline_state>: Take a thread pointer instead of a
ptid_t. All callers adjusted.
<ptid>: Delete, replaced by ...
<thread>: ... this new field.
(find_inline_frame_state): Take a thread pointer instead of a
ptid_t. All callers adjusted.
(skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Take a thread
pointer instead of a ptid_t. All callers adjusted.
* inline-frame.h (skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Likewise.
* linux-fork.c (delete_checkpoint_command): Adjust to use thread
pointers directly.
* linux-nat.c (get_detach_signal): Likewise.
* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
(thread_db_notice_clone): Adjust.
(thread_db_find_new_threads_silently)
(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
a thread pointer instead of a ptid_t. All callers adjusted.
* mi/mi-cmd-var.c: Include "inferior.h".
(mi_cmd_var_update_iter): Update to use thread pointers.
* mi/mi-interp.c (mi_new_thread): Update to use the thread's
inferior directly.
(mi_output_running_pid, mi_inferior_count): Delete, bits factored
out to ...
(mi_output_running): ... this new function.
(mi_on_resume_1): Adjust to use it.
(mi_user_selected_context_changed): Adjust to use inferior_thread.
* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
directly.
(interrupt_thread_callback): : Adjust to use thread and inferior
pointers.
* proc-service.c: Include "gdbthread.h".
(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
* progspace-and-thread.c: Include "inferior.h".
* progspace.c: Include "inferior.h".
* python/py-exitedevent.c (create_exited_event_object): Adjust to
hold a reference to an inferior_object.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
inferior_thread.
* python/py-inferior.c (struct inferior_object): Give the type a
tag name instead of a typedef.
(python_on_normal_stop): No need to check if the current thread is
listed.
(inferior_to_inferior_object): Change return type to
inferior_object. All callers adjusted.
(find_thread_object): Delete, bits factored out to ...
(thread_to_thread_object): ... this new function.
* python/py-infthread.c (create_thread_object): Use
inferior_to_inferior_object.
(thpy_is_stopped): Use thread pointer directly.
(gdbpy_selected_thread): Use inferior_thread.
* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(btpy_insn_or_gap_new): Drop const.
(btpy_list_new): Take a thread pointer instead of a ptid_t. All
callers adjusted.
* python/py-record.c: Include "gdbthread.h".
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
(gdbpy_current_recording): Use inferior_thread.
* python/py-record.h (recpy_record_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_element_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
* python/py-threadevent.c: Include "gdbthread.h".
(get_event_thread): Use thread_to_thread_object.
* python/python-internal.h (struct inferior_object): Forward
declare.
(find_thread_object, find_inferior_object): Delete declarations.
(thread_to_thread_object, inferior_to_inferior_object): New
declarations.
* record-btrace.c: Include "inferior.h".
(require_btrace_thread): Use inferior_thread.
(record_btrace_frame_sniffer)
(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
(get_thread_current_frame): Use scoped_restore_current_thread and
switch_to_thread.
(get_thread_current_frame): Use thread pointer directly.
(record_btrace_replay_at_breakpoint): Use thread's inferior
pointer directly.
* record-full.c: Include "inferior.h".
* regcache.c: Include "gdbthread.h".
(get_thread_arch_regcache): Use the inferior's address space
directly.
(get_thread_regcache, registers_changed_thread): New.
* regcache.h (get_thread_regcache(thread_info *thread)): New
overload.
(registers_changed_thread): New.
(remote_target) <remote_detach_1>: Swap order of parameters.
(remote_add_thread): <remote_add_thread>: Return the new thread.
(get_remote_thread_info(ptid_t)): New overload.
(remote_target::remote_notice_new_inferior): Use thread pointers
directly.
(remote_target::process_initial_stop_replies): Use
thread_info::set_running.
(remote_target::remote_detach_1, remote_target::detach)
(extended_remote_target::detach): Adjust.
* stack.c (frame_show_address): Use inferior_thread.
* target-debug.h (target_debug_print_thread_info_pp): New.
* target-delegates.c: Regenerate.
* target.c (default_thread_address_space): Delete.
(memory_xfer_partial_1): Use current_inferior.
(target_detach): Use current_inferior.
(target_thread_address_space): Delete.
(generic_mourn_inferior): Use current_inferior.
* target.h (struct target_ops) <thread_address_space>: Delete.
(target_thread_address_space): Delete.
* thread.c (init_thread_list): Use ALL_THREADS_SAFE. Use thread
pointers directly.
(delete_thread_1, delete_thread, delete_thread_silent): Take a
thread pointer instead of a ptid_t. Adjust all callers.
(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_thread_of_process): Rename to ...
(any_thread_of_inferior): ... this, and take an inferior pointer.
(any_live_thread_of_process): Rename to ...
(any_live_thread_of_inferior): ... this, and take an inferior
pointer.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Take a thread pointer instead
of a ptid_t. Adjust all callers.
(thread_info::set_running): New.
(validate_registers_access): Use inferior_thread.
(can_access_registers_ptid): Rename to ...
(can_access_registers_thread): ... this, and take a thread
pointer.
(print_thread_info_1): Adjust to compare thread pointers instead
of ptids.
(switch_to_no_thread, switch_to_thread): Make extern.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Use m_thread pointer directly.
(scoped_restore_current_thread::scoped_restore_current_thread):
Use inferior_thread.
(thread_command): Use thread pointer directly.
(thread_num_make_value_helper): Use inferior_thread.
* top.c (execute_command): Use inferior_thread.
* tui/tui-interp.c: Include "inferior.h".
* varobj.c (varobj_create): Use inferior_thread.
(value_of_root_1): Use find_thread_global_id instead of
global_thread_id_to_ptid.
|
|
This patch essentially causes GDB to treat inlined frames like "normal"
frames from the user's perspective. This means, for example, that when a
user sets a breakpoint in an inlined function, GDB will now actually stop
"in" that function.
Using the test case from breakpoints/17534,
3 static inline void NVIC_EnableIRQ(int IRQn)
4 {
5 volatile int y;
6 y = IRQn;
7 }
8
9 __attribute__( ( always_inline ) ) static inline void __WFI(void)
10 {
11 __asm volatile ("nop");
12 }
13
14 int main(void) {
15
16 x= 42;
17
18 if (x)
19 NVIC_EnableIRQ(16);
20 else
21 NVIC_EnableIRQ(18);
(gdb) b NVIC_EnableIRQ
Breakpoint 1 at 0x4003e4: NVIC_EnableIRQ. (2 locations)
(gdb) r
Starting program: 17534
Breakpoint 1, main () at 17534.c:19
19 NVIC_EnableIRQ(16);
Because skip_inline_frames currently skips every inlined frame, GDB "stops"
in the caller. This patch adds a new parameter to skip_inline_frames
that allows us to pass in a bpstat stop chain. The breakpoint locations
on the stop chain can be used to determine if we've stopped inside an inline
function (due to a user breakpoint). If we have, we do not elide the frame.
With this patch, GDB now reports that the inferior has stopped inside the
inlined function:
(gdb) r
Starting program: 17534
Breakpoint 1, NVIC_EnableIRQ (IRQn=16) at 17534.c:6
6 y = IRQn;
Many thanks to Jan and Pedro for guidance on this.
gdb/ChangeLog:
* breakpoint.c (build_bpstat_chain): New function, moved from
bpstat_stop_status.
(bpstat_stop_status): Add optional parameter, `stop_chain'.
If no stop chain is passed, call build_bpstat_chain to build it.
* breakpoint.h (build_bpstat_chain): Declare.
(bpstat_stop_status): Move documentation here from breakpoint.c.
* infrun.c (handle_signal_stop): Before eliding inlined frames,
build the stop chain and pass it to skip_inline_frames.
Pass this stop chain to bpstat_stop_status.
* inline-frame.c: Include breakpoint.h.
(stopped_by_user_bp_inline_frame): New function.
(skip_inline_frames): Add parameter `stop_chain'.
Move documention to inline-frame.h.
If non-NULL, use stopped_by_user_bp_inline_frame to determine
whether the frame should be elided.
* inline-frame.h (skip_inline_frames): Add parameter `stop_chain'.
Add moved documentation and update for new parameter.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_inlined_func.exp: Update inlined frame locations
in expected breakpoint stop locations.
* gdb.dwarf2/implptr.exp (implptr_test_baz): Use up/down to
move to proper scope to test variable values.
* gdb.opt/inline-break.c (inline_func1, not_inline_func1)
(inline_func2, not_inline_func2, inline_func3, not_inline_func3):
New functions.
(main): Call not_inline_func3.
* gdb.opt/inline-break.exp: Start inferior and set breakpoints at
inline_func1, inline_func2, and inline_func3. Test that when each
breakpoint is hit, GDB properly reports both the stop location
and the backtrace. Repeat tests for temporary breakpoints.
|
|
This changes some functions in cli-script.c to use function_view
rather than a function pointer and closure argument. This simplifies
the code a bit and is useful in a subsequent patch.
ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
* tracepoint.c (actions_command): Update.
* mi/mi-cmd-break.c (mi_command_line_array)
(mi_command_line_array_cnt, mi_command_line_array_ptr)
(mi_read_next_line): Remove.
(mi_cmd_break_commands): Update.
* cli/cli-script.h (read_command_lines, read_command_lines_1): Use
function_view.
* cli/cli-script.c (get_command_line): Update.
(process_next_line): Use function_view. Constify.
(recurse_read_control_structure, read_command_lines)
(read_command_lines_1): Change argument types to function_view.
(do_define_command, document_command): Update.
* breakpoint.h (check_tracepoint_command): Don't declare.
* breakpoint.c (check_tracepoint_command): Remove.
(commands_command_1, create_tracepoint_from_upload): Update.
|
|
Currently command lines are reference counted using shared_ptr only
when attached to breakpoints. This patch changes gdb to use
shared_ptr in commands as well. This allows for the removal of
copy_command_lines.
Note that the change to execute_user_command explicitly makes a new
reference to the command line. This will be used in a later patch.
This simplifies struct command_line based on the observation that a
given command can have at most two child bodies: an "if" can have both
"then" and "else" parts. Perhaps the names I've chosen for the
replacements here are not very good -- your input requested.
ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
* tracepoint.c (all_tracepoint_actions): Rename from
all_tracepoint_actions_and_cleanup. Change return type.
(actions_command, encode_actions_1, encode_actions)
(trace_dump_actions, tdump_command): Update.
* remote.c (remote_download_command_source): Update.
* python/python.c (gdbpy_eval_from_control_command)
(python_command, python_interactive_command): Update.
* mi/mi-cmd-break.c (mi_cmd_break_commands): Update.
* guile/guile.c (guile_command)
(gdbscm_eval_from_control_command, guile_command): Update.
* compile/compile.c (compile_code_command)
(compile_print_command, compile_to_object): Update.
* cli/cli-script.h (struct command_lines_deleter): New.
(counted_command_line): New typedef.
(struct command_line): Add constructor, destructor.
<body_list>: Remove.
<body_list_0, body_list_1>: New members.
(command_line_up): Remove typedef.
(read_command_lines, read_command_lines_1, get_command_line):
Update.
(copy_command_lines): Don't declare.
* cli/cli-script.c (build_command_line): Use "new".
(get_command_line): Return counted_command_line.
(print_command_lines, execute_user_command)
(execute_control_command_1, while_command, if_command): Update.
(realloc_body_list): Remove.
(process_next_line, recurse_read_control_structure): Update.
(read_command_lines, read_command_lines_1): Return counted_command_line.
(free_command_lines): Use "delete".
(copy_command_lines): Remove.
(define_command, document_command, show_user_1): Update.
* cli/cli-decode.h (struct cmd_list_element) <user_commands>: Now
a counted_command_line.
* breakpoint.h (counted_command_line): Remove typedef.
(breakpoint_set_commands): Update.
* breakpoint.c (check_no_tracepoint_commands)
(validate_commands_for_breakpoint): Update.
(breakpoint_set_commands): Change commands to be a
counted_command_line.
(commands_command_1, update_dprintf_command_list)
(create_tracepoint_from_upload): Update.
|
|
This fixes setting breakpoints on ifunc functions by name after the
ifunc has already been resolved.
In that case, if you have debug info for the ifunc resolver, without
the fix, then gdb puts a breakpoint past the prologue of the resolver,
instead of setting a breakpoint at the ifunc target:
break gnu_ifunc
Breakpoint 4 at 0x7ffff7bd36f2: file src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c, line 34.
(gdb) continue
Continuing.
[Inferior 1 (process 13300) exited normally]
(gdb)
above we should have stopped at "final", but didn't because we never
resolved the ifunc to the final location.
If you don't have debug info for the resolver, GDB manages to resolve
the ifunc target, but, it should be setting a breakpoint after the
prologue of the final function, and instead what you get is that GDB
sets a breakpoint on the first address of the target function. With
the gnu-ifunc.exp tests added by a later patch, we get, without the
fix:
(gdb) break gnu_ifunc
Breakpoint 4 at 0x400753
(gdb) continue
Continuing.
Breakpoint 4, final (arg=1) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:20
20 {
vs, fixed:
(gdb) break gnu_ifunc
Breakpoint 4 at 0x40075a: file src/gdb/testsuite/gdb.base/gnu-ifunc-final.c, line 21.
(gdb) continue
Continuing.
Breakpoint 4, final (arg=2) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:21
21 return arg + 1;
(gdb)
Fix the problems above by moving the ifunc target resolving to
linespec.c, before we skip a function's prologue. We need to save
something in the sal, so that set_breakpoint_location_function knows
that it needs to create a bp_gnu_ifunc_resolver bp_location. Might as
well just save a pointer to the minsym.
gdb/ChangeLog:
2018-04-26 Pedro Alves <palves@redhat.com>
* breakpoint.c (set_breakpoint_location_function): Don't resolve
ifunc targets here. Instead, if we have an ifunc minsym, use its
address/name.
(add_location_to_breakpoint): Store the minsym and the objfile in
the breakpoint location.
* breakpoint.h (bp_location) <msymbol, objfile>: New fields.
* linespec.c (minsym_found): Resolve GNU ifunc targets here.
Record the minsym in the sal.
* symtab.h (symtab_and_line) <msymbol>: New field.
|
|
Now that value_ref_ptr exists, it is possible to simplify breakpoint
and bpstat memory management by using a value_ref_ptr rather than
manually handling the reference counts.
gdb/ChangeLog
2018-04-06 Tom Tromey <tom@tromey.com>
* value.c (release_value): Update.
* breakpoint.h (struct watchpoint) <val>: Now a value_ref_ptr.
(struct bpstats) <val>: Now a value_ref_ptr.
* breakpoint.c (update_watchpoint, breakpoint_init_inferior)
(~bpstats, bpstats, bpstat_clear_actions, watchpoint_check)
(~watchpoint, print_it_watchpoint, watch_command_1)
(invalidate_bp_value_on_memory_change): Update.
|
|
This patch replaces VEC(static_tracepoint_marker_p) with std::vector,
and does some c++ification around that. I thought a new overload of
hex2str was useful, so I added it as well as corresponding unit tests.
I also added an overload of ui_out::field_string that takes an
std::string directly.
gdb/ChangeLog:
* tracepoint.h (struct static_tracepoint_marker): Initialize
fields, define default constructor, move constructor and move
assignment, disable the rest.
<str_id, extra>: Make std::string.
(release_static_tracepoint_marker): Remove.
(free_current_marker): Remove.
* tracepoint.c (free_current_marker): Remove.
(parse_static_tracepoint_marker_definition): Adjust to
std::string, use new hex2str overload.
(release_static_tracepoint_marker): Remove.
(print_one_static_tracepoint_marker): Get marker by reference
and adjust to std::string.
(info_static_tracepoint_markers_command): Adjust to std::vector
changes
* target.h (static_tracepoint_marker_p): Remove typedef.
(DEF_VEC_P(static_tracepoint_marker_p)): Remove.
(struct target_ops) <to_static_tracepoint_marker_at>: Return
bool.
<to_static_tracepoint_markers_by_strid>: Return std::vector.
* target-debug.h
(target_debug_print_VEC_static_tracepoint_marker_p_p): Remove.
(target_debug_print_std_vector_static_tracepoint_marker): New.
(target_debug_print_struct_static_tracepoint_marker_p): Rename
to...
(target_debug_print_static_tracepoint_marker_p): ... this.
* target-delegates.c: Re-generate.
* breakpoint.h (struct tracepoint) <static_trace_marker_id>:
Make std::string.
* breakpoint.c (init_breakpoint_sal): Adjust to std::string.
(decode_static_tracepoint_spec): Adjust to std::vector.
(tracepoint_print_one_detail): Adjust to std::string.
(strace_marker_decode_location): Adjust to std::string.
(update_static_tracepoint): Adjust to std::string, remove call
to release_static_tracepoint_marker.
* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
Adjust to std::vector.
* remote.c (remote_static_tracepoint_marker_at): Return bool.
(remote_static_tracepoint_markers_by_strid): Adjust to
std::vector.
* common/rsp-low.h (hex2str): New overload with explicit count
of bytes.
* common/rsp-low.c (hex2str): New overload with explicit count
of bytes.
* unittests/rsp-low-selftests.c (test_hex2str): New function.
(_initialize_rsp_low_selftests): Add test_hex2str test.
* unittests/tracepoint-selftests.c
(test_parse_static_tracepoint_marker_definition): Adjust to
std::string.
|
|
gdb/ChangeLog:
Update copyright year range in all GDB files
|
|
This constifies the add_setshow_* family of functions, and then fixes
up the fallout. The bulk of this patch was written by script.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* ada-lang.c (catch_ada_exception_command): Constify.
(catch_assert_command): Constify.
* break-catch-throw.c (catch_catch_command, catch_throw_command)
(catch_rethrow_command): Constify.
(catch_exception_command_1): Constify.
* breakpoint.h (add_catch_command): Constify.
* break-catch-syscall.c (catch_syscall_command_1): Constify.
(catch_syscall_split_args): Constify.
* break-catch-sig.c (catch_signal_command): Constify.
(catch_signal_split_args): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Use
cmd_const_sfunc_ftype.
* cli/cli-decode.c (add_setshow_cmd_full): Constify.
(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, struct cmd_list_element)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
Constify.
(set_cmd_sfunc): Constify.
(empty_sfunc): Constify.
* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Constify.
(set_cmd_sfunc): Constify.
(cmd_sfunc_ftype): Remove.
* compile/compile.c (set_compile_args): Constify.
* infrun.c (set_disable_randomization): Constify.
* infcmd.c (set_args_command, set_cwd_command): Constify.
* breakpoint.c (set_condition_evaluation_mode): Constify.
(add_catch_command): Constify.
(catch_fork_command_1, catch_exec_command_1)
(catch_load_command_1, catch_unload_command_1): Constify.
(catch_load_or_unload): Constify.
* guile/scm-param.c (pascm_set_func): Constify.
(add_setshow_generic): Constify.
* python/py-param.c (get_set_value): Constify.
* top.h (set_verbose): Constify.
* tui/tui-win.c (tui_set_var_cmd): Constify.
* mi/mi-main.c (set_mi_async_command): Constify.
* cli/cli-logging.c (set_logging_overwrite)
(set_logging_redirect): Constify.
* value.c (set_max_value_size): Constify.
* valprint.c (set_input_radix, set_output_radix): Constify.
* utils.c (set_width_command, set_height_command): Constify.
* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
* tracepoint.c (set_disconnected_tracing)
(set_circular_trace_buffer, set_trace_buffer_size)
(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
* top.c (set_history_size_command, set_verbose, set_editing)
(set_gdb_datadir, set_history_filename): Constify.
* target.c (set_targetdebug, maint_set_target_async_command)
(maint_set_target_non_stop_command, set_target_permissions)
(set_write_memory_permission): Constify.
(open_target): Constify.
* target-descriptions.c (set_tdesc_filename_cmd): Constify.
* target-dcache.c (set_stack_cache, set_code_cache): Constify.
* symtab.c (set_symbol_cache_size_handler): Constify.
* symfile.c (set_ext_lang_command): Constify.
* symfile-debug.c (set_debug_symfile): Constify.
* source.c (set_directories_command): Constify.
* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
* serial.c (set_parity): Constify.
* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
* remote.c (set_remote_exec_file, set_remotebreak)
(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
* record.c (set_record_insn_history_size)
(set_record_call_history_size): Constify.
* record-full.c (set_record_full_insn_max_num): Constify.
* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
* osabi.c (set_osabi): Constify.
* mips-tdep.c (set_mips64_transfers_32bit_regs)
(reinit_frame_cache_sfunc, mips_abi_update): Constify.
* maint.c (maintenance_set_profile_cmd): Constify.
* linux-thread-db.c (set_libthread_db_search_path): Constify.
* language.c (set_language_command, set_range_command)
(set_case_command): Constify.
* infrun.c (set_non_stop, set_observer_mode)
(set_stop_on_solib_events, set_schedlock_func)
(set_exec_direction_func): Constify.
* infcmd.c (set_inferior_tty_command): Constify.
* disasm.c (set_disassembler_options_sfunc): Constify.
* demangle.c (set_demangling_command): Constify.
* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
* cris-tdep.c (set_cris_version, set_cris_mode)
(set_cris_dwarf2_cfi): Constify.
* corefile.c (set_gnutarget_command): Constify.
* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
(set_target_wide_charset_sfunc): Constify.
* breakpoint.c (update_dprintf_commands): Constify.
* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
(set_disassembly_style_sfunc): Constify.
* arch-utils.c (set_endian, set_architecture): Constify.
* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
* agent.c (set_can_use_agent): Constify.
|
|
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes
up all the command implementations.
In most cases this is trivial.
In a couple of places I had to again introduce a temporary non-const
overload. These overloads will be removed when add_info is
constified.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* solib.h (no_shared_libraries): Constify.
* frame.h (return_command): Constify.
* cli/cli-cmds.h (quit_command): Constify.
* top.h (quit_command, execute_command): Constify.
* target.h (flash_erase_command): Constify.
* inferior.h (set_inferior_args, attach_command): Constify.
* tracepoint.h (start_tracing, stop_tracing): Constify.
* breakpoint.h (break_command, tbreak_command)
(hbreak_command_wrapper, thbreak_command_wrapper)
(rbreak_command_wrapper, watch_command_wrapper)
(awatch_command_wrapper, rwatch_command_wrapper)
(get_tracepoint_by_number): Constify.
* symtab.c (info_variables_command, rbreak_command)
(symtab_symbol_info): Constify.
(info_variables_command): Add non-const overload.
* top.c (dont_repeat_command): Constify.
* breakpoint.c (ignore_command, commands_command)
(condition_command, tbreak_command, hbreak_command)
(thbreak_command, clear_command, break_command)
(info_breakpoints_command, watch_command, rwatch_command)
(awatch_command, trace_command, ftrace_command, strace_command)
(trace_pass_command, break_range_command, dprintf_command)
(agent_printf_command, get_tracepoint_by_number)
(watch_maybe_just_location, trace_pass_command): Constify.
(info_breakpoints_command): Add non-const overload.
* tracefile.c (tsave_command): Constify.
* infcmd.c (attach_command, disconnect_command, signal_command)
(queue_signal_command, stepi_command, nexti_command)
(finish_command, next_command, step_command, until_command)
(advance_command, jump_command, continue_command, run_command)
(start_command, starti_command, interrupt_command)
(run_command_1, set_inferior_args, step_1): Constify.
* inferior.c (add_inferior_command, remove_inferior_command)
(clone_inferior_command): Constify.
* linux-fork.c (checkpoint_command, restart_command): Constify.
* windows-nat.c (signal_event_command): Constify.
* guile/guile.c (guile_repl_command, guile_command): Constify.
* printcmd.c (x_command, display_command, printf_command)
(output_command, set_command, call_command, print_command)
(eval_command): Constify.
(non_const_set_command): Remove.
(_initialize_printcmd): Update.
* source.c (forward_search_command, reverse_search_command):
Constify.
* jit.c (jit_reader_load_command, jit_reader_unload_command):
Constify.
* infrun.c (handle_command): Constify.
* memattr.c (mem_command): Constify.
* stack.c (return_command, up_command, up_silently_command)
(down_command, down_silently_command, frame_command)
(backtrace_command, func_command, backtrace_command_1): Constify.
(backtrace_command): Add non-const overload.
* remote-sim.c (simulator_command): Constify.
* exec.c (set_section_command): Constify.
* tracepoint.c (tdump_command, trace_variable_command)
(tstatus_command, tstop_command, tstart_command)
(end_actions_pseudocommand, while_stepping_pseudocommand)
(collect_pseudocommand, teval_pseudocommand, actions_command)
(start_tracing, stop_tracing): Constify.
* value.c (init_if_undefined_command): Constify.
* tui/tui-stack.c (tui_update_command): Constify.
* tui/tui-win.c (tui_refresh_all_command)
(tui_set_tab_width_command, tui_set_win_height_command)
(tui_set_focus_command, tui_scroll_forward_command)
(tui_scroll_backward_command, tui_scroll_left_command)
(tui_scroll_right_command, parse_scrolling_args, tui_set_focus)
(tui_set_win_height): Constify.
* tui/tui-layout.c (tui_layout_command): Constify.
* procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd)
(proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd)
(proc_untrace_sysexit_cmd): Constify.
* remote.c (threadlist_test_cmd, threadinfo_test_cmd)
(threadset_test_cmd, threadlist_update_test_cmd)
(threadalive_test): Constify.
* objc-lang.c (print_object_command): Constify.
* command.h (add_com): Constify.
* cli/cli-dump.c (restore_command): Constify.
* cli/cli-cmds.c (pwd_command, echo_command, quit_command)
(help_command, complete_command, shell_command, edit_command)
(list_command, disassemble_command, make_command)
(apropos_command, alias_command): Constify.
* cli/cli-script.c (document_command, define_command)
(while_command, if_command, validate_comname): Constify.
* cli/cli-decode.c (struct cmd_list_element): Change type of
"fun".
* target.c (do_monitor_command, flash_erase_command): Constify.
* regcache.c (reg_flush_command): Constify.
* reverse.c (reverse_step, reverse_next, reverse_stepi)
(reverse_nexti, reverse_continue, reverse_finish)
(save_bookmark_command, goto_bookmark_command)
(exec_reverse_once): Constify.
* python/python.c (python_interactive_command, python_command):
Constify.
* typeprint.c (ptype_command, whatis_command, whatis_exp):
Constify.
* solib.c (sharedlibrary_command, no_shared_libraries): Constify.
* gcore.c (gcore_command): Constify.
|
|
This introduces gdb_breakpoint_up, a unique_ptr typedef that owns a
breakpoint. It then changes set_momentary_breakpoint to return a
gdb_breakpoint_up and fixes up the fallout. This then allows the
removal of make_cleanup_delete_breakpoint.
Once breakpoints are fully C++-ified, this typedef can be removed in
favor of a plain std::unique_ptr.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* breakpoint.c (set_momentary_breakpoint): Return
breakpoint_up.
(until_break_command): Update.
(new_until_break_fsm): Change argument types to
breakpoint_up.
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(do_delete_breakpoint_cleanup, make_cleanup_delete_breakpoint):
Remove.
* infcmd.c (finish_forward): Update.
* breakpoint.h (set_momentary_breakpoint)
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(make_cleanup_delete_breakpoint): Remove.
(struct breakpoint_deleter): New.
(breakpoint_up): New typedef.
* infrun.c (insert_step_resume_breakpoint_at_sal_1): Update.
(insert_exception_resume_breakpoint): Update.
(insert_exception_resume_from_probe): Update.
(insert_longjmp_resume_breakpoint): Update.
* arm-linux-tdep.c (arm_linux_copy_svc): Update.
* elfread.c (elf_gnu_ifunc_resolver_stop): Update.
* infcall.c (call_function_by_hand_dummy): Update
|
|
This replaces start_rbreak_breakpoints and end_rbreak_breakpoints with
a new scoped class. This allows the removal of a cleanup.
This also fixes an earlier memory leak regression, by changing
"string" to be a std::string.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* breakpoint.c
(scoped_rbreak_breakpoints::scoped_rbreak_breakpoints): Rename
from start_rbreak_breakpoints.
(scoped_rbreak_breakpoints): Rename from end_rbreak_breakpoints.
* breakpoint.h (class scoped_rbreak_breakpoints): New.
(start_rbreak_breakpoints, end_rbreak_breakpoints): Remove.
* symtab.c (do_end_rbreak_breakpoints): Remove.
(rbreak_command): Use scoped_rbreak_breakpoints, std::string.
|
|
Currently, "info break" can show some (perhaps) unexpected results when
setting a breakpoint on an inlined function:
(gdb) list
1 #include <stdio.h>
2
3 static inline void foo()
4 {
5 printf("Hello world\n");
6 }
7
8 int main()
9 {
10 foo();
11 return 0;
12 }
13
(gdb) b foo
Breakpoint 1 at 0x400434: file foo.c, line 5.
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in main at foo.c:5
GDB reported that we understood what "foo" was, but we then report that the
breakpoint is actually set in main. While that is literally true, we can
do a little better.
This is accomplished by copying the symbol for which the breakpoint was set
into the bp_location. From there, print_breakpoint_location can use this
information to print out symbol information (if available) instead of calling
find_pc_sect_function.
With the patch installed,
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5
gdb/ChangeLog:
* breakpoint.c (print_breakpoint_location): Use the symbol saved
in the bp_location, falling back to find_pc_sect_function when
needed.
(add_location_to_breakpoint): Save sal->symbol.
* breakpoint.h (struct bp_location) <symbol>: New field.
* symtab.c (find_function_start_sal): Save the symbol into the SaL.
* symtab.h (struct symtab_and_line) <symbol>: New field.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-break.exp (break_info_1): New procedure.
Test "info break" for every inlined function breakpoint.
|
|
There is no regular_breakpoint_inserted_here_p definition at all, so
this patch removes the declaration.
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* breakpoint.h (regular_breakpoint_inserted_here_p): Remove.
|
|
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* break-catch-sig.c (signal_catchpoint_breakpoint_hit): Make
aspace const.
* break-catch-syscall.c (breakpoint_hit_catch_syscall):
Likewise.
* breakpoint.c (bpstat_check_location): Remove cast.
(breakpoint_hit_catch_fork): Make aspce const.
(breakpoint_hit_catch_solib): Likewise.
(breakpoint_hit_catch_exec): Likewise.
(breakpoint_hit_ranged_breakpoint): Likewise.
(breakpoint_hit_watchpoint): Likewise.
(base_breakpoint_breakpoint_hit): Likewise.
(bkpt_breakpoint_hit): Likewise.
(dprintf_breakpoint_hit): Likewise.
(tracepoint_breakpoint_hit): Likewise.
* breakpoint.h (breakpoint_ops) <breakpoint_hit>: Likewise.
|
|
This patch changes the parameter "struct address_space *aspace" to "const
address_space *aspace" in many functions.
gdb:
2017-10-26 Yao Qi <yao.qi@linaro.org>
* breakpoint.c (breakpoint_location_address_match): Change
"struct address_space *" to "const address_space".
(breakpoint_location_address_range_overlap): Likewise.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(bp_location_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(bpstat_check_location): Likewise.
(bpstat_stop_status): Likewise.
(breakpoint_address_match): Likewise.
(breakpoint_address_match_range): Likewise.
(breakpoint_location_address_match): Likewise.
(breakpoint_location_address_range_overlap): Likewise.
(insert_single_step_breakpoint): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(pc_at_non_inline_function): Likewise.
* breakpoint.h (bpstat_stop_status): Update declaration.
(breakpoint_here_p): Likewise.
(breakpoint_in_range_p): Likewise.
(moribund_breakpoint_here_p): Likewise.
(breakpoint_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(breakpoint_has_location_inserted_here): Likewise.
(single_step_breakpoint_inserted_here_p): Likewise.
(hardware_watchpoint_inserted_in_range): Likewise.
(breakpoint_address_match): Likewise.
(insert_single_step_breakpoint): Likewise.
(pc_at_non_inline_function): Likewise.
* gdbthread.h (thread_has_single_step_breakpoint_here): Likewise.
* record.c (record_check_stopped_by_breakpoint): Likewise.
* record.h (record_check_stopped_by_breakpoint): Likewise.
* thread.c (thread_has_single_step_breakpoint_here): Likewise.
|
|
Not used anywhere.
gdb/ChangeLog:
2017-10-11 Pedro Alves <palves@redhat.com>
* breakpoint.c (reattach_breakpoints): Delete.
* breakpoint.h (reattach_breakpoints): Delete.
|
|
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.
|
|
This also makes delete_command static; but now I wonder if it is used
in Insight and should not be touched.
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* breakpoint.h (delete_command): Don't declare.
* breakpoint.c (delete_command, enable_once_command)
(enable_count_command, enable_delete_command, breakpoint_1)
(maintenance_info_breakpoints, stopin_command, stopat_command)
(delete_command, delete_trace_command, save_breakpoints)
(save_breakpoints_command, save_tracepoints_command): Constify.
|
|
This changes a few linespec functions to work on "const char *" and
then fixes up all the callers. This allows further constification
elsewhere.
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* tracepoint.c (info_scope_command): Constify.
* python/python.c (gdbpy_decode_line): Constify.
* python/py-breakpoint.c (bppy_init): Constify.
* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify.
* location.h: (new_linespec_location)
(string_to_event_location_basic, string_to_event_location):
Constify.
* location.c (new_linespec_location)
(string_to_event_location_basic, string_to_event_location):
Constify.
* linespec.h (decode_line_with_current_source)
(decode_line_with_last_displayed, linespec_lex_to_end): Constify.
* linespec.c (linespec_lex_to_end)
(decode_line_with_current_source)
(decode_line_with_last_displayed): Constify.
* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x):
Constify.
* cli/cli-cmds.c (edit_command, list_command): Constify.
* breakpoint.h (until_break_command, watch_command_wrapper)
(awatch_command_wrapper, rwatch_command_wrapper)
(init_ada_exception_breakpoint): Constify.
* breakpoint.c (break_command_1, dprintf_command)
(break_range_command, watch_command_wrapper)
(rwatch_command_wrapper, awatch_command_wrapper)
(until_break_command, init_ada_exception_breakpoint)
(strace_marker_create_sals_from_location, trace_command)
(ftrace_command, strace_command, struct tracepoint): Constify.
* ax-gdb.c (agent_command_1): Constify.
* ada-lang.c (ada_exception_sal): Constify.
|
|
This changes counted_command_line to be a typedef for std::shared_ptr
and removes the associated cleanups. In the long run I believe that
cmd_list_element should also be changed to use a shared_ptr.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* breakpoint.c (struct counted_command_line): Remove.
(breakpoint_commands): Update.
(alloc_counted_command_line, incref_counted_command_line)
(decref_counted_command_line, do_cleanup_counted_command_line)
(make_cleanup_decref_counted_command_line): Remove.
(breakpoint_set_commands, commands_command_1, ~bpstats, bpstats)
(bpstat_clear_actions, bpstat_do_actions_1, watchpoint_check)
(bpstat_stop_status, print_one_breakpoint_location, ~breakpoint)
(save_breakpoints): Update.
* breakpoint.h (counted_command_line): Now a typedef to
shared_ptr.
(struct breakpoint) <commands>: Now a counted_command_line.
(struct bpstats) <command>: Likewise.
|
|
This changes struct bpstats to be allocated with new and freed with
delete, adding constructors and a destructor in the process. This
allows the removal of one cleanup and clears the way for more to
follow.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* breakpoint.c (~bpstats): Rename from bpstat_free. Update.
(bpstat_clear): Use delete.
(bpstats): New constructors.
(bpstat_copy, bpstat_stop_status): Use new.
(dprintf_after_condition_true): Update.
* breakpoint.h (bpstats::bpstats): Add constructors.
(bpstats::~bpstats): Add destructor.
|