aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2019-08-15Change tui_line_is_displayed to be a methodTom Tromey5-32/+35
This changes tui_line_is_displayed to be a method on tui_source_window, now that it is obvious that it can only be called for this type. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_line_is_displayed): Don't declare. * tui/tui-winsource.c (tui_line_is_displayed): Move to tui-source.c. * tui/tui-source.h (struct tui_source_window) <line_is_displayed>: Declare. * tui/tui-source.c (tui_source_window::line_is_displayed): New method. (tui_source_window::maybe_update): Update.
2019-08-15Change tui_addr_is_displayed into a methodTom Tromey5-32/+35
This changes tui_addr_is_displayed to be a method on tui_disasm_window, now that it is obvious that it can only be called for this type. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_addr_is_displayed): Don't declare. * tui/tui-winsource.c (tui_addr_is_displayed): Move to tui-disasm.c. * tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>: Declare. * tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New method. (tui_disasm_window::maybe_update): Update.
2019-08-15Move contents of tui_show_frame_info to new methodTom Tromey7-57/+85
This moves much of the body of tui_show_frame_info to a new method on tui_source_window_base. This removes a check for the type of a window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <maybe_update>: Declare. * tui/tui-stack.c (tui_show_frame_info): Call maybe_update method. * tui/tui-source.h (struct tui_source_window) <maybe_update>: Declare. * tui/tui-source.c (tui_source_window::maybe_update): New method. * tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>: Declare. * tui/tui-disasm.c (tui_disasm_window::maybe_update): New method.
2019-08-15Avoid string_file in tui_make_status_lineTom Tromey2-5/+7
tui_make_status_line uses string_file where a simple std::string constructor would do. This makes this change. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (tui_make_status_line): Use string constructor.
2019-08-15Move locator code to tui-stack.cTom Tromey6-50/+65
The locator is mostly implemented in tui-stack.c. This moves the remaining bits to tui-stack.c and tui-stack.h, as appropriate. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c: Include tui-stack.h. * tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move from tui-data.h. * tui/tui-stack.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move from tui-data.c. * tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move to tui-stack.c. * tui/tui-data.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move to tui-stack.c.
2019-08-15Remove FIXMEs from tui-layout.cTom Tromey3-10/+10
An earlier patch added a couple of FIXME comments to tui-layout.c. This removes them. This is possible due to the previous patch that changed how boxing works in the TUI -- now, no special case for the command window is needed in box_win. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Use make_visible method, not tui_make_window. * tui/tui-command.h (struct tui_cmd_window) <make_visible>: Remove.
2019-08-15Simplify TUI boxingTom Tromey7-15/+39
In the TUI, whether or not a window can be boxed is a property of the window's type. This adds a can_box method to the window classes, and changes tui_make_window to defer to this, removing the "box_it" paramter. This also lets us remove "enum tui_box", as it is no longer used. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Update. * tui/tui-wingeneral.c (tui_make_window): Remove "box_it" parameter. (tui_gen_win_info::make_visible): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method. (enum tui_box): Remove. (struct tui_win_info) <can_box>: New method. * tui/tui-command.h (struct tui_cmd_window) <can_box>: New method.
2019-08-15Disable dw2-dir-file-name.exp on remote and/or Windows host.Sandra Loosemore2-0/+12
This test has many hardwired assumptions that pathnames on build and host are the same, and that POSIX pathname syntax is used. This results in dozens of failures on a remote Windows host. Fixing these assumptions would involve nontrivial rewrites; meanwhile, let's make the test results reflect the reality that this testcase isn't supported on remote host. 2019-08-15 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.dwarf2/dw2-dir-file-name.exp: Skip on remote or Windows host.
2019-08-15Skip batch-preserve-term-settings.exp tests that cannot work on Windows.Sandra Loosemore2-0/+12
This group of tests assume that the gdb "shell" command launches a POSIX-compliant shell supporting the PPID environment variable, which is used to get gdb's pid for killing it from a remote_exec shell. But on Windows host "shell" launches cmd.exe, which doesn't have an equivalent query. 2019-08-15 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.base/batch-preserve-term-settings.exp (test_terminal_settings_preserved_after_sigterm): Skip on Windows.
2019-08-15Use gdb::byte_vector in target_write_memoryTom Tromey2-1/+6
Pedro pointed out that target_write_memory should use gdb::byte_vector rather than std::vector<unsigned char>. gdb/gdbserver/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * target.c (target_write_memory): Use gdb::byte_vector.
2019-08-15[testsuite] Make the testsuite work on mingwChristian Biesinger2-0/+9
Dejagnu produces an objdir like /c/, but GDB expects something like c:/. So fix it up in lib/gdb.exp. gdb/testsuite/ChangeLog: 2019-08-14 Christian Biesinger <cbiesinger@google.com> * lib/gdb.exp: When running on a mingw target, replace /x/ with x:/.
2019-08-15Replace write_inferior_memory with target_write_memoryTom Tromey12-68/+89
target_write_memory is just a simple wrapper for write_inferior_memory. Because target_write_memory is needed for gdbsupport, and because gdb uses the name "target_write_memory" everywhere, this patch renames write_inferior_memory and removes the wrapper. I think this brings gdb and gdbserver slightly more in sync. gdb/gdbserver/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * tracepoint.c (write_inferior_data_pointer) (write_inferior_integer, write_inferior_int8) (write_inferior_uinteger, m_tracepoint_action_download) (r_tracepoint_action_download, x_tracepoint_action_download) (l_tracepoint_action_download, clear_inferior_trace_buffer) (download_agent_expr, download_tracepoint_1) (download_trace_state_variables, upload_fast_traceframes): Update. * server.c (gdb_write_memory): Update. * remote-utils.c (relocate_instruction): Update. * proc-service.c (ps_pdwrite): Update. * mem-break.c (remove_memory_breakpoint) (delete_fast_tracepoint_jump, set_fast_tracepoint_jump) (uninsert_fast_tracepoint_jumps_at) (reinsert_fast_tracepoint_jumps_at): Update. * linux-x86-low.c (append_insns) (i386_install_fast_tracepoint_jump_pad) (amd64_write_goto_address, i386_write_goto_address): Update. * linux-s390-low.c (append_insns, s390_write_goto_address): Update. * linux-ppc-low.c (ppc_relocate_instruction) (ppc_install_fast_tracepoint_jump_pad, emit_insns) (ppc_write_goto_address): Update. * linux-aarch64-low.c (append_insns): Update. * target.h (struct target_ops): Update. (write_inferior_memory): Don't declare. * target.c (target_write_memory): Rename from write_inferior_memory. Remove old target_write_memory.
2019-08-15Simplify write_inferior_memoryTom Tromey2-17/+9
gdbserver's write_inferior_memory uses a static variable to avoid memory leaks, and has a comment referring to the lack of cleanups. This patch removes this comment and the code in favor of a straightforward use of std::vector. gdb/gdbserver/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * target.c (write_inferior_memory): Use std::vector.
2019-08-15[gdb] Fix gdb build on mips64-linuxTom de Vries2-0/+5
When compiling for mips64-linux, we get: ... src/gdb/linux-nat-trad.c:139:12: error: ‘gdbarch_num_regs’ was not declared \ in this scope 139 | regnum < gdbarch_num_regs (regcache->arch ()); ... Fix this by including gdbarch.h in linux-nat-trad.c, similar to commit b1c896b365 "Fix gdb build on macOS". Build on mips64-linux. gdb/ChangeLog: 2019-08-15 Tom de Vries <tdevries@suse.de> * linux-nat-trad.c: Include gdbarch.h.
2019-08-14AArch64: Allow additional sizes in prologueAlan Hayward5-22/+139
When saving registers to the stack at the start of a function, not all state needs to be saved. For example, only the first 64bits of float registers need saving. However, a program may choose to store extra state if it wishes, there is nothing preventing it doing so. The aarch64_analyze_prologue will error if it detects extra state being stored. Relex this restriction. Tested via aarch64-prologue test. gdb/ChangeLog: * aarch64-tdep.c (aarch64_analyze_prologue): Allow any valid register sizes. gdb/testsuite/ChangeLog: * gdb.arch/aarch64-prologue.c: New test. * gdb.arch/aarch64-prologue.exp: New file.
2019-08-14Fix gdb build on macOSTom Tromey3-0/+7
Internal testing showed that the macOS port did not build. The breakage was caused by the patch to remove the gdbarch.h include from defs.h. This patch fixes the problem. gdb/ChangeLog 2019-08-14 Tom Tromey <tromey@adacore.com> * darwin-nat.c: Include gdbarch.h. * darwin-nat-info.c: Include gdbarch.h.
2019-08-13Remove tui_gen_win_info::last_visible_lineTom Tromey3-4/+7
The last_visible_line field of tui_gen_win_info is not used, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>: Remove. * tui/tui-data.c (tui_initialize_static_data): Update.
2019-08-13Don't track the contents of the execution info windowTom Tromey3-70/+22
The curses library keeps track of the contents of each window, and can redraw the screen as needed. This means that in most cases is no need for the TUI windows to also keep track of their contents. This patch removes content tracking from the execution window, leaving that to curses. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) <~tui_exec_info_window, maybe_allocate_content, get_content, m_content>: Remove. (struct tui_source_window_base) <set_exec_info_content, show_exec_info_content>: Don't declare. * tui/tui-winsource.c (tui_exec_info_window::maybe_allocate_content): Remove. (tui_source_window_base::update_exec_info): Rename from set_exec_info_content. (tui_source_window_base::show_exec_info_content) (tui_source_window_base::update_exec_info): Remove.
2019-08-13Remove tui_clear_exec_info_contentTom Tromey3-18/+16
After the previous patch, all calls to tui_clear_exec_info_content come just after a call to tui_clear_source_content. Because these two windows are linked, I think it makes sense to have tui_clear_source_content simply do the work. So, this patch removes tui_clear_exec_info_content. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr, tui_erase_source_content): Update. (tui_clear_exec_info_content): Remove.
2019-08-13Remove tui_erase_exec_info_contentTom Tromey3-9/+11
One call to tui_erase_exec_info_content can be removed. This call is not needed because the function in question then immediately sets the execution info window contents. Once this is done, tui_clear_exec_info_content is just a wrapper for the only call to tui_erase_exec_info_content, so tui_erase_exec_info_content can be renamed and the wrapper function removed. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Don't call tui_erase_exec_info_content. (tui_clear_exec_info_content): Rename from tui_erase_exec_info_content. (tui_clear_exec_info_content): Delete.
2019-08-13Turn tui_show_exec_info_content into a methodTom Tromey3-7/+19
This changes tui_show_exec_info_content to be a method on tui_source_window_base. As it is only called by other methods on this class, it can be private. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_exec_info_content>: Declare. (tui_show_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::show_exec_info_content): Rename from tui_show_exec_info_content. (tui_source_window_base::update_exec_info): Update.
2019-08-13Move code to tui-winsource.hTom Tromey3-41/+51
This moves code related to the execution info window from tui-data.h to tui-winsource.h. It fits better here because the execution info is conceptually part of the source and disassembly windows, and tui-winsource.h is where this common class lives. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element) (TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS) (TUI_EXECINFO_SIZE, tui_exec_info_content): Move ... * tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS) (TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content): ... here.
2019-08-13Change tui_update_exec_info to be a methodTom Tromey4-9/+21
This changes tui_update_exec_info to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_exec_info>: Declare. (tui_update_exec_info): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_source_window_base::refresh_all) (tui_update_all_breakpoint_info): Update. (tui_source_window_base::update_exec_info): Rename from tui_update_exec_info. * tui/tui-stack.c (tui_show_frame_info): Update.
2019-08-13Change tui_set_exec_info_content to be a methodTom Tromey3-9/+20
This changes tui_set_exec_info_content to bea method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_exec_info_content>: Declare. (tui_set_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::set_exec_info_content): Rename from tui_set_exec_info_content. (tui_update_exec_info): Update.
2019-08-13Change tui_show_source_content to be a methodTom Tromey4-13/+26
This changes tui_show_source_content to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_source_content>: Declare. (tui_show_source_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is): Update. (tui_source_window_base::show_source_content): Rename from tui_show_source_content. (tui_source_window_base::refresh_all): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update.
2019-08-13Change tui_check_and_display_highlight_if_needed to be a methodTom Tromey7-15/+33
This changes tui_check_and_display_highlight_if_needed to be a method on tui_win_info. This makes it clear that the NULL check in that function is not needed, so it is removed here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_erase_source_content) (tui_show_source_content, tui_source_window_base::refresh_all): Update. * tui/tui-wingeneral.h (tui_check_and_display_highlight_if_needed): Don't declare. * tui/tui-wingeneral.c (tui_win_info::check_and_display_highlight_if_needed): Rename from check_and_display_highlight_if_needed. * tui/tui-win.c (tui_rehighlight_all) (tui_win_info::make_visible_with_new_height): Update. * tui/tui-regs.c (tui_data_window::display_registers_from_line) (tui_data_window::erase_data_content) (tui_data_window::display_all_data): Update. * tui/tui-data.h (struct tui_win_info) <check_and_display_highlight_if_needed>: Declare.
2019-08-13Delete invisible TUI windowsTom Tromey5-13/+41
This changes the TUI so that when the layout changes, any windows that are invisible are now deleted. This makes it simpler to understand window lifetimes. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all): Call tui_delete_invisible_windows. * tui/tui-layout.c (show_layout): Call tui_delete_invisible_windows. * tui/tui-data.h (tui_delete_invisible_windows): Declare. * tui/tui-data.c (tui_delete_invisible_windows): New function.
2019-08-13Simplify tui_show_disassemTom Tromey2-1/+7
tui_show_disassem does not need to call tui_add_win_to_layout, because the callers that could change the layout have already ensured that it exists. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-disasm.c (tui_show_disassem): Add assertion. Don't call tui_add_win_to_layout.
2019-08-13Make tui_default_win_height staticTom Tromey3-3/+6
tui_default_win_height is only used in tui-layout.c, so make it static. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui_default_win_height): Don't declare. * tui/tui-layout.c (tui_default_win_height): Now static.
2019-08-13Two simplifications in tui-layout.cTom Tromey2-119/+116
This patch simplifies some code in tui-layout.c. In show_layout, all the layout settings can be handled by a single switch statement. In show_source_disasm_command and show_source_or_disasm_and_command, there is no need to check the current layout, as the caller has already done so. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_layout): Unify all layout cases into a single switch. (show_source_disasm_command, show_source_or_disasm_and_command): Don't check current layout.
2019-08-13Simplify tui_make_all_invisibleTom Tromey4-16/+18
This simplifies the implementation of tui_make_all_invisible. Also, because show_data is only called by show_layout, this hoists the call to tui_make_all_invisible and removes the call from show_data. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (make_all_visible): Remove. (tui_make_all_invisible): Simplify. * tui/tui-layout.c (tui_make_all_invisible): Move from tui-wingeneral.c; simplify. (show_layout): Hoist call to tui_make_all_invisible. (show_data): Don't call tui_make_all_invisible.
2019-08-13Remove tui_make_all_visibleTom Tromey3-7/+5
The function tui_make_all_visible is not used, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_all_visible): Don't declare. * tui/tui-wingeneral.c (tui_make_all_visible): Remove.
2019-08-13Move current_layout to tui-layout.cTom Tromey4-21/+24
This moves the current_layout global to tui-layout.c. This allows for the removal of an accessor function; but also it just seems clearer to have it here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (current_layout, tui_current_layout): Move from tui-data.c. (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Don't use tui_set_current_layout_to. * tui/tui-data.h (tui_set_current_layout_to): Don't declare. * tui/tui-data.c (current_layout, tui_current_layout): Move to tui-layout.c. (tui_set_current_layout_to): Remove.
2019-08-13Remove struct tui_layout_defTom Tromey4-23/+8
"layout_def" isn't actually used in the TUI, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_layout_def): Remove. (tui_layout_def): Don't declare. * tui/tui-data.c (layout_def): Remove. (tui_layout_def): Remove.
2019-08-13clear_detail can only be called on TUI source windowsTom Tromey7-25/+12
The clear_detail method can only be called on source windows, so remove definitions from the base of the class hierarchy, leaving only a single non-virtual method. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: No longer "override". * tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove. * tui/tui-regs.c (tui_data_window::clear_detail): Remove. * tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove. * tui/tui-command.h (struct tui_cmd_window) <clear_detail>: Remove. * tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-08-13Don't include readline headers from tracepoint.cTom Tromey2-7/+4
I was curious why updating readline caused so much to be to rebuilt, so I look at all the uses of the readline headers. Most are included for valid reasons (either readline directory or for tilde_expand); but the includes in tracepoint.c didn't seem to be used. This patch removes them. Tested by rebuilding. gdb/ChangeLog 2019-08-13 Tom Tromey <tromey@adacore.com> * tracepoint.c: Don't include readline.h or history.h.
2019-08-13[gdb/testsuite] Fix gdb.gdb/selftest.exp regexpTom de Vries2-1/+6
With gdb.gdb/selftest.exp, we get: ... (xgdb) PASS: gdb.gdb/selftest.exp: send SIGINT signal to child process ^M Thread 1 "xgdb" received signal SIGINT, Interrupt.^M 0x00007ffff5bf01db in poll () from /lib64/libc.so.6^M (gdb) FAIL: gdb.gdb/selftest.exp: send ^C to child process again ... The failure is due to gdb printing 'Thread 1 "xgdb" received signal SIGINT', but the regexp in the test-case expecting 'Program received signal SIGINT'. Fix this by updating the regexp, similar to how that is done earlier in the test-case. gdb/testsuite/ChangeLog: 2019-08-13 Tom de Vries <tdevries@suse.de> * gdb.gdb/selftest.exp (send ^C to child process again): Accept also Thread.
2019-08-13Fixes for gdb.python tests on remote Windows host.Sandra Loosemore14-71/+118
This patch fixes several test ERRORs and FAILs seen from running gdb.python tests on a remote Windows host. The problems fixed generally fall into these categories: - Failure to copy the .py script to the host. - Confusion between build and host pathnames. - Assuming pathnames printed on the host include "/" as a directory separator. - Tests that need to be conditionally disabled due to missing features on the host, etc. 2019-08-13 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.python/py-completion.exp: Download the .py file to the host and use its host pathname. Conditionalize tests that use tab completion and manipulate files on the build machine. * gdb.python/py-events.exp: Download the .py file to the host and use its host pathname. * gdb.python/py-evsignal.exp: Likewise. * gdb.python/py-evthreads.exp: Likewise. * gdb.python/py-framefilter-invalidarg.exp: Match Windows pathname syntax. * gdb.python/py-framefilter.exp: Download the .py file to the right place on the host. Match Windows pathname syntax. * gdb.python/py-mi-var-info-path-expression.exp: Download the .py file to the host and use its host pathname. * gdb.python/py-objfile-script.exp: Match Windows pathname syntax. * gdb.python/py-objfile.exp: Expect a host pathname, not a build pathname. Skip symlink test on Windows host. Add missing newline at end of file. * gdb.python/py-pp-maint.exp: Download the .py file to the host and use its host pathname. * gdb.python/py-pp-registration.exp: Match Windows pathname syntax. * gdb.python/py-section-script.exp: Use host location of binfile on safe-path. Use correct path separator on Windows host. Reorder alternatives in gdb_test_multiple to prevent matching the wrong alternative on success. * gdb.python/py-symtab.exp: Match Windows pathname syntax.
2019-08-12Require readline 7 or newerTom Tromey7-2/+67
This changes gdb to require readline 7 or newer at build time. gdb/ChangeLog 2019-08-12 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Check for readline 7. * NEWS: Mention readline 7 requirement. * README: Update. gdb/doc/ChangeLog 2019-08-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Configure Options): Document minimum version of readline.
2019-08-12Remove readline hack from gdb_selectTom Tromey2-9/+4
As discussed on gdb-patches, this removes the readline hack from the mingw-hdep.c version of gdb_select. It's believed that this is not needed any more. See: https://sourceware.org/ml/gdb-patches/2019-03/msg00465.html gdb/ChangeLog 2019-08-12 Tom Tromey <tom@tromey.com> * mingw-hdep.c (gdb_select): Remove readline hack.
2019-08-12Fix gdb's selftest.exp after readline importPatrick Palka2-3/+26
After the sync there is one testsuite regression, the test "signal SIGINT" in gdb.gdb/selftest.exp which now FAILs. Previously, the readline 6.2 SIGINT handler would temporarily reinstall the underlying application's SIGINT handler and immediately re-raise SIGINT so that the orginal handler gets invoked. But now (since readline 6.3) its SIGINT handler does not re-raise SIGINT or directly invoke the original handler; it now sets a flag marking that SIGINT was raised, and waits until readline explicitly has control to call the application's SIGINT handler. Anyway, because SIGINT is no longer re-raised from within readline's SIGINT handler, doing "signal SIGINT" with a stopped inferior gdb process will no longer resume and then immediately stop the process (since there is no 2nd SIGINT to immediately catch). Instead, the inferior gdb process will now just print "Quit" and continue to run. So with this commit, this particular test case is adjusted to reflect this change in behavior (we now have to send a 2nd SIGINT manually to stop it). gdb/testsuite/ChangeLog 2019-08-12 Patrick Palka <patrick@parcs.ath.cx> * gdb.gdb/selftest.exp (test_with_self): Update test to now expect the GDB inferior to no longer immediately stop after being resumed with "signal SIGINT".
2019-08-09Match Windows pathnames in gdb.linespec/break-ask.exp.Sandra Loosemore2-3/+8
2019-08-09 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.linespec/break-ask.exp: Generalize regexps to match Windows pathnames too.
2019-08-09Fix access to uninitialized variable in fill_in_stop_funcPedro Franco de Carvalho2-0/+7
This patch changes find_pc_partial_function so that *block is set to nullptr when it fails, so that fill_in_stop_func won't access an uninitialized variable. gdb/ChangeLog: 2019-08-09 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * blockframe.c (find_pc_partial_function): Set *block to nullptr when the function fails.
2019-08-09s390: Implement 'type_align' gdbarch methodAndreas Arnez2-0/+38
The align.exp test case yields many FAILs on s390x, since GDB's _Alignoff doesn't always agree with the compiler's. On s390x, the maximum alignment is 8, but GDB returns an alignment of 16 for 16-byte data types such as "long double". This is fixed by implementing the type_align gdbarch method. The new method returns an alignment of 8 for all integer, floating-point, and vector types larger than 8 bytes. With this change, all align.exp tests pass. gdb/ChangeLog: * s390-tdep.c (s390_type_align): New function. (s390_gdbarch_init): Set it as type_align gdbarch method.
2019-08-09doc: fix PAC typoAlan Hayward2-1/+5
gdb/doc/ChangeLog: * gdb.texinfo (AArch64 Pointer Authentication): Fix typo.
2019-08-09[gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pieTom de Vries2-2/+14
With target board unix/-fPIE/-pie, we get: ... FAIL: gdb.dwarf2/varval.exp: print varval2 ... This is due comparing a get_frame_pc result (which includes the for PIE non-zero relocation offset) with pc_high and pc_low obtained using get_scope_pc_bounds (which do not include the relocation offset). Fix this by adjusting pc_high and pc_low with the relocation offset. Tested on x86_64-linux with target board unix/-fPIE/-pie. gdb/ChangeLog: 2019-08-09 Tom de Vries <tdevries@suse.de> PR gdb/24591 * dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and pc_low with relocation offset.
2019-08-08[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1Tom de Vries2-1/+6
With gdb.tui/basic.exp and check-read1, we run into (using -v for verbose log): ... ^[[0+++ _csi_0 <<<>>> ERROR: (DejaGnu) proc "_csi_0" does not exist. ... In contrast, without check-read1, we have: ... ^[[0;10m<SNIP>+++ _csi_m <<<0;10>>> ... The problem is that this regexp in _accept: ... -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" { ... while matching the longer sequence '^[' '[' '0' ';' '1' '0' 'm', also matches the shorter sequence '^[' '[' '0'. The regexp attempts to match a CSI (Control Sequence Introducer) sequence, and the final byte of such a sequence cannot be a digit. Fix the regexp accordingly: ... - -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" { + -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" { ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-08 Tom de Vries <tdevries@suse.de> PR testsuite/24862 * lib/tuiterm.exp (_accept): Fix CSI regexp.
2019-08-07Make struct frame_arg self-managingTom Tromey5-25/+22
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.
2019-08-07AArch64 pauth: Indicate unmasked addresses in backtraceAlan Hayward9-11/+82
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.
2019-08-06Introduce obstack_strndupTom Tromey8-23/+43
This introduces obstack_strndup and changes gdb to use it. Note that obstack_strndup works like savestring, and not exactly like xstrndup. The difference is that obstack_strndup uses the passed-in length, while xstrndup uses strnlen to choose the length. gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * stabsread.c (patch_block_stabs, read_one_struct_field) (read_enum_type): Use obstack_strndup. * rust-exp.y (rust_parser::copy_name): Use obstack_strndup. * gdb_obstack.h (obstack_strndup): Use obstack_strndup. * dwarf2read.c (guess_full_die_structure_name) (anonymous_struct_prefix): Use obstack_strndup. * dbxread.c (cp_set_block_scope): Use obstack_strndup. * c-exp.y (yylex): Use obstack_strndup. * ada-exp.y (write_object_renaming, write_ambiguous_var) (write_var_or_type): Use obstack_strndup.