In order to be able to add/remove insns to/from the middle of these
tests, generalize the patterns for the symbol reference comments of RIP-
relative operands.
With target board unix/-fPIE/-pie, we get:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
This is due comparing a get_frame_pc result (which includes the for PIE
non-zero relocation offset) with pc_high and pc_low obtained using
get_scope_pc_bounds (which do not include the relocation offset).
Fix this by adjusting pc_high and pc_low with the relocation offset.
Tested on x86_64-linux with target board unix/-fPIE/-pie.
gdb/ChangeLog:
2019-08-09 Tom de Vries <tdevries@suse.de>
PR gdb/24591
* dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and
pc_low with relocation offset.
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.
When printing unknown note types, readelf prints the raw description
section byte-by-byte. However, it does not mask appropriately, e.g. it
prints the byte 'ba' as 'ffffffba'.
* readelf.c (process_note): Mask unknown description data bytes.
PR 24854
* arc-dis.c (arc_insn_length): Return 0 rather than aborting when
encountering an unknown machine type.
(print_insn_arc): Handle arc_insn_length returning 0. In error
cases return -1 rather than calling abort.
I noticed the test for overflow of amt = size * nmemb in get_data
wasn't effective. An obvious example of nmemb = 3 and size = half max
value overflows but doesn't result in amt < nmemb. This patch fixes
this problem and reports a size truncation or overflow rather than out
of memory in more cases.
* readelf.c (get_data): Improve overflow checks.
PR 24777
* doc/binutils.texi: Ensure consistent formating of title strings
for man pages. Extend the title of the size man page to be more
informative.
This changes struct frame_arg to be self-managing and then fixes the
various users.
Tested by the buildbot.
gdb/ChangeLog
2019-08-07 Tom Tromey <tromey@adacore.com>
* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(print_frame_args): Update.
* python/py-framefilter.c (py_print_single_arg, enumerate_args):
Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* frame.h (struct frame_arg): Add initializers.
<error>: Now a unique_xmalloc_ptr.
Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.
The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking. This includes the backtrace when using MI.
For example, consider the following backtrace:
(gdb) bt
0 0x0000000000400490 in puts@plt ()
1 0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2 0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3 0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4 0x00000000004005b4 in main () at cbreak-3.c:10
The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.
An extra bool is added alongside the prev_pc in the frame structure. At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool. This is the most efficient way of doing it.
The marker is also added to the python frame printer, which is always printed if
set. The marker is not explicitly exposed to the python code.
I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used. This should be fixed up in the
the future once real hardware is available for full testsuite testing.
gdb/ChangeLog:
* NEWS: Expand the Pointer Authentication entry.
* aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
(aarch64_frame_unmask_lr): ... to this.
(aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
Call aarch64_frame_unmask_lr.
* frame.c (struct frame_info): Add "masked" variable.
(frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
(fprint_frame): Check for masked pc.
* frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
* stack.c (print_frame): Check for masked pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): New subsection.
This patch makes the elf64bpf emulation to use it's own linker script,
based on elf.sc. At the moment, the only change is that the BPF
executable doesn't define an entry symbol (BPF programs feature
several entry points scattered in several sections.)
This is a step towards the goal of generating proper ELF executables
that would be loaded by the kernel's libbpf. We are not there yet:
BPF "programs" should still be linked with -r.
This change removes a warning while linking executables, decreases the
number of unsupported tests in the target from 47 to 29, and increases
the number of expected passes from 104 to 145.
Regtested in x86_64 for all targets.
No regressions.
ld/ChangeLog:
2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com>
* scripttempl/elf64bpf.sc: Adapted from elf.sc.
* emulparams/elf64bpf.sh (SCRIPT_NAME): Use elf64bpf.
(EMBEDDED): Define.
* testsuite/ld-bpf/call-1.d: Do not expect a warning regarding an
undefined entry symbol.
* testsuite/ld-bpf/jump-1.d: Likewise.
* testsuite/ld-undefined/undefined.exp: Do not pass '-e entry' to
ld in BPF targets, and do not expect line number information.
* testsuite/ld-srec/srec.exp (run_srec_test): xfail s-record tests
in BPF targets.
This patch changes the eBPF linker to provide a relocate_section
function instead of relying on using special functions in relocation
howtos.
Tested in x86_64 host.
No regressions.
bfd/ChangeLog:
2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf64-bpf.c (bpf_elf_relocate_section): New function.
(bpf_elf_insn_disp_reloc): Delete function.
(elf_backend_relocate_section): Define.
* testsuite/binutils-all/objdump.exp
(test_objdump_dotnet_assemblies): Fix test to distinguish errors
in parsing simple pei-i386 and pei-x86-64 vs parsing the newly
introduced machine types.
* testsuite/gentestdlls.c (write_simple_dll): New function.
(main): Generate simple and Linux-specific variants of pei-i386
and pei-x86-64 files so both can be used by tests.
The flag is supposed to be used in templates which allow for both a
"short" and a "long" format memory operand. Drop it from templates not
matching this pattern. In the control/status word cases it was (ab)used
in place of the intended IgnoreSize.
This introduces obstack_strndup and changes gdb to use it.
Note that obstack_strndup works like savestring, and not exactly like
xstrndup. The difference is that obstack_strndup uses the passed-in
length, while xstrndup uses strnlen to choose the length.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* stabsread.c (patch_block_stabs, read_one_struct_field)
(read_enum_type): Use obstack_strndup.
* rust-exp.y (rust_parser::copy_name): Use obstack_strndup.
* gdb_obstack.h (obstack_strndup): Use obstack_strndup.
* dwarf2read.c (guess_full_die_structure_name)
(anonymous_struct_prefix): Use obstack_strndup.
* dbxread.c (cp_set_block_scope): Use obstack_strndup.
* c-exp.y (yylex): Use obstack_strndup.
* ada-exp.y (write_object_renaming, write_ambiguous_var)
(write_var_or_type): Use obstack_strndup.
This adds an obstack_strdup overload that takes a std::string, and
changes a few spots in gdb to use it.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Use obstack_strdup.
* stabsread.c (read_type): Use obstack_strdup.
* gdb_obstack.h (obstack_strdup): New overload.
* dwarf2read.c (dwarf2_compute_name, create_dwo_unit_in_dwp_v1)
(create_dwo_unit_in_dwp_v2, build_error_marker_type)
(dwarf2_canonicalize_name): Use obstack_strdup.
* dbxread.c (read_dbx_symtab): Use obstack_strdup.
* cp-support.c (inspect_type, replace_typedefs_qualified_name):
Use obstack_strdup.
This changes obstack_strdup to be an inline function. This seems
better to me, considering how small it is; but also it follows what
the code did before the previous patch.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* gdb_obstack.h (obstack_strdup): Define.
* gdb_obstack.c (obstack_strdup): Don't define.
This changes gdb to use obstack_strdup when appropriate, rather than
the wordier obstack_copy0.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use
obstack_strdup.
* typeprint.c (typedef_hash_table::find_global_typedef): Use
obstack_strdup.
* symfile.c (allocate_compunit_symtab): Use obstack_strdup.
* stabsread.c (common_block_start): Use obstack_strdup.
* objfiles.c (set_objfile_main_name, objfile): Use
obstack_strdup.
* namespace.c (add_using_directive): Use obstack_strdup.
* mdebugread.c (parse_symbol, parse_type): Use obstack_strdup.
* jit.c (finalize_symtab): Use obstack_strdup.
* dwarf2read.c (fixup_go_packaging, dwarf2_physname)
(guess_partial_die_structure_name, partial_die_info::fixup)
(dwarf2_name): Use obstack_strdup.
* coffread.c (coff_read_struct_type, coff_read_enum_type): Use
obstack_strdup.
* c-exp.y (scan_macro_expansion): Use obstack_strdup.
* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use
obstack_strdup.
* ada-lang.c (ada_decode_symbol): Use obstack_strdup.
Several approaches were discussed (mail or irc) to verify the invariants of
the GDB help documentation : checking with apropos ., modifying add_cmd
to do the check and output a warning, implement maintenance check-doc.
A selftest was finally chosen as:
* this can be run on demand, including by users if they want
to check user defined commands.
* it does not interact with the normal behaviour of apropos, define,
python, ...
(such as output warnings when a user defines a command help that
does not respect the doc).
* when the selftest runs, it checks the user defined and python
defined commands currently defined.
gdb/ChangeLog
* unittests/help-doc-selftests.c: New file.
* Makefile.in: Add the new file.
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.
This patch drops gdb's configury support for glibc's mcheck function.
It has been observed to cause false abort()s, because it is
thread-unsafe yet interposes every malloc/free operation. So if any
library transitively used by gdb also uses threads, then these
functions can easily corrupt their own checking data. These days, gcc
ASAN and valgrind provide high quality checking, and mcheck is
apparently itself being slowly deprecated.
So, let's stop linking to it. Attached patch drops the
autoconf/Makefile machinery for both gdb and gdbserver. No
testsuite-visible impact. IMHO not worth mentioning in NEWS.
See also: https://sourceware.org/bugzilla/show_bug.cgi?id=9939
gdb/ChangeLog
PR build/24886
* configure.ac: Drop enable-libmcheck support.
* configure, config.in: Rebuild.
* libmcheck.m4: Remove.
* acinclude.m4: Don't include it.
* Makefile.in: Don't distribute it.
* top.c (print_gdb_configuration): Don't mention it.
gdb/gdbserver/ChangeLog
PR build/24886
* configure.ac: Drop enable-libmcheck support.
* configure, config.in: Rebuild.
* acinclude.m4: Don't include it.
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.
For better readability and type safety.
gdb/ChangeLog:
2019-08-06 Christian Biesinger <cbiesinger@google.com>
* symtab.c (symbol_cache_lookup): Change int to enum block_enum.
(error_in_psymtab_expansion): Likewise.
(lookup_symbol_via_quick_fns): Likewise.
(basic_lookup_transparent_type_quick): Likewise.
(basic_lookup_transparent_type_1): Likewise.
print_source_lines_base reopens the source file every time that a
source line is to be printed. However, there's no need to do this so
frequently -- it's enough to do it when switching source files, and
otherwise rely on the cache.
The code seems to try to avoid these multiple opens; at a guess I'd
say something just got confused along the way.
This patch fixes the problem by reorganizing the code both to make it
more clear, and to ensure that reopens only occur when the "last
source visited" changes.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source.c (last_source_error): Now bool.
(print_source_lines_base): Make "noprint" bool. Only open
source file when last_source_visited changes.
Currently, gdb stores the number of lines and an array of file offsets
for the start of each line in struct symtab. This patch moves this
information to the source cache. This has two benefits.
First, it allows gdb to read a source file less frequently.
Currently, a source file may be read multiple times: once when
computing the file offsets, once when highlighting, and then pieces
may be read again while printing source lines. With this change, the
file is read once for its source text and file offsets; and then
perhaps read again if it is evicted from the cache.
Second, if multiple symtabs cover the same source file, then this will
share the file offsets between them. I'm not sure whether this
happens in practice.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* annotate.c (annotate_source_line): Use g_source_cache.
* source-cache.c (source_cache::get_plain_source_lines): Change
parameters. Populate m_offset_cache.
(source_cache::ensure): New method.
(source_cache::get_line_charpos): New method.
(extract_lines): Move lower. Change parameters.
(source_cache::get_source_lines): Move lower.
* source-cache.h (class source_cache): Update comment.
<get_line_charpos>: New method.
<get_source_lines>: Update comment.
<clear>: Clear m_offset_cache.
<get_plain_source_lines>: Change parameters.
<ensure>: New method
<m_offset_cache>: New member.
* source.c (forget_cached_source_info_for_objfile): Update.
(info_source_command): Use g_source_cache.
(find_source_lines, open_source_file_with_line_charpos): Remove.
(print_source_lines_base, search_command_helper): Use g_source_cache.
* source.h (open_source_file_with_line_charpos): Don't declare.
* symtab.h (struct symtab) <nlines, line_charpos>: Remove.
* tui/tui-source.c (tui_source_window::do_scroll_vertical):
Use g_source_cache.
Currently the source cache will only store highlighted text. However,
there's no reason it could not also store plain text, when styling is
turned off.
This patch makes this change. This also simplifies the source cache
code somewhat.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source-cache.c (source_cache::get_plain_source_lines):
Remove "first_line" and "last_line" parameters.
(source_cache::get_source_lines): Cache plain text.
* source-cache.h (class source_cache)
<get_plain_source_lines>: Update.
The source cache was not returning the final \n of the requested range
of lines. This caused regressions with later patches in this series,
so this patch pre-emptively fixes the bug.
This adds a self-test of "extract_lines" to the source cache code. To
make it simpler to test, I changed extract_lines to be a static
function, and changed it's API a bit.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source-cache.c (extract_lines): No longer a method.
Changed type of parameter. Include final newline.
(selftests::extract_lines_test): New function.
(_initialize_source_cache): Likewise.
* source-cache.h (class source_cache)
<extract_lines>: Don't declare.
This changes breakpoint::filter to be a unique_xmalloc_ptr, removing
an explicit xfree, as well as a use of a "release" method.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* breakpoint.c (init_breakpoint_sal): Update.
(breakpoint): Update.
* breakpoint.h (struct breakpoint) <filter>: Now a
unique_xmalloc_ptr.
This is a mostly cosmetic fix for cases like PR24873 where LTO
recompiled objects were supposed to be inserted inside a group. The
specific case handled by this patch is when the first file inside a
group is an archive, the first file claimed by the plugin. Prior to
this patch we would have inserted the recompiled objects before the
group, which doesn't matter really since the entire group will be
reloaded, but it looks a little wrong in map files.
PR 24873
* ldlang.c (find_replacements_insert_point): Return "before" flag.
(find_next_input_statement): New function.
(lang_process): When placing recompiled LTO objects before a
claimed archive, place them immediately before in the statement
list.
Reloading of archives (and checking --as-needed DSOs again) is
disabled until we hit the plugin insert point. It's necessary to do
that because in a case like lib1.a lto.o lib2.a where lib1.a and
lib2.a contain duplicate symbols, we want the lto.o recompiled object
to pull in objects from lib2.a as necessary, but not from lib1.a.
Unfortunately this heuristic fails when the insert point is inside a
group, because ld actually loads the symbols from the recompiled
object before running over the contours of the script, thus missing
the fact that new undefs appeared in the group.
PR 24873
* ldlang.c (plugin_undefs): New static var.
(open_input_bfds <lang_group_statement_enum>): Loop on
plugin_undefs and hitting plugin_insert point.
(lang_process <lto_plugin_active>): Set plugin_undefs.
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.
Based on an explanation by tromey on IRC.
gdb/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* objfiles.h (objfile): Add a comment describing partial symbols.
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.
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.
Currently some code in gdb uses build_help with N_(), like:
static const std::string compile_print_help
= gdb::option::build_help (N_("\
I believe this is incorrect. The N_ macro is used to mark text that
should end up in the message catalog, but which will be translated by
a later call to gettext.
However, in this case, there is no later call to gettext, so (if gdb
had translations), this text would remain untranslated.
Instead, I think using the ordinary _() macro is correct here.
Translators will have to know to preserve "%OPTIONS%" in the text --
but that seems both unavoidable and fine.
Tested by rebuilding as there's not much else to do.
gdb/ChangeLog
2019-08-05 Tom Tromey <tromey@adacore.com>
* compile/compile.c (_initialize_compile): Use _(), not N_().
* thread.c (_initialize_thread): Use _(), not N_().
* stack.c (_initialize_stack): Use _(), not N_().
* printcmd.c (_initialize_printcmd): Use _(), not N_().
Previously GAS would accept .u32, .u16 and .u8 suffixes to the VQ(R)DMLAH and VQ(R)DMLASH
instructions, however the Armv8.1-M Mainline specification states that these functions only
have signed variations (.s32, .s16 and .s8 suffixes).
This is documented here:
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf?_ga=2.143079093.1892401233.1563295591-999473562.1560847439#page=1183
gas * config/tc-arm.c (do_mve_vqdmlah): Use N_S_32 macro.
(do_neon_qrdmlah): Use N_S_32 macro.
* testsuite/gas/arm/mve-vqdmlah-bad.d: New test.
* testsuite/gas/arm/mve-vqdmlah-bad.l: New test.
* testsuite/gas/arm/mve-vqdmlah-bad.s: New test.
* testsuite/gas/arm/mve-vqdmlah.d: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlah.s: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlash-bad.d: New test.
* testsuite/gas/arm/mve-vqdmlash-bad.l: New test.
* testsuite/gas/arm/mve-vqdmlash-bad.s: New test.
* testsuite/gas/arm/mve-vqdmlash.d: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlash.s: Remove unsigned instruction tests.
opcodes * arm-dis.c: Only accept signed variants of VQ(R)DMLAH and VQ(R)DMLASH
instructions.
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.