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.
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.
While reading that code, I noticed that some variables essentially meant
whether to consider some other variable or not. I think using
gdb::optional (which was not available when this code was written) is
clearer, as it embeds the used/not used predicate directly in the type
of the variable, making it harder to miss.
gdb/ChangeLog:
* dwarf2read.c (struct dw2_symtab_iterator):
<want_specific_block>: Remove.
<block_index>: Change type to gdb::optional.
(dw2_symtab_iter_init): Remove WANT_SPECIFIC_BLOCK parameter,
change type of BLOCK_INDEX parameter to gdb::optional.
(dw2_symtab_iter_next): Re-write in function of gdb::optional.
(dw2_lookup_symbol): Don't pass argument for
WANT_SPECIFIC_BLOCK.
(dw2_expand_symtabs_for_function): Don't pass argument for
WANT_SPECIFIC_BLOCK, pass empty optional for BLOCK_INDEX.
(class dw2_debug_names_iterator)
<dw2_debug_names_iterator>: Remove WANT_SPECIFIC_BLOCK
parameter, change BLOCK_INDEX type to gdb::optional.
<m_want_specific_block>: Remove.
<m_block_index>: Change type to gdb::optional.
(dw2_debug_names_iterator::next): Change type of IS_STATIC to
gdb::optional. Re-write in function of gdb::optional.
(dw2_debug_names_lookup_symbol): Don't pass argument for
WANT_SPECIFIC_BLOCK.
(dw2_debug_names_expand_symtabs_for_function): Don't pass
argument for WANT_SPECIFIC_BLOCK, pass empty optional for
BLOCK_INDEX.
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.
gdb/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* symtab.c (filename_partial_match_opts): New struct type.
(struct output_source_filename_data): New members
regexp, c_regexp, partial_match.
(output_source_filename): Use new members to decide to print file.
(info_sources_option_defs): New variable.
(make_info_sources_options_def_group, print_info_sources_header,
info_sources_command_completer):
New functions.
(info_sources_command): Read new optional arguments.
(_initialize_symtab): Update info sources help.
A new pair of hooks used by Ada exception handlers, for correct
release of reraised exception occurrences, involves the introduction
of new v1 symbols that GDB should use when available. The older, v0
ABI remains available in newer runtimes for bootstrapping purposes
only.
for gdb/ChangeLog
* ada-lang.c (exception_support_info_v0): Renamed from...
(default_exception_support_info): ... this. Create new
definition for v1.
(ada_has_this_exception_support): Look up catch_handlers_sym.
(ada_exception_support_info_sniffer): Try v0 after default.
Gold version of git commit c213164ad2.
elfcpp/
* powerpc.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
gold/
* powerpc.cc (Target_powerpc::Scan::get_reference_flags): Set
flags for new relocations, and some missing older relocs.
(Target_powerpc::Scan::local): Handle new pcrel tls relocs.
Call set_has_static_tls for tprel relocs.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Handle new pcrel tls relocs.
Relocations with right shifts were calculating wrong overflow status.
Since the addr34 split-field reloc is implemented as an 18-bit high
part with value shifted right by 16 and a 16-bit low part, most of the
pc-relative relocs were affected.
* powerpc.cc (Powerpc_relocate_functions::rela, rela_ua): Perform
signed right shift for signed overflow check.
bfd/ChangeLog
Ilia Diachkov <ilia.diachkov@optimitech.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Set lui relax safety area to
two pages in relro presence.
Adjust gdb.base/batch-exit-status.exp so that test prefixes don't show
directory names for the source scripts passed with -x, to make test
results from different build directories comparable.
gdb/testsuite/ChangeLog:
2019-08-01 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.base/batch-exit-status.exp: Call test_exit_status with
prefix argument.
(test_exit_status): Add prefix argument.
check_loop_aligned is used during link time relaxation to only allow
transformations that don't violate loop body alignment requirements.
Assembler can relax loops that have too long body by adding instructions
between the loop instruction and the loop body. check_loop_aligned must
check alignment of the first instruction of the actual loop body.
Detect loop / rsr.lend / wsr.lbeg sequence used in assembly time
relaxation and adjust alignment check when it's detected.
bfd/
2019-08-01 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (insn_num_slots, get_rsr_lend_opcode)
(get_wsr_lbeg_opcode): New functions.
(check_loop_aligned): Detect relaxed loops and adjust loop_len
and insn_len for the first actual instruction of the loop.
This fixes the ia64 libunwind build.
gdb/ChangeLog
2019-08-01 Tom Tromey <tromey@adacore.com>
* ia64-libunwind-tdep.h (struct libunwind_descr): Include
gdbarch.h.
This file exists in binutils-gdb/opcodes, and nothing in Makefile.in adds this
to the include path. Default builds work because in-tree readline adds
binutils-gdb/ to the include path (!). However, this is broken when compiling
with system readline.
Other files already use this way to include files in opcodes:
./gdb/lm32-tdep.c:#include "../opcodes/lm32-desc.h"
./gdb/or1k-tdep.h:#include "../opcodes/or1k-desc.h"
./gdb/mep-tdep.c:#include "../opcodes/mep-desc.h"
etc.
gdb/ChangeLog:
2019-08-01 Christian Biesinger <cbiesinger@google.com>
* s12z-tdep.c: Fix include path for s12z-opc.h.
Gdbserver has failed to build with GNU make 3.81 since commit 08f10e02be.
Update the NEWS file to state that versions earlier than 3.82 are not
supported.
3.82 was released in 2010, 3.81 was released 2006. A quick investigation
of the default GNU make version provided across various distros found the
earliest provided version to be 3.82:
*RHEL 7, Centos 6 - make 3.82
*Fedora 27 - make 4.2.1
*OpenSuse 42.2, SLES11 - make 4.2.1
*Ubuntu 16.04/18.04 - make 4.1
*Debian Jessie - make 4.0
Note that Glibc requires at least 4.0, whereas GCC still allows 3.81.
gdb/ChangeLog:
* NEWS: Require GNU make 3.82.
With gdb.threads/fork-plus-threads.exp and check-run1 we get:
...
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
inferior 1 exited (timeout)
...
Fix this by calling exp_continue for new thread and thread exited messages.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.threads/fork-plus-threads.exp: Fix check-run1 timeout by
calling exp_continue for new thread and thread exited messages.
With gdb.base/structs.exp and check-read1 we get:
...
FAIL: gdb.base/structs.exp: p chartest (timeout)
...
Fix this by using gdb_test_sequence.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/structs.exp: Fix check-read1 timeout using
gdb_test_sequence.
* lib/gdb.exp (tcl_version_at_least, lrepeat): New proc.
With gdb.base/break-interp.exp and check-read1, we run get:
...
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \
BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \
BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \
BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \
BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout)
...
Fix this by calling exp_continue after each "info files" line.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/break-interp.exp: Use exp_continue after each "info files"
line.
With gdb.base/signals.exp and check-read1 we get:
...
FAIL: gdb.base/signals.exp: info signals (timeout)
...
Fix this by using gdb_test_sequence.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/signals.exp: Fix check-read1 timeout using gdb_test_sequence.
This patch processes INSERT AFTER and INSERT BEFORE in a user -T
script when such a script is invoked on the command line inside
--start-group/--end-group. Also, ld now warns when the user simply
forgot --end-group.
PR 24806
* ldlang.c (process_insert_statements): Add start of list
parameter. Use rather than lang_os_list.head. Process insert
statements inside group statements with a recursive call.
(lang_process): Adjust process_insert_statements call.
* lexsup.c (parse_args): Warn when adding missing --end-group.
The idea is to make it a little easier to find uses of this list,
so searches don't hit occurrences of lang_output_section_statement_type
and lang_output_section_statement_enum.
* ldlang.h (lang_os_list): Rename from lang_output_section_statement.
* ldlang.c: Likewise throughout file.
* emultempl/alphaelf.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
tui_copy_win and tui_box_win are not implemented, so don't declare
them.
gdb/ChangeLog
2019-07-16 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_copy_win, tui_box_win): Don't
declare.
In Ada, it's possible to have nested functions. However,
block.c:contained_in does not recognize this. Normally, this is no
problem, but if gdb is stopped inside a nested function, then you can
end up in the unexpected situation that "print" of an expression will
work, whereas "display" of the same expression will not -- because
contained_in returns 0.
This patch simply removes the BLOCK_FUNCTION check from contained_in.
The rationale here is that in languages without nested functions, this
will not cause any issues.
gdb/ChangeLog
2019-07-30 Tom Tromey <tromey@adacore.com>
* block.c (contained_in): Remove BLOCK_FUNCTION check.
gdb/testsuite/ChangeLog
2019-07-30 Tom Tromey <tromey@adacore.com>
* gdb.ada/display_nested.exp: New file.
* gdb.ada/display_nested/foo.adb: New file.
* gdb.ada/display_nested/pack.adb: New file.
* gdb.ada/display_nested/pack.ads: New file.
When examining addresses associated with blocks with non-contiguous
address ranges, it's not uncommon to see large positive offsets which,
for some address width, actually represent a smaller negative offset.
Here's an example taken from the test case (using the
dw2-ranges-func-lo-cold executable):
(gdb) x/5i foo_cold
0x40110d <foo+4294967277>: push %rbp
0x40110e <foo+4294967278>: mov %rsp,%rbp
0x401111 <foo+4294967281>: callq 0x401106 <baz>
0x401116 <foo+4294967286>: nop
0x401117 <foo+4294967287>: pop %rbp
This commit, in conjuction with an earlier patch from this series, causes
cases like the above to be displayed like this (below) instead:
(gdb) x/5i foo_cold
0x40110d <foo_cold>: push %rbp
0x40110e <foo-18>: mov %rsp,%rbp
0x401111 <foo-15>: callq 0x401106 <baz>
0x401116 <foo-10>: nop
0x401117 <foo-9>: pop %rbp
Note that the address of foo_cold is now (due to another patch) being
displayed as <foo_cold> instead of <foo+BigOffset>. The subsequent
lines are shown as negative offsets from foo.
Disassembly using the "disassemble" command is somewhat affected by
these changes:
Before:
(gdb) disassemble foo_cold
Dump of assembler code for function foo:
Address range 0x401120 to 0x40113b:
0x0000000000401120 <+0>: push %rbp
0x0000000000401121 <+1>: mov %rsp,%rbp
0x0000000000401124 <+4>: callq 0x401119 <bar>
0x0000000000401129 <+9>: mov 0x2ef1(%rip),%eax # 0x404020 <e>
0x000000000040112f <+15>: test %eax,%eax
0x0000000000401131 <+17>: je 0x401138 <foo+24>
0x0000000000401133 <+19>: callq 0x40110d <foo+4294967277>
0x0000000000401138 <+24>: nop
0x0000000000401139 <+25>: pop %rbp
0x000000000040113a <+26>: retq
Address range 0x40110d to 0x401119:
0x000000000040110d <+-19>: push %rbp
0x000000000040110e <+-18>: mov %rsp,%rbp
0x0000000000401111 <+-15>: callq 0x401106 <baz>
0x0000000000401116 <+-10>: nop
0x0000000000401117 <+-9>: pop %rbp
0x0000000000401118 <+-8>: retq
End of assembler dump.
After:
(gdb) disassemble foo_cold
Dump of assembler code for function foo:
Address range 0x401120 to 0x40113b:
0x0000000000401120 <+0>: push %rbp
0x0000000000401121 <+1>: mov %rsp,%rbp
0x0000000000401124 <+4>: callq 0x401119 <bar>
0x0000000000401129 <+9>: mov 0x2ef1(%rip),%eax # 0x404020 <e>
0x000000000040112f <+15>: test %eax,%eax
0x0000000000401131 <+17>: je 0x401138 <foo+24>
0x0000000000401133 <+19>: callq 0x40110d <foo_cold>
0x0000000000401138 <+24>: nop
0x0000000000401139 <+25>: pop %rbp
0x000000000040113a <+26>: retq
Address range 0x40110d to 0x401119:
0x000000000040110d <-19>: push %rbp
0x000000000040110e <-18>: mov %rsp,%rbp
0x0000000000401111 <-15>: callq 0x401106 <baz>
0x0000000000401116 <-10>: nop
0x0000000000401117 <-9>: pop %rbp
0x0000000000401118 <-8>: retq
End of assembler dump.
Note that negative offsets are now displayed without the leading "+".
Also, the callq to foo_cold is now displayed as such instead of a callq
to foo with a large positive offset.
gdb/ChangeLog:
* printcmd.c (print_address_symbolic): Print negative offsets.
(build_address_symbolic): Force signed arithmetic when computing
offset.
Similar to lookup_global_symbol, except that it checks the
STATIC_SCOPE.
gdb/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
PR/24474: Add a function to lookup static variables.
* NEWS: Mention this new function.
* python/py-symbol.c (gdbpy_lookup_static_symbol): New function.
* python/python-internal.h (gdbpy_lookup_static_symbol): New function.
* python/python.c (python_GdbMethods): Add new function.
gdb/doc/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* python.texi (Symbols In Python): Document new function
gdb.lookup_static_symbol.
gdb/testsuite/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-symbol.c: Add a static variable and one in an anonymous
namespace.
* gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
When running libsegfault.exp with check-read1, I get:
...
Running gdb/testsuite/gdb.base/libsegfault.exp ...
ERROR: tcl error sourcing gdb/testsuite/gdb.base/libsegfault.exp.
ERROR: no such variable
(read trace on "env(LD_PRELOAD)")
invoked from within
"set env(LD_PRELOAD)"
("uplevel" body line 1)
invoked from within
"uplevel 1 [list set $var]"
invoked from within
"if [uplevel 1 [list array exists $var]] {
set saved_arrays($var) [uplevel 1 [list array get $var]]
} else {
set saved_scalars($var) [uplevel ..."
invoked from within
"if [uplevel 1 [list info exists $var]] {
if [uplevel 1 [list array exists $var]] {
set saved_arrays($var) [uplevel 1 [list array get $var]]
..."
(procedure "save_vars" line 11)
invoked from within
"save_vars { env(LD_PRELOAD) } {
if { ![info exists env(LD_PRELOAD) ]
|| $env(LD_PRELOAD) == "" } {
set env(LD_PRELOAD) "$lib"
} else {
..."
(procedure "gdb_spawn_with_ld_preload" line 4)
invoked from within
"gdb_spawn_with_ld_preload $libsegfault """
...
There are several things here interacting with environment variable
LD_PRELOAD:
- the expect "binary" build/gdb/testsuite/expect-read1 with does
export LD_PRELOAD=build/gdb/testsuite/read1.so before calling native expect
- read1.so which does unsetenv ("LD_PRELOAD") upon first call to read
- the test-case, which wants to set or append libSegFault.so to LD_PRELOAD
The error occurs when accessing $env(LD_PRELOAD), in a branch where
"info exists env(LD_PRELOAD)" returns true. AFAIU, this is
https://core.tcl-lang.org/tcl/tktview?name=67fd4f973a "incorrect results of
'info exists' when unset env var in one interp and check for existence from
another interp".
Work around the tcl bug by not unsetting the variable, but setting it to ""
instead:
...
- unsetenv ("LD_PRELOAD");
+ setenv ("LD_PRELOAD", "", 1);
...
Verified that reverting commit de28a3b72e "[gdb/testsuite, 2/2] Fix
gdb.linespec/explicit.exp with check-read1" reintroduced the check-read1
failure in gdb.linespec/explicit.exp.
This fixes a similar error in attach-slow-waitpid.exp, which also sets
LD_PRELOAD.
Tested on x86_64-linux with check-read1.
gdb/testsuite/ChangeLog:
2019-07-30 Tom de Vries <tdevries@suse.de>
* lib/read1.c (read): Don't use unsetenv (v), use setenv (v, "", 1)
instead.
When running gdb.base/dump.exp with --target_board=unix/-fPIE/-pie, we get:
...
Running gdb/testsuite/gdb.base/dump.exp ...
FAIL: gdb.base/dump.exp: dump array as value, intel hex
...
The FAIL happens because although the test specifies nopie, the exec is
in fact compiled as PIE. The "-fPIE -pie" options specified using the
target_board are interpreted by dejagnu as multilib_flags, and end up
overriding the nopie flags.
Fix this by checking in gdb_compile if the resulting exec is PIE despite of
a nopie setting, and if so return an error:
...
Running gdb/testsuite/gdb.base/dump.exp ...
gdb compile failed, nopie failed to prevent PIE executable
=== gdb Summary ===
nr of untested testcases 1
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-30 Tom de Vries <tdevries@suse.de>
PR testsuite/24834
* lib/gdb.exp (gdb_compile): Fail if nopie results in PIE executable.
(exec_is_pie): New proc.
This is essentially the inverse of Symbol.objfile. This allows
handling different symbols with the same name (but from different
objfiles) and can also be faster if the objfile is known.
gdb/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention new functions Objfile.lookup_{global,static}_symbol.
* python/py-objfile.c (objfpy_lookup_global_symbol): New function.
(objfpy_lookup_static_symbol): New function.
(objfile_object_methods): Add new functions.
gdb/doc/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* python.texi (Objfiles In Python): Document new functions
Objfile.lookup_{global,static}_symbol.
gdb/testsuite/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-objfile.c: Add global and static vars.
* gdb.python/py-objfile.exp: Test new functions Objfile.
lookup_global_symbol and lookup_static_symbol.
Exactly which escape sequences are emitted by gdb in TUI mode are
determined largely by the curses implementation. Testing my latest
(as yet unsubmitted) series to refactor the TUI showed a couple of
failures that I tracked to the test suite's terminal implementation.
In particular, the CSI "@" sequence was not implemented; and the CSI
"X" sequence was implemented incorrectly.
This patch fixes both of these problems. Tested on x86-64 Fedora 28.
gdb/testsuite/ChangeLog
2019-07-29 Tom Tromey <tom@tromey.com>
* lib/tuiterm.exp (Term::_csi_@): New proc.
(Term::_csi_X): Don't move cursor.
gdb/ChangeLog
2019-06-19 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention 'set|show print frame-info'. Mention new
'presence' value for 'frame-arguments'. Mention new '-frame-info'
backtrace argument. Mention that python frame filtering code
is now consistent with what 'backtrace' command prints.
gdb/doc/ChangeLog
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Backtrace): Document the new '-frame-info'
backtrace option. Reference 'set print frame-info'.
(Print Settings): Document 'set|show print frame-info'.
Document new 'presence' value for 'set print frame-arguments.
Updated tests to test the new options and new values.
Test the default for print_what in python frame filtering.
Updated the tests impacted by the default in python frame filtering
which is now consistent with the backtrace command.
gdb/testsuite/ChangeLog
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/options.exp: Update backtrace - completion to
new option -frame-info.
* gdb.base/frame-args.exp: Test new 'frame-arguments presence'.
Test new 'set print frame-info'. Test backtrace -frame-info
overriding 'set print frame-info'.
* gdb.python/py-framefilter.exp: Test new 'frame-arguments presence'.
Test new 'set print frame-info'.
Verify consistency of backtrace with and without filters, with and
without -no-filters.
* gdb.python/py-framefilter-invalidarg.exp: Update to new print_what
default.
New settings allow to better control what frame information is printed.
'set print frame-info' allows to override the default frame information
printed when a GDB command prints a frame.
The backtrace command has a new option -frame-info to override
this global setting.
It is now possible to have very short frame information by using the
new 'set print frame-arguments presence' and
'set print frame-info short-location'.
Combined with 'set print address off', a backtrace will only show
the essential information to see the function call chain, e.g.:
(gdb) set print address off
(gdb) set print frame-arguments presence
(gdb) set print frame-info short-location
(gdb) bt
#0 break_me ()
#1 call_me (...)
#2 main ()
(gdb)
This is handy in particular for big backtraces with functions having
many arguments.
Python frame filter printing logic has been updated to respect the new
setting in non MI mode.
Also, the default frame information printed was inconsistent when
backtrace was printing the frame information itself, or when the python
frame filtering code was printing the frame information.
This patch changes the default of python frame filtering to have a
consistent behaviour regarding printed frame-information, whatever
the presence/activity/matches of python filters.
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* frame.h (enum print_what): New value 'SHORT_LOCATION', update
comments.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location):
New declarations.
(struct frame_print_options): New member print_frame_info.
* extension.h (enum ext_lang_frame_args): New value CLI_PRESENCE.
* stack.h (get_user_print_what_frame_info): New declaration.
(frame_show_address): New declaration.
* stack.c (print_frame_arguments_choices): New value 'presence'.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location,
print_frame_info_choices, print_frame_info_print_what): New definitions.
(print_frame_args): Only print dots for args if print frame-arguments
is 'presence'.
(frame_print_option_defs): New element for "frame-info".
(get_user_print_what_frame_info): New function.
(frame_show_address): Make non static. Move comment to stack.h.
(print_frame_info_to_print_what): New function.
(print_frame_info): Update comment. Use fp_opts.print_frame_info
to decide what to print.
(backtrace_command_1): Handle the new print_frame_arguments_presence
value.
(_initialize_stack): Call add_setshow_enum_cmd for frame-info.
* python/py-framefilter.c (py_print_args): Handle CLI_PRESENCE.
(py_print_frame): In non-mi mode, use LOCATION as default for
print_what, similarly to frame information printed directly by
backtrace command. Handle frame-info user option in non MI mode.
When running gdb.linespec/explicit.exp with check-read1, we get:
...
(gdb) PASS: gdb.linespec/explicit.exp: set max-completions unlimited
break
-function
...
top
(gdb) PASS: gdb.linespec/explicit.exp: complete with no arguments
break
-function
...
top
(gdb) FAIL: gdb.linespec/explicit.exp: complete with no arguments (clearing input line)
...
The problem is that the send_gdb "\t\t" triggers completion twice:
...
set tst "complete with no arguments"
send_gdb "break \t"
gdb_test_multiple "" $tst {
"break \\\x07" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
...
}
clear_input_line $tst
...
but the following gdb_test_multiple only parses it once, so the second
completion is left for clear_input_line, which fails.
Fix this by triggering completion only once.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-29 Tom de Vries <tdevries@suse.de>
* gdb.linespec/explicit.exp: Fix completion trigger for "complete with
no arguments".
When running gdb.linespec/explicit.exp with check-read1, we get:
...
(gdb) PASS: gdb.linespec/explicit.exp: complete unique file name: break -source "3explicit.c"
break -source exp^Glicit^G^M
explicit.c explicit2.c ^M
(gdb) FAIL: gdb.linespec/explicit.exp: complete non-unique file name
...
The problem is that we have a gdb_test_multiple where we match two regexps:
...
set tst "complete non-unique file name"
send_gdb "break -source exp\t"
gdb_test_multiple "" $tst {
-re "break -source exp\\\x07licit" {
...
}
-re "break -source exp\\\x07l" {
# This pattern may occur when glibc debuginfo is installed.
...
}
}
...
but since second is a substring of the first, we'll usually match the first,
but with check-read1 we'll match the second.
Fix this by using a single regexp and merging the related code.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-29 Tom de Vries <tdevries@suse.de>
* gdb.linespec/explicit.exp: Fix gdb_test_multiple regexps where second
is a substring of the first for "complete non-unique file name".