aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2021-02-09[gdb/symtab] Fix element type modification in read_array_typeTom de Vries3-10/+55
When running test-case gdb.fortran/function-calls.exp with target board unix/gdb:debug_flags=-gdwarf-5, I run into: ... (gdb) PASS: gdb.fortran/function-calls.exp: \ p derived_types_and_module_calls::pass_cart(c) p derived_types_and_module_calls::pass_cart_nd(c_nd)^M ^M Program received signal SIGSEGV, Segmentation fault.^M 0x0000000000400f73 in derived_types_and_module_calls::pass_cart_nd \ (c=<error reading variable: Cannot access memory at address 0xc>) at \ function-calls.f90:130^M 130 pass_cart_nd = ubound(c%d,1,4)^M The program being debugged was signaled while in a function called from GDB.^M GDB has restored the context to what it was before the call.^M To change this behavior use "set unwindonsignal off".^M Evaluation of the expression containing the function^M (derived_types_and_module_calls::pass_cart_nd) will be abandoned.^M (gdb) FAIL: gdb.fortran/function-calls.exp: p ... The problem originates in read_array_type, when reading a DW_TAG_array_type with a dwarf-5 DW_TAG_generic_subrange child. This is not supported, and the fallout of this is that rather than constructing a new array type, the code proceeds to modify the element type. Fix this conservatively by issuing a complaint and bailing out in read_array_type when not being able to construct an array type, such that we have: ... (gdb) maint expand-symtabs function-calls.f90^M During symbol reading: unable to find array range \ - DIE at 0xe1e [in module function-calls]^M During symbol reading: unable to find array range \ - DIE at 0xe1e [in module function-calls]^M (gdb) KFAIL: gdb.fortran/function-calls.exp: no complaints in srcfile \ (PRMS: symtab/27388) ... Tested on x86_64-linux. gdb/ChangeLog: 2021-02-09 Tom de Vries <tdevries@suse.de> PR symtab/27341 * dwarf2/read.c (read_array_type): Return NULL when not being able to construct an array type. Add assert to ensure that element_type is not being modified. gdb/testsuite/ChangeLog: 2021-02-09 Tom de Vries <tdevries@suse.de> PR symtab/27341 * lib/gdb.exp (with_complaints): New proc, factored out of ... (gdb_load_no_complaints): ... here. * gdb.fortran/function-calls.exp: Add test-case.
2021-02-09[testsuite] Don't use 'testfile' before 'standard_testfile'.Hafiz Abid Qadeer5-8/+16
While running tests on arm-none-eabi, I noticed following errors in some gdb.threads tests. ERROR: can't read "testfile": no such variable These were being caused by ${testfile} being used before 'standard_testfile' which sets it. This patch just moves standard_testfile before the use. 2021-02-09 Abid Qadeer <abidh@codesourcery.com> gdb/testsuite/ChangeLog: * gdb.threads/signal-command-handle-nopass.exp: Call 'standard_testfile' before using 'testfile'. * gdb.threads/signal-command-multiple-signals-pending.exp: Likewise. * gdb.threads/signal-delivered-right-thread.exp: Likewise * gdb.threads/signal-sigtrap.exp: Likewise
2021-02-08Build gdb.base/gnu-ifunc.exp with lazy bindingLuis Machado2-0/+8
The test expects the ifunc resolver to run lazily, at a later stage. Depending on the distro and toolchain configuration, this is not the case. Some configurations use non-lazy binding and thus the ifunc resolver resolves all the ifunc references very early in the process startup, before main. Ubuntu is one such case. It has switched its toolchains to pass -Wl,z,now by default, since 16.04. This wasn't a problem before 20.04 (at least for aarch64) because the toolchains did not support ifunc's. Forcing lazy binding makes the test run as expected, as opposed to the 80 or so failures it showed before the change. Tested on aarch64-linux/x86_64-linux Ubuntu 20.04. gdb/testsuite: 2021-02-08 Luis Machado <luis.machado@linaro.org> * gdb.base/gnu-ifunc.exp (build): Pass -Wl,z,lazy.
2021-02-08[gdb/testsuite] Use DW_FORM_ref_addr in gdb.dwarf2/enqueued-cu-base-addr.expTom de Vries2-1/+5
When running test-case gdb.dwarf2/enqueued-cu-base-addr.exp with target board cc-with-dwz, I get: ... gdb compile failed, dwz: enqueued-cu-base-addr: \ Couldn't find DIE at [100] referenced by DW_AT_type from DIE at [d8] ... At 0xd8 we have DIE: ... <1><d8>: Abbrev Number: 3 (DW_TAG_variable) <d9> DW_AT_name : foo <dd> DW_AT_type : <0x100> <e1> DW_AT_const_value : 1 ... referring to: ... <1><100>: Abbrev Number: 3 (DW_TAG_base_type) <101> DW_AT_byte_size : 4 <102> DW_AT_encoding : 5 (signed) <103> DW_AT_name : int ... The reference is inter-CU, but the used abbrev uses DW_FORM_ref4: ... 3 DW_TAG_variable [no children] DW_AT_name DW_FORM_string DW_AT_type DW_FORM_ref4 DW_AT_const_value DW_FORM_sdata DW_AT value: 0 DW_FORM value: 0 ... which is for intra-CU references. Fix this by using a '%' instead of a ':' label prefix in the dwarf assembly. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-02-08 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/enqueued-cu-base-addr.exp: Fix inter-CU reference.
2021-02-08gdb: return true in TuiWindow.is_valid only if TUI is enabledAndrew Burgess4-0/+327
If the user implements a TUI window in Python, and this window responds to GDB events and then redraws its window contents then there is currently an edge case which can lead to problems. The Python API documentation suggests that calling methods like erase or write on a TUI window (from Python code) will raise an exception if the window is not valid. And the description for is_valid says: This method returns True when this window is valid. When the user changes the TUI layout, windows no longer visible in the new layout will be destroyed. At this point, the gdb.TuiWindow will no longer be valid, and methods (and attributes) other than is_valid will throw an exception. From this I, as a user, would expect that if I did 'tui disable' to switch back to CLI mode, then the window would no longer be valid. However, this is not the case. When the TUI is disabled the windows in the TUI are not deleted, they are simply hidden. As such, currently, the is_valid method continues to return true. This means that if the users Python code does something like: def event_handler (e): global tui_window_object if tui_window_object->is_valid (): tui_window_object->erase () tui_window_object->write ("Hello World") gdb.events.stop.connect (event_handler) Then when a stop event arrives GDB will try to draw the TUI window, even when the TUI is disabled. This exposes two bugs. First, is_valid should be returning false in this case, second, if the user forgot to add the is_valid call, then I believe the erase and write calls should be throwing an exception (when the TUI is disabled). The solution to both of these issues is I think bound together, as it depends on having a working 'is_valid' check. There's a rogue assert added into tui-layout.c as part of this commit. While working on this commit I managed to break GDB such that TUI_CMD_WIN was nullptr, this was causing GDB to abort. I'm leaving the assert in as it might help people catch issues in the future. This patch is inspired by the work done here: https://sourceware.org/pipermail/gdb-patches/2020-December/174338.html gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_window) <is_valid>: New member function. (REQUIRE_WINDOW): Call is_valid member function. (REQUIRE_WINDOW_FOR_SETTER): New define. (gdbpy_tui_is_valid): Call is_valid member function. (gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead. * tui/tui-data.h (struct tui_win_info) <is_visible>: Check tui_active too. * tui/tui-layout.c (tui_apply_current_layout): Add an assert. * tui/tui.c (tui_enable): Move setting of tui_active earlier in the function. gdb/doc/ChangeLog: * python.texinfo (TUI Windows In Python): Extend description of TuiWindow.is_valid. gdb/testsuite/ChangeLog: * gdb.python/tui-window-disabled.c: New file. * gdb.python/tui-window-disabled.exp: New file. * gdb.python/tui-window-disabled.py: New file.
2021-02-08gdb/python: don't allow the user to delete window title attributesAndrew Burgess3-1/+23
There's a bug in the python tui API. If the user tries to delete the window title attribute then this will trigger undefined behaviour in GDB due to a missing nullptr check. gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_set_title): Check that the new value for the title is not nullptr. gdb/testsuite/ChangeLog: * gdb.python/tui-window.exp: Add new tests. * gdb.python/tui-window.py (TestWindow) <__init__>: Store TestWindow object into global the_window. <remote_title>: New method. (delete_window_title): New function.
2021-02-08gdb/tui: don't add windows to global list from tui_layout:window::applyAndrew Burgess2-0/+18
This commit was inspired by this mailing list patch: https://sourceware.org/pipermail/gdb-patches/2021-January/174713.html Currently, calling tui_layout_window::apply will add the window from the layout object to the global tui_windows list. Unfortunately, when the user runs the 'winheight' command, this calls tui_adjust_window_height, which calls the tui_layout_base::adjust_size function, which can then call tui_layout_base::apply. The consequence of this is that when the user does 'winheight' duplicate copies of a window can be added to the global tui_windows list. The original patch fixed this by changing the apply function to only update the global list some of the time. This patch takes a different approach. The apply function no longer updates the global tui_windows list. Instead a new virtual function is added to tui_layout_base which is used to gather all the currently applied windows into a vector. Finally tui_apply_current_layout is updated to make use of this new function to update the tui_windows list. The benefits I see in this approach are, (a) the apply function now no longer touches global state, this solves the immediate problem, and (b) now that tui_windows is updated directly in the function tui_apply_current_layout, we can drop the saved_tui_windows global. gdb/ChangeLog: * tui-layout.c (saved_tui_windows): Delete. (tui_apply_current_layout): Don't make use of saved_tui_windows, call new get_windows member function instead. (tui_get_window_by_name): Check in tui_windows. (tui_layout_window::apply): Don't add to tui_windows. * tui-layout.h (tui_layout_base::get_windows): New member function. (tui_layout_window::get_windows): Likewise. (tui_layout_split::get_windows): Likewise. gdb/testsuite/ChangeLog: * gdb.tui/winheight.exp: Add more tests.
2021-02-08gdb/python: reformat an error stringAndrew Burgess3-2/+7
While working on another patch I noticed an oddly formatted error message in the Python code. When 'set python print-stack message' is in effect then consider this Python script: class TestCommand (gdb.Command): def __init__ (self): gdb.Command.__init__ (self, "test-cmd", gdb.COMMAND_DATA) def invoke(self, args, from_tty): raise RuntimeError ("bad") TestCommand () And this GDB session: (gdb) source path/to/python/script.py (gdb) test-cmd Python Exception <class 'RuntimeError'> bad: Error occurred in Python: bad The line 'Python Exception <class 'RuntimeError'> bad:' doesn't look terrible in this situation, the colon at the end of the first line makes sense given the second line. However, there are places in GDB where there is no second line printed, for example consider this python script: def stop_listener (e): raise RuntimeError ("bad") gdb.events.stop.connect (stop_listener) Then this GDB session: (gdb) file helloworld.exe (gdb) start Temporary breakpoint 1 at 0x40112a: file hello.c, line 6. Starting program: helloworld.exe Temporary breakpoint 1, main () at hello.c:6 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'> bad: (gdb) si 0x000000000040112f 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'> bad: In this case there is no auxiliary information displayed after the warning, and the line ending in the colon looks weird to me. A quick survey of the code seems to indicate that it is not uncommon for there to be no auxiliary information line printed, its not just the one case I found above. I propose that the line that currently looks like this: Python Exception <class 'RuntimeError'> bad: Be reformatted like this: Python Exception <class 'RuntimeError'>: bad I think this looks fine then in either situation. The first now looks like this: (gdb) test-cmd Python Exception <class 'RuntimeError'>: bad Error occurred in Python: bad And the second like this: (gdb) si 0x000000000040112f 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'>: bad There's just two tests that needed updating. Errors are checked for in many more tests, but most of the time the pattern doesn't care about the colon. gdb/ChangeLog: * python/python.c (gdbpy_print_stack): Reformat an error message. gdb/testsuite/ChangeLog: * gdb.python/py-framefilter.exp: Update expected results. * gdb.python/python.exp: Update expected results.
2021-02-08gdb/tui: fix issue with handling the return characterAndrew Burgess2-19/+34
My initial goal was to fix our gdb/testsuite/lib/tuiterm.exp such that it would correctly support (some limited) scrolling of the command window. What I observe is that when sending commands to the tui command window in a test script with: Term::command "p 1" The command window would be left looking like this: (gdb) (gdb) p 1$1 = 1 (gdb) When I would have expected it to look like this: (gdb) p 1 $1 = 1 (gdb) Obviously a bug in our tuiterm.exp library, right??? Wrong! Turns out there's a bug in GDB. If in GDB I enable the tui and then type (slowly) the 'p 1\r' (the \r is pressing the return key at the end of the string), then you do indeed get the "expected" terminal output. However, if instead I copy the 'p 1\r' string and paste it into the tui in one go then I now see the same corrupted output as we do when using tuiterm.exp. It turns out the problem is that GDB fails when handling lots of input arriving quickly with a \r (or \n) on the end. The reason for this bug is as follows: When the tui is active the terminal is in no-echo mode, so characters sent to the terminal are not echoed out again. This means that when the user types \r, this is not echoed to the terminal. The characters read in are passed to readline and \r indicates that the command line is complete and ready to be processed. However, the \r is not included in readlines command buffer, and is NOT printed by readline when is displays its buffer to the screen. So, in GDB we have to manually spot the \r when it is read in and update the display. Printing a newline character to the output and moving the cursor to the next line. This is done in tui_getc_1. Now readline tries to reduce the number of write calls. So if we very quickly (as in paste in one go) the text 'p 1' to readline (this time with no \r on the end), then readline will fetch the fist character and add it to its internal buffer. But before printing the character out readline checks to see if there's more input incoming. As we pasted multiple characters, then yes, readline sees the ' ' and adds this to its buffer, and finally the '1', this too is added to the buffer. Now if at this point we take a break, readline sees there is no more input available, and so prints its buffer out. Now when we press \r the code in tui_getc_1 kicks in, adds a \n to the output and moves the cursor to the next line. But, if instead we paste 'p 1\r' in one go then readline adds 'p 1' to its buffer as before, but now it sees that there is still more input available. Now it fetches the '\r', but this triggers the newline behaviour, we print '\n' and move to the next line - however readline has not printed its buffer yet! So finally we end up on the next line. There's no more input available so readline prints its buffer, then GDB gets passed the buffer, handles it, and prints the result. The solution I think is to put of our special newline insertion code until we know that readline has finished printing its buffer. Handily we know when this is - the next thing readline does is pass us the command line buffer for processing. So all we need to do is hook in to the command line processing, and before we pass the command line to GDB's internals we do all of the magic print a newline and move the cursor to the next line stuff. Luckily, GDB's interpreter mechanism already provides the hooks we need to do this. So all I do here is move the newline printing code from tui_getc_1 into a new function, setup a new input_handler hook for the tui, and call my new newline printing function. After this I can enable the tui and paste in 'p 1\r' and see the correct output. Also the tuiterm.exp library will now see non-corrupted output. gdb/ChangeLog: * tui/tui-interp.c (tui_command_line_handler): New function. (tui_interp::resume): Register tui_command_line_handler as the input_handler. * tui/tui-io.c (tui_inject_newline_into_command_window): New function. (tui_getc_1): Delete handling of '\n' and '\r'. * tui-io.h (tui_inject_newline_into_command_window): Declare. gdb/testsuite/ChangeLog: * gdb.tui/scroll.exp: Tighten expected results. Remove comment about bug in GDB, update expected results, and add more tests.
2021-02-08gdb/testsuite: fix implementation of delete line in tuiterm.expAndrew Burgess4-18/+106
The implementation of the delete line escape sequence in tuiterm.exp was wrong. Delete should take a count and then delete COUNT lines at the current cursor location, all remaining lines in the scroll region are moved up to replace the deleted lines, with blank lines being added at the end of the scroll region. It's not clear to me what "scroll region" means here (or at least how that is defined), but for now I'm just treating the whole screen as the scroll region, which seems to work fine. In contrast the current broken implementation deletes COUNT lines at the cursor location moving the next COUNT lines up to fill the gap. The rest of the screen is then cleared. gdb/testsuite/ChangeLog: * gdb.tui/scroll.exp: New file. * gdb.tui/tui-layout-asm-short-prog.exp: Update expected results. * lib/tuiterm.exp (Term::_csi_M): Delete count lines, scroll remaining lines up. (Term::check_region_contents): New proc. (Term::check_box_contents): Use check_region_contents.
2021-02-06[gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32Tom de Vries2-2/+11
When running test-case gdb.tui/tui-layout-asm.exp with target board unix/-m32, we run into: ... FAIL: gdb.tui/tui-layout-asm.exp: scroll to end of assembler (scroll failed) ... Comparing screen dumps (edited a bit to fit column width) before: ... 0 +--------------------------------------------------------------------+ 1 | 0x8049194 <__libc_csu_init+68> call *-0x104(%ebp,%esi,4) | 2 | 0x804919b <__libc_csu_init+75> add $0x1,%esi | 3 | 0x804919e <__libc_csu_init+78> add $0x10,%esp | 4 | 0x80491a1 <__libc_csu_init+81> cmp %esi,%ebx | 5 | 0x80491a3 <__libc_csu_init+83> jne 0x8049188 <__...> | 6 | 0x80491a5 <__libc_csu_init+85> add $0xc,%esp | 7 | 0x80491a8 <__libc_csu_init+88> pop %ebx | 8 | 0x80491a9 <__libc_csu_init+89> pop %esi | 9 | 0x80491aa <__libc_csu_init+90> pop %edi | 10 | 0x80491ab <__libc_csu_init+91> pop %ebp | 11 | 0x80491ac <__libc_csu_init+92> ret | 12 | 0x80491ad lea 0x0(%esi),%esi | 13 | 0x80491b0 <__libc_csu_fini> ret | 14 +--------------------------------------------------------------------+ ... and after: ... 0 +--------------------------------------------------------------------+ 1 | 0x804919b <__libc_csu_init+75> add $0x1,%esi | 2 | 0x804919e <__libc_csu_init+78> add $0x10,%esp | 3 | 0x80491a1 <__libc_csu_init+81> cmp %esi,%ebx | 4 | 0x80491a3 <__libc_csu_init+83> jne 0x8049188 <__...> | 5 | 0x80491a5 <__libc_csu_init+85> add $0xc,%esp | 6 | 0x80491a8 <__libc_csu_init+88> pop %ebx | 7 | 0x80491a9 <__libc_csu_init+89> pop %esi | 8 | 0x80491aa <__libc_csu_init+90> pop %edi | 9 | 0x80491ab <__libc_csu_init+91> pop %ebp | 10 | 0x80491ac <__libc_csu_init+92> ret | 11 | 0x80491ad lea 0x0(%esi),%esi | 12 | 0x80491b0 <__libc_csu_fini> ret | 13 | 0x80491b1 <__x86.get_pc_thunk.bp> mov (%esp),%ebp | 14 +--------------------------------------------------------------------+ ... it seems the mismatch comes from the extra indentation forced by the longer <__x86.get_pc_thunk.bp> that was scrolled in. Fix this by ignoring whitespace when comparing scrolled lines. Tested on x86_64-linux, using -m64 and -m32. gdb/testsuite/ChangeLog: 2021-02-06 Tom de Vries <tdevries@suse.de> PR testsuite/26922 * gdb.tui/tui-layout-asm.exp: Ignore whitespace mismatches when scrolling.
2021-02-05[gdb/breakpoints] Fix segfault for catch syscall -1Tom de Vries2-0/+9
Using a hello world a.out, I run into a segfault: ... $ gcc hello.c $ gdb -batch a.out -ex "catch syscall -1" -ex r Catchpoint 1 (syscall -1) Aborted (core dumped) ... Fix this by erroring out if a negative syscall number is used in the catch syscall command. Tested on x86_64-linux. gdb/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR breakpoints/27313 * break-catch-syscall.c (catch_syscall_split_args): Reject negative syscall numbers. gdb/testsuite/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR breakpoints/27313 * gdb.base/catch-syscall.exp: Check that "catch syscall -1" is rejected.
2021-02-05[gdb/testsuite] Add KFAILs for PR symtab/24549Tom de Vries3-3/+37
When an executable contains an index such as a .gdb_index or .debug_names section, gdb ignores the DW_AT_subprogram attribute. This problem has been filed as PR symtab/24549. Add KFAILs for this PR in test-cases gdb.dwarf2/main-subprogram.exp and gdb.fortran/mixed-lang-stack.exp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/main-subprogram.exp: Add KFAIL for PR symtab/24549. * gdb.fortran/mixed-lang-stack.exp: Same.
2021-02-05[gdb/exp] Fix assert when adding ptr to imaginary unitTom de Vries2-0/+16
I'm running into this assertion failure: ... $ gdb -batch -ex "p (void *)0 - 5i" gdbtypes.c:3430: internal-error: \ type* init_complex_type(const char*, type*): Assertion \ `target_type->code () == TYPE_CODE_INT \ || target_type->code () == TYPE_CODE_FLT' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ... This is a regression since commit c34e8714662 "Implement complex arithmetic". Before that commit we had: ... (gdb) p (void *)0 - 5i Argument to arithmetic operation not a number or boolean. ... Fix this in complex_binop by throwing an error, such that we have: ... (gdb) print (void *)0 - 5i Argument to complex arithmetic operation not supported. ... Tested on x86_64-linux. gdb/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR exp/27265 * valarith.c (complex_binop): Throw an error if complex type can't be created. gdb/testsuite/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR exp/27265 * gdb.base/complex-parts.exp: Add tests.
2021-02-05[gdb/symtab] Fix duplicate CUs in create_cus_from_debug_names_listTom de Vries2-0/+21
When running test-case gdb.dwarf2/clang-debug-names.exp, I run into the following warning: ... (gdb) file clang-debug-names^M Reading symbols from clang-debug-names...^M warning: Section .debug_aranges in clang-debug-names has duplicate \ debug_info_offset 0xc7, ignoring .debug_aranges.^M ... This is caused by a missing return in commit 3ee6bb113af "[gdb/symtab] Fix incomplete CU list assert in .debug_names". Fix this by adding the missing return, such that we have instead this warning: ... (gdb) file clang-debug-names^M Reading symbols from clang-debug-names...^M warning: Section .debug_aranges in clang-debug-names \ entry at offset 0 debug_info_offset 0 does not exists, \ ignoring .debug_aranges.^M ... which is a known problem filed as PR25969 - "Ignoring .debug_aranges with clang .debug_names". Tested on x86_64-linux. gdb/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR symtab/27307 * dwarf2/read.c (create_cus_from_debug_names_list): Add missing return. gdb/testsuite/ChangeLog: 2021-02-05 Tom de Vries <tdevries@suse.de> PR symtab/27307 * gdb.dwarf2/clang-debug-names.exp: Check file command warnings.
2021-02-04gdb: Use correct feature in tdesc-regs for ARCShahab Vahedi2-1/+6
tdesc-regs.exp test fails for ARC because the test is not using the correct XML files as target description. With this change, the correct directory and files are used. v2 (after Andrew's remark [1]): - Update the feature file names again. Test results now: Test run by shahab on Tue Jan 26 11:31:16 2021 Target is arc-default-elf32 Host is x86_64-unknown-linux-gnu === gdb tests === Schedule of variations: arc-nsim Running target arc-nsim Running /src/gdb/testsuite/gdb.xml/tdesc-regs.exp ... PASS: gdb.xml/tdesc-regs.exp: set tdesc file single-reg.xml PASS: gdb.xml/tdesc-regs.exp: cd to directory holding xml PASS: gdb.xml/tdesc-regs.exp: set tdesc filename test-extra-regs.xml... PASS: gdb.xml/tdesc-regs.exp: ptype $extrareg PASS: gdb.xml/tdesc-regs.exp: ptype $uintreg PASS: gdb.xml/tdesc-regs.exp: ptype $vecreg PASS: gdb.xml/tdesc-regs.exp: ptype $unionreg PASS: gdb.xml/tdesc-regs.exp: ptype $unionreg.v4 PASS: gdb.xml/tdesc-regs.exp: ptype $structreg PASS: gdb.xml/tdesc-regs.exp: ptype $structreg.v4 PASS: gdb.xml/tdesc-regs.exp: ptype $bitfields PASS: gdb.xml/tdesc-regs.exp: ptype $flags PASS: gdb.xml/tdesc-regs.exp: ptype $mixed_flags PASS: gdb.xml/tdesc-regs.exp: maintenance print reggroups PASS: gdb.xml/tdesc-regs.exp: core-only.xml: set tdesc filename... PASS: gdb.xml/tdesc-regs.exp: core-only.xml: ptype $extrareg === gdb Summary === # of expected passes 16 [1] https://sourceware.org/pipermail/gdb-patches/2021-January/175465.html gdb/testsuite/ChangeLog: * gdb.xml/tdesc-regs.exp: Use correct core-regs for ARC.
2021-02-03Testcase for detaching while stepping over breakpointPedro Alves3-0/+407
This adds a testcase that exercises detaching while GDB is stepping over a breakpoint, in all combinations of: - maint target non-stop off/on - set non-stop on/off - displaced stepping on/off This exercises the bugs fixed in the previous 8 patches. gdb/testsuite/ChangeLog: * gdb.threads/detach-step-over.c: New file. * gdb.threads/detach-step-over.exp: New file.
2021-02-03Testcase for attaching in non-stop modePedro Alves3-0/+211
This adds a testcase exercising attaching to a multi-threaded process, in all combinations of: - set non-stop on/off - maint target non-stop off/on - "attach" vs "attach &" This exercises the bugs fixed in the two previous patches. gdb/testsuite/ChangeLog: * gdb.threads/attach-non-stop.c: New file. * gdb.threads/attach-non-stop.exp: New file.
2021-02-02Inferior without argument prints detail of current inferior.Lancelot SIX3-0/+63
This patch makes the inferior command display information about the current inferior when called with no argument. This behavior is similar to the one of the thread command. Before patch: (gdb) info inferior Num Description Connection Executable * 1 process 19221 1 (native) /home/lsix/tmp/a.out 2 process 19239 1 (native) /home/lsix/tmp/a.out (gdb) inferior 2 [Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)] [Switching to thread 2.1 (process 19239)] #0 0x0000000000401146 in main () (gdb) inferior Argument required (expression to compute). After patch: (gdb) info inferior Num Description Connection Executable * 1 process 18699 1 (native) /home/lsix/tmp/a.out 2 process 18705 1 (native) /home/lsix/tmp/a.out (gdb) inferior 2 [Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)] [Switching to thread 2.1 (process 18705)] #0 0x0000000000401146 in main () (gdb) inferior [Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)] gdb/doc/ChangeLog: * gdb.texinfo (Inferiors Connections and Programs): Document the inferior command when used without argument. gdb/ChangeLog: * NEWS: Add entry for the behavior change of the inferior command. * inferior.c (inferior_command): When no argument is given to the inferior command, display info about the currently selected inferior. gdb/testsuite/ChangeLog: * gdb.base/inferior-noarg.c: New test. * gdb.base/inferior-noarg.exp: New test.
2021-02-02gdb/testsuite: use proc_with_prefix in gdb.base/scope.expSimon Marchi2-5/+9
Fixes: Running /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/scope.exp ... DUPLICATE: gdb.base/scope.exp: print 'scope0.c'::filelocal_ro DUPLICATE: gdb.base/scope.exp: print 'scope0.c'::filelocal_ro DUPLICATE: gdb.base/scope.exp: next gdb/testsuite/ChangeLog: * gdb.base/scope.exp: Use proc_with_prefix. Change-Id: Ic40e24a603da6f2a4f8003b74b2ff3040d2b098d
2021-02-02gdb/testsuite: add test for .debug_{rng,loc}lists section without offset arraySimon Marchi5-13/+164
It is possible for the tables in the .debug_{rng,loc}lists sections to not have an array of offsets. In that case, the offset_entry_count field of the header is 0. The forms DW_FORM_{rng,loc}listx (reference by index) can't be used with that table. Instead, the DW_FORM_sec_offset form, which references a {rng,loc}list by direct offset in the section, must be used. From what I saw, this is what GCC currently produces. Add tests for this case. I didn't see any bug related to this, I just think that it would be nice to have coverage for this. A new `-with-offset-array` option is added to the `table` procs, used when generating {rng,loc}lists, to decide whether to generate the offset array. gdb/testsuite/ChangeLog: * lib/dwarf.exp (rnglists): Add -no-offset-array option to table proc. * gdb.dwarf2/rnglists-sec-offset.exp: Add test for .debug_rnglists table without offset array. * gdb.dwarf2/loclists-sec-offset.exp: Add test for .debug_loclists table without offset array. Change-Id: I8e34a7bf68c9682215ffbbf66600da5b7db91ef7
2021-02-02gdb/dwarf: split dwarf2_cu::ranges_base in twoSimon Marchi4-9/+134
Consider the test case added in this patch. It defines a compilation unit with a DW_AT_rnglists_base attribute (used for attributes of form DW_FORM_rnglistx), but also uses DW_AT_ranges of form DW_FORM_sec_offset: 0x00000027: DW_TAG_compile_unit DW_AT_ranges [DW_FORM_sec_offset] (0x0000004c [0x0000000000005000, 0x0000000000006000)) DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000044) The DW_AT_rnglists_base does not play a role in reading the DW_AT_ranges of form DW_FORM_sec_offset, but it should also not do any harm. This case is currently not handled correctly by GDB. This is not something that a compiler is likely to emit, but in my opinion there's no reason why GDB should fail reading it. The problem is that in partial_die_info::read and a few other places where the same logic is replicated, the cu->ranges_base value, containing the DW_AT_rnglists_base value, is wrongfully added to the DW_AT_ranges value. It is quite messy how to decide whether cu->ranges_base should be added to the attribute's value or not. But to summarize, the only time we want to add it is when the attribute comes from a pre-DWARF 5 split unit file (a .dwo) [1]. In this case, the DW_AT_ranges attribute from the split unit file will have form DW_FORM_sec_offset, pointing somewhere in the linked file's .debug_ranges section. *But* it's not a "true" DW_FORM_sec_offset, in that it's an offset relative to the beginning of that CU's contribution in the section, not relative to the beginning of the section. So in that case, and only that case, do we want to add the ranges base value, which we found from the DW_AT_GNU_ranges_base attribute on the skeleton unit. Almost all instances of the DW_AT_ranges attribute will be found in the split unit (on DW_TAG_subprogram, for example), and therefore need to have the ranges base added. However, the DW_TAG_compile_unit DIE in the skeleton may also have a DW_AT_ranges attribute. For that one, the ranges base must not be added. Once the DIEs have been loaded in GDB, however, the distinction between what's coming from the skeleton and what's coming from the split unit is not clear. It is all merged in one big happy tree. So how do we know if a given attribute comes from the split unit or not? We use the fact that in pre-DWARF 5 split DWARF, DW_AT_ranges is found on the skeleton's DW_TAG_compile_unit (in the linked file) and never in the split unit's DW_TAG_compile_unit. This is why you have this in partial_die_info::read: int need_ranges_base = (tag != DW_TAG_compile_unit && attr.form != DW_FORM_rnglistx); However, with the corner case described above (where we have a DW_AT_rnglists_base attribute and a DW_AT_ranges attribute of form DW_FORM_sec_offset) the condition gets it wrong when it encounters an attribute like DW_TAG_subprogram with a DW_AT_ranges attribute of DW_FORM_sec_offset form: it thinks that it is necessary to add the base, when it reality it is not. The problem boils down to failing to differentiate these cases: - a DW_AT_ranges attribute of form DW_FORM_sec_offset in a pre-DWARF 5 split unit (in which case we need to add the base) - a DW_AT_ranges attribute of form DW_FORM_sec_offset in a DWARF 5 non-split unit (in which case we must not add the base) What makes it unnecessarily complex is that the cu->ranges_base field is overloaded, used to hold the pre-DWARF 5, non-standard DW_AT_GNU_ranges_base and the DWARF 5 DW_AT_rnglists_base. In reality, these two are called "bases" but are not the same thing. The result is that we need twisted conditions to try to determine whether or not we should add the base to the attribute's value. To fix it, split the field in two distinct fields. I renamed everything related to the "old" ranges base to "gnu_ranges_base", to make it clear that it's about the non-standard, pre-DWARF 5 thing. And everything related to the DWARF 5 thing gets renamed "rnglists". I think it becomes much easier to reason this way. The issue described above gets fixed by the fact that the DW_AT_rnglists_base value does not end up in cu->gnu_ranges_base, so cu->gnu_ranges_base stays 0. The condition to determine whether gnu_ranges_base should be added can therefore be simplified back to: tag != DW_TAG_compile_unit ... as it was before rnglistx support was added. Extend the gdb.dwarf2/rnglists-sec-offset.exp to cover this case. I also extended the test case for loclists similarly, just to see if there would be some similar problem. There wasn't, but I think it's not a bad idea to test that case for loclists as well, so I left it in the patch. [1] https://gcc.gnu.org/wiki/DebugFission gdb/ChangeLog: * dwarf2/die.h (struct die_info) <ranges_base>: Split in... <gnu_ranges_base>: ... this... <rnglists_base>: ... and this. * dwarf2/read.c (struct dwarf2_cu) <ranges_base>: Split in... <gnu_ranges_base>: ... this... <rnglists_base>: ... and this. (read_cutu_die_from_dwo): Adjust (dwarf2_get_pc_bounds): Adjust (dwarf2_record_block_ranges): Adjust. (read_full_die_1): Adjust (partial_die_info::read): Adjust. (read_rnglist_index): Adjust. gdb/testsuite/ChangeLog: * gdb.dwarf2/rnglists-sec-offset.exp: Add test for DW_AT_ranges of DW_FORM_sec_offset form plus DW_AT_rnglists_base attribute. * gdb.dwarf2/loclists-sec-offset.exp: Add test for DW_AT_location of DW_FORM_sec_offset plus DW_AT_loclists_base attribute Change-Id: Icd109038634b75d0e6e9d7d1dcb62fb9eb951d83
2021-02-02gdb/testsuite: add .debug_loclists testsSimon Marchi6-0/+551
Add tests for the various issues fixed in the previous patches. Add a new "loclists" procedure to the DWARF assembler, to allow generating .debug_loclists sections. gdb/testsuite/ChangeLog: PR gdb/26813 * lib/dwarf.exp (_handle_DW_FORM): Handle DW_FORM_loclistx. (loclists): New proc. * gdb.dwarf2/loclists-multiple-cus.c: New. * gdb.dwarf2/loclists-multiple-cus.exp: New. * gdb.dwarf2/loclists-sec-offset.c: New. * gdb.dwarf2/loclists-sec-offset.exp: New. Change-Id: I209bcb2a9482762ae943e518998d1f7761f76928
2021-02-02gdb/testsuite: DWARF assembler: add context parameters to _locationSimon Marchi2-13/+32
The _location proc is used to assemble a location description. It needs to know some contextual information: - size of an address - size of an offset (into another DWARF section) - DWARF version It currently get all this directly from global variables holding the compilation unit information. This is fine because as of now, all location descriptions are generated in the context of creating a compilation unit. However, a subsequent patch will generate location descriptions while generating a .debug_loclists section. _location should therefore no longer rely on the current compilation unit's properties. Change it to accept these values as parameters instead of accessing the values for the CU. No functional changes intended. gdb/testsuite/ChangeLog: * lib/dwarf.exp (_location): Add parameters. (_handle_DW_FORM): Adjust. Change-Id: Ib94981979c83ffbebac838081d645ad71c221637
2021-02-02gdb/testsuite: add .debug_rnglists testsSimon Marchi4-3/+375
Add tests for the various issues fixed in the previous patches. Add a new "rnglists" procedure to the DWARF assembler, to allow generating .debug_rnglists sections. A trivial change is required to support the DWARF 5 CU header layout. gdb/testsuite/ChangeLog: PR gdb/26813 * lib/dwarf.exp (_handle_DW_FORM): Handle DW_FORM_rnglistx. (cu): Generate header for DWARF 5. (rnglists): New proc. * gdb.dwarf2/rnglists-multiple-cus.exp: New. * gdb.dwarf2/rnglists-sec-offset.exp: New. Change-Id: I5b297e59c370c60cf671dec19796a6c3b9a9f632
2021-02-02[gdb/symtab] Fix assert in write_one_signatured_typeTom de Vries2-0/+20
When running test-case gdb.dwarf2/fission-reread.exp with target board cc-with-gdb-index, we run into an abort during the generation of the gdb-index by cc-with-tweaks.sh: ... build/gdb/testsuite/cache/gdb.sh: line 1: 27275 Aborted (core dumped) ... This can be reproduced on the command line like this: ... $ gdb -batch ./outputs/gdb.dwarf2/fission-reread/fission-reread \ -ex 'save gdb-index ./outputs/gdb.dwarf2/fission-reread' warning: Could not find DWO TU fission-reread.dwo(0x9022f1ceac7e8b19) \ referenced by TU at offset 0x0 [in module fission-reread] warning: Could not find DWO CU fission-reread.dwo(0x807060504030201) \ referenced by CU at offset 0x561 [in module fission-reread] Aborted (core dumped) ... The abort is a segfault due to a using a nullptr psymtab in write_one_signatured_type. The problem is that we're trying to write index entries for the type unit with signature: ... (gdb) p /x entry->signature $2 = 0x9022f1ceac7e8b19 ... which is a skeleton type unit: ... Contents of the .debug_types section: Compilation Unit @ offset 0x0: Length: 0x4a (32-bit) Version: 4 Abbrev Offset: 0x165 Pointer Size: 4 Signature: 0x9022f1ceac7e8b19 Type Offset: 0x0 <0><17>: Abbrev Number: 2 (DW_TAG_type_unit) <18> DW_AT_comp_dir : /tmp/src/gdb/testsuite <2f> DW_AT_GNU_dwo_name: fission-reread.dwo <42> DW_AT_GNU_pubnames: 0x0 <46> DW_AT_GNU_pubtypes: 0x0 <4a> DW_AT_GNU_addr_base: 0x0 ... referring to a .dwo file, but as the warnings show, the .dwo file is not found. Fix this by skipping the type unit in write_one_signatured_type if psymtab == nullptr. Tested on x86_64-linux. gdb/ChangeLog: 2021-02-02 Tom de Vries <tdevries@suse.de> PR symtab/24620 * dwarf2/index-write.c (write_one_signatured_type): Skip if psymtab == nullptr. gdb/testsuite/ChangeLog: 2021-02-02 Tom de Vries <tdevries@suse.de> PR symtab/24620 * gdb.dwarf2/fission-reread.exp: Add test-case.
2021-02-01[gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_indexTom de Vries11-52/+64
When running test-case gdb.dwarf2/fission-reread.exp with target board cc-with-gdb-index, we run into: ... gdb compile failed, warning: Could not find DWO TU \ fission-reread.dwo(0x9022f1ceac7e8b19) referenced by TU at offset 0x0 \ [in module outputs/gdb.dwarf2/fission-reread/fission-reread] ... The problem is that the .dwo file is not found. There's code added in the .exp file to make sure the .dwo can be found: ... # Make sure we can find the .dwo file, regardless of whether we're # running in parallel mode. gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ "set debug-file-directory" ... This works normally, but not for the gdb invocation done by cc-with-tweaks.sh for target board cc-with-gdb-index. Fix this by finding the full path to the .dwo file and passing it to the compilation. Tested on x86_64-linux with native and target boards cc-with-gdb-index, cc-with-debug-names and readnow. gdb/testsuite/ChangeLog: 2021-02-01 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/fission-base.S: Pass -DDWO=$dwo. * gdb.dwarf2/fission-loclists-pie.S: Same. * gdb.dwarf2/fission-loclists.S: Same. * gdb.dwarf2/fission-multi-cu.S: Same. * gdb.dwarf2/fission-reread.S: Same. * gdb.dwarf2/fission-base.exp: Use DWO. * gdb.dwarf2/fission-loclists-pie.exp: Same. * gdb.dwarf2/fission-loclists.exp: Same. * gdb.dwarf2/fission-multi-cu.exp: Same. * gdb.dwarf2/fission-reread.exp: Same.
2021-01-29[gdb/breakpoint] Fix stepping past non-stmt line-table entriesTom de Vries3-0/+176
Consider the test-case small.c: ... $ cat -n small.c 1 __attribute__ ((noinline, noclone)) 2 int foo (char *c) 3 { 4 asm volatile ("" : : "r" (c) : "memory"); 5 return 1; 6 } 7 8 int main () 9 { 10 char tpl1[20] = "/tmp/test.XXX"; 11 char tpl2[20] = "/tmp/test.XXX"; 12 int fd1 = foo (tpl1); 13 int fd2 = foo (tpl2); 14 if (fd1 == -1) { 15 return 1; 16 } 17 18 return 0; 19 } ... Compiled with gcc-8 and optimization: ... $ gcc-8 -O2 -g small.c ... We step through the calls to foo, but fail to visit line 13: ... 12 int fd1 = foo (tpl1); (gdb) step foo (c=c@entry=0x7fffffffdea0 "/tmp/test.XXX") at small.c:5 5 return 1; (gdb) step foo (c=c@entry=0x7fffffffdec0 "/tmp/test.XXX") at small.c:5 5 return 1; (gdb) step main () at small.c:14 14 if (fd1 == -1) { (gdb) ... This is caused by the following. The calls to foo are implemented by these insns: .... 4003df: 0f 29 04 24 movaps %xmm0,(%rsp) 4003e3: 0f 29 44 24 20 movaps %xmm0,0x20(%rsp) 4003e8: e8 03 01 00 00 callq 4004f0 <foo> 4003ed: 48 8d 7c 24 20 lea 0x20(%rsp),%rdi 4003f2: 89 c2 mov %eax,%edx 4003f4: e8 f7 00 00 00 callq 4004f0 <foo> 4003f9: 31 c0 xor %eax,%eax ... with corresponding line table entries: ... INDEX LINE ADDRESS IS-STMT 8 12 0x00000000004003df Y 9 10 0x00000000004003df 10 11 0x00000000004003e3 11 12 0x00000000004003e8 12 13 0x00000000004003ed 13 12 0x00000000004003f2 14 13 0x00000000004003f4 Y 15 13 0x00000000004003f4 16 14 0x00000000004003f9 Y 17 14 0x00000000004003f9 ... Once we step out of the call to foo at 4003e8, we land at 4003ed, and gdb enters process_event_stop_test to figure out what to do. That entry has is-stmt=n, so it's not the start of a line, so we don't stop there. However, we do update ecs->event_thread->current_line to line 13, because the frame has changed (because we stepped out of the function). Next we land at 4003f2. Again the entry has is-stmt=n, so it's not the start of a line, so we don't stop there. However, because the frame hasn't changed, we don't update update ecs->event_thread->current_line, so it stays 13. Next we land at 4003f4. Now is-stmt=y, so it's the start of a line, and we'd like to stop here. But we don't stop because this test fails: ... if ((ecs->event_thread->suspend.stop_pc == stop_pc_sal.pc) && (ecs->event_thread->current_line != stop_pc_sal.line || ecs->event_thread->current_symtab != stop_pc_sal.symtab)) { ... because ecs->event_thread->current_line == 13 and stop_pc_sal.line == 13. Fix this by resetting ecs->event_thread->current_line to 0 if is-stmt=n and the frame has changed, such that we have: ... 12 int fd1 = foo (tpl1); (gdb) step foo (c=c@entry=0x7fffffffdbc0 "/tmp/test.XXX") at small.c:5 5 return 1; (gdb) step main () at small.c:13 13 int fd2 = foo (tpl2); (gdb) ... Tested on x86_64-linux, with gcc-7 and gcc-8. gdb/ChangeLog: 2021-01-29 Tom de Vries <tdevries@suse.de> PR breakpoints/26063 * infrun.c (process_event_stop_test): Reset ecs->event_thread->current_line to 0 if is-stmt=n and frame has changed. gdb/testsuite/ChangeLog: 2021-01-29 Tom de Vries <tdevries@suse.de> PR breakpoints/26063 * gdb.dwarf2/dw2-step-out-of-function-no-stmt.c: New test. * gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp: New file.
2021-01-29[gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32 and gcc-10Tom de Vries2-24/+6
When running test-case gdb.opt/solib-intra-step.exp with target board unix/-m32 and gcc-10, I run into: ... (gdb) step^M __x86.get_pc_thunk.bx () at ../sysdeps/i386/crti.S:68^M 68 ../sysdeps/i386/crti.S: No such file or directory.^M (gdb) step^M shlib_second (dummy=0) at solib-intra-step-lib.c:23^M 23 abort (); /* second-hit */^M (gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit ... The problem is that the test-case expects to step past the retry line, which is optional. Fix this by removing the state tracking logic from the gdb_test_multiples. It makes the test more difficult to understand, and doesn't specifically test for faulty gdb behaviour. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-29 Tom de Vries <tdevries@suse.de> * gdb.opt/solib-intra-step.exp: Remove state tracking logic.
2021-01-28[gdb/testsuite] Fix gdb.arch/i386-gnu-cfi.expTom de Vries2-7/+25
When running test-case gdb.arch/i386-gnu-cfi.exp with target board unix/-m32, I get: ... (gdb) up 3^M 79 abort.c: No such file or directory.^M (gdb) FAIL: gdb.arch/i386-gnu-cfi.exp: shift up to the modified frame ... The preceding backtrace looks like this: ... (gdb) bt^M #0 0xf7fcf549 in __kernel_vsyscall ()^M #1 0xf7ce8896 in __libc_signal_restore_set (set=0xffffc3bc) at \ ../sysdeps/unix/sysv/linux/internal-signals.h:104^M #2 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:47^M #3 0xf7cd0314 in __GI_abort () at abort.c:79^M #4 0x0804919f in gate (gate=0x8049040 <abort@plt>, data=0x0) at gate.c:3^M #5 0x08049176 in main () at i386-gnu-cfi.c:27^M ... with function gate at position #4, while on another system where the test passes, I see instead function gate at position #3. Fix this by capturing the position of function gate in the backtrace, and using that in the rest of the test instead of hardcoded constant 3. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-28 Tom de Vries <tdevries@suse.de> * gdb.arch/i386-gnu-cfi.exp: Capture the position of function gate in the backtrace, and use that in the rest of the test instead of hardcoded constant 3. Use "frame" instead of "up" for robustness.
2021-01-28[gdb/testsuite] Fix g0 search in gdb.arch/i386-sse-stack-align.expTom de Vries4-27/+34
When running test-case gdb.arch/i386-sse-stack-align.exp on target board unix/-m32, I run into: ... (gdb) print (int) g0 ()^M Invalid data type for function to be called.^M (gdb) FAIL: gdb.arch/i386-sse-stack-align.exp: print (int) g0 () ... Gdb is supposed to use minimal symbol g0: ... $ nm i386-sse-stack-align | grep g0 08049194 t g0 ... but instead it finds a g0 symbol in the debug info of libm, specifically in ./sysdeps/ieee754/ldbl-96/e_lgammal_r.c. Fix this by renaming g[0-4] to test_g[0-4]. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-28 Tom de Vries <tdevries@suse.de> * gdb.arch/i386-sse-stack-align.S: Rename g[0-4] to test_g[0-4]. * gdb.arch/i386-sse-stack-align.c: Same. * gdb.arch/i386-sse-stack-align.exp: Same.
2021-01-28gdb/testsuite: unset XDG_CONFIG_HOMEAndrew Burgess2-0/+11
Since this commit: commit 64aaad6349d2b2c45063a5383f877ce9a3a0c354 Date: Fri Sep 25 14:50:56 2020 +0100 gdb: use get_standard_config_dir when looking for .gdbinit GDB has been checking for ${XDG_CONFIG_HOME}/gdb/gdbinit on startup. Most tests pass -nx to GDB to block loading of gdbinit files, but there are a few tests (e.g. gdb.base/gdbinit-history.exp) that don't use -nx and instead setup a fake HOME directory containing a gdbinit file. However, since the above commit, if XDG_CONFIG_HOME is set then once -nx is no longer being passed GDB will load any gdbinit file it finds in that directory, which could cause the test to fail. As a concrete example: $ mkdir -p fake_xdg_config_home/gdb/ $ cat <<EOF >fake_xdg_config_home/gdb/gdbinit echo goodbye\n quit EOF $ export XDG_CONFIG_HOME=$PWD/fake_xdg_config_home $ make check-gdb TESTS="gdb.base/gdbinit-history.exp" Should result in the test failing. The solution I propose is to unset XDG_CONFIG_HOME in default_gdb_init, we already unset a bunch of environment variables in this proc. gdb/testsuite/ChangeLog: * lib/gdb.exp (default_gdb_init): Unset XDG_CONFIG_HOME.
2021-01-28[gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp with -m32 and gcc-10Tom de Vries2-2/+5
When running test-case gdb.ada/out_of_line_in_inlined.exp with target board unix/-m32 on a system with gcc-10 default compiler, we run into: ... (gdb) break foo_o224_021.child1.child2^M Breakpoint 1 at 0x804ba59: foo_o224_021.child1.child2. (3 locations)^M (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \ break foo_o224_021.child1.child2 ... The test does not expect the "3 locations" part. Fix this by using gdb_breakpoint instead of gdb_test. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-28 Tom de Vries <tdevries@suse.de> * gdb.ada/out_of_line_in_inlined.exp: Use gdb_breakpoint.
2021-01-28[gdb/testsuite] Fix ERROR in gdb.dwarf2/dw2-out-of-range-end-of-seq.expTom de Vries2-3/+10
When running test-case gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on a system with debug packages installed, I run into: ... (gdb) maint info line-table^M ... <lots of output> ... ERROR: internal buffer is full. UNRESOLVED: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: \ END with address 1 eliminated ... Fix this by limiting the output of the command using a regexp. I also noticed that when making the regexp match nothing, meaning the command has no output, the test didn't FAIL. Fixed this by adding a PASS pattern. I also noticed that the FAIL pattern didn't work with -m32, fixed that as well. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-28 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: Add regexp to "maint info line-table". Make PASS pattern more specific. Make FAIL pattern work for -m32.
2021-01-27Avoid use after free with logging and debug redirect.Lancelot SIX2-0/+15
This patch addresses PR gdb/27133. Before it, the following succession of commands would cause gdb to crash: set logging redirect on set logging debugredirect on set logging on The problem eventually comes down to a use after free. The function cli_interp_base::set_logging is called with a unique_ptr argument that holds a pointer to the redirection file. In the problematic use case, no-one ever took ownership of that pointer (as far as unique_ptr is concerned), so the call to its dtor at the end of the function causes the file object to be deleted. Any later use of the pointer to the redirection file is therefore an error. This patch ensures that the unique_ptr is released when required (so it does not assume ownership anymore). The internal logic of cli_interp_base::set_logging takes care of freeing the ui_file when it is not necessary anymore using the saved_output.file_to_delete field. gdb/ChangeLog: PR gdb/27133 * cli/cli-interp.c (cli_interp_base::set_logging): Ensure the unique_ptr is released when the wrapped pointer is kept for later use. gdb/testsuite/ChangeLog: PR gdb/27133 * gdb.base/ui-redirect.exp: Add test case that ensures that redirecting both logging and debug does not cause gdb to crash.
2021-01-27GDB: aarch64: Add ability to displaced step over a BR/BLR instructionMatthew Malcomson2-0/+85
Enable displaced stepping over a BR/BLR instruction Displaced stepping over an instruction executes a instruction in a scratch area and then manually fixes up the PC address to leave execution where it would have been if the instruction were in its original location. The BR instruction does not need modification in order to run correctly at a different address, but the displaced step fixup method should not manually adjust the PC since the BR instruction sets that value already. The BLR instruction should also avoid such a fixup, but must also have the link register modified to point to just after the original code location rather than back to the scratch location. This patch adds the above functionality. We add this functionality by modifying aarch64_displaced_step_others rather than by adding a new visitor method to aarch64_insn_visitor. We choose this since it seems that visitor approach is designed specifically for PC relative instructions (which must always be modified when executed in a different location). It seems that the BR and BLR instructions are more like the RET instruction which is already handled specially in aarch64_displaced_step_others. This also means the gdbserver code to relocate an instruction when creating a fast tracepoint does not need to be modified, since nothing special is needed for the BR and BLR instructions there. Regression tests showed nothing untoward on native aarch64 (though it took a while for me to get the testcase to account for PIE). ------##### Original observed (mis)behaviour before was that displaced stepping over a BR or BLR instruction would not execute the function they called. Most easily seen by putting a breakpoint with a condition on such an instruction and a print statement in the functions they called. When run with the breakpoint enabled the function is not called and "numargs called" is not printed. When run with the breakpoint disabled the function is called and the message is printed. --- GDB Session ~ [15:57:14] % gdb ../using-blr Reading symbols from ../using-blr...done. (gdb) disassemble blr_call_value Dump of assembler code for function blr_call_value: ... 0x0000000000400560 <+28>: blr x2 ... 0x00000000004005b8 <+116>: ret End of assembler dump. (gdb) break *0x0000000000400560 Breakpoint 1 at 0x400560: file ../using-blr.c, line 22. (gdb) condition 1 10 == 0 (gdb) run Starting program: /home/matmal01/using-blr [Inferior 1 (process 33279) exited with code 012] (gdb) disable 1 (gdb) run Starting program: /home/matmal01/using-blr numargs called [Inferior 1 (process 33289) exited with code 012] (gdb) Test program: ---- using-blr ---- \#include <stdio.h> typedef int (foo) (int, int); typedef void (bar) (int, int); struct sls_testclass { foo *x; bar *y; int left; int right; }; __attribute__ ((noinline)) int blr_call_value (struct sls_testclass x) { int retval = x.x(x.left, x.right); if (retval % 10) return 100; return 9; } __attribute__ ((noinline)) int blr_call (struct sls_testclass x) { x.y(x.left, x.right); if (x.left % 10) return 100; return 9; } int numargs (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right) { printf("numargs called\n"); return 10; } void altfunc (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right) { printf("altfunc called\n"); } int main(int argc, char **argv) { struct sls_testclass x = { .x = numargs, .y = altfunc, .left = 1, .right = 2 }; if (argc > 2) { blr_call (x); } else blr_call_value (x); return 10; }
2021-01-26[gdb/testsuite] Fix gdb.threads/killed-outside.exp with -m32Tom de Vries2-0/+7
When running test-case gdb.threads/killed-outside.exp with target board unix/-m32, we run into: ... (gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior Executing on target: kill -9 10969 (timeout = 300) spawn -ignore SIGHUP kill -9 10969^M continue^M Continuing.^M [Thread 0xf7cb4b40 (LWP 10973) exited]^M ^M Program terminated with signal SIGKILL, Killed.^M The program no longer exists.^M (gdb) FAIL: gdb.threads/killed-outside.exp: prompt after first continue ... Fix this by allowing this output. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-26 Tom de Vries <tdevries@suse.de> * gdb.threads/killed-outside.exp: Allow regular output.
2021-01-26[gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32Tom de Vries2-17/+42
When running test-case gdb.opt/solib-intra-step.exp with target board unix/-m32, we run into: ... (gdb) step^M __x86.get_pc_thunk.bx () at ../sysdeps/i386/crti.S:66^M 66 ../sysdeps/i386/crti.S: No such file or directory.^M (gdb) FAIL: gdb.opt/solib-intra-step.exp: first-hit (optimized) ... The thunk is a helper function for PIC, and given that we have line info for it, we step into. Fix this by allowing the step into the thunk, and stepping out of it. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-26 Tom de Vries <tdevries@suse.de> * gdb.opt/solib-intra-step.exp: Handle stepping into thunk.
2021-01-25[gdb/symtab] Handle DW_AT_ranges with DW_FORM_sec_off in partial DIETom de Vries3-1/+45
While looking into a failure in gdb.go/package.exp with gcc-11, I noticed that gdb shows some complaints when loading the executable (also with gcc-10, where the test-case passes): ... $ gdb -batch -iex "set complaints 100" package.10 -ex start During symbol reading: Attribute value is not a constant (DW_FORM_sec_offset) Temporary breakpoint 1 at 0x402ae6: file gdb.go/package1.go, line 8. During symbol reading: Attribute value is not a constant (DW_FORM_sec_offset) During symbol reading: Invalid .debug_rnglists data (no base address) ... Fix this by using as_unsigned () to read DW_AT_ranges in the partial DIE reader, similar to how that is done in dwarf2_get_pc_bounds. Tested on x86_64-linux. gdb/ChangeLog: 2021-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de> Simon Marchi <simon.marchi@polymtl.ca> Tom de Vries <tdevries@suse.de> * dwarf2/read.c (partial_die_info::read): Use as_unsigned () for DW_AT_ranges. gdb/testsuite/ChangeLog: 2021-01-25 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-ranges-psym.exp (gdb_load_no_complaints): New proc. * lib/gdb.exp: Use gdb_load_no_complaints.
2021-01-25Fix fixed-point regression with recent GCCTom Tromey4-0/+18
A recent version of GCC changed how fixed-point types are described. For example, a denominator in one test case now looks like: GNU_denominator (exprloc) [ 0] implicit_value: 16 byte block: 00 00 b8 9d 0d 69 55 a0 01 00 00 00 00 00 00 00 ... the difference being that this now uses exprloc and emits a DW_OP_implicit_value for the 16-byte block. (DWARF 5 still uses DW_FORM_data16.) This change was made here: https://gcc.gnu.org/pipermail/gcc-patches/2020-December/560897.html This patch updates gdb to handle this situation. Note that, before GCC 11, this test would not give the same answer. Earlier versions of GCC fell back to GNAT encodings for this case. gdb/ChangeLog 2021-01-25 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (get_mpz): New function. (get_dwarf2_rational_constant): Use it. gdb/testsuite/ChangeLog 2021-01-25 Tom Tromey <tromey@adacore.com> * gdb.ada/fixed_points.exp: Add regression test. * gdb.ada/fixed_points/fixed_points.adb (FP5_Var): New variable. * gdb.ada/fixed_points/pck.adb (Delta5, FP5_Type): New.
2021-01-25Specially handle array contexts in Ada expression resolutionTom Tromey2-0/+9
A user noticed that the Ada expression code in gdb did not automatically disambiguate an enumerator in an array context. That is, an expression like "print array(enumerator)" is not ambiguous, even if "enumerator" is declared in multiple enumerations, because the correct one can be found by examining the array's index type. This patch changes the Ada expression resolution code to handle this case. gdb/ChangeLog 2021-01-25 Tom Tromey <tromey@adacore.com> * ada-lang.c (resolve_subexp): Handle array context. gdb/testsuite/ChangeLog 2021-01-25 Tom Tromey <tromey@adacore.com> * gdb.ada/local-enum.exp: Add enumerator resolution test.
2021-01-25Add test case for symbol menu for local enumeratorsTom Tromey3-0/+116
Ada will normally present a menu to the user to allow manual disambiguation of symbols. The AdaCore internal GDB had a bug that prevented this from happening. Although this bug is not in the FSF GDB, it seemed worthwhile to write a test case to ensure this. gdb/testsuite/ChangeLog 2021-01-25 Tom Tromey <tromey@adacore.com> * gdb.ada/local-enum.exp: New file. * gdb.ada/local-enum/local.adb: New file.
2021-01-23Disable bracketed paste mode in GDB testsTom Tromey2-7/+12
I have a patch to import GNU readline 8.1 into GDB. However, when running the tests, there were a number of failures due to "bracketed paste mode". This is a terminal feature that readline 8.1 enables by default. The simplest way to work around this was to always make a ".inputrc" for GDB tests that will tell readline to disable brackted paste mode. gdb/testsuite/ChangeLog 2021-01-23 Tom Tromey <tom@tromey.com> * lib/gdb.exp (default_gdb_init): Set INPUTRC to a cached file.
2021-01-22Fix expected output of gdb.base/line65535.exp with dwarf-5Bernd Edlinger2-1/+5
With gcc & binutils built from latest git revision this test case fails because the output of the break command changes and contains the full path name of the source file, while previously only the file name was printed. Fixed that by adjusting the test expectation. 2021-01-22 Bernd Edlinger <bernd.edlinger@hotmail.de> * gdb.base/line65535.exp: Fix test expectation.
2021-01-22gdb/testsuite: eliminate gdb_suppress_tests mechanismSimon Marchi20-772/+300
There is a lot of support code for the test suppression mechanism. But as far as I know, it is not useful. The gdb_suppress_tests proc is in fact disabled with this comment that has been there since forever: return; # fnf - disable pending review of results where # testsuite ran better without this I suggest to just remove everything related to test suppression, that removes some unnecessary complexity from the support code and the tests. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_test_multiple): Remove things related to test suppression. (default_gdb_exit): Likewise. (default_gdb_spawn): Likewise. (send_gdb): Likewise. (gdb_expect): Likewise. (gdb_expect_list): Likewise. (default_gdb_init): Likewise. (gdb_suppress_entire_file): Remove. (gdb_suppress_tests): Remove. (gdb_stop_suppressing_tests): Remove. (gdb_clear_suppressed): Remove. * lib/mi-support.exp (mi_uncatched_gdb_exit): Remove things related to test suppression. (default_mi_gdb_start): Likewise. (mi_gdb_reinitialize_dir): Likewise. (mi_gdb_test): Likewise. (mi_run_cmd_full): Likewise. (mi_runto_helper): Likewise. (mi_execute_to): Likewise. * lib/prompt.exp (default_prompt_gdb_start): Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/dfp-test.exp: Likewise. * gdb.base/endian.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/hbreak2.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/until.exp: Likewise. * gdb.cp/misc.exp: Likewise. Change-Id: Ie6d3025091691ba72010faa28b85ebd417b738f7
2021-01-22gdb: add new version styleAndrew Burgess3-1/+15
This commit adds a new 'version' style, which replaces the hard coded styling currently used for GDB's version string. GDB's version number is displayed: 1. In the output of 'show version', and 2. When GDB starts up (without the --quiet option). This new style can only ever affect the first of these two cases as the second case is printed before GDB has processed any initialization files, or processed any GDB commands passed on the command line. However, because the first case exists I think this commit makes sense, it means the style is no longer hard coded into GDB, and we can add some tests that the style can be enabled/disabled correctly. This commit is an alternative to a patch Tom posted here: https://sourceware.org/pipermail/gdb-patches/2020-June/169820.html I've used the style name 'version' instead of 'startup' to reflect what the style is actually used for. If other parts of the startup text end up being highlighted I imagine they would get their own styles based on what is being highlighted. I feel this is more inline with the other style names that are already in use within GDB. I also decoupled adding this style from the idea of startup options, and the possibility of auto-saving startup options. Those ideas can be explored in later patches. This commit should probably be considered only a partial solution to issue PR cli/25956. The colours of the style are no longer hard coded, however, it is still impossible to change the styling of the version string displayed during startup, so in one sense, the styling of that string is still "hard coded". A later patch will hopefully extend GDB to allow it to adjust the version styling before the initial version string is printed. gdb/ChangeLog: PR cli/25956 * cli/cli-style.c: Add 'cli/cli-setshow.h' include. (version_style): Define. (cli_style_option::cli_style_option): Add intensity parameter, and use as appropriate. (_initialize_cli_style): Register version style set/show commands. * cli/cli-style.h (cli_style_option): Add intensity parameter. (version_style): Declare. * top.c (print_gdb_version): Use version_stype, and styled_string to print the GDB version string. gdb/doc/ChangeLog: PR cli/25956 * gdb.texinfo (Output Styling): Document version style. gdb/testsuite/ChangeLog: PR cli/25956 * gdb.base/style.exp (run_style_tests): Add version string test. (test_startup_version_string): Use version style name. * lib/gdb-utils.exp (style): Handle version style name.
2021-01-22gdb: don't print escape characters when a style is disabledAndrew Burgess2-172/+268
While working on another patch I noticed that if I disable a single style with, for example: set style filename background none set style filename foreground none set style filename intensity normal Then in some places escape characters are still injected into the output stream. This is a bit of an edge case, and I can't think when this would actually cause problems, but it still felt like a bit of an annoyance. One place where this does impact is in testing, where it becomes harder to write tight test patterns if it is not obvious when GDB will decide to inject escape sequences. It's especially annoying because depending on how something is printed then GDB might, or might not, add escape characters. So this would not add escape characters if the filename style was disabled: fprintf_filtered (file, "%ps", styled_string (file_name_style.style (), "This is a test")); But this would add escape characters: fprintf_styled (file, file_name_style.style (), "%s", "This is a test"); I tracked this down to some calls to set_output_style in utils.c. Currently some calls to set_output_style (in utils.c) are guarded like this: if (!STYLE.is_default ()) set_output_style (stream, STYLE); But some calls are not. It is the calls that are NOT guarded that cause the extra escape sequences to be emitted. My initial proposal to resolve this issue was simply to ensure that all calls to set_output_style were guarded. The patch I posted for this can be found here: https://sourceware.org/pipermail/gdb-patches/2021-January/175096.html The feedback on this proposal was that it might be better to guard against the escape sequences being emitted at a later lever, right down at emit_style_escape. So this is what this version does. In emit_style_escape we already track the currently applied style, so if the style we are being asked to switch to is the same as the currently applied style then no escape sequence needs to be emitted. Making this change immediately exposed some issues in fputs_maybe_filtered related to line wrapping. The best place to start to understand what's going on with the styling and wrapping is look at the test: gdb.base/style.exp: all styles enabled: frame when width=20 If you run this test and then examine the output in an editor so the escape sequences can be seen you'll see the duplicate escape sequences that are emitted before this patch, the compare to after this patch you'll see the set of escape sequences should be the minimum required. In order to test these changes I have rewritten the gdb.base/style.exp test script. The core of the script is now run multiple times. The first time the test is run things are as they were before, all styles are on. After that the test is rerun multiple times. Each time through a single style is disabled using the 3 explicit set calls listed above. I then repeat all the tests, however, I arrange so that the patterns for the disabled style now require no escape sequences. gdb/ChangeLog: * utils.c (emit_style_escape): Only emit an escape sequence if the requested style is different than the current applied style. (fputs_maybe_filtered): Adjust the juggling of the wrap_style, and current applied_style. (fputs_styled): Remove is_default check. (fputs_styled_unfiltered): Likewise. (vfprintf_styled_no_gdbfmt): Likewise. gdb/testsuite/ChangeLog: * gdb.base/style.exp (limited_style): New proc. (clean_restart_and_disable): New proc. (run_style_tests): New proc. Most of the old tests from this file are now in this proc. (test_startup_version_string): New proc. Reamining test from the old file is in this proc.
2021-01-22gdb: add remote_debug_printfSimon Marchi2-5/+8
This is the next in the new-style debug macro series. For this one, I decided to omit the function name from the "Sending packet" / "Packet received" kind of prints, just because it's not very useful in that context and hinders readability more than anything else. This is completely arbitrary. This is with: [remote] putpkt_binary: Sending packet: $qTStatus#49... [remote] getpkt_or_notif_sane_1: Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: and without: [remote] Sending packet: $qTStatus#49... [remote] Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: A difference is that previously, the query packet and its reply would be printed on the same line, like this: Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: Now, they are printed on two lines, since each remote_debug_printf{,_nofunc} prints its own complete message including an end of line. It's probably a matter of taste, but I prefer the two-line version, it's easier to follow, especially when the query packet is long. As a result, lib/range-stepping-support.exp needs to be updated, as it currently expects the vCont packet and the reply to be on the same line. I think it's sufficient in that context to just expect the vCont packet and not the reply, since the goal is just to count how many vCont;r GDB sends. gdb/ChangeLog: * remote.h (remote_debug_printf): New. (remote_debug_printf_nofunc): New. (REMOTE_SCOPED_DEBUG_ENTER_EXIT): New. * remote.c: Use above macros throughout file. gdbsupport/ChangeLog: * common-debug.h (debug_prefixed_printf_cond_nofunc): New. * common-debug.c (debug_prefixed_vprintf): Handle a nullptr func. gdb/testsuite/ChangeLog: * lib/range-stepping-support.exp (exec_cmd_expect_vCont_count): Adjust to "set debug remote" changes. Change-Id: Ica6dead50d3f82e855c7d763f707cef74bed9fee
2021-01-21Handle additional connection errorLuis Machado2-0/+8
On Ubuntu 18.04/20.04 I was running into annoying timeouts for gdb.server/server-connect.exp. Those were caused by the ipv6 tests, because they were running into the "Cannot assign requested address" error, originated from the connect syscall. Improve this by handling this additional error in the testsuite library. It still fails for me, but at least it fails pretty quickly and doesn't make the testsuite run take longer. gdb/testsuite/ChangeLog: 2021-01-21 Luis Machado <luis.machado@linaro.org> * lib/gdbserver-support.exp (gdb_target_cmd_ext): Handle a new error message.
2021-01-21gdb/testsuite: improve logging in lib/tuiterm.expSimon Marchi2-171/+281
Here's a bonus patch that applies on top of the other two. While debugging TUI test cases, it's hard to know what exactly is happening in the little mind of the terminal emulator. Add some logging for all input processing. Right now I'm interested in seeing what happens to the cursor position, so made it so all operations log the "before" and "after" cursor position. It should help see if any operation is not behaving as expected, w.r.t. the cursor position. Here are some examples of the logging found in gdb.log with this patch applied: +++ Inserting string '+|' +++ Inserted char '+', cursor: (0, 79) -> (1, 0) +++ Inserted char '|', cursor: (1, 0) -> (1, 1) +++ Inserted string '+|', cursor: (0, 79) -> (1, 1) +++ Cursor Horizontal Absolute (80), cursor: (1, 1) -> (1, 79) In the last line, note that the argument is 80 and we move to 79, that's because the position in the argument to the control sequence is 1-based, while our indexing is 0-based. gdb/testsuite/ChangeLog: * lib/tuiterm.exp (_log, _log_cur): New, use throughout. Change-Id: Ibf570d4b2867729ce65bea8c193343a8a846170d