aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2019-09-14[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.expTom de Vries3-0/+29
When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get: ... FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ before changing its value FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ after changing its value ... The commit last touching the test-case (afcfda091e) states: ... The test still fails with old compilers that do not properly generate debug info for this renaming: ... Fix this by requiring at least gnatmake 8 for the test-case. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-14 Tom de Vries <tdevries@suse.de> PR teststuite/24599 * gdb.ada/rename_subscript_param.exp: Require gnatmake 8. * lib/ada.exp (gnatmake_version_at_least): New proc.
2019-09-12gdb/testsuite: Make use of exec_has_index_section functionAndrew Burgess2-12/+5
Make use of exec_has_index_section library function rather than manually checking in the 'maintenance info sections' output. Should make no difference to the test results, just makes the code easier to read. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Use exec_has_index_section.
2019-09-12gdb: Have 'maint info sections' print all sections againAndrew Burgess2-0/+21
In this commit: commit 6eac171f0624303d944ff1a1ae4d0e3b0a63c800 Date: Fri Aug 16 00:25:14 2019 +0200 [gdb] Make maint info sections print relocated addresses A couple of things broke with the 'maintenance info sections' command, here is some before output: (gdb) maintenance info sections Exec file: `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. [0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS [1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS [2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS [3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS [4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS [5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS [6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS [7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS [8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS [9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS [10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS [11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS [12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS [13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS [14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS [15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS [16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS [17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS [18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS [19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS [20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS [21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS [22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS [23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC [24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS [25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS [26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS [27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS [28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS [29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS (gdb) And here is the output after the above commit: (gdb) maintenance info sections +maintenance info sections Exec file: `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC 0x00000000->0x00000000 at 0x00000000: *COM* IS_COMMON 0x00000000->0x00000000 at 0x00000000: *UND* 0x00000000->0x00000000 at 0x00000000: *ABS* 0x00000000->0x00000000 at 0x00000000: *IND* (gdb) We lost the section index numbers, but more importantly, we lost the information about the .debug* sections. We also gained entries for the "fake" sections *COM*, *UND*, *ABS*, and *IND*. I noticed this when running: make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp" As this test relies on looking in the 'maint info sections' output to see if we have a .debug_names or .gdb_index section, and these are debug sections so they no longer show up in the 'main info sections' output, the gdb.base/maint.exp test fails. This commit restores the old behaviour while keeping the important change that the above commit introduced, the addresses printed for sections are the relocated addresses where appropriate. The above commit mentions using this test: make check-gdb RUNTESTFLAGS="CFLAGS_FOR_TARGET='-pie' gdb.base/compare-sections.exp" And this still passes after this commit. The output for 'maint info sections' now looks like this: (gdb) maintenance info sections Exec file: `/home/andrew/projects/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. [0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS [1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS [2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS [3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS [4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS [5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS [6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS [7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS [8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS [9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS [10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS [11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS [12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS [13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS [14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS [15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS [16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS [17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS [18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS [19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS [20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS [21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS [22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS [23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC [24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS [25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS [26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS [27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS [28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS [29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS (gdb) This is basically as it was before, except that the index numbers are now padded so the section information all lines up. When GDB has relocated a section then the relocated addresses will be printed, otherwise the non-relocated addresses from the bfd will be printed. I've added a test to gdb.base/maint.exp to do some basic validation of the output format. gdb/ChangeLog: * maint.c: Add 'cmath' include. (struct maint_print_section_data): New structure. (print_section_index): New function. (print_bfd_section_info): Add header comment, small whitespace cleanup, and update to call new print_section_index function. (print_objfile_section_info): Likewise. (maint_obj_section_from_bfd_section): New function. (print_bfd_section_info_maybe_relocated): New function. (maintenance_info_sections): Add header comment, always use bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Add test for 'maint info sections'.
2019-09-12[gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupportedTom de Vries2-20/+50
The test-case gdb.base/store.exp fails with gcc 7.4.0: ... nr of unexpected failures 27 ... The first FAIL: ... 110 l = add_float (l, r); (gdb) PASS: gdb.base/store.exp: continue to wack_float print l $21 = <optimized out> FAIL: gdb.base/store.exp: var float l; print old l, expecting -1 ... relates to this bit in the test-case (compiled at -O0): ... 106 float 107 wack_float (register float u, register float v) 108 { 109 register float l = u, r = v; 110 l = add_float (l, r); 111 return l + r; 112 } ... and it expects to be able to read and modify variable l before executing line 110, but it already fails to read the value, because l has no DW_AT_location attribute in the debug info. Variable l is declared with the register keyword, and GCC implements the register keyword at -O0 like so: ... the compiler allocates distinct stack memory for all variables that do not have the register storage-class specifier; if register is specified, the variable may have a shorter lifespan than the code would indicate and may never be placed in memory. ... The fact that l has no DW_AT_location attribute, matches with the documented "variable may have a shorter lifespan that code would indicate", (though it is the most extreme case of it) so the gcc behaviour is valid. We can of course improve gcc to generate better debuginfo (filed gcc PR91611), but this not a wrong-debug problem. [ The test-case passes with gcc 4.2.1, but for the failing test discussed above, it passes simply because it doesn't store l in a register. ] With the debug info missing for l, reading and setting l is unsupported, so fix the FAIL by marking the test UNSUPPORTED instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-12 Tom de Vries <tdevries@suse.de> * gdb.base/store.exp: Allow register variables to be optimized out at -O0.
2019-09-12Output the Ada task name in more messages.Philippe Waroquiers3-2/+8
With this patch, we e.g. get: [Switching to task 2 "task_list(1)"] [Current task is 2 "task_list(1)"] instead of [Switching to task 2] [Current task is 2] The logic to produce the taskno optionally followed by the task name has been factorized in the task_to_str function. Task names are output between double quotes in the new messages, similarly to what GDB does for thread names. However, no quotes are put around task names in 'info tasks' Name column. This was discussed with Tom, that preferred no quotes there, while I was more in favour of visual consistency. I discussed with a few more users, which led to (exactly) 50% preferring quotes and 50% preferring no quotes :). To arrive to the decision to remove the quotes, the following "killing args" were used: * To have quotes or to not have quotes, that is the question; yes but not *THE* question :). * If there is not a clear majority that prefers quotes, better to not disturb the existing user basis for a (somewhat) irrelevant aspect. * The opinion of the reviewer has more weight. So, compared to the previous version, this version remotes the quotes in 'info tasks'. It improves the alignement of 'info tasks' output. With this patch, we get: (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) instead of (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) (e.g. the first one properly shows parent and priority under the correct header). This is version 4 of the 'task name' patch. Compared to version 3, the changes are: output task names between quotes but not in 'info tasks' gdb/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Announce that Ada task names are now shown at more places, and between quotes (except in info task output). * gdb/ada-tasks.c (task_to_str): New function. (display_current_task_id): Call task_to_str. (task_command_1): Likewise. (print_ada_task_info): In non-mi mode, Properly align headers and data when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR). gdb/doc/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Ada Tasks): Tell the task name is printed, update examples. gdb/testsuite/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.ada/rdv_wait.exp: Update to new task names. * gdb.base/task_switch_in_core.exp: Likewise. * gdb.base/info_sources_base.c: Likewise.
2019-09-10Add Ada support to cc-with-tweaks.expTom Tromey2-0/+9
This adds Ada support to the cc-with-tweaks.exp board file, so that we can test Ada this way. The cc-with-tweaks.sh script already works reasonably well as a wrapper for gnatmake. gdb/testsuite/ChangeLog 2019-09-10 Tom Tromey <tromey@adacore.com> * boards/cc-with-tweaks.exp: Set GNATMAKE_FOR_TARGET.
2019-09-10Fix latent bug in .debug_names file-name handlingTom Tromey3-0/+58
An internal Ada test case showed that the .debug_names code does not compute the same list of file names as the partial symbol reader. In particular, the partial symbol reader uses the DW_AT_name of the CU: /* Allocate a new partial symbol table structure. */ filename = dwarf2_string_attr (comp_unit_die, DW_AT_name, cu); if (filename == NULL) filename = ""; pst = create_partial_symtab (per_cu, filename); This patch changes the .debug_names reader to follow. gdb/ChangeLog 2019-09-10 Tom Tromey <tromey@adacore.com> * dwarf2read.c (dw2_get_file_names_reader): Add the CU's file name to the results. gdb/testsuite/ChangeLog 2019-09-10 Tom Tromey <tromey@adacore.com> * gdb.ada/dgopt.exp: New file. * gdb.ada/dgopt/x.adb: New file.
2019-09-08Truncate long TUI window titlesTom Tromey4-11/+6
If a TUI window has a long title, it can overflow the title line. This changes the TUI to use just the tail part of the title in this case. gdb/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (box_win): Truncate long window titles. gdb/testsuite/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * gdb.tui/resize.exp: Remove setup_xfail. * gdb.tui/regs.exp: Remove setup_xfail. * gdb.tui/basic.exp: Remove setup_xfail.
2019-09-06un-XFAIL under Clang tests using labelsDavid Blaikie4-14/+6
gdb/testsuite/ * gdb.base/label.exp: un-XFAIL label related tests under Clang. * gdb.cp/cplabel.exp: Ditto. * gdb.linespec/ls-errs.exp: Ditto.
2019-09-05[gdb/testsuite] Restore breakpoint command in ui-redirect.expTom de Vries3-8/+56
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write the current breakpoints to a file, but the actual output is not verified. Consequently, the test has regressed in that the "print 1" command associated with a breakpoint on main is removed by a subsequent runto_main, which first deletes all breakpoints: ... (gdb) break main Breakpoint 1 at 0x4004d7: file start.c, line 34. (gdb) commands Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". > PASS: gdb.base/ui-redirect.exp: commands print 1 > PASS: gdb.base/ui-redirect.exp: print 1 end (gdb) PASS: gdb.base/ui-redirect.exp: end delete breakpoints Delete all breakpoints? (y or n) y ... and consequently the "save breakpoint" output is missing the breakpoint command for main: ... break main - commands - print 1 - end break foo break bar ... Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the "save breakpoints" output. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (cmp_file_string): New proc. * gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with runto_main. Verify save breakpoints output.
2019-09-04Avoid expect's buffer overflow in info-var.exp test.Philippe Waroquiers2-4/+8
Once the executable is started, info variables can show thousands of variables belonging to glibc (see below). This long list of variables then causes the test to fail, due to expect's buffer overflow: Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ... ERROR: internal buffer is full. ERROR: internal buffer is full. ERROR: internal buffer is full. Fix this by testing 'info variables' without running the executable. gdb ./info-var ... Reading symbols from ./info-var... (gdb) |info variables|wc 27 54 971 (gdb) start Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23. Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var Temporary breakpoint 1, main () at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23 23 return global_var + get_offset() + f1_var; (gdb) |info variables|wc 4334 14581 130738 (gdb) gdb/testsuite/ChangeLog 2019-09-04 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/info-var.exp: Test info variables without running to main, to avoid expect's buffer overflow.
2019-09-03Handle biased typesTom Tromey7-1/+163
In Ada, the programmer can request that a range type with a non-zero base be stored in the minimal number of bits required for the range. This is done by biasing the values; so, for example, a range of -7..-4 may be stored as two bits with a bias of -7. This patch implements this for gdb. It is done by adding a bias to struct range_bounds and then adjusting a few spots to handle this. The test case is written to use -fgnat-encodings=minimal, but a future compiler patch will change the compiler to emit DW_AT_GNU_bias with -fgnat-encodings=gdb. It seemed good to get the gdb patch in first. Tested on x86-64 Fedora 29; plus a variety of targets using AdaCore's internal test suite. gdb/ChangeLog 2019-09-03 Tom Tromey <tromey@adacore.com> * ada-valprint.c (ada_val_print_num): Don't recurse for range types. (has_negatives): Unbias a range type bound. * dwarf2read.c (read_subrange_type): Handle DW_AT_GNU_bias. * gdbtypes.c (operator==): Handle new field. (create_range_type): Add "bias" parameter. (create_static_range_type, resolve_dynamic_range): Update. * gdbtypes.h (struct range_bounds) <bias>: New member. (create_range_type): Add bias parameter. * printcmd.c (print_scalar_formatted): Unbias range types. * value.c (unpack_long): Unbias range types. (pack_long): Bias range types. gdb/testsuite/ChangeLog 2019-09-03 Tom Tromey <tromey@adacore.com> * gdb.ada/bias.exp: New file. * gdb.ada/bias/bias.adb: New file. * gdb.ada/print_chars.exp: Add regression test. * gdb.ada/print_chars/foo.adb (My_Character): New type. (MC): New variable.
2019-08-29Run argv0-symlink.exp only on native target and local host.Sandra Loosemore2-0/+22
This testcase was originally for PR gdb/15415, a problem with the "run" command expanding symlinks in the name of the program being run. It does not correctly distinguish between files on build, host, and target, and it is not clear if it would be testing anything useful in configurations where "run" is not being used. 2019-08-29 Sandra Loosemore <sandra@codesourcery.com> * gdb.base/argv0-symlink.exp: Run only on native target and local host.
2019-08-29[gdb/testsuite] Fix gdb.fortran/info-types.exp regexpTom de Vries3-4/+25
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8. Fix the gdb_test regexp to fix all those cases. gdb/testsuite/ChangeLog: 2019-08-29 Tom de Vries <tdevries@suse.de> * gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more diverse debug info. * lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
2019-08-28[gdb/testsuite] Fix info-var.exp for debug info from other filesTom de Vries2-2/+13
On openSUSE Leap 15.1, I get: ... FAIL: gdb.base/info-var.exp: info variables FAIL: gdb.base/info-var.exp: info variables -n ... because the info variables command prints info also for init.c: ... File init.c:^M 24: const int _IO_stdin_used;^M ... while the regexps in the test-case only expect info for info-var-f1.c and info-var-f2.c. Fix this by extending the regexps. Tested on x86_64-linux, both openSUSE Leap 15.1 and Fedora 30. gdb/testsuite/ChangeLog: 2019-08-28 Tom de Vries <tdevries@suse.de> * gdb.base/info-var.exp: Allow info variables to print info for files other than info-var-f1.c and info-var-f2.c.
2019-08-28gdb/fortran: Don't include module symbols when searching for typesAndrew Burgess3-1/+19
Currently the 'info types' command will return symbols that correspond to Fortran modules. This is because the symbols are created with domain MODULE_DOMAIN and address_class LOC_TYPEDEF. The address_class LOC_TYPEDEF is the same address_class used for type symbols which is why the modules show up when listing types. This commit explicitly prevents symbols in the MODULE_DOMAIN from appearing when we search for symbols in the TYPES_DOMAIN, this prevents the Fortran module symbols from appearing in the output of 'info types'. gdb/ChangeLog: * symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols when searching for types. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: Add module. * gdb.fortran/info-types.f90: Update expected results.
2019-08-28gdb/fortran: Implement la_print_typedef for FortranAndrew Burgess4-0/+88
Implement an la_print_typedef method for Fortran, this allows 'info types' to work for Fortran. The implementation is just copied from ada_print_typedef (with the appropriate changes). To support the testing of this patch I added a new proc, fortran_character1, to lib/fortran.exp which returns a regexp to match a 1-byte character type. The regexp returned is correct for current versions of gFortran. All of the other regexp are guesses based on all of the other support procs in lib/fortran.exp, I haven't tested them myself. gdb/ChangeLog: * f-lang.c (f_language_defn): Use f_print_typedef. * f-lang.h (f_print_typedef): Declare. * f-typeprint.c (f_print_typedef): Define. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: New file. * gdb.fortran/info-types.f90: New file. * lib/fortran.exp (fortran_character1): New proc.
2019-08-27gdb: Add new -n flag to some info commandsAndrew Burgess6-44/+190
The 'info variables', its alias 'whereis', and 'info functions' all include non-debug symbols in the output by default. The list of non-debug symbols can sometimes be quite long, resulting in the debug symbol based results being scrolled off the screen. This commit adds a '-n' flag to all of the commands listed above that excludes the non-debug symbols from the results, leaving just the debug symbol based results. gdb/ChangeLog: * cli/cli-utils.c (info_print_options_defs): Delete. (make_info_print_options_def_group): Delete. (extract_info_print_options): Delete. (info_print_command_completer): Delete. (info_print_args_help): Add extra parameter, and optionally include text about -n flag. * cli/cli-utils.h (struct info_print_options): Delete. (extract_info_print_options): Delete declaration. (info_print_command_completer): Delete declaration. (info_print_args_help): Add extra parameter, extend header comment. * python/python.c (gdbpy_rbreak): Pass additional parameter to search_symbols. * stack.c (struct info_print_options): New type. (info_print_options_defs): New file scoped variable. (make_info_print_options_def_group): New static function. (info_print_command_completer): New static function. (info_locals_command): Update to use new local functions. (info_args_command): Likewise. (_initialize_stack): Add extra parameter to calls to info_print_args_help. * symtab.c (search_symbols): Add extra parameter, use this to possibly excluse non-debug symbols. (symtab_symbol_info): Add extra parameter, which is passed on to search_symbols. (struct info_print_options): New type. (info_print_options_defs): New file scoped variable. (make_info_print_options_def_group): New static function. (info_print_command_completer): New static function. (info_variables_command): Update to use local functions, and pass extra parameter through to symtab_symbol_info. (info_functions_command): Likewise. (info_types_command): Pass additional argument through to symtab_symbol_info. (rbreak_command): Pass extra argument to search_symbols. (_initialize_symtab): Add extra arguments for calls to info_print_args_help, and update help text for 'info variables', 'whereis', and 'info functions' commands. * symtab.h (search_symbols): Add extra argument to declaration. * NEWS: Mention new flags. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Add information about the -n flag to "info variables" and "info functions". gdb/testsuite/ChangeLog: * gdb.base/info-fun.exp: Extend to test the -n flag for 'info functions'. Reindent as needed. * gdb.base/info-var-f1.c: New file. * gdb.base/info-var-f2.c: New file. * gdb.base/info-var.exp: New file. * gdb.base/info-var.h: New file.
2019-08-26[gdb, c++] Improve error message when using libstdcxx without SDT probesTom de Vries2-0/+46
When using catch catch/rethrow/catch, a libstdcxx with SDT probes is required for both the regexp argument, and the convenience variable $_exception ( https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html ). Currently, when using these features with a libstdcxx without SDT probes, we get the cryptic error message: ... not stopped at a C++ exception catchpoint ... Improve this by instead emitting the more helpful: ... did not find exception probe (does libstdcxx have SDT probes?) ... Tested on x86_64-linux. gdb/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> PR c++/24852 * break-catch-throw.c (fetch_probe_arguments): Improve error mesage when pc_probe.prob == NULL. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> PR c++/24852 * gdb.cp/no-libstdcxx-probe.exp: New test.
2019-08-26[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if trueTom de Vries4-6/+15
The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests need to be skipped, while tcl interprets 0 as false rather than true, which is confusing. Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need to be skipped. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe * tests need to be skipped. * gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests. * gdb.mi/mi-catch-cpp-exceptions.exp: Update call to mi_skip_libstdcxx_probe_tests.
2019-08-26Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's ↵Sergio Durigan Junior2-18/+23
"SyntaxWarning: invalid escape sequence") The way unrecognized escape sequences are handled has changed in Python 3.8: users now see a SyntaxWarning message, which will eventually become a SyntaxError in future versions of Python: (gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py /blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque nce \+ 'operator\+', /blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque nce \+ 'operator\+\+', One of our testcases, gdb.python/py-xmethods.exp, contains strings in the form of "operator\+". This is not recognized by Python, but is still needed by the testsuite to work properly. The solution is simple: we just have to make sure these strings are marked as raw (i.e, r""). This is what this patch does. I took the opportunity to also convert other strings to raw, which, in two cases, allowed the removal of an extra backslash. I tested this using Python 3.7 and Python 3.8, and everything works fine. I think I could push this as obvious, but decided to send it to gdb-patches just in case. gdb/testsuite/ChangeLog: 2019-08-26 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.python/py-xmethods.exp: Use raw strings when passing arguments to SimpleXMethodMatcher.
2019-08-22[gdb/testsuite] Make gdb_test message more informative in ↵Tom de Vries2-2/+7
multi-term-settings.exp This racy fail message, reported in PR24929: ... FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: \ stop with control-c ... does not make clear which gdb_test fails here: ... if {$expect_ttou} { gdb_test "" "Quit" "stop with control-c" } else { gdb_test "" "received signal SIGINT.*" "stop with control-c" } ... Fix this by making the gdb_test message argument more informative. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-22 Tom de Vries <tdevries@suse.de> * gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages more informative.
2019-08-21Fix nullptr in with_command_1Pedro Alves2-0/+6
Running 'with' without arguments crashes GDB. This fixes it. gdb/ChangeLog: 2019-08-21 Bogdan Harjoc <harjoc@gmail.com> * cli/cli-cmds.c (with_command_1): Error out if no arguments. gdb/testsuite/ChangeLog: 2019-08-21 Pedro Alves <palves@redhat.com> * gdb.base/with.exp: Test "with" with no arguments.
2019-08-21[gdb/testsuite] Stabilize gdb-caching-proc.exp test orderTom de Vries2-0/+5
The test-case gdb-caching-proc.exp tests each gdb_caching_proc in gdb/testsuite/lib/*.exp. However, the order of .exp file being tested can change from run to run, because of using glob. Fix this by sorting the glob result. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-21 Tom de Vries <tdevries@suse.de> * gdb.base/gdb-caching-proc.exp: Sort files.
2019-08-20[gdb/testsuite] Clean up stale exec in gdb_compile_pascalTom de Vries2-0/+7
When running a pascal test with the stabs target board: ... $ test=gdb.pascal/case-insensitive-symbols.exp $ cd build/gdb/testsuite $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we get: ... nr of untested testcases 1 nr of unsupported tests 1 ... due to: ... Error: Illegal parameter: -gstabs+^M Error: /usr/bin/ppcx64 returned an error exitcode^M ... OTOH, when running the same pascal test without the stabs target board: ... $ make check RUNTESTFLAGS="$test" ... we get: ... nr of expected passes 20 ... But when subsequently again running with the stabs target board: ... $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we now get: ... nr of expected passes 20 ... The problem is that gdb_compile_pascal determines success based on existence of the exec after compilation: ... if ![file exists $destfile] { unsupported "Pascal compilation failed: $result" return "Pascal compilation failed." } ... without removing the exec before compilation, which allows a stale exec to make it seem as if compilation has succeeded. Fix this by removing the stale exec before compilation. gdb/testsuite/ChangeLog: 2019-08-20 Tom de Vries <tdevries@suse.de> * lib/pascal.exp (gdb_compile_pascal): Remove $destfile before compilation.
2019-08-16[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pieTom de Vries2-2/+14
When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we get: ... FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r ... The test expects the read-only sections to have the same contents as in the file: ... # Assume startup code doesn't change read-only sections. compare_sections "-r" ... but that's not the case for PIE executables. Fix this by allowing mismatched read-only sections for PIE executables. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-16 Tom de Vries <tdevries@suse.de> * gdb.base/compare-sections.exp ("after run to main"): Allow mismatched read-only sections for PIE executables.
2019-08-16Remove the TUI execution info windowTom Tromey4-10/+23
The TUI execution info window is unusual in that it is always linked to a source or disassembly window. Even updates of its content are handled by the source window, so it really has no life of its own. This patch removes this window entirely and puts its functionality directly into the source window. This simplifies the code somewhat. This is a user-visible change, because now the box around the source (or disassembly) window encloses the execution info as well. I consider this an improvement as well, though. Note that this patch caused ncurses to start emitting the "CSI Z" sequence, so I've added this to the test suite terminal implementation. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove. * tui/tui-winsource.h (struct tui_exec_info_window): Remove. (struct tui_source_window_base) <make_visible, refresh_window, resize>: Remove methods. <execution_info>: Remove field. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content) (tui_show_source_line, tui_source_window_base) (~tui_source_window_base): Update. (tui_source_window_base::resize) (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Remove. (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. gdb/testsuite/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_csi_Z): New proc. * gdb.tui/basic.exp: Update window positions. * gdb.tui/empty.exp: Update window positions.
2019-08-15Fix paste-o in examine-backward.exp.Sandra Loosemore2-1/+6
This patch fixes a paste-o that was introduced in commit c8ad9b9a31aa3e6039567fc1f152dd454c946d5f. Previously the regexp for the "examine 3 bytes backward from ${address_zero}" test correctly matched 3 "${byte}" patterns, but in that commit the 6-byte regexp from the previous test was mistakenly repeated here instead. 2019-08-15 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.base/examine-backward.exp: Correct regexp for "examine 3 bytes backward from ${address_zero}".
2019-08-15TUI resize unificationTom Tromey2-10/+12
The TUI currently has two different ways to resize a window: the resize method, and the methods make_invisible_and_set_new_height and make_visible_with_new_height. There's no deep reason to have two different ways to resize a window, so this patch unifies them, leaving just the "resize" method. This also changes the locator to be handled more like an ordinary window and less like an adjunct of the associated source window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before calling update_cmdwin_start_line. * tui/tui-winsource.h (struct tui_source_window_base) <do_make_visible_with_new_height, set_new_height>: Don't declare. <rerender>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_tab_width): Call rerender. (tui_source_window_base::set_new_height): Remove. (tui_source_window_base::rerender): Rename from do_make_visible_with_new_height. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use resize method. (tui_win_info::make_invisible_and_set_new_height) (tui_win_info::make_visible_with_new_height): Remove. * tui/tui-stack.h (struct tui_locator_window) <rerender>: Declare. * tui/tui-stack.c (tui_locator_window::rerender): New method. * tui/tui-regs.h (struct tui_data_window) <set_new_height, do_make_visible_with_new_height>: Don't declare. <rerender>: Declare. * tui/tui-regs.c (tui_data_window::rerender): Rename from set_new_height. (tui_data_window::do_make_visible_with_new_height): Remove. * tui/tui-layout.c (show_source_disasm_command, show_data): Don't call tui_show_locator_content. (tui_gen_win_info::resize): Call rerender. (show_source_or_disasm_and_command): Don't call tui_show_locator_content. * tui/tui-data.h (struct tui_gen_win_info) <rerender>: New method. (struct tui_win_info) <rerender>: Declare. <set_new_height, make_invisible_and_set_new_height, make_visible_with_new_height>: Don't declare. * tui/tui-data.c (tui_win_list::rerender): New method. * tui/tui-command.h (struct tui_cmd_window) <do_make_visible_with_new_height>: Don't declare. * tui/tui-command.c (tui_cmd_window::do_make_visible_with_new_height): Remove. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * gdb.tui/empty.exp: Enable resizing tests.
2019-08-15Fix bug with character enumeration literalTom Tromey4-4/+18
gnat encodes character enumeration literals using a few different schemes. The gnat compiler documented the "QU" and "QW" encodings, but failed to document that a simpler encoding was used for certain characters. This patch updates gdb to handle this simple Q encoding. Note that wide character literals are still not handled. gdb/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * ada-exp.y (convert_char_literal): Handle "Q%c" encoding. * ada-lang.c (ada_enum_name): Likewise. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * gdb.ada/char_enum.exp: Add regression tests. * gdb.ada/char_enum/foo.adb (Char_Enum_Type): Use '_' and '0'. (Char, Gchar): Update. * gdb.ada/char_enum/pck.ads (Global_Enum_Type): Use '+'.
2019-08-15Rename internal Python functions to start with an underscoreChristian Biesinger2-2/+7
I could not tell if GdbSetPythonDirectory is internal or not because I could not find any references to it, so I left it as-is. Tested by running the testsuite on gdb.python/*.exp; everything still passes. 2019-08-15 Christian Biesinger <cbiesinger@google.com> * python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a leading underscore. (GdbOutputErrorFile): Likewise. (global scope): Adjust constructor calls to GdbOutput{,Error}File accordingly. (execute_unwinders): Rename to have a leading underscore. (auto_load_packages): Likewise. (global scope): Adjust call to auto_load_packages accordingly. (GdbSetPythonDirectory): Likewise. * python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders instead of execute_unwinders. gdb/testsuite/ChangeLog: 2019-08-15 Christian Biesinger <cbiesinger@google.com> * gdb.python/python.exp: Expect a leading underscore on GdbOutput{,Error}File.
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-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-14AArch64: Allow additional sizes in prologueAlan Hayward3-0/+124
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-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-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-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 first and last lines of 'command help documentation' consistent.Philippe Waroquiers3-6/+11
With this patch, the help docs now respect 2 invariants: * The first line of a command help is terminated by a '.' character. * The last character of a command help is not a newline character. Note that the changes for the last invariant were done by Tom, as part of : [PATCH] Remove trailing newlines from help text https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html but some occurrences have been re-introduced since then. Some help docs had to be rephrased/restructured to respect the above invariants. Before this patch, print_doc_line was printing the first line of a command help documentation, but stopping at the first '.' or ',' character. This was giving inconsistent results : * The first line of command helps was sometimes '.' terminated, sometimes not. * The first line of command helps was not always designed to be readable/understandable/unambiguous when stopping at the first '.' or ',' character. This e.g. created the following inconsistencies/problems: < catch exception -- Catch Ada exceptions < catch handlers -- Catch Ada exceptions < catch syscall -- Catch system calls by their names < down-silently -- Same as the `down' command while the new help is: > catch exception -- Catch Ada exceptions, when raised. > catch handlers -- Catch Ada exceptions, when handled. > catch syscall -- Catch system calls by their names, groups and/or numbers. > down-silently -- Same as the `down' command, but does not print anything. Also, the command help doc should not be terminated by a newline character, but this was not respected by all commands. The cli-option -OPT framework re-introduced some occurences. So, the -OPT build help framework was changed to not output newlines at the end of %OPTIONS% replacement. This patch changes the help documentations to ensure the 2 invariants given above. It implied to slightly rephrase or restructure some help docs. Based on the above invariants, print_doc_line (called by 'apropos' and 'help' commands to print the first line of a command help) now outputs the full first line of a command help. This all results in a lot of small changes in the produced help docs. There are less code changes than changes in the help docs, as a lot of docs are produced by some code (e.g. the remote packet usage settings). gdb/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.h (print_doc_line): Add for_value_prefix argument. * cli/cli-decode.c (print_doc_line): Likewise. It now prints the full first line, except when FOR_VALUE_PREFIX. In this case, the trailing '.' is not output, and the first character is uppercased. (print_help_for_command): Update call to print_doc_line. (print_doc_of_command): Likewise. * cli/cli-setshow.c (deprecated_show_value_hack): Likewise. * cli/cli-option.c (append_indented_doc): Do not append newline. (build_help_option): Append newline after first appended_indented_doc only if a second call is done. (build_help): Append 2 new lines before each option, except the first one. * compile/compile.c (_initialize_compile): Add new lines after %OPTIONS%, when not at the end of the help. Change help doc or code producing the help doc to respect the invariants. * maint-test-options.c (_initialize_maint_test_options): Likewise. Also removed the new line after 'Options:', as all other commands do not put an empty line between 'Options:' and the first option. * printcmd.c (_initialize_printcmd): Likewise. * stack.c (_initialize_stack): Likewise. * interps.c (interpreter_exec_cmd): Fix "Usage:" line that was incorrectly telling COMMAND is optional. * ada-lang.c (_initialize_ada_language): Change help doc or code producing the help doc to respect the invariants. * ada-tasks.c (_initialize_ada_tasks): Likewise. * breakpoint.c (_initialize_breakpoint): Likewise. * cli/cli-cmds.c (_initialize_cli_cmds): Likewise. * cli/cli-logging.c (_initialize_cli_logging): Likewise. * cli/cli-setshow.c (_initialize_cli_setshow): Likewise. * cli/cli-style.c (cli_style_option::add_setshow_commands, _initialize_cli_style): Likewise. * corelow.c (core_target_info): Likewise. * dwarf-index-cache.c (_initialize_index_cache): Likewise. * dwarf2read.c (_initialize_dwarf2_read): Likewise. * filesystem.c (_initialize_filesystem): Likewise. * frame.c (_initialize_frame): Likewise. * gnu-nat.c (add_task_commands): Likewise. * infcall.c (_initialize_infcall): Likewise. * infcmd.c (_initialize_infcmd): Likewise. * interps.c (_initialize_interpreter): Likewise. * language.c (_initialize_language): Likewise. * linux-fork.c (_initialize_linux_fork): Likewise. * maint-test-settings.c (_initialize_maint_test_settings): Likewise. * maint.c (_initialize_maint_cmds): Likewise. * memattr.c (_initialize_mem): Likewise. * printcmd.c (_initialize_printcmd): Likewise. * python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq, _RegEx): Likewise. * ravenscar-thread.c (_initialize_ravenscar): Likewise. * record-btrace.c (_initialize_record_btrace): Likewise. * record-full.c (_initialize_record_full): Likewise. * record.c (_initialize_record): Likewise. * regcache-dump.c (_initialize_regcache_dump): Likewise. * regcache.c (_initialize_regcache): Likewise. * remote.c (add_packet_config_cmd, init_remote_threadtests, _initialize_remote): Likewise. * ser-tcp.c (_initialize_ser_tcp): Likewise. * serial.c (_initialize_serial): Likewise. * skip.c (_initialize_step_skip): Likewise. * source.c (_initialize_source): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * symtab.c (_initialize_symtab): Likewise. * target-descriptions.c (_initialize_target_descriptions): Likewise. * top.c (init_main): Likewise. * tracefile-tfile.c (tfile_target_info): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. * tui/tui-win.c (_initialize_tui_win): Likewise. * utils.c (add_internal_problem_command): Likewise. * valprint.c (value_print_option_defs): Likewise. gdb/testsuite/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/style.exp: Update tests for help doc new invariants. * gdb.base/help.exp: Likewise.
2019-08-06Add more styling to "disassemble"Tom Tromey3-1/+16
This adds more styling to the disassemble command. In particular, addresses and function names in the disassembly are now styled. This required fixing a small latent bug in set_output_style. This function always passed NULL to emit_style_escape; but when writing to a file other than gdb_stdout, it should emit the style escape directly. (FWIW this is another argument for better integrating the pager with ui_file and getting rid of this entire layer.) gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * utils.c (set_output_style): Sometimes pass stream to emit_style_escape. * ui-out.h (class ui_out) <can_emit_style_escape>: Declare. * record-btrace.c (btrace_insn_history): Update. * mi/mi-out.h (class mi_ui_out) <can_emit_style_escape>: New method. * disasm.h (gdb_pretty_print_disassembler): Add uiout parameter. Update initializers. <m_uiout>: New field. <m_di>: Move lower. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Remove "uiout" parameter. (dump_insns): Update. * cli-out.h (class cli_ui_out) <can_emit_style_escape>: Declare. * cli-out.c (cli_ui_out::can_emit_style_escape): New method. gdb/testsuite/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Add disassemble test. * gdb.base/style.c (some_called_function): New function. (main): Use it.
2019-08-05Add block['var'] accessorChristian Biesinger2-0/+9
Currently we support iteration on blocks; this patch extends that to make subscript access work as well. gdb/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention dictionary access on blocks. * python/py-block.c (blpy_getitem): New function. (block_object_as_mapping): New struct. (block_object_type): Use new struct for tp_as_mapping field. gdb/doc/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * python.texi (Blocks In Python): Document dictionary access on blocks. gdb/testsuite/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * gdb.python/py-block.exp: Test dictionary access on blocks.
2019-08-05Increase timeout in gdb.mi/list-thread-groups-available.expSimon Marchi2-4/+16
Running make check-read1 TESTS="gdb.mi/list-thread-groups-available.exp" on my machine results in timeout failures. Running it while having `tail -F testsuite/gdb.log` on the side shows that the test is never really blocked, it is just slow at consuming the large output generated by `-list-thread-groups --available` (which lists all the processes on the system). If I increase the timeout to a large value, the test passes in ~30 seconds (compared to under 1 second normally). Increase the timeout for the particular mi_gdb_test that is long to execute under read1. The new timeout value is a bit arbitrary. The default timeout is 10 seconds, so I set the new timeout to be "old-timeout * 10", so 100 seconds in the typical case. gdb/testsuite/ChangeLog: PR gdb/24863 * gdb.mi/list-thread-groups-available.exp: Increase timeout for -list-thread-groups --available test when running under check-read1.
2019-08-05[gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factorTom de Vries5-33/+73
When running tests with check-read1, we run into some timeouts where the tests are not easy to rewrite using gdb_test_sequence: ... FAIL: gdb.base/help.exp: help data (timeout) FAIL: gdb.base/help.exp: help files (timeout) FAIL: gdb.base/help.exp: help internals (timeout) FAIL: gdb.base/help.exp: help user-defined (timeout) FAIL: gdb.base/help.exp: help breakpoint "b" abbreviation (timeout) FAIL: gdb.base/help.exp: help breakpoint "br" abbreviation (timeout) FAIL: gdb.base/help.exp: help breakpoint "bre" abbreviation (timeout) FAIL: gdb.base/info-macros.exp: info macros 2 (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros 3 (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros 7 (timeout) FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = -1) // parse failed (timeout) FAIL: gdb.cp/nested-types.exp: set print type nested-type-limit 1 (timeout) ... Fix these by increasing the timeout by a factor 10. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * lib/gdb.exp (with_read1_timeout_factor): New proc. * gdb.base/help.exp: Use with_read1_timeout_factor. * gdb.base/info-macros.exp: Same. * gdb.cp/nested-types.exp: Same.
2019-08-05[gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executableTom de Vries2-14/+72
When running gdb.base/break-idempotent.exp with --target_board=unix/-fno-PIE/-no-pie, we get: ... nr of expected passes 140 ... The test-case is compiled once with nopie and once with pie, but in both cases we end up with a non-PIE executable. The "-fno-PIE -no-pie" options specified using the target_board are interpreted by dejagnu as multilib_flags, and end up overriding the pie flags. Fix this by checking in gdb_compile if the resulting exec is non-PIE despite of a pie setting, and if so return an error: ... Running gdb/testsuite/gdb.base/break-idempotent.exp ... gdb compile failed, pie failed to generate PIE executable === gdb Summary === nr of expected passes 70 nr of untested testcases 1 ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (version_at_least): Factor out of ... (tcl_version_at_least): ... here. (gdb_compile): Fail if pie results in non-PIE executable. (readelf_version, readelf_prints_pie): New proc. (exec_is_pie): Return -1 if unknown.
2019-08-05[gdb/testsuite] Fix typo in tcl_version_at_leastTom de Vries2-1/+5
In tcl_version_at_least we compare a minor against a major version number: ... } elseif { $tcl_version_major == $major \ && $tcl_version_major >= $minor } { ... Fix this by using $tcl_version_minor in the comparison instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (tcl_version_at_least): Fix typo.
2019-08-04Skip GDB test reconnect-ctrl-c.exp if nointerrupts is set.Sandra Loosemore2-0/+9
2019-08-04 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.server/reconnect-ctrl-c.exp: Skip if nointerrupts.
2019-08-04Add check for readline support to more GDB tab-completion tests.Sandra Loosemore2-3/+16
2019-08-04 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * lib/completion-support.exp (test_gdb_complete_none): Skip tab completion tests if no readline support. (test_gdb_complete_unique_re): Likewise. (test_gdb_complete_multiple): Likewise.
2019-08-03New test for 'info sources [-dirname | -basename] [--] [REGEXP]'.Philippe Waroquiers4-0/+147
This patch introduces a test for the 'info sources' command and its new arguments [-dirname | -basename] [--] [REGEXP]. gdb/testsuite/ChangeLog 2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/info_sources.exp: New file. * gdb.base/info_sources.c: New file. * gdb.base/info_sources_base.c: New file.