Age | Commit message (Collapse) | Author | Files | Lines |
|
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
|
|
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 struct frame_arg to be self-managing and then fixes the
various users.
Tested by the buildbot.
gdb/ChangeLog
2019-08-07 Tom Tromey <tromey@adacore.com>
* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(print_frame_args): Update.
* python/py-framefilter.c (py_print_single_arg, enumerate_args):
Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* frame.h (struct frame_arg): Add initializers.
<error>: Now a unique_xmalloc_ptr.
|
|
Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.
The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking. This includes the backtrace when using MI.
For example, consider the following backtrace:
(gdb) bt
0 0x0000000000400490 in puts@plt ()
1 0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2 0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3 0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4 0x00000000004005b4 in main () at cbreak-3.c:10
The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.
An extra bool is added alongside the prev_pc in the frame structure. At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool. This is the most efficient way of doing it.
The marker is also added to the python frame printer, which is always printed if
set. The marker is not explicitly exposed to the python code.
I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used. This should be fixed up in the
the future once real hardware is available for full testsuite testing.
gdb/ChangeLog:
* NEWS: Expand the Pointer Authentication entry.
* aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
(aarch64_frame_unmask_lr): ... to this.
(aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
Call aarch64_frame_unmask_lr.
* frame.c (struct frame_info): Add "masked" variable.
(frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
(fprint_frame): Check for masked pc.
* frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
* stack.c (print_frame): Check for masked pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): New subsection.
|
|
New settings allow to better control what frame information is printed.
'set print frame-info' allows to override the default frame information
printed when a GDB command prints a frame.
The backtrace command has a new option -frame-info to override
this global setting.
It is now possible to have very short frame information by using the
new 'set print frame-arguments presence' and
'set print frame-info short-location'.
Combined with 'set print address off', a backtrace will only show
the essential information to see the function call chain, e.g.:
(gdb) set print address off
(gdb) set print frame-arguments presence
(gdb) set print frame-info short-location
(gdb) bt
#0 break_me ()
#1 call_me (...)
#2 main ()
(gdb)
This is handy in particular for big backtraces with functions having
many arguments.
Python frame filter printing logic has been updated to respect the new
setting in non MI mode.
Also, the default frame information printed was inconsistent when
backtrace was printing the frame information itself, or when the python
frame filtering code was printing the frame information.
This patch changes the default of python frame filtering to have a
consistent behaviour regarding printed frame-information, whatever
the presence/activity/matches of python filters.
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* frame.h (enum print_what): New value 'SHORT_LOCATION', update
comments.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location):
New declarations.
(struct frame_print_options): New member print_frame_info.
* extension.h (enum ext_lang_frame_args): New value CLI_PRESENCE.
* stack.h (get_user_print_what_frame_info): New declaration.
(frame_show_address): New declaration.
* stack.c (print_frame_arguments_choices): New value 'presence'.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location,
print_frame_info_choices, print_frame_info_print_what): New definitions.
(print_frame_args): Only print dots for args if print frame-arguments
is 'presence'.
(frame_print_option_defs): New element for "frame-info".
(get_user_print_what_frame_info): New function.
(frame_show_address): Make non static. Move comment to stack.h.
(print_frame_info_to_print_what): New function.
(print_frame_info): Update comment. Use fp_opts.print_frame_info
to decide what to print.
(backtrace_command_1): Handle the new print_frame_arguments_presence
value.
(_initialize_stack): Call add_setshow_enum_cmd for frame-info.
* python/py-framefilter.c (py_print_args): Handle CLI_PRESENCE.
(py_print_frame): In non-mi mode, use LOCATION as default for
print_what, similarly to frame information printed directly by
backtrace command. Handle frame-info user option in non MI mode.
|
|
This adds support for comand options to the "backtrace" command. We'll get:
(gdb) bt -
-entry-values -hide -past-main
-frame-arguments -no-filters -raw-frame-arguments
-full -past-entry
~~~~
(gdb) help backtrace
Print backtrace of all stack frames, or innermost COUNT frames.
Usage: backtrace [OPTION]... [QUALIFIER]... [COUNT | -COUNT]
Options:
-entry-values no|only|preferred|if-needed|both|compact|default
Set printing of function arguments at function entry
GDB can sometimes determine the values of function arguments at entry,
in addition to their current values. This option tells GDB whether
to print the current value, the value at entry (marked as val@entry),
or both. Note that one or both of these values may be <optimized out>.
-frame-arguments all|scalars|none
Set printing of non-scalar frame arguments
-raw-frame-arguments [on|off]
Set whether to print frame arguments in raw form.
If set, frame arguments are printed in raw form, bypassing any
pretty-printers for that value.
-past-main [on|off]
Set whether backtraces should continue past "main".
Normally the caller of "main" is not of interest, so GDB will terminate
the backtrace at "main". Set this if you need to see the rest
of the stack trace.
-past-entry [on|off]
Set whether backtraces should continue past the entry point of a program.
Normally there are no callers beyond the entry point of a program, so GDB
will terminate the backtrace there. Set this if you need to see
the rest of the stack trace.
-full
Print values of local variables.
-no-filters
Prohibit frame filters from executing on a backtrace.
-hide
Causes Python frame filter elided frames to not be printed.
For backward compatibility, the following qualifiers are supported:
full - same as -full option.
no-filters - same as -no-filters option.
hide - same as -hide.
With a negative COUNT, print outermost -COUNT frames.
~~~~
Implementation wise, this:
- Moves relevant options/settings globals to structures.
- Tweaks a number of functions to pass down references to such structures.
- Adds option_def structures describing the options/settings.
- Makes backtrace_command parse the options, with gdb::option::process_options.
- Tweaks "backtrace"'s help to describe the new options.
- Adds testcases.
Note that backtrace is a PROCESS_OPTIONS_UNKNOWN_IS_OPERAND command,
because of the "-COUNT" argument.
The COUNT/-COUNT argument is currently parsed as an expression. I
considered whether it would be prudent here to require "--", but
concluded that the risk of causing a significant breakage here is much
lower compared to "print", since printing the expression is not the
whole point of the "backtrace" command. Seems OK to me to require
typing "backtrace -past-main -- -p" if the user truly wants to refer
to the negative of a backtrace count stored in an inferior variable
called "p".
gdb/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* frame.c: Include "cli/cli-option.h.
(user_set_backtrace_options): New.
(backtrace_past_main, backtrace_past_entry, backtrace_limit):
Delete.
(get_prev_frame): Adjust.
(boolean_option_def, uinteger_option_def)
(set_backtrace_option_defs): New.
(_initialize_frame): Adjust and use
gdb::option::add_setshow_cmds_for_options to install "set
backtrace past-main" and "set backtrace past-entry".
* frame.h: Include "cli/cli-option.h".
(struct frame_print_options): Forward declare.
(print_frame_arguments_all, print_frame_arguments_scalars)
(print_frame_arguments_none): Declare.
(print_entry_values): Delete declaration.
(struct frame_print_options, user_frame_print_options): New.
(struct set_backtrace_options): New.
(set_backtrace_option_defs, user_set_backtrace_options): Declare.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_list_locals, mi_cmd_stack_list_args)
(mi_cmd_stack_list_variables): Pass down USER_FRAME_PRINT_OPTIONS.
(list_args_or_locals): Add frame_print_options parameter.
(mi_cmd_stack_info_frame): Pass down USER_FRAME_PRINT_OPTIONS.
* python/py-framefilter.c (enumerate_args): Pass down
USER_FRAME_PRINT_OPTIONS.
* stack.c: Include "cli/cli-option.h".
(print_frame_arguments_all, print_frame_arguments_scalars)
(print_frame_arguments_none): Declare.
(print_raw_frame_arguments, print_entry_values): Delete.
(user_frame_print_options): New.
(boolean_option_def, enum_option_def, frame_print_option_defs):
New.
(struct backtrace_cmd_options): New.
(bt_flag_option_def): New.
(backtrace_command_option_defs): New.
(print_stack_frame): Pass down USER_FRAME_PRINT_OPTIONS.
(print_frame_arg, read_frame_arg, print_frame_args)
(print_frame_info, print_frame): Add frame_print_options parameter
and use it.
(info_frame_command_core): Pass down USER_FRAME_PRINT_OPTIONS.
(backtrace_command_1): Add frame_print_options and
backtrace_cmd_options parameters and use them.
(make_backtrace_options_def_group): New.
(backtrace_command): Process command options with
gdb::option::process_options.
(backtrace_command_completer): New.
(_initialize_stack): Extend "backtrace"'s help to mention
supported options. Install completer for "backtrace".
Install some settings commands with add_setshow_cmds_for_options.
gdb/testsuite/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.base/options.exp (test-backtrace): New.
(top level): Call it.
|
|
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.
|
|
I am currently working with these functions, and though this renaming
could help to reason about the code. Some functions take a frame and
will return the value associated to that frame, others will return the
value associated to the previous frame. Those usually conveniently
contain "unwind" in their name, but naming the variable next_frame
instead of frame helps remembering which frame we are dealing with.
I also included a little typo fix at the top of frame.h.
gdb/ChangeLog:
* frame.c (frame_register_unwind): Change parameter name.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
* frame.h (frame_register_unwind): Likewise.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
(frame_unwind_arch): Likewise.
|
|
PR gdb/23203 reports 'bt full' causing the currently selected frame to
change, this issue is fixed in this commit.
Add a new class scoped_restore_selected_frame that saves and restores
the selected frame. Make use of this in print_frame_local_vars to
restore the selected frame on exit.
gdb/ChangeLog:
PR gdb/23203
* frame.c
(scoped_restore_selected_frame::scoped_restore_selected_frame):
Define.
(scoped_restore_selected_frame::~scoped_restore_selected_frame):
Define.
* frame.h (class scoped_restore_selected_frame): New class.
* stack.c (print_frame_local_vars): Remove catching and rethrowing
of any exception, use scoped_restore_selected_frame to restore the
frame instead.
gdb/testsuite/ChangeLog:
PR gdb/23203
* gdb.base/bt-selected-frame.c: New file.
* gdb.base/bt-selected-frame.exp: New file.
* lib/gdb.exp (get_current_frame_number): New function.
|
|
This patch adds a new class (type) for readonly regcache, which is
created via regcache::save. readonly_detached_regcache inherits
readable_regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* dummy-frame.c (dummy_frame_cache) <prev_regcache>: Use
readonly_detached_regcache.
(dummy_frame_prev_register): Use regcache->cooked_read.
* frame.c (frame_save_as_regcache): Change return type.
(frame_pop): Update.
* frame.h (frame_save_as_regcache): Update declaration.
* inferior.h (get_infcall_suspend_state_regcache): Update
declaration.
* infrun.c (infcall_suspend_state) <registers>: use
readonly_detached_regcache.
(save_infcall_suspend_state): Don't use regcache_dup.
(get_infcall_suspend_state_regcache): Change return type.
* linux-fork.c (struct fork_info) <savedregs>: Change to
readonly_detached_regcache.
<pc>: New field.
(fork_save_infrun_state): Don't use regcache_dup.
(info_checkpoints_command): Adjust.
* mi/mi-main.c (register_changed_p): Update declaration.
(mi_cmd_data_list_changed_registers): Use
readonly_detached_regcache.
(register_changed_p): Change parameter type to
readonly_detached_regcache.
* ppc-linux-tdep.c (ppu2spu_cache) <regcache>: Use
readonly_detached_regcache.
(ppu2spu_sniffer): Construct a new readonly_detached_regcache.
* regcache.c (readonly_detached_regcache::readonly_detached_regcache):
New.
(regcache::save): Move it to reg_buffer.
(regcache::restore): Change parameter type.
(regcache_dup): Remove.
* regcache.h (reg_buffer) <save>: New method.
(readonly_detached_regcache): New class.
* spu-tdep.c (spu2ppu_cache) <regcache>: Use
readonly_detached_regcache.
(spu2ppu_sniffer): Construct a new readonly_detached_regcache.
|
|
gdb/ChangeLog:
Update copyright year range in all GDB files
|
|
This patch constifies add_info and updates all the info commands. The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.
I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* frame.h (info_locals_command, info_args_command): Constify.
* auto-load.h (auto_load_info_scripts): Constify.
* inferior.h (registers_info): Constify.
* copying.c: Rebuild.
* copying.awk: Constify generated commands.
* auto-load.c (auto_load_info_scripts)
(info_auto_load_gdb_scripts): Constify.
* cli/cli-decode.c (struct cmd_list_element): Take a
cmd_const_cfunc_ftype.
* command.h (add_info): Take a cmd_const_cfunc_ftype.
* tui/tui-win.c (tui_all_windows_info): Constify.
* python/py-auto-load.c (info_auto_load_python_scripts):
Constify.
* cli/cli-cmds.c (show_command): Remove non-const overload.
* tracepoint.c (info_tvariables_command, info_scope_command):
Constify.
(info_static_tracepoint_markers_command): Constify.
* thread.c (info_threads_command): Constify.
(print_thread_info_1): Constify.
* target.c (info_target_command): Constify.
* symtab.c (info_sources_command, info_functions_command)
(info_types_command): Constify.
(info_variables_command): Remove non-const overload.
* symfile.c (info_ext_lang_command): Constify.
* stack.c (info_frame_command, info_locals_command)
(info_args_command): Constify.
(backtrace_command): Remove non-const overload.
* source.c (info_source_command, info_line_command): Constify.
* solib.c (info_sharedlibrary_command): Constify.
* skip.c (info_skip_command): Constify.
* ser-go32.c (info_serial_command): Constify.
* reverse.c (info_bookmarks_command): Constify.
* printcmd.c (info_symbol_command, info_address_command)
(info_display_command): Constify.
* osdata.c (info_osdata_command): Constify.
* objc-lang.c (info_selectors_command, info_classes_command):
Constify.
* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
* memattr.c (info_mem_command): Constify.
* macrocmd.c (info_macro_command, info_macros_command): Constify.
* linux-fork.c (info_checkpoints_command): Constify.
* infrun.c (info_signals_command): Constify.
* inflow.c (info_terminal_command): Constify.
* inferior.c (info_inferiors_command): Constify.
(print_inferior): Constify.
* infcmd.c (info_program_command, info_all_registers_command)
(info_registers_command, info_vector_command)
(info_float_command): Constify.
(registers_info): Constify.
* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
Constify.
* f-valprint.c (info_common_command): Constify.
* dcache.c (info_dcache_command): Constify.
(dcache_info_1): Constify.
* darwin-nat-info.c (info_mach_tasks_command)
(info_mach_task_command, info_mach_ports_command)
(info_mach_port_command, info_mach_threads_command)
(info_mach_thread_command, info_mach_regions_command)
(info_mach_regions_recurse_command, info_mach_region_command)
(info_mach_exceptions_command): Constify.
(get_task_from_args): Constify.
* cp-support.c (info_vtbl_command): Constify.
* breakpoint.c (info_watchpoints_command)
(info_tracepoints_command): Constify.
(info_breakpoints_command): Remove non-const overload.
* avr-tdep.c (avr_io_reg_read_command): Constify.
* auxv.c (info_auxv_command): Constify.
* ada-tasks.c (info_tasks_command): Constify.
(info_task): Constify.
* ada-lang.c (info_exceptions_command): 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.
|
|
regcache::m_aspace is a const, never changed during the lifetime of
regcache object. The address_space object is a const object too.
gdb:
2017-11-02 Yao Qi <yao.qi@linaro.org>
* breakpoint.c (insert_single_step_breakpoints): Update.
* frame.c (struct frame_info) <aspace>: Add const.
(frame_save_as_regcache): Add const.
(get_frame_address_space): Return const address_space *.
* frame.h (get_frame_address_space): Update declaration.
* infrun.c (struct step_over_info) <aspace>: Add const.
(set_step_over_info): Make aspace const.
(displaced_step_prepare_throw): Change variable const.
(resume): Likewise.
(proceed): Likewise.
(adjust_pc_after_break): Likewise.
(save_waitstatus): Likewise.
(handle_signal_stop): Likewise.
(keep_going_pass_signal): Likewise.
* jit.c (jit_frame_sniffer): Add const.
* mips-tdep.c (mips_single_step_through_delay): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): Likewise.
* record-full.c (record_full_wait_1): Likewise.
* regcache.c (regcache::regcache): Change parameter to const.
* regcache.h (regcache::regcache): Likewise.
(regcache::aspace): Return const address_space *.
(regcache) <m_aspace>: Add const.
|
|
Currently frame_prepare_for_sniffer returns a cleanup. This patch
changes it to return void, and exposes frame_cleanup_after_sniffer to
the caller.
Normally I would write an RAII class for this sort of thing; but
because there was just a single caller of frame_prepare_for_sniffer,
and because this caller is already using try/catch, I thought it
seemed ok to require explicit calls in this instance.
Regression tested by the buildbot.
gdb/ChangeLog
2017-10-08 Tom Tromey <tom@tromey.com>
* frame-unwind.c (frame_unwind_try_unwinder): Update.
* frame.h (frame_cleanup_after_sniffer): Declare.
(frame_prepare_for_sniffer): Return void.
* frame.c (frame_cleanup_after_sniffer): No longer static. Change
type of argument.
(frame_prepare_for_sniffer): Return void.
|
|
A following patch will remove this hack from within regcache's
implementation:
struct regcache *
get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
{
struct address_space *aspace;
/* For the benefit of "maint print registers" & co when debugging an
executable, allow dumping the regcache even when there is no
thread selected (target_thread_address_space internal-errors if
no address space is found). Note that normal user commands will
fail higher up on the call stack due to no
target_has_registers. */
aspace = (ptid_equal (null_ptid, ptid)
? NULL
: target_thread_address_space (ptid));
i.e., it'll no longer be possible to try to build a regcache for
null_ptid. That change alone would regress the gdbarch self tests
though, causing this:
(gdb) maintenance selftest
[...]
Running selftest register_to_value.
src/gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.gdb/unittest.exp: maintenance selftest (GDB internal error)
The problem is that the way the mocking environment for those unit
tests is written is a bit fragile: it creates a special purpose
regcache (and sentinel's frame), using whatever is the current
inferior_ptid (usually null_ptid), and assumes get_current_regcache
will find that in the regcache::current_regcache list.
This commit changes the way the mock environment is created. It
eliminates the special regcache and frame and instead creates a fuller
mock environment, with a custom mock target_ops, and then a mock
inferior and thread "running" on that target.
If there's already a running target when you type "maint selftest",
then we error out, instead of pushing a new target on top of the
existing one (and thus killing the debug session). This results in:
(gdb) maint selftest
(...)
Self test failed: arch i386: target already pushed
Self test failed: arch i386:x86-64: target already pushed
Self test failed: arch i386:x64-32: target already pushed
Self test failed: arch i8086: target already pushed
Self test failed: arch i386:intel: target already pushed
Self test failed: arch i386:x86-64:intel: target already pushed
Self test failed: arch i386:x64-32:intel: target already pushed
Self test failed: arch i386:nacl: target already pushed
Self test failed: arch i386:x86-64:nacl: target already pushed
Self test failed: arch i386:x64-32:nacl: target already pushed
Self test failed: self-test failed at /home/pedro/gdb/mygit/src/gdb/selftest-arch.c:86
(...)
Ran 19 unit tests, 1 failed
I think that's OK, because self tests are really meant to be run from
a clean state right after GDB is started. I'm adding that erroring
out just as safe measure just in case someone types "maint selftest"
on the command line while already debugging something (as I've done
it).
(In my multi-target branch, where this patch originated from, we don't
actually need to error out, because there each inferior has its own
target stack).
Also, note that the current code was doing:
current_inferior()->gdbarch = gdbarch;
without taking care to restore the previous gdbarch. This means that
GDB's state was being left inconsistent after running the self tests,
further supporting the point that there's probably not much
expectation that mixing "maint selftests" and regular debugging in the
same GDB invocation really works. This patch fixes that, regardless.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* frame.c (create_test_frame): Delete.
* frame.h (create_test_frame): Delete.
* gdbarch-selftests.c: Include gdbthread.h and target.h.
(class regcache_test): Delete.
(test_target_has_registers, test_target_has_stack)
(test_target_has_memory, test_target_prepare_to_store)
(test_target_store_registers): New functions.
(test_target_ops): New class.
(register_to_value_test): Error out if there's already a
process_stratum (or higher) target pushed. Create a fuller mock
environment, with mock target_ops, inferior, address space, thread
and inferior_ptid.
* progspace.c (struct address_space): Move to ...
* progspace.h (struct address_space): ... here.
* regcache.h (regcache::~regcache, regcache::raw_write)
[GDB_SELF_TEST]: No longer virtual.
|
|
This removes make_cleanup_regcache_xfree in favor of using
std::unique_ptr as the return type of frame_save_as_regcache.
gdb/ChangeLog
2017-09-25 Tom Tromey <tom@tromey.com>
* spu-tdep.c (spu2ppu_sniffer): Update.
* regcache.h (make_cleanup_regcache_xfree): Don't declare.
* regcache.c (do_regcache_xfree, make_cleanup_regcache_xfree):
Remove.
* ppc-linux-tdep.c (ppu2spu_sniffer): Update.
* mi/mi-main.c (mi_cmd_data_list_changed_registers): Update.
* frame.h (frame_save_as_regcache): Return std::unique_ptr.
* frame.c (frame_save_as_regcache): Return std::unique_ptr.
(frame_pop): Update.
|
|
Instead, make symtab_and_line initialize its members itself. Many
symtab_and_line declarations are moved to where the object is
initialized at the same time both for clarity and to avoid double
initialization. A few functions, like e.g., find_frame_sal are
adjusted to return the sal using normal function return instead of an
output parameter likewise to avoid having to default-construct a sal
and then immediately have the object overwritten.
gdb/ChangeLog:
2017-09-04 Pedro Alves <palves@redhat.com>
* ada-lang.c (is_known_support_routine): Move sal declaration to
where it is initialized.
* breakpoint.c (create_internal_breakpoint, init_catchpoint)
(parse_breakpoint_sals, decode_static_tracepoint_spec)
(clear_command, update_static_tracepoint): Remove init_sal
references. Move declarations closer to initializations.
* cli/cli-cmds.c (list_command): Move sal declarations closer to
initializations.
* elfread.c (elf_gnu_ifunc_resolver_stop): Remove init_sal
references. Move sal declarations closer to initializations.
* frame.c (find_frame_sal): Return a symtab_and_line via function
return instead of output parameter. Remove init_sal references.
* frame.h (find_frame_sal): Return a symtab_and_line via function
return instead of output parameter.
* guile/scm-frame.c (gdbscm_frame_sal): Adjust.
* guile/scm-symtab.c (stscm_make_sal_smob): Use in-place new
instead of memset.
(gdbscm_find_pc_line): Remove init_sal reference.
* infcall.c (call_function_by_hand_dummy): Remove init_sal
references. Move declarations closer to initializations.
* infcmd.c (set_step_frame): Update. Move declarations closer to
initializations.
(finish_backward): Remove init_sal references. Move declarations
closer to initializations.
* infrun.c (process_event_stop_test, handle_step_into_function)
(insert_hp_step_resume_breakpoint_at_frame)
(insert_step_resume_breakpoint_at_caller): Likewise.
* linespec.c (create_sals_line_offset, decode_digits_ordinary)
(symbol_to_sal): Likewise.
* probe.c (parse_probes_in_pspace): Remove init_sal reference.
* python/py-frame.c (frapy_find_sal): Move sal declaration closer
to its initialization.
* reverse.c (save_bookmark_command): Use new/delete. Remove
init_sal references. Move declarations closer to initializations.
* source.c (get_current_source_symtab_and_line): Remove brace
initialization.
(set_current_source_symtab_and_line): Now takes the sal by const
reference. Remove brace initialization.
(line_info): Remove init_sal reference.
* source.h (set_current_source_symtab_and_line): Now takes a
symtab_and_line via const reference.
* stack.c (set_current_sal_from_frame): Adjust.
(print_frame_info): Adjust.
(get_last_displayed_sal): Return the sal via function return
instead of via output parameter. Simplify.
(frame_info): Adjust.
* stack.h (get_last_displayed_sal): Return the sal via function
return instead of via output parameter.
* symtab.c (init_sal): Delete.
(find_pc_sect_line): Remove init_sal references. Move
declarations closer to initializations.
(find_function_start_sal): Remove init_sal references. Move
declarations closer to initializations.
* symtab.h (struct symtab_and_line): In-class initialize all
fields.
* tracepoint.c (set_traceframe_context)
(print_one_static_tracepoint_marker): Remove init_sal references.
Move declarations closer to initializations.
* tui/tui-disasm.c (tui_show_disassem_and_update_source): Adjust.
* tui/tui-stack.c (tui_show_frame_info): Adjust. Move
declarations closer to initializations.
* tui/tui-winsource.c (tui_update_source_window_as_is): Remove
init_sal references. Adjust.
|
|
This patch renames a few functions implementing CLI commands to follow
the style <command-name>_command, so that they are easier to search for.
gdb/ChangeLog:
* breakpoint.c (breakpoints_info): Rename to ...
(info_breakpoints_command): ... this.
(watchpoints_info): Rename to ...
(info_watchpoints_command): ... this.
(tracepoints_info): Rename to ...
(info_tracepoints_command): ... this.
(_initialize_breakpoint): Adjust.
* dcache.c (dcache_info): Rename to ...
(info_display_command): ... this.
(_initialize_dcache): Adjust.
* frame.h (args_info): Rename to ...
(info_args_command): ... this.
(locals_info): Rename to ...
(info_locals_command): ... this.
* infcmd.c (nofp_registers_info): Rename to ...
(info_registers_command): ... this.
(float_info): Rename to ...
(info_float_command): ... this.
(program_info): Rename to ...
(info_program_command): ... this.
(all_registers_info): Rename to ...
(info_all_registers_command): ... this.
(vector_info): Rename to ...
(info_vector_command): ... this.
(float_info): Rename to ...
(info_float_command): ... this.
(_initialize_infcmd): Adjust.
* inferior.h (term_info): Rename to ...
(info_terminal_command): ... this.
* inflow.c (term_info): Rename to ...
(info_terminal_command): ... this.
(_initialize_inflow): Adjust.
* infrun.c (signals_info): Rename to ...
(info_signals_command): ... this.
(_initialize_infrun): Adjust.
* objc-lang.c (classes_info): Rename to ...
(info_classes_command): ... this.
(selectors_info): Rename to ...
(info_selectors_command): ... this.
(_initialize_objc_language): Adjust.
* printcmd.c (sym_info): Rename to ...
(info_symbol_command): ... this.
(address_info): Rename to ...
(info_address_command): ... this.
(display_info): Rename to ...
(info_display_command): ... this.
(_initialize_printcmd): Adjust.
* reverse.c (bookmarks_info): Rename to ...
(info_breakpoints_command): ... this.
(_initialize_reverse): Adjust.
* ser-go32.c (dos_info): Rename to ...
(info_serial_command): ... this.
(_initialize_ser_dos): Adjust.
* skip.c (skip_info): Rename to ...
(info_skip_command): ... this.
(_initialize_step_skip): Adjust.
* source.c (line_info): Rename to ...
(info_line_command): ... this.
(source_info): Rename to ...
(info_source_command)
* stack.c (frame_info): Rename to ...
(info_frame_command): ... this.
(locals_info): Rename to ...
(info_locals_command): ... this.
(args_info): Rename to ...
(info_args_command): ... this.
(_initialize_stack): Adjust.
* symtab.c (sources_info): Rename to ...
(info_sources_command): ... this.
(variables_info): Rename to ...
(info_variables_command): ... this.
(functions_info): Rename to ...
(info_functions_command): ... this.
(types_info): Rename to ...
(info_types_command): ... this.
(_initialize_symtab): Adjust.
* target.c (target_info): Rename to ...
(info_target_command): ... this.
(initialize_targets): Adjust.
* tracepoint.c (tvariables_info): Rename to ...
(info_tvariables_command): ... this.
(scope_info): Rename to ...
(info_scope_command): ... this.
(trace_dump_actions): Adjust.
(_initialize_tracepoint): Adjust.
|
|
This patch adds one unit test for gdbarch methods register_to_value and
value_to_register. The test pass different combinations of {regnu, type}
to gdbarch_register_to_value and gdbarch_value_to_register. In order
to do the test, add a new function create_new_frame to create a fake
frame. It can be improved after we converted frame_info to class.
In order to isolate regcache (from target_ops operations on writing
registers, like target_store_registers), the sub-class of regcache in the
test override raw_write. Also, in order to get the right regcache from
get_thread_arch_aspace_regcache, the sub-class of regcache inserts itself
to current_regcache.
Suppose I incorrectly modified the size of buffer as below,
@@ -1228,7 +1228,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte in[MAX_REGISTER_SIZE];
+ gdb_byte in[1];
/* Convert to TYPE. */
if (!get_frame_register_bytes (frame, regnum, 0,
build GDB with "-fsanitize=address" and run unittest.exp, asan can detect
such error
==2302==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff98193870 at pc 0xbd55ea bp 0x7fff981935a0 sp 0x7fff98193598
WRITE of size 16 at 0x7fff98193870 thread T0
#0 0xbd55e9 in frame_register_unwind(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1119
#1 0xbd58c8 in frame_register(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1147
#2 0xbd6e25 in get_frame_register_bytes(frame_info*, int, unsigned long, int, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1427
#3 0x70080a in ia64_register_to_value /home/yao/SourceCode/gnu/gdb/git/gdb/ia64-tdep.c:1236
#4 0xbf570e in gdbarch_register_to_value(gdbarch*, frame_info*, int, type*, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch.c:2619
#5 0xc05975 in register_to_value_test /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch-selftests.c:131
Or, even if GDB is not built with asan, GDB just crashes.
*** stack smashing detected ***: ./gdb terminated
Aborted (core dumped)
gdb:
2017-05-24 Yao Qi <yao.qi@linaro.org>
* Makefile.in (SFILES): Add gdbarch-selftests.c.
(COMMON_OBS): Add gdbarch-selftests.o.
* frame.c [GDB_SELF_TESTS] (create_new_frame): New function.
* frame.h [GDB_SELF_TESTS] (create_new_frame): Declare.
* gdbarch-selftests.c: New file.
* regcache.h (regcache) <~regcache>: Mark it virtual if
GDB_SELF_TEST.
<raw_write>: Likewise.
|
|
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.
gdb/ChangeLog:
Update copyright year range in all GDB files.
|
|
The VALUE_FRAME_ID macro provides access to a member in struct value
that's used to hold the frame id that's used when determining a
register's value or when assigning to a register. The underlying
member has a long and obscure name. I won't refer to it here, but
will simply refer to VALUE_FRAME_ID as if it's the struct value member
instead of being a convenient macro.
At the moment, without this patch in place, VALUE_FRAME_ID is set in
value_of_register_lazy() and several other locations to hold the frame
id of the frame passed to those functions.
VALUE_FRAME_ID is used in the lval_register case of
value_fetch_lazy(). To fetch the register's value, it calls
get_frame_register_value() which, in turn, calls
frame_unwind_register_value() with frame->next.
A python based unwinder may wish to determine the value of a register
or evaluate an expression containing a register. When it does this,
value_fetch_lazy() will be called under some circumstances. It will
attempt to determine the frame id associated with the frame passed to
it. In so doing, it will end up back in the frame sniffer of the very
same python unwinder that's attempting to learn the value of a
register as part of the sniffing operation. This recursion is not
desirable.
As noted above, when value_fetch_lazy() wants to fetch a register's
value, it does so (indirectly) by unwinding from frame->next.
With this in mind, a solution suggests itself: Change VALUE_FRAME_ID
to hold the frame id associated with the next frame. Then, when it
comes time to obtain the value associated with the register, we can
simply unwind from the frame corresponding to the frame id stored in
VALUE_FRAME_ID. This neatly avoids the python unwinder recursion
problem by changing when the "next" operation occurs. Instead of the
"next" operation occuring when the register value is fetched, it
occurs earlier on when assigning a frame id to VALUE_FRAME_ID.
(Thanks to Pedro for this suggestion.)
This patch implements this idea.
It builds on the patch "Distinguish sentinel frame from null frame".
Without that work in place, it's necessary to check for null_id at
several places and then obtain the sentinel frame.
It also renames most occurences of VALUE_FRAME_ID to
VALUE_NEXT_FRAME_ID to reflect the new meaning of this field.
There are several uses of VALUE_FRAME_ID which were not changed. In
each case, the original meaning of VALUE_FRAME_ID is required to get
correct results. In all but one of these uses, either
put_frame_register_bytes() or get_frame_register_bytes() is being
called with the frame value obtained from VALUE_FRAME_ID. Both of
these functions perform some unwinding by performing a "->next"
operation on the frame passed to it. If we were to use the new
VALUE_NEXT_FRAME_ID macro, this would effectively do two "->next"
operations, which is not what we want.
The VALUE_FRAME_ID macro has been redefined in terms of
VALUE_NEXT_FRAME_ID. It simply fetches the previous frame's id,
providing this id as the value of the macro.
gdb/ChangeLog:
* value.h (VALUE_FRAME_ID): Rename to VALUE_NEXT_FRAME_ID. Update
comment. Create new VALUE_FRAME_ID which is defined in terms of
VALUE_NEXT_FRAME_ID.
(deprecated_value_frame_id_hack): Rename to
deprecated_value_next_frame_id_hack.
* dwarf2loc.c, findvar.c, frame-unwind.c, sentinel-frame.c,
valarith.c, valops.c, value.c: Adjust nearly all occurences of
VALUE_FRAME_ID to VALUE_NEXT_FRAME_ID. Add comments for those
which did not change.
* value.c (struct value): Rename frame_id field to next_frame_id.
Update comment.
(deprecated_value_frame_id_hack): Rename to
deprecated_value_next_frame_id_hack.
(value_fetch_lazy): Call frame_unwind_register_value()
instead of get_frame_register_value().
* frame.c (get_prev_frame_id_by_id): New function.
* frame.h (get_prev_frame_id_by_id): Declare.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Make
VALUE_NEXT_FRAME_ID refer to the next frame.
* findvar.c (value_of_register_lazy): Likewise.
(default_value_from_register): Likewise.
(value_from_register): Likewise.
* frame_unwind.c (frame_unwind_got_optimized): Likewise.
* sentinel-frame.c (sentinel_frame_prev_register): Likewise.
* value.h (VALUE_FRAME_ID): Update comment describing this macro.
|
|
This patch replaces the `current_frame' static global in frame.c with
`sentinel_frame'. It also makes the sentinel frame id unique and
different from the null frame.
By itself, there is not much point to this patch, but it makes
the code cleaner for the VALUE_FRAME_ID changes in another patch.
Since we now allow "navigation" to the sentinel frame, it removes
the necessity of adding special cases to other parts of GDB.
Note that a new function, get_next_frame_sentinel_okay, is introduced
in this patch. It will be used by the VALUE_FRAME_ID changes that
I've made.
Thanks to Pedro Alves for this suggestion.
gdb/ChangeLog:
* frame.h (enum frame_id_stack_status): Add FID_STACK_SENTINEL.
(struct frame_id): Increase number of bits required for storing
stack status to 3 from 2.
(sentinel_frame_id): New declaration.
(get_next_frame_sentinel_okay): Declare.
(frame_find_by_id_sentinel_okay): Declare.
* frame.c (current_frame): Rename this static global to...
(sentinel_frame): ...this static global, which has also been
moved an earlier location in the file.
(fprint_frame_id): Add case for sentinel frame id.
(get_frame_id): Return early for sentinel frame.
(sentinel_frame_id): Define.
(frame_find_by_id): Add case for sentinel_frame_id.
(create_sentinel_frame): Use sentinel_frame_id for this_id.value
instead of null_frame_id.
(get_current_frame): Add local declaration for `current_frame'.
Remove local declaration for `sentinel_frame.'
(get_next_frame_sentinel_okay): New function.
(reinit_frame_cache): Use `sentinel_frame' in place of
`current_frame'.
|
|
Fixes this failure when building in C mode. I think it's relevant for master
as well, since it's a good practice to include (or forward-declare) what you
use.
In file included from ../../binutils-gdb/gdb/gdbarch.h:38:0,
from ../../binutils-gdb/gdb/defs.h:653,
from ../../binutils-gdb/gdb/dictionary.c:23:
../../binutils-gdb/gdb/frame.h:710:48: warning: ‘struct ui_out’ declared inside parameter list will not be visible outside of this definition or declaration
extern void print_stack_frame_to_uiout (struct ui_out *uiout,
gdb/ChangeLog:
* frame.h: Forward-declare struct ui_out.
|
|
With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.
This patch addresses PR gdb/20487.
In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame. The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event. The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.
Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console. The format of
the frame attribute is the same as what is found in the *stopped events.
Here's a detailed example for each command and the events they generate:
thread
------
1. CLI command:
thread 1.3
MI event:
=thread-selected,id="3",frame={...}
2. MI command:
-thread-select 3
CLI event:
[Switching to thread 1.3 ...]
3. MI command (CLI-in-MI):
thread 1.3
MI event/reply:
&"thread 1.3\n"
~"#0 child_sub_function () ...
=thread-selected,id="3",frame={level="0",...}
^done
frame
-----
1. CLI command:
frame 1
MI event:
=thread-selected,id="3",frame={level="1",...}
2. MI command:
-stack-select-frame 1
CLI event:
#1 0x00000000004007f0 in child_function...
3. MI command (CLI-in-MI):
frame 1
MI event/reply:
&"frame 1\n"
~"#1 0x00000000004007f9 in ..."
=thread-selected,id="3",frame={level="1"...}
^done
inferior
--------
Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.
1. CLI command:
inferior 2
MI event:
=thread-selected,id="3"
Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification. Since there is no threads to
select, the =thread-selected event does not apply...
2. MI command (CLI-in-MI):
inferior 2
MI event/reply:
&"inferior 2\n"
~"[Switching to inferior 2 ...]"
=thread-selected,id="4",frame={level="0"...}
^done
Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed. It is used to implement the select-frame command in
this patch.
The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement. It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again. It therefore protects again emitting the
event twice.
No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.
gdb/ChangeLog:
YYYY-MM-DD Antoine Tremblay <antoine.tremblay@ericsson.com>
YYYY-MM-DD Simon Marchi <simon.marchi@ericsson.com>
PR gdb/20487
* NEWS: Mention new frame field of =thread-selected event.
* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
(add_com_suppress_notification): New function definition.
(cmd_func): Set and restore the suppress_notification flag.
* cli/cli-deicode.h (struct cmd_list_element)
<suppress_notification>: New field.
* cli/cli-interp.c (cli_suppress_notification): New global variable.
(cli_on_user_selected_context_changed): New function.
(_initialize_cli_interp): Attach to user_selected_context_changed
observer.
* command.h (struct cli_suppress_notification): New structure.
(cli_suppress_notification): New global variable declaration.
(add_com_suppress_notification): New function declaration.
* defs.h (enum user_selected_what_flag): New enum.
(user_selected_what): New enum flag type.
* frame.h (print_stack_frame_to_uiout): New function declaration.
* gdbthread.h (print_selected_thread_frame): New function declaration.
* inferior.c (print_selected_inferior): New function definition.
(inferior_command): Remove printing of inferior/thread/frame switch
notifications, notify user_selected_context_changed observer.
* inferior.h (print_selected_inferior): New function declaration.
* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
suppression to stack-select-frame and thread-select commands.
* mi/mi-interp.c (struct mi_suppress_notification)
<user_selected_context>: Initialize.
(mi_user_selected_context_changed): New function definition.
(_initialize_mi_interp): Attach to user_selected_context_changed.
* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
(mi_execute_command): Handle notification suppression. Notify
user_selected_context_changed observer on thread change instead of printing
event directly. Don't send it if command already sends the notification.
(command_notifies_uscc_observer): New function.
(mi_cmd_execute): Don't handle notification suppression.
* mi/mi-main.h (struct mi_suppress_notification)
<user_selected_context>: New field.
* stack.c (print_stack_frame_to_uiout): New function definition.
(select_frame_command): Notify user_selected_context_changed
observer.
(frame_command): Call print_selected_thread_frame if there's no frame
change or notify user_selected_context_changed observer if there is.
(up_command): Notify user_selected_context_changed observer.
(down_command): Likewise.
(_initialize_stack): Suppress user_selected_context notification for
command select-frame.
* thread.c (thread_command): Notify
user_selected_context_changed if the thread has changed, print
thread info directly if it hasn't.
(do_captured_thread_select): Do not print thread switch event.
(print_selected_thread_frame): New function definition.
* tui/tui-interp.c (tui_on_user_selected_context_changed):
New function definition.
(_initialize_tui_interp): Attach to user_selected_context_changed
observer.
gdb/doc/ChangeLog:
PR gdb/20487
* gdb.texinfo (Context management): Update mention of frame
change notifications.
(gdb/mi Async Records): Document frame field in
=thread-select event.
* observer.texi (GDB Observers): New user_selected_context_changed
observer.
gdb/testsuite/ChangeLog:
PR gdb/20487
* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
=thread-select-event check.
|
|
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
|
|
In skip_artificial_frames we repeatedly call get_prev_frame_always until we get
a non-inline and non-tailcall frame assuming that there must be such a frame
eventually.
For record targets, however, we may have a frame chain that consists only of
artificial frames. This leads to a crash in get_frame_type when dereferencing a
NULL frame pointer.
Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a
case and modify each caller to cope with a NULL return.
In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that
the returned value is not NULL. Their caller was supposed to check
frame_unwind_caller_id before calling those functions.
In other cases, we thrown an error.
In infcmd further move the skip_tailcall_frames call to the forward-stepping
case since we don't need a frame for reverse execution and we don't want to fail
because of that. Reverse-finish does make sense for a tailcall frame.
gdb/
* frame.h (skip_tailcall_frames): Update comment.
* frame.c (skip_artificial_frames, skip_tailcall_frames): Return NULL
if only artificial frames are found. Update comment.
(frame_unwind_caller_id): Handle NULL return.
(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
skip_artificial_frames does not return NULL.
(frame_pop): Add an error if only tailcall frames are found.
* infcmd.c (finish_command): Move skip_tailcall_frames call into forward-
execution case. Add an error if only tailcall frames are found.
testsuite/
* gdb.btrace/tailcall-only.exp: New.
* gdb.btrace/tailcall-only.c: New.
* gdb.btrace/x86_64-tailcall-only.S: New.
* gdb.btrace/i686-tailcall-only.S: New.
|
|
Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames.
gdb/
* frame.h (skip_tailcall_frames): New.
* frame.c (skip_tailcall_frames): New.
(frame_pop): Call skip_tailcall_frames.
* infcmd.c (finish_command): Call skip_tailcall_frames.
|
|
gdb/ChangeLog:
Update year range in copyright notice of all files.
|
|
The get_frame_language feels like it would be more at home in frame.c
rather than in stack.c, while the declaration, that is currently in
language.h can be moved into frame.h to match.
A couple of new includes are added, but otherwise no substantial change
here.
gdb/ChangeLog:
* stack.c (get_frame_language): Moved ...
* frame.c (get_frame_language): ... to here.
* language.h (get_frame_language): Declaration moved to frame.h.
* frame.h: Add language.h include, for language enum.
(get_frame_language): Declaration moved from language.h.
* language.c: Add frame.h include.
* top.c: Add frame.h include.
* symtab.h (struct obj_section): Declare.
(struct cmd_list_element): Declare.
|
|
The select_frame hook is used by TUI to update TUI's frame and register
information following changes to the selected frame. The problem with
this hook is that it gets called after every single frame change, even
if the frame change is only temporary or internal. This is the primary
cause of flickering and slowdown when running the inferior under TUI
with conditional breakpoints set. Internal GDB events are the source of
many calls to select_frame and these internal events are triggered
frequently, especially when a few conditional breakpoints are set.
This patch removes the select_frame hook altogether and instead makes
the frame and register information get updated in two key places (using
observers): after an inferior stops, and right before displaying a
prompt. The latter hook covers the case when frame information must be
updated following a call to "up", "down" or "frame", and the former
covers the case when frame and register information must be updated
after a call to "continue", "step", etc. or after the inferior stops in
async execution mode. Together these hooks should cover all the cases
when frame information ought to be refreshed (and when the relevant
windows ought to be subsequently updated).
The print_frame_info_listing hook is also effectively obsolete now, but
it still must be set while the TUI is active because its caller
print_frame_info will otherwise assume that the CLI is active, and will
print the frame informaion accordingly. So this patch also sets the
print_frame_info_listing hook to a dummy callback, in lieu of outright
removing it yet.
Effectively, with this patch, frame/PC changes that do not immediately
precede an inferior-stop event or a prompt display event no longer cause
TUI's frame and register information to be updated.
And as a result of this change and of the previous change to
tui_show_frame_info, the TUI is much more disciplined about updating the
screen, and so the flicker as described in the PR is totally gone.
gdb/ChangeLog:
PR tui/13378
* frame.c (select_frame): Remove reference to
deprecated_selected_frame_level_changed_hook.
* frame.h (deprecated_selected_frame_level_changed_hook): Remove
declaration.
* stack.c (deprecated_selected_frame_level_changed_hook):
Likewise.
* tui/tui-hooks.c (tui_selected_frame_level_changed_hook):
Rename to ...
(tui_refresh_frame_and_register_information): ... this. Bail
out if there is no stack. Don't update register information
unless registers_too_p is true.
(tui_print_frame_info_listing_hook): Rename to ...
(tui_dummy_print_frame_info_listing_hook): ... this.
(tui_before_prompt): New function.
(tui_normal_stop): New function.
(tui_before_prompt_observer): New observer.
(tui_normal_stop_observer): New observer.
(tui_install_hooks): Set
deprecated_print_frame_info_listing_hook to
tui_dummy_print_frame_info_listing_hook. Register
tui_before_prompt_observer to call tui_before_prompt and
tui_normal_stop_observer to call tui_normal_stop. Remove
reference to deprecated_selected_frame_level_changed_hook.
(tui_remove_hooks): Detach and unset tui_before_prompt_observer
and tui_normal_stop_observer. Remove reference to
deprecated_selected_frame_level_changed_hook.
|
|
gdb/ChangeLog:
Update year range in copyright notice of all files.
|
|
This makes some spots in gdb, particularly general_symbol_info, use a
"const struct block", then fixes the fallout.
The justification is that, ordinarily, blocks ought to be readonly.
Note though that we can't add "const" in the blockvector due to block
relocation. This can be done once blocks are made independent of the
program space.
2014-06-18 Tom Tromey <tromey@redhat.com>
* varobj.c (varobj_create): Update.
* valops.c (value_of_this): Update.
* tracepoint.c (add_local_symbols, scope_info): Update.
* symtab.h (struct general_symbol_info) <block>: Now const.
* symtab.c (skip_prologue_sal)
(default_make_symbol_completion_list_break_on)
(skip_prologue_using_sal): Update.
* stack.h (iterate_over_block_locals)
(iterate_over_block_local_vars): Update.
* stack.c (print_frame_args): Update.
(iterate_over_block_locals, iterate_over_block_local_vars): Make
parameter const.
(get_selected_block): Make return type const.
* python/py-frame.c (frapy_block): Update.
* python/py-block.c (gdbpy_block_for_pc): Update.
* p-exp.y (%union) <bval>: Now const.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* mdebugread.c (mylookup_symbol, parse_procedure): Update.
* m2-exp.y (%union) <bval>: Now const.
* linespec.c (get_current_search_block): Make return type const.
(create_sals_line_offset, find_label_symbols): Update.
* inline-frame.c (inline_frame_sniffer, skip_inline_frames):
Update.
(block_starting_point_at): Make "block" const.
* infrun.c (insert_exception_resume_breakpoint): Make "b" const.
(check_exception_resume): Update.
* guile/scm-frame.c (gdbscm_frame_block): Update.
* guile/scm-block.c (gdbscm_lookup_block): Update.
* frame.h (get_frame_block): Update.
(get_selected_block): Make return type const.
* frame.c (frame_id_inner): Update.
* f-valprint.c (info_common_command_for_block)
(info_common_command): Update.
* dwarf2loc.c (dwarf2_find_location_expression)
(dwarf_expr_frame_base, dwarf2_compile_expr_to_ax)
(locexpr_describe_location_piece): Update.
* c-exp.y (%union) <bval>: Now const.
* breakpoint.c (resolve_sal_pc): Update.
* blockframe.c (get_frame_block):Make return type const.
(get_pc_function_start, get_frame_function, find_pc_sect_function)
(block_innermost_frame): Update.
* block.h (blockvector_for_pc, blockvector_for_pc_sect)
(block_for_pc, block_for_pc_sect): Update.
* block.c (blockvector_for_pc_sect, blockvector_for_pc): Make
'pblock' const.
(block_for_pc_sect, block_for_pc): Make return type const.
* ax-gdb.c (gen_expr): Update.
* alpha-mdebug-tdep.c (find_proc_desc): Update.
* ada-lang.c (ada_read_renaming_var_value): Make 'block' const.
(ada_make_symbol_completion_list, ada_add_exceptions_from_frame)
(ada_read_var_value): Update.
* ada-exp.y (struct name_info) <block>: Now const.
(%union): Likewise.
(block_lookup): Constify.
|
|
https://sourceware.org/ml/gdb-patches/2014-05/msg00737.html
Currently a MEMORY_ERROR raised during unwinding a frame will cause the
unwind to stop with an error message, for example:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
Cannot access memory at address 0x2aaaaaab0000
However, frame #4 is marked as being the end of the stack unwind, so a
subsequent request for the backtrace looses the error message, such as:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
When fetching the backtrace, or requesting the stack depth using the MI
interface the situation is even worse, the first time a request is made
we encounter the memory error and so the MI returns an error instead of
the correct result, for example:
(gdb) -stack-info-depth
^error,msg="Cannot access memory at address 0x2aaaaaab0000"
Or,
(gdb) -stack-list-frames
^error,msg="Cannot access memory at address 0x2aaaaaab0000"
However, once one of these commands has been used gdb has, internally,
walked the stack and figured that out that frame #4 is the bottom of the
stack, so the second time an MI command is tried you'll get the "expected"
result:
(gdb) -stack-info-depth
^done,depth="5"
Or,
(gdb) -stack-list-frames
^done,stack=[frame={level="0", .. snip lots .. }]
After this patch the MEMORY_ERROR encountered during the frame unwind is
attached to frame #4 as the stop reason, and is displayed in the CLI each
time the backtrace is requested. In the MI, catching the error means that
the "expected" result is returned the first time the MI command is issued.
So, from the CLI the results of the backtrace will be:
(gdb) bt
#0 breakpt () at amd64-invalid-stack-middle.c:27
#1 0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
#2 0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
#3 0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
#4 0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
Backtrace stopped: Cannot access memory at address 0x2aaaaaab0000
Each and every time that the backtrace is requested, while the MI output
will similarly be consistently:
(gdb) -stack-info-depth
^done,depth="5"
Or,
(gdb) -stack-list-frames
^done,stack=[frame={level="0", .. snip lots .. }]
gdb/ChangeLog:
* frame.c (struct frame_info): Add stop_string field.
(get_prev_frame_always_1): Renamed from get_prev_frame_always.
(get_prev_frame_always): Old content moved into
get_prev_frame_always_1. Call get_prev_frame_always_1 inside
TRY_CATCH, handle MEMORY_ERROR exceptions.
(frame_stop_reason_string): New function definition.
* frame.h (unwind_stop_reason_to_string): Extend comment to
mention frame_stop_reason_string.
(frame_stop_reason_string): New function declaration.
* stack.c (frame_info): Switch to frame_stop_reason_string.
(backtrace_command_1): Switch to frame_stop_reason_string.
* unwind_stop_reason.def: Add UNWIND_MEMORY_ERROR.
(LAST_ENTRY): Changed to UNWIND_MEMORY_ERROR.
* guile/lib/gdb.scm: Add FRAME_UNWIND_MEMORY_ERROR to export list.
gdb/doc/ChangeLog:
* guile.texi (Frames In Guile): Mention FRAME_UNWIND_MEMORY_ERROR.
* python.texi (Frames In Python): Mention
gdb.FRAME_UNWIND_MEMORY_ERROR.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-invalid-stack-middle.exp: Update expected results.
* gdb.arch/amd64-invalid-stack-top.exp: Likewise.
|
|
https://sourceware.org/ml/gdb-patches/2014-05/msg00721.html
This function is confusingly named, the "frame_" in the name implies it
somehow is frame dependent, when in reality the function just converts an
'enum unwind_stop_reason' value to a string.
gdb/ChangeLog:
* frame.c (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* frame.h (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* stack.c (frame_info): Update call to frame_stop_reason_string.
(backtrace_command_1): Likewise.
* guile/scm-frame.c (gdbscm_unwind_stop_reason_string): Likewise.
* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.
|
|
I noticed that "list" behaves differently in CLI vs MI. Particularly:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli
Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done.
(gdb) start
Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62.
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli
Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62
62 callee1 (2, "A string argument.", 3.5);
(gdb) list
57 {
58 }
59
60 main ()
61 {
62 callee1 (2, "A string argument.", 3.5);
63 callee1 (2, "A string argument.", 3.5);
64
65 do_nothing (); /* Hello, World! */
66
(gdb)
Note the list started at line 57. IOW, the program stopped at line
62, and GDB centered the list on that.
compare with:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..."
~"done.\n"
(gdb)
start
&"start\n"
...
~"\nTemporary breakpoint "
~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n"
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0"
=breakpoint-deleted,id="1"
(gdb)
-interpreter-exec console list
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
~"63\t callee1 (2, \"A string argument.\", 3.5);\n"
~"64\t\n"
~"65\t do_nothing (); /* Hello, World! */\n"
~"66\t\n"
~"67\t callme (1);\n"
~"68\t callme (2);\n"
~"69\t\n"
~"70\t return 0;\n"
~"71\t}\n"
^done
(gdb)
Here the list starts at line 62, where the program was stopped.
This happens because print_stack_frame, called from both normal_stop
and mi_on_normal_stop, is the function responsible for setting the
current sal from the selected frame, overrides the PRINT_WHAT
argument, and only after that does it decide whether to center the
current sal line or not, based on the overridden value, and it will
always decide false.
(The print_stack_frame call in mi_on_normal_stop is a little different
from the call in normal_stop, in that it is an unconditional
SRC_AND_LOC call. A future patch will make those uniform.)
A previous version of this patch made MI uniform with CLI here, by
making print_stack_frame also center when MI is active. That changed
the output of a "list" command in mi-cli.exp, to expect line 57
instead of 62, as per the example above.
However, looking deeper, that list in question is the first "list"
after the program stops, and right after the stop, before the "list",
the test did "set listsize 1". Let's try the same thing with the CLI:
(gdb) start
62 callee1 (2, "A string argument.", 3.5);
(gdb) set listsize 1
(gdb) list
57 {
Huh, that's unexpected. Why the 57? It's because print_stack_frame,
called in reaction to the breakpoint stop, expecting the next "list"
to show 10 lines (the listsize at the time) around line 62, sets the
lines listed range to 57-67 (62 +/- 5). If the user changes the
listsize before "list", why would we still show that range? Looks
bogus to me.
So the fix for this whole issue should be delay trying to center the
listing to until actually listing, so that the correct listsize can be
taken into account. This makes MI and CLI uniform too, as it deletes
the center code from print_stack_frame.
A series of tests are added to list.exp to cover this. mi-cli.exp was
after all correct all along, but it now gains an additional test that
lists lines with listsize 10, to ensure the centering is consistent
with CLI's.
One related Python test changed related output -- it's a test that
prints the line number after stopping for a breakpoint, similar to the
new list.exp tests. Previously we'd print the stop line minus 5 (due
to the premature centering), now we print the stop line. I think
that's a good change.
Tested on x86_64 Fedora 20.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (list_command): Handle the first "list" after the
current source line having changed.
* frame.h (set_current_sal_from_frame): Remove 'center' parameter.
* infrun.c (normal_stop): Adjust call to
set_current_sal_from_frame.
* source.c (clear_lines_listed_range): New function.
(set_current_source_symtab_and_line, identify_source_line): Clear
the lines listed range.
(line_info): Handle the first "info line" after the current source
line having changed.
* stack.c (print_stack_frame): Remove center handling.
(set_current_sal_from_frame): Remove 'center' parameter. Don't
center sal.line.
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/list.exp (build_pattern, test_list): New procedures.
Use them to test variations of "list" after reaching a breakpoint.
* gdb.mi/mi-cli.exp (line_main_callme_2): New global.
Test "list" with listsize 10 after reaching a breakpoint.
* gdb.python/python.exp (decode_line current location line
number): Adjust expected line number.
|
|
This PR is about an assertion failure in GDB that can be triggered by
setting "backtrace limit" to a value that causes GDB to stop unwinding
after an inline frame. In this case, an assertion in
inline_frame_this_id will trigger:
/* We need a valid frame ID, so we need to be based on a valid
frame. (...). */
gdb_assert (frame_id_p (*this_id));
Looking at the function:
static void
inline_frame_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct symbol *func;
/* In order to have a stable frame ID for a given inline function,
we must get the stack / special addresses from the underlying
real frame's this_id method. So we must call get_prev_frame.
Because we are inlined into some function, there must be previous
frames, so this is safe - as long as we're careful not to
create any cycles. */
*this_id = get_frame_id (get_prev_frame (this_frame));
we see we're computing the frame id for the inline frame. If this is
an inline frame, which is a virtual frame constructed based on debug
info, on top of a real stack frame, we should _always_ be able to find
where the frame was inlined into, as that ultimately just means
peeling off the virtual frames on top of the real stack frame. If
there ultimately was no prev (real) stack frame, then we wouldn't have
been able to construct the inline frame either, by design. That's
what the assertion catches.
So we have an inline frame, we should _always_ be able to compute its
ID, even if that means bypassing the user backtrace limits to get at
the real stack frame's info. The problem is that inline_frame_id
calls get_prev_frame, and that takes user backtrace limits into
account. Code that wants to bypass the limits calls get_prev_frame_1
instead.
Note how get_prev_frame_1 already skips all checks for inline frames:
/* If we are unwinding from an inline frame, all of the below tests
were already performed when we unwound from the next non-inline
frame. We must skip them, since we can not get THIS_FRAME's ID
until we have unwound all the way down to the previous non-inline
frame. */
if (get_frame_type (this_frame) == INLINE_FRAME)
return get_prev_frame_if_no_cycle (this_frame);
And note how the related frame_unwind_caller_id function also uses
get_prev_frame_1:
struct frame_id
frame_unwind_caller_id (struct frame_info *next_frame)
{
struct frame_info *this_frame;
/* Use get_prev_frame_1, and not get_prev_frame. The latter will truncate
the frame chain, leading to this function unintentionally
returning a null_frame_id (e.g., when a caller requests the frame
ID of "main()"s caller. */
next_frame = skip_artificial_frames (next_frame);
this_frame = get_prev_frame_1 (next_frame);
if (this_frame)
return get_frame_id (skip_artificial_frames (this_frame));
else
return null_frame_id;
}
get_prev_frame_1 is currently static in frame.c. As a _1 suffix is
not a good name for an extern function, I've renamed it.
Tested on x86-64 Fedora 17.
gdb/
2014-04-18 Pedro alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
PR backtrace/15558
* frame.c (get_prev_frame_1): Rename to ...
(get_prev_frame_always): ... this, and make extern. Adjust.
(skip_artificial_frames): Use get_prev_frame_always.
(frame_unwind_caller_id, frame_pop, get_prev_frame)
(get_frame_unwind_stop_reason): Adjust to rename.
* frame.h (get_prev_frame_always): Declare.
* inline-frame.c: Include frame.h.
(inline_frame_this_id): Use get_prev_frame_always.
gdb/testsuite/
2014-04-18 Tom Tromey <palves@redhat.com>
Pedro alves <tromey@redhat.com>
PR backtrace/15558
* gdb.opt/inline-bt.exp: Test backtracing from an inline function
with a backtrace limit.
* gdb.python/py-frame-inline.exp: Test running to an inline
function with a backtrace limit, and printing the newest frame.
* gdb.python/py-frame-inline.c (main): Call f.
|
|
Add a function to build a frame_id for a frame with unavailable stack
and with a special identifier address.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* frame.h (frame_id_build_unavailable_stack_special): New.
* frame.c (frame_id_build_unavailable_stack_special): New.
|
|
|
|
Like when stepping, the current stack frame location is expected to be
printed as result of tfind command, if that results in moving to a
different function. In tfind_1 we see:
if (from_tty
&& (has_stack_frames () || traceframe_number >= 0))
{
enum print_what print_what;
/* NOTE: in imitation of the step command, try to determine
whether we have made a transition from one function to
another. If so, we'll print the "stack frame" (ie. the new
function and it's arguments) -- otherwise we'll just show the
new source line. */
if (frame_id_eq (old_frame_id,
get_frame_id (get_current_frame ())))
print_what = SRC_LINE;
else
print_what = SRC_AND_LOC;
print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
do_displays ();
}
However, when we haven't collected any registers in the tracepoint
(collect $regs), that doesn't actually work:
(gdb) tstart
(gdb) info tracepoints
Num Type Disp Enb Address What
1 tracepoint keep y 0x080483b7 in func0
at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28
collect testload
installed on target
2 tracepoint keep y 0x080483bc in func1
at ../.././../git/gdb/testsuite/gdb.trace/circ.c:32
collect testload
installed on target
(gdb) c
Continuing.
Breakpoint 3, end () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:72
72 }
(gdb) tstop
(gdb) tfind start
Found trace frame 0, tracepoint 1
#0 func0 () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28
28 }
(gdb) tfind
Found trace frame 1, tracepoint 2
32 }
(gdb)
When we don't have info about the stack available
(UNWIND_UNAVAILABLE), frames end up with outer_frame_id as frame ID.
And in the scenario above, the issue is that both frames before and
after the second tfind (the frames for func0 an func1) have the same
id (outer_frame_id), so the frame_id_eq check returns false, even
though the frames were of different functions. GDB knows that,
because the PC is inferred from the tracepoint's address, even if no
registers were collected.
To fix this, this patch adds support for frame ids with a valid code
address, but <unavailable> stack address, and then makes the unwinders
use that instead of the catch-all outer_frame_id for such frames. The
frame_id_eq check in tfind_1 then automatically does the right thing
as expected.
I tested with --directory=gdb.trace/ , before/after the patch, and
compared the resulting gdb.logs, then adjusted the tests to expect the
extra output that came out. Turns out that was only circ.exp, the
original test that actually brought this issue to light.
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/
2013-12-17 Pedro Alves <palves@redhat.com>
* frame.h (enum frame_id_stack_status): New enum.
(struct frame_id) <stack_addr>: Adjust comment.
<stack_addr_p>: Delete field, replaced with ...
<stack_status>: ... this new field.
(frame_id_build_unavailable_stack): Declare.
* frame.c (frame_addr_hash, fprint_field, outer_frame_id)
(frame_id_build_special): Adjust.
(frame_id_build_unavailable_stack): New function.
(frame_id_build, frame_id_build_wild): Adjust.
(frame_id_p, frame_id_eq, frame_id_inner): Adjust to take into
account frames with unavailable stack.
* amd64-tdep.c (amd64_frame_this_id)
(amd64_sigtramp_frame_this_id, amd64_epilogue_frame_this_id): Use
frame_id_build_unavailable_stack.
* dwarf2-frame.c (dwarf2_frame_this_id): Likewise.
* i386-tdep.c (i386_frame_this_id, i386_epilogue_frame_this_id)
(i386_sigtramp_frame_this_id): Likewise.
gdb/testsuite/
2013-12-17 Pedro Alves <palves@redhat.com>
* gdb.trace/circ.exp: Expect frame info to be printed when
switching between frames with unavailable stack, but different
functions.
|
|
Doing "info frame" in the outermost frame, when that was indicated by
the next frame saying the unwound PC is undefined/not saved, results
in error and incomplete output:
(gdb) bt
#0 thread_function0 (arg=0x0) at threads.c:63
#1 0x00000034cf407d14 in start_thread (arg=0x7ffff7fcb700) at pthread_create.c:309
#2 0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) frame 2
#2 0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
115 call *%rax
(gdb) info frame
Stack level 2, frame at 0x0:
rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip Register 16 was not saved
(gdb)
Not saved register values are treated as optimized out values
internally throughout. stack.c:frame_info is handing unvailable
values, but not optimized out ones. The patch deletes the
frame_unwind_caller_pc_if_available wrapper function and instead lets
errors propagate to frame_info (it's only user).
As frame_unwind_pc now needs to be able to handle and cache two
different error scenarios, the prev_pc.p variable is replaced with an
enumeration.
(FWIW, I looked into making gdbarch_unwind_pc or a variant return
struct value's instead, but it results in lots of boxing and unboxing
for no real gain -- e.g., the mips and arm implementations need to do
computation on the unboxed PC value. Might as well throw an error on
first attempt to get at invalid contents.)
After the patch, we get:
(gdb) info frame
Stack level 2, frame at 0x0:
rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip = <not saved>
Outermost frame: outermost
caller of frame at 0x7ffff7fcafc0
source language asm.
Arglist at 0x7ffff7fcafb8, args:
Locals at 0x7ffff7fcafb8, Previous frame's sp is 0x7ffff7fcafc8
(gdb)
A new test is added. It's based off dw2-reg-undefined.exp, and tweaked to
mark the return address (rip) of "stop_frame" as undefined.
Tested on x86_64 Fedora 17.
gdb/
2013-12-06 Pedro Alves <palves@redhat.com>
* frame.c (enum cached_copy_status): New enum.
(struct frame_info) <prev_pc.p>: Change type to enum
cached_copy_status.
(fprint_frame): Handle not saved and unavailable prev_pc values.
(frame_unwind_pc_if_available): Delete and merge contents into ...
(frame_unwind_pc): ... here. Handle OPTIMIZED_OUT_ERROR. Adjust
to use enum cached_copy_status.
(frame_unwind_caller_pc_if_available): Delete.
(create_new_frame): Adjust.
* frame.h (frame_unwind_caller_pc_if_available): Delete
declaration.
* stack.c (frame_info): Use frame_unwind_caller_pc instead of
frame_unwind_caller_pc_if_available, and handle
NOT_AVAILABLE_ERROR and OPTIMIZED_OUT_ERROR errors.
* valprint.c (val_print_optimized_out): Use val_print_not_saved.
(val_print_not_saved): New function.
* valprint.h (val_print_not_saved): Declare.
gdb/testsuite/
2013-12-06 Pedro Alves <palves@redhat.com>
* gdb.dwarf2/dw2-undefined-ret-addr.S: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.c: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.exp: New file.
|
|
"break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...
(gdb) b start
(gdb) c
...
(gdb) list
*lists "start"*
(gdb) b 23
Breakpoint 3 at 0x400614: file test.c, line 23.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
(gdb) b 23
Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
^^^^^^^^^^^^^^^
(gdb) list
93 lll_wait_tid (pd->tid);
94
95
96 /* Restore cancellation mode. */
97 CANCEL_RESET (oldtype);
98
99 /* Remove the handler. */
100 pthread_cleanup_pop (0);
101
102
The issue is that print_stack_frame always sets the current sal to the
frame's sal. print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION. Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO. What we have is two logically
distinct operations mixed in the same function(s):
#1 - print frame, in the format specified by {print_what,
print_level and print_args}.
#2 - We're displaying a frame to the user, and I want the default
sal to point here, because the program stopped here, or the user
did some context-changing command (up, down, etc.).
So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.
Tested on x86_64 Fedora 17.
gdb/
2013-09-17 Pedro Alves <palves@redhat.com>
PR gdb/15911
* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
* corelow.c (core_open):
* frame.h (print_stack_frame, print_frame_info): New
'set_current_sal' parameter.
* infcmd.c (finish_command, kill_command): Adjust call to
print_stack_frame.
* inferior.c (inferior_command): Likewise.
* infrun.c (normal_stop): Likewise.
* linux-fork.c (linux_fork_context): Likewise.
* record-full.c (record_full_goto_entry, record_full_restore):
Likewise.
* remote-mips.c (common_open): Likewise.
* stack.c (print_stack_frame): New 'set_current_sal' parameter.
Use it.
(print_frame_info): New 'set_current_sal' parameter. Set the last
displayed sal depending on the new paremeter instead of looking at
print_what.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust call to
print_stack_frame.
* thread.c (print_thread_info, restore_selected_frame)
(do_captured_thread_select): Adjust call to print_stack_frame.
* tracepoint.c (tfind_1): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Likewise.
* mi/mi-interp.c (mi_on_normal_stop): Likewise.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.
gdb/testsuite/
* gdb.threads/info-threads-cur-sal-2.c: New file.
* gdb.threads/info-threads-cur-sal.c: New file.
* gdb.threads/info-threads-cur-sal.exp: New file.
|
|
This is declaring a function that no longer exists. It was deleted
back in 2003-01-13:
...
show_and_print_stack_frame, print_only_stack_frame_stub,
print_only_stack_frame): Delete functions.
gdb/
2013-08-30 Pedro Alves <palves@redhat.com>
* frame.h (show_and_print_stack_frame): Delete declaration.
|
|
* frame.h (read_frame_local): Declare.
* mi/mi-cmd-stack.c (list_args_or_locals): Call
read_frame_local.
* stack.c (read_frame_local): New.
gdb/testsuite/
* gdb.trace/mi-trace-unavailable.exp: Don't set
"print entry-values" to "no".
(test_trace_unavailable): Set various values to
"print entry-values" to test that the output of
'-stack-list-locals' is not affected, and then set
set "print entry-values" to "no".
|
|
I noticed there are no users of deprecated_pc_in_call_dummy left in
the tree.
The last user was ARM. Usage removed here:
http://sourceware.org/ml/gdb-patches/2010-03/msg00820.html
This deletes the function.
2013-02-01 Pedro Alves <palves@redhat.com>
* dummy-frame.c (deprecated_pc_in_call_dummy): Delete function.
* frame.h (deprecated_pc_in_call_dummy): Delete declaration.
|
|
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
|
|
gdb/ChangeLog:
* frame.h (deprecated_frame_register_read): Renames
frame_register_read.
* frame.c (deprecated_frame_register_read): Renames
frame_register_read. Update all callers.
* i386-tdep.c: Update all callers of frame_register_read.
* infcmd.c: Likewise.
* jit.c: Likewise.
* mips-tdep.c: Likewise.
* mt-tdep.c: Likewise.
* sh64-tdep.c: Likewise.
|
|
gdb/ChangeLog:
* frame.h (frame_register_read): Remove FIXME comment.
* frame.c (frame_register_read): Add suggestion explaining
which function to use in place of this one.
|
|
Code cleanup - rename 'inline' depth to 'artificial' depth.
* breakpoint.c (set_momentary_breakpoint): Rename at a caller to
frame_id_artificial_p, extend the comment.
* dwarf2-frame-tailcall.c (tailcall_frame_this_id): Rename at a user.
* frame.c (fprint_frame_id): Rename at a user, change debug output
text to "artificial=".
(skip_inlined_frames): Rename to ...
(skip_artificial_frames): ... here. Extend the comment.
(get_stack_frame_id, frame_unwind_caller_id): Rename at a caller.
(frame_id_inlined_p): Rename to ...
(frame_id_artificial_p): ... here. Rename at a user.
(frame_id_eq, frame_id_inner, frame_unwind_caller_pc)
(frame_unwind_caller_pc_if_available, frame_unwind_caller_arch): Rename
at a user.
* frame.h (struct frame_id): Rename inline_depth to artificial_depth.
Extend the comment.
(frame_id_inlined_p): Rename to ...
(frame_id_artificial_p): ... here.
* inline-frame.c (inline_frame_this_id): Rename at a user.
|
|
* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
(_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* dwarf2loc.h: Update the declaration of 'entry_values_debug'.
* dwarf2read.c (dwarf2_die_debug): Add 'unsigned'.
(_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'.
(_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* frame.c (frame_debug): Add 'unsigned'.
(_intialize_frame): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* frame.h: Update the declaration of 'frame_debug'.
* gdbtypes.c (overload_debug): Add 'unsigned'.
(_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* inferior.h: Update declaration of 'debug_infrun'.
* infrun.c (debug_infrun): Add 'unsigned'.
(_initialize_infrun): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* jit.c (jit_debug): Add 'unsigned'.
(_initialize_jit): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* linux-nat.c (debug_linux_nat): Add 'unsigned'.
(_initialize_linux_nat): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* linux-thread-db.c (libthread_db_debug): Add 'unsigned'.
(_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* machoread.c (mach_o_debug_level): Add 'unsigned'.
(_initialize_machoread): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'.
* microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'.
(_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd
intead of add_setshow_zinteger_cmd.
* mips-tdep.c (mips_debug): Add 'unsigned'.
(_initialize_mips_tdep): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* monitor.c (monitor_debug): Add 'unsigned'.
(_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* observer.c (observer_debug): Add 'unsigned'.
(_initialize_observer): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* parse.c (expressiondebug): Add 'unsigned'.
(_initialize_parse): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* record.c (record_debug): Add 'unsigned'.
(_initialize_record): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* record.h: Update the declaration of 'record_debug'.
* stap-probe.c (stap_expression_debug): Add 'unsigned'.
(_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* serial.c (global_serial_debug_p): Add 'unsigned'.
(_initialize_serial): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'.
(_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* solib-frv.c (solib_frv_debug): Add 'unsigned'.
(_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* target.c (targetdebug): Add 'unsigned'.
(initialize_targets): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* valops.c (overload_debug): Add 'unsigned'.
* varobj.c (varobjdebug): Add 'unsigned'.
(_initialize_varobj): Call add_setshow_zuinteger_cmd instead of
add_setshow_zinteger_cmd.
* xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'.
(_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* arch-utils.h: Remove the declaration of 'gdbarch_debug'.
* gdbarch.sh (gdbarch_debug): Add 'unsigned'.
(extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd
instead of add_setshow_zinteger_cmd.
* gdbarch.c, gdbarch.h: Re-generated.
|