Simon Marchi [Sun, 13 Oct 2019 04:46:13 +0000 (00:46 -0400)]
gdb: remove unused includes from dwarf2read.c
include-what-you-use says:
../../../src/binutils-gdb/gdb/dwarf2read.c should remove these lines:
- #include <ctype.h> // lines 67-67
- #include <sys/stat.h> // lines 59-59
- #include <sys/types.h> // lines 83-83
- #include <cmath> // lines 88-88
- #include <forward_list> // lines 90-90
- #include <set> // lines 89-89
- #include <unordered_set> // lines 85-85
- #include "completer.h" // lines 60-60
- #include "expression.h" // lines 44-44
- #include "gdbsupport/byte-vector.h" // lines 78-78
- #include "gdbsupport/filestuff.h" // lines 71-71
- #include "gdbsupport/gdb_unlinker.h" // lines 74-74
After a quick glance, that makes sense, so this patch removes them.
gdb/ChangeLog:
* dwarf2read.c: Remove includes.
Change-Id: I13cfcb2f1d747144fddba7f66b329630b79dae90
Alan Modra [Mon, 14 Oct 2019 03:27:01 +0000 (13:57 +1030)]
qsort: ldctor.c CONSTRUCTORS
ctor_cmp had an ineffective comparison of addresses in an attempt to
ensure sort stability. Comparing the addresses passed to the
comparison function can't work since those addresses may be from an
array that is already perturbed by qsort.
* ldctor.h (struct set_element): Make next field a union, adding
idx field.
* ldctor.c (ctor_cmp): Dereference pointer and lose unnecessary
const. Replace final sort on pointer value with final sort on idx.
(ldctor_add_set_entry): Adjust next field access.
(ldctor_build_sets): Likewise. Set u.idx field for sort.
Alan Modra [Mon, 14 Oct 2019 03:25:32 +0000 (13:55 +1030)]
qsort: pe-dll.c reloc sorting
* pe-dll.c (reloc_data_type): Add idx field.
(reloc_sort): Perform final sort by idx.
(generate_reloc): Set idx.
Alan Modra [Mon, 14 Oct 2019 03:24:09 +0000 (13:54 +1030)]
qsort: objcopy.c section sort
* objcopy.c (compare_section_lma): Correct comment. Dereference
section pointer earlier and lose unnecessary const. Style fixes.
Add final sort by id.
Alan Modra [Mon, 14 Oct 2019 03:23:40 +0000 (13:53 +1030)]
qsort: syms.c stab sorting
* syms.c (struct indexentry): Add idx field.
(cmpindexentry): Final sort on idx.
(_bfd_stab_section_find_nearest_line): Set idx.
Alan Modra [Mon, 14 Oct 2019 03:22:32 +0000 (13:52 +1030)]
qsort: dwarf2.c
This patch ensures qsort stability in line and function sorting done
in dwarf2.c. For the line sequences we make use of an existing field
that isn't used until later, as a monotonic counter for the qsort.
* dwarf2.c (struct lookup_funcinfo): Add idx field.
(compare_lookup_funcinfos): Perform final sort on idx.
(build_lookup_funcinfo_table): Set idx.
(compare_sequences): Perform final sort on num_lines.
(build_line_info_table): Set num_lines and line_info_lookup earlier.
(sort_line_sequences): Set num_lines for sort.
Alan Modra [Mon, 14 Oct 2019 03:21:19 +0000 (13:51 +1030)]
qsort: elf_link_add_object_symbols weak aliases
This particular sort almost certainly does not need to be stable for
the ELF linker to work correctly. However it is conceivable that an
unstable sort could affect linker output, and thus different output be
seen with differing qsort implementations. The argument goes like
this: Given more than one strong alias symbol of equal section, value,
and size, the aliases will compare equal by elf_sort_symbol and thus
which one is chosen as the "real" symbol to be made dynamic depends on
qsort. Why would anyone define two symbols at the same address?
Well, sometimes the fact that there are more than one strong alias
symbol is due to linker script symbols like __bss_start being made
dynamic. This will match the first symbol defined in .bss if it
doesn't have correct size, and forgetting to properly set size and
type of symbols isn't as rare as it should be.
This patch adds some more heuristics to elf_sort_symbol.
* elflink.c (elf_sort_symbol): Sort on type and name as well.
(elf_link_add_object_symbols): Style fix.
Alan Modra [Mon, 14 Oct 2019 03:20:48 +0000 (13:50 +1030)]
qsort: elf_sort_sections use of target_index
elf_sort_sections tried to ensure a stable qsort by using target_index
as the final comparison, but target_index hasn't been set by anything
at the time elf_sort_sections was run. This patch arrange to have
target_index set.
* elf.c (_bfd_elf_map_sections_to_segments): Init target_index
for sections about to be sorted.
(assign_file_positions_for_load_sections): Likewise.
(elf_sort_sections): Don't bother optimising both TOEND case.
* elflink.c (bfd_elf_final_link): Reset target_index.
Alan Modra [Mon, 14 Oct 2019 03:19:34 +0000 (13:49 +1030)]
qsort: SHF_LINK_ORDER section sort
The linker SHF_LINK_ORDER section sorting had a number of defects.
1) The ordering was by VMA, which won't work with overlays. LMA is
better.
2) Zero size sections can result in two sections at the same LMA/VMA.
When only one of the two sections at the same LMA is zero size,
that one must be first.
3) Warnings given by elf_get_linked_section_vma won't ever be emitted
since elf_object_p warns and excludes objects with zero sh_link on
a SHF_LINK_ORDER section.
4) Section offset was adjusted down rather than up by section
alignment, possibly creating overlapping sections.
5) Finding the linked section did so the hard way, rather than simply
using elf_linked_to_section.
* elflink.c (elf_get_linked_section_vma): Delete.
(compare_link_order): Use elf_linked_to_section and sort by lma,
size, and id.
(elf_fixup_link_order): Use size_t variables where appropriate.
Make use of elf_linked_to_section. Formatting. Properly align
sections.
Alan Modra [Mon, 14 Oct 2019 03:05:21 +0000 (13:35 +1030)]
qsort issues
qsort isn't guaranteed to be a stable sort, that is, elements
comparing equal according to the comparison function may be reordered
relative to their original ordering. Of course sometimes you may not
care, but even in those cases it is good to force some ordering
(ie. not have the comparison function return 0) so that linker output
is reproducible over different libc qsort implementations.
One way to make qsort stable (which the glibc manual incorrectly says
is the only way) is to augment the elements being sorted with a
monotonic counter of some kind, and use that counter as the final
arbiter of ordering in the comparison function.
Another way is to set up an array of pointers into the array of
elements, first pointer to first element, second pointer to second
element and so so, and sort the pointer array rather than the element
array. Final arbiter in the comparison function then is the pointer
difference. This works well with, for example, the symbol pointers
returned by _bfd_elf_canonicalize_symtab which point into a symbol
array.
This patch fixes a few places where sorting by symbol pointers is
appropriate, and adds comments where qsort stability is a non-issue.
* elf-strtab.c (strrevcmp): Comment.
* merge.c (strrevcmp): Likewise.
* elf64-ppc.c (compare_symbols): Correct final pointer comparison.
Comment on why comparing pointers ensures a stable sort.
* elflink.c (struct elf_symbol): Add void* to union.
(elf_sort_elf_symbol): Ensure a stable sort with pointer comparison.
(elf_sym_name_compare): Likewise.
(bfd_elf_match_symbols_in_sections): Style fix.
(elf_link_sort_cmp1): Comment.
Alan Modra [Mon, 14 Oct 2019 03:04:30 +0000 (13:34 +1030)]
PR24955, libbfd terminating program on out of memory (part2)
PR 24955
* elflink.c (elf_output_implib): Don't use xmalloc. Don't ignore
return value of bfd_alloc2.
* peXXigen.c (_bfd_XXi_write_codeview_record): Don't use xmalloc.
* pef.c (bfd_pef_print_symbol): Likewise. Don't ignore return
value of bfd_get_section_contents.
* som.c (som_write_space_strings): Don't use xmalloc.
(som_write_symbol_strings): Likewise.
GDB Administrator [Mon, 14 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 11 Oct 2019 19:36:49 +0000 (15:36 -0400)]
gdb: Silence -Wformat-nonliteral warning with clang
We get this warning when building with clang:
CXX ui-out.o
/home/smarchi/src/binutils-gdb/gdb/ui-out.c:590:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
do_message (style, format, args);
^~~~~~
This can be considered a legitimate warning, as call_do_message's format
parameter is not marked as a format string. Therefore, we should
normally mark the call_do_message method with the `format` attribute.
However, doing so just moves (and multiplies) the problem, as all the
uses of call_do_message in the vmessage method now warn. If we wanted
to continue on that path, we should silence the warning for each of
them, as a way of telling the compiler "it's ok, we know what we are
doing".
But since call_do_message is really just vmessage's little helper, it's
simpler to just silence the warning at that single point.
gdb/ChangeLog:
* ui-out.c (ui_out::call_do_message): Silence
-Wformat-nonliteral warning.
Change-Id: I58ad41793448f38835c5d6ba7b9e5c4dd8df260f
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR c++/20020 in ChangeLog entry
[ Port of gdb-8.3-branch commit
59047affb0a "Update ChangeLog entry of commit
98c90f8028 and mention PR c++/20020". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR testsuite/25016 in ChangeLog entry
[ Port of gdb-8.3-branch commit
3d80b2e754f "Update ChangeLog entry of commit
3b752ac2e6 and mention PR testsuite/25016". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR breakpoints/25011 in ChangeLog entry
[ Port of gdb-8.3-branch commit
88f07f28d5b "Update ChangeLog entry of commit
7e38ddcb2e and mention PR breakpoints/25011". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR gdb/25010 in ChangeLog entry
[ Port of gdb-8.3-branch commit
5ca0b868fa7 "Update ChangeLog entry of commit
8ac39635f6 and mention PR gdb/25010". ]
Nick Clifton [Sun, 13 Oct 2019 12:33:27 +0000 (13:33 +0100)]
Update the README-how-to-make-a-release file with a note to reset the development flag back to true after making a point release. Aldo fix a typo in the ld/NEWS file.
binutils* README-how-to-make-a-release: Add a note to reset the
development flag back to true after making a point release.
ld * NEWS: Delete superflous "Changes in 2.33" comment.
Simon Marchi [Sun, 13 Oct 2019 03:46:15 +0000 (23:46 -0400)]
gdb: small cleanup in breakpoint.c's includes
In an attempt to reduce the number of files re-build when some headers
are touched, I ran include-what-you-use with breakpoint.c as a guinea
pig. It revealed a few files that were unnecessary to include, which
this patch removes.
breakpoint.c uses tilde_expand from readline, hence the necessity to
include tilde.h. AFAIK, it's fine to include just that, and not the
whole readline headers.
include-what-you-use also reported many header files that should be
included but aren't, I suppose that breakpoint.c currently includes them
indirectly. For now I'll pretend I didn't see that :).
gdb/ChangeLog:
* breakpoint.c: Remove some includes: continuations.h, skip.h,
mi/mi-main.h, readline/readline.h, readline/history.h. Add
include: readline/tilde.h.
-#include "skip.h"
#include "ax-gdb.h"
#include "dummy-frame.h"
#include "interps.h"
@@ -69,11 +67,9 @@
#include "thread-fsm.h"
#include "tid-parse.h"
#include "cli/cli-style.h"
-#include "mi/mi-main.h"
/* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include "readline/tilde.h"
/* readline defines this. */
#undef savestring
Change-Id: I88bfe9071f2f973fd84caaf04b95c33a4dfb33de
Tom de Vries [Sun, 13 Oct 2019 00:40:57 +0000 (02:40 +0200)]
[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
Normally the gdb.reverse/*.exp test-cases pass on my system (apart from the
record/23188 KFAIL for gdb.reverse/step-precsave.exp). But when specifying
GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable to force glibc to use
_dl_runtime_resolve_xsave instead of _dl_runtime_resolve_xsavec, we run into
1054 FAILs like this:
...
(gdb) PASS: gdb.reverse/sigall-reverse.exp: b gen_HUP
continue^M
Continuing.^M
Process record does not support instruction 0xfae64 at address \
0x7ffff7ded958.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00007ffff7ded958 in _dl_runtime_resolve_xsave () from \
/lib64/ld-linux-x86-64.so.2^M
(gdb) FAIL: gdb.reverse/sigall-reverse.exp: get signal ABRT
...
The problem is that the xsave instruction is not supported in
reverse-debugging (PR record/25038).
Add KFAILs for this PR.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-13 Tom de Vries <tdevries@suse.de>
PR record/25038
* gdb.reverse/sigall-precsave.exp: Add PR record/25038 KFAIL.
* gdb.reverse/sigall-reverse.exp: Same.
* gdb.reverse/solib-precsave.exp: Same.
* gdb.reverse/solib-reverse.exp: Same.
* gdb.reverse/step-precsave.exp: Same.
* gdb.reverse/until-precsave.exp: Same.
* gdb.reverse/until-reverse.exp: Same.
* lib/gdb.exp (gdb_continue_to_breakpoint): Same.
GDB Administrator [Sun, 13 Oct 2019 00:01:15 +0000 (00:01 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 11 Oct 2019 03:57:36 +0000 (22:57 -0500)]
Remove unnecessary declaration of trace_regblock_size
This variable is declared in tracepoint.h, which is already included
by remote.c.
gdb/ChangeLog:
2019-10-12 Christian Biesinger <cbiesinger@google.com>
* remote.c (remote_target::get_trace_status): Remove declaration of
trace_regblock_size.
Christian Biesinger [Thu, 10 Oct 2019 04:27:33 +0000 (23:27 -0500)]
Move declaration of max_user_call_depth to header
Also removes an unnecessary declaration of cmdlist in cli-cmds.c.
I don't understand why it is there, the definition of cmdlist is
at the top of the same file.
gdb/ChangeLog:
2019-10-12 Christian Biesinger <cbiesinger@google.com>
* cli/cli-cmds.c (max_user_call_depth): Move comment to header.
(show_user): Remove declaration of cmdlist.
* cli/cli-cmds.h (max_user_call_depth): Declare.
* cli/cli-script.c (execute_user_command): Remove declaration
of max_user_call_depth.
Nick Clifton [Sat, 12 Oct 2019 15:04:20 +0000 (16:04 +0100)]
Tweak the 'how to make a release' document
GDB Administrator [Sat, 12 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Fri, 11 Oct 2019 18:28:35 +0000 (11:28 -0700)]
Improve comments in print-utils.h.
Since I had to look at these function comments to fix the RISC-V ARI warnings,
I noticed that they make no sense. The pulongest and plongest comments are
swapped. phex is missing a comment. And phex_nz doesn't mention how it is
different from phex.
* gdbsupport/print-utils.h (pulongest): Fix comment.
(plongest): Likewise.
(phex): Add missing comment, mention leading zeros.
(phex_nz): Add mention of no leading zeros to comment.
Jim Wilson [Fri, 11 Oct 2019 18:26:29 +0000 (11:26 -0700)]
RISC-V: Fix two ARI warnings.
> gdb/riscv-tdep.c:1657: code: %ll: Do not use printf(%ll), instead use printf(%s,phex()) to dump a 'long long' value
gdb/riscv-tdep.c:1657: "Writing %lld-byte nop instruction to %s: %s\n",
> gdb/riscv-tdep.c:1658: code: long long: Do not use 'long long', instead use LONGEST
gdb/riscv-tdep.c:1658: ((unsigned long long) sizeof (nop_insn)),
fprintf_unfiltered doesn't support z (or j for that matter), and fixing that
is a larger patch than I'd like to write, so this does basically what the
ARI warnings recommends. We don't need the cast as there is a prototype for
plongest.
* riscv-tdep.c (riscv_push_dummy_code): Change %lld to %s and use
plongest instead of unsigned long long cast.
Max Filippov [Thu, 10 Oct 2019 23:37:25 +0000 (16:37 -0700)]
bfd/dwarf2.c: fix assertion failure in comp_unit_hash_info
stash_maybe_enable_info_hash_tables sets
stash->info_hash_status = STASH_INFO_HASH_ON;
regardless of the result of stash_maybe_update_info_hash_tables call. In
case it fails this results in repeated invocation of comp_unit_hash_info
for the same comp unit and assertion failure in this function.
Only set stash->info_hash_status = STASH_INFO_HASH_ON; when
stash_maybe_update_info_hash_tables is successful.
bfd/
2019-10-11 Max Filippov <jcmvbkbc@gmail.com>
* dwarf2.c (stash_maybe_enable_info_hash_tables): Only set
stash->info_hash_status = STASH_INFO_HASH_ON when
stash_maybe_update_info_hash_tables succeeds.
Nick Clifton [Fri, 11 Oct 2019 10:58:22 +0000 (11:58 +0100)]
Updated traditional Chinese translation for the binutils/ subdirectory
GDB Administrator [Fri, 11 Oct 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Thu, 10 Oct 2019 17:42:41 +0000 (12:42 -0500)]
Include gdbtk.h to avoid declarations
Once https://sourceware.org/ml/insight/2019-q4/msg00000.html lands,
we can just include gdbtk.h to get the declarations for
external_editor_command and gdbtk_test, instead of having to
declare them here in main.c.
gdb/ChangeLog:
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* main.c (captured_main_1): Include gdbtk.h and remove declarations
for external_editor_command and gdbtk_test.
Christian Biesinger [Thu, 10 Oct 2019 04:06:14 +0000 (23:06 -0500)]
Move declaration of varobjdebug to header
gdb/ChangeLog:
2019-10-10 Christian Biesinger <cbiesinger@google.com>
* mi/mi-cmd-var.c (varobjdebug): Remove declaration.
* varobj.c (varobjdebug): Move comment to...
* varobj.h (varobjdebug): ...here, and declare.
Andreas Arnez [Thu, 10 Oct 2019 10:22:49 +0000 (12:22 +0200)]
gdb/testsuite: Fix typos in infcall-nested-structs.c
Some of the comparison functions in infcall-nested-structs.c contain
redundant comparisons like a.<some_field> == a.<some_field> instead of
a.<some_field> == b.<some_field>. They were introduced with this commit:
36eb4c5f9bbe6 - "infcall-nested-structs: Test up to five fields"
Fix the redundant comparisons.
gdb/testsuite/ChangeLog:
* gdb.base/infcall-nested-structs.c (cmp_struct_02_01)
(cmp_struct_02_02, cmp_struct_04_01, cmp_struct_04_02)
(cmp_struct_05_01, cmp_struct_static_02_01)
(cmp_struct_static_04_01, cmp_struct_static_06_01): Fix redundant
comparisons.
Tom de Vries [Thu, 10 Oct 2019 09:51:34 +0000 (11:51 +0200)]
[gdb/testsuite] Fix ada tests with -fPIE/-pie
When running the gdb testsuite with target board unix/-fPIE/-pie, the
resulting ada executables are not PIE executables, because gnatmake doesn't
recognize -pie, and consequently doesn't pass it to gnatlink.
Fix this by replacing "-pie" with "-largs -pie -margs" in
target_compile_ada_from_dir, and doing the same for -no-pie.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-10 Tom de Vries <tdevries@suse.de>
PR testsuite/24888
* lib/ada.exp (target_compile_ada_from_dir): Route -pie/-no-pie to
gnatlink.
GDB Administrator [Thu, 10 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 1 Oct 2019 23:42:17 +0000 (17:42 -0600)]
Don't call erase_data_content from tui_data_window::show_registers
tui_data_window::show_registers currently calls erase_data_content.
However, I think it's better to have fewer calls to this (ideally just
one would suffice). This refactors that function to remove this call.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::show_registers): Don't call
erase_data_content.
Tom Tromey [Tue, 1 Oct 2019 23:29:49 +0000 (17:29 -0600)]
Make TUI window handle a unique_ptr
This changes tui_gen_win_info::handle to be a specialization of
unique_ptr. This is perhaps mildly uglier in some spots, due to the
proliferation of "get"; but on the other hand it cleans up some manual
management and it allows for the removal of tui_delete_win.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_delete_win): Don't declare.
* tui/tui-stack.c (tui_locator_window::rerender): Update.
* tui/tui-command.c (tui_cmd_window::resize)
(tui_refresh_cmd_win): Update.
* tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update.
* tui/tui.c (tui_rl_other_window, tui_enable): Update.
* tui/tui-data.c (~tui_gen_win_info): Remove.
* tui/tui-layout.c (tui_gen_win_info::resize): Update.
* tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts)
(tui_redisplay_readline, tui_mld_flush)
(tui_mld_erase_entire_line, tui_mld_getc, tui_getc): Update.
* tui/tui-regs.c (tui_data_window::delete_data_content_windows)
(tui_data_window::erase_data_content)
(tui_data_item_window::rerender)
(tui_data_item_window::refresh_window): Update.
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window)
(box_win, tui_gen_win_info::make_window)
(tui_gen_win_info::make_visible): Update.
(tui_delete_win): Remove.
* tui/tui-winsource.c
(tui_source_window_base::do_erase_source_content): Update.
(tui_show_source_line, tui_source_window_base::update_tab_width)
(tui_source_window_base::update_exec_info): Update.
* tui/tui-data.h (struct curses_deleter): New.
(struct tui_gen_win_info) <handle>: Now a unique_ptr.
(struct tui_gen_win_info) <~tui_gen_win_info>: Define.
Tom Tromey [Tue, 1 Oct 2019 23:16:41 +0000 (17:16 -0600)]
Remove declaration from tui-wingeneral.h
tui-wingeneral.h has an unused forward declaration. This removes it.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (struct tui_gen_win_info): Don't declare.
Tom Tromey [Tue, 1 Oct 2019 23:14:14 +0000 (17:14 -0600)]
Remove tui_win_is_auxiliary
tui_win_is_auxiliary is not used, so remove it.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui-data.c (tui_win_is_auxiliary): Remove.
* tui/tui-data.h (tui_win_is_auxiliary): Don't declare.
Tom Tromey [Tue, 1 Oct 2019 23:03:54 +0000 (17:03 -0600)]
Remove tui_default_win_viewport_height
tui_default_win_viewport_height was only called from a single spot,
for a single type of window. This patch removes the function and
moves the logic into the sole caller.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_low_disassembly_address): Compute
window height directly.
* tui/tui-layout.h (tui_default_win_viewport_height): Don't
declare.
* tui/tui-layout.c (tui_default_win_height): Remove.
(tui_default_win_viewport_height): Remove.
Tom Tromey [Tue, 1 Oct 2019 22:58:26 +0000 (16:58 -0600)]
Remove two TUI comments
This removes two comments from tui.h. These were not useful.
gdb/ChangeLog
2019-10-09 Tom Tromey <tom@tromey.com>
* tui/tui.h: Remove comments.
Tom de Vries [Wed, 9 Oct 2019 21:57:11 +0000 (23:57 +0200)]
[gdb/testsuite] Add XFAILs in gdb.rust/simple.exp for incorrect DWARF
On openSUSE Leap 15.1 using rustc version 1.36.0 (using llvm 7), I get:
...
(gdb) PASS: gdb.rust/simple.exp: print e2.0
print k^M
$54 = simple::SpaceSaver::Thebox(40, 0x0)^M
(gdb) FAIL: gdb.rust/simple.exp: print k
...
while we're expecting:
...
gdb_test "print k" " = simple::SpaceSaver::Nothing"
...
When using a relatively recent version of Rust with a somewhat older version
of LLVM, the Rust compiler will emit a legacy encoding of enums (see also
quirk_rust_enum in dwarf2read.c).
So, the variable k:
...
<17><3d58>: Abbrev Number: 15 (DW_TAG_variable)
<3d59> DW_AT_location : 3 byte block: 91 b8 4 (DW_OP_fbreg: 568)
<3d5d> DW_AT_name : (indirect string, offset: 0xf9a): k
<3d61> DW_AT_alignment : 1
<3d62> DW_AT_decl_file : 1
<3d63> DW_AT_decl_line : 129
<3d64> DW_AT_type : <0x4232>
...
has type:
...
<2><4232>: Abbrev Number: 11 (DW_TAG_union_type)
<4233> DW_AT_name : (indirect string, offset: 0x3037): SpaceSaver
<4237> DW_AT_byte_size : 16
<4238> DW_AT_alignment : 8
<3><4239>: Abbrev Number: 9 (DW_TAG_member)
<423a> DW_AT_name : (indirect string, offset: 0x29f5): RUST$ENCODED$ENUM$0$Nothing
<423e> DW_AT_type : <0x4245>
<4242> DW_AT_alignment : 8
<4243> DW_AT_data_member_location: 0
...
The "RUST$ENCODED$ENUM$0$Nothing" means that field 0 is both a pointer and a
discriminant, and if the value is 0, then the enum is just a data-less variant
named "Nothing".
However, the corresponding type has two fields, where not field 0 but field 1
is a pointer, and field 0 is a byte:
...
<2><4245>: Abbrev Number: 8 (DW_TAG_structure_type)
<4246> DW_AT_name : (indirect string, offset: 0x2a11): Thebox
<424a> DW_AT_byte_size : 16
<424b> DW_AT_alignment : 8
<3><424c>: Abbrev Number: 9 (DW_TAG_member)
<424d> DW_AT_name : (indirect string, offset: 0x670): __0
<4251> DW_AT_type : <0x436b>
<4255> DW_AT_alignment : 1
<4256> DW_AT_data_member_location: 8
<3><4257>: Abbrev Number: 9 (DW_TAG_member)
<4258> DW_AT_name : (indirect string, offset: 0x1662): __1
<425c> DW_AT_type : <0x45da>
<4260> DW_AT_alignment : 8
<4261> DW_AT_data_member_location: 0
...
Mark this as xfail.
gdb/testsuite/ChangeLog:
2019-10-09 Tom de Vries <tdevries@suse.de>
PR testsuite/25048
* gdb.rust/simple.exp: Add xfails for incorrect DWARF.
Tom de Vries [Wed, 9 Oct 2019 21:52:46 +0000 (23:52 +0200)]
[gdb/target] Fix pretty-printer for MPX bnd registers
I'm seeing this failure:
...
(gdb) print /x $bnd0 = {0x10, 0x20}^M
$23 = {lbound = 0x10, ubound = 0x20}^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: verify size for bnd0
...
The test expects a pretty printer to be actived printing 'size 17':
...
set test_string ".*\\\: size 17.*"
gdb_test "print /x \$bnd0 = {0x10, 0x20}" "$test_string" "verify size for bnd0"
...
but that doesn't happen.
The pretty printer is for the type of the $bnd0 register, which is created
here in i386_bnd_type:
...
t = arch_composite_type (gdbarch,
"__gdb_builtin_type_bound128", TYPE_CODE_STRUCT);
append_composite_type_field (t, "lbound", bt->builtin_data_ptr);
append_composite_type_field (t, "ubound", bt->builtin_data_ptr);
TYPE_NAME (t) = "builtin_type_bound128";
...
And the pretty-printer is registered here in
gdb/python/lib/gdb/printer/bound_registers.py:
...
gdb.printing.add_builtin_pretty_printer ('mpx_bound128',
'^__gdb_builtin_type_bound128',
MpxBound128Printer)
...
Fix the pretty printer by changing the regexp argument of
add_builtin_pretty_printer to match "builtin_type_bound128", the TYPE_NAME.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-09 Tom de Vries <tdevries@suse.de>
* python/lib/gdb/printer/bound_registers.py: Use
'^builtin_type_bound128' as regexp argument for
add_builtin_pretty_printer.
Christian Biesinger [Mon, 7 Oct 2019 22:38:51 +0000 (17:38 -0500)]
Mark guile_{extension_,}script_ops as static
This makes it clearer that the structs are only used in this file. It
required moving the definition of extension_language_guile further
down in the file, because static structs can't be forward-declared.
gdb/ChangeLog:
2019-10-09 Christian Biesinger <cbiesinger@google.com>
* guile/guile.c (guile_extension_script_ops): Remove forward
declaration and mark as static.
(guile_script_ops): Likewise.
(extension_language_guile): Move further down in the file so
it can reference the definitions for guile_{extension_,}script_ops.
Nick Clifton [Wed, 9 Oct 2019 12:48:06 +0000 (13:48 +0100)]
Fix the disassembly of the LDS and STS instructions of the AVR architecture.
PR 25041
opcodes * avr-dis.c (avr_operand): Fix construction of address for lds/sts
instructions.
gas * testsuite/gas/avr/pr25041.s: New test.
* testsuite/gas/avr/pr25041.d: New test driver.
Alan Modra [Wed, 9 Oct 2019 10:55:25 +0000 (21:25 +1030)]
PR25081, Discrepancy between VMA and LMA after ALIGN
The testcase in the PR has two empty output sections, .sec1 with an
ALIGN and symbol assignment, and .sec2 just with an empty input
section. The symbol assignment results in .sec1 being kept, but
because it is empty this section doesn't take space from the memory
region as you might expect from the ALIGN. Instead the next section
.sec2, has vma/lma as if .sec1 wasn't present. However, .sec2 is
discarded and os->ignored set, which unfortunately meant that dot
wasn't set from .sec2 vma. That in turn results in .sec2 lma being
set incorrectly. That vma/lma difference is then propagated to
.sec3 where it is seen as an overlap.
PR 25081
* ldlang.c (lang_size_sections_1): Set lma from section vma
rather than dot.
Andreas Arnez [Wed, 9 Oct 2019 09:09:22 +0000 (11:09 +0200)]
s390: Add record/replay support for arch13 instructions
Enable recording most of the new "arch13" instructions on z/Architecture
targets, except for the specialized-function-assist instructions:
SORTL - sort lists
DFLTCC - deflate conversion call
KDSA - compute digital signature authentication
gdb/ChangeLog:
* s390-tdep.c (390_process_record): Handle new arch13 instructions
except SORTL, DFLTCC, and KDSA.
Alan Modra [Wed, 9 Oct 2019 00:17:13 +0000 (10:47 +1030)]
PR25070, SEGV in function _bfd_dwarf2_find_nearest_line
Evil testcase with two debug info sections, with sizes of
2aaaabac4ec1
and
ffffd5555453b140 result in a total size of 1. Reading the first
section of course overflows the buffer and tramples on other memory.
PR 25070
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Catch overflow of
total_size calculation.
GDB Administrator [Wed, 9 Oct 2019 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 8 Oct 2019 17:21:46 +0000 (11:21 -0600)]
Remove two unused items from windows-nat.c
windows_thread_info_struct::sf is unused, as is
struct safe_symbol_file_add_args in windows-nat.c.
This patch removes them both. Tested by grep and
rebuilding.
gdb/ChangeLog
2019-10-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info_struct) <sf>: Remove.
(struct safe_symbol_file_add_args): Remove.
Tom Tromey [Wed, 2 Oct 2019 19:24:15 +0000 (13:24 -0600)]
Don't include buildsym-legacy.h in windows-nat.c
I noticed that windows-nat.c includes buildsym-legacy.h -- but there's
no reason to do so, as windows-nat.c doesn't create any symbols.
gdb/ChangeLog
2019-10-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c: Don't include buildsym-legacy.h.
Tom Tromey [Wed, 2 Oct 2019 16:13:33 +0000 (10:13 -0600)]
Let ARI allow gdb %p printf extensions
As pointed out by Simon, this changes ARI to allow the gdb-specific %p
printf extensions.
gdb/ChangeLog
2019-10-08 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh (%p): Allow gdb-specific %p extensions.
Christian Biesinger [Mon, 7 Oct 2019 19:40:32 +0000 (14:40 -0500)]
Move declaration of overload_debug to header
gdb/ChangeLog:
2019-10-08 Christian Biesinger <cbiesinger@google.com>
* gdbtypes.c (overload_debug): Move comment to header.
* gdbtypes.h (overload_debug): Declare.
* valops.c: Remove declaration of overload_debug, instead
include gdbtypes.h.
Christian Biesinger [Mon, 7 Oct 2019 17:55:44 +0000 (12:55 -0500)]
Move declaration of lang_frame_mismatch_warn to header.
Also makes it localizable.
gdb/ChangeLog:
2019-10-08 Christian Biesinger <cbiesinger@google.com>
* language.c (show_language_command): Pass lang_frame_mismatch_warn
through _().
(lang_frame_mismatch_warn): Make const, mark with N_(), and
move comment...
* language.h (lang_frame_mismatch_warn): ... here. Also add
declaration.
* top.c (lang_frame_mismatch_warn): Remove declaration.
(check_frame_language_change): Pass lang_frame_mismatch_warn
through _().
Alan Modra [Tue, 8 Oct 2019 13:41:28 +0000 (00:11 +1030)]
PR25079, "ar s" stopped working
's' is both a command and a modifier. If given as a command then we
aren't lacking an operation. I think the same goes when mri mode is
selected: any following command line used to be ignored.
PR 25079
* ar.c (decode_options): Don't try for command options if
write_armap or mri_mode is selected.
Alan Modra [Tue, 8 Oct 2019 13:37:29 +0000 (00:07 +1030)]
PR25078, stack overflow in function find_abstract_instance
PR 25078
* dwarf2.c (find_abstract_instance): Delete orig_info_ptr, add
recur_count. Error on recur_count reaching 100 rather than
info_ptr matching orig_info_ptr. Adjust calls.
Alan Modra [Tue, 8 Oct 2019 00:30:11 +0000 (11:00 +1030)]
PowerPC local got test
This is the one that causes ld segfaults between 2019-10-04 and
2019-10-07. Bug introduced with
f749f26eea, fixed by
93370e8e7b.
* testsuite/ld-powerpc/localgot.s,
* testsuite/ld-powerpc/localgot.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.
Andreas Krebbel [Tue, 8 Oct 2019 09:23:57 +0000 (11:23 +0200)]
S/390: Add support for z15 as CPU name.
So far z15 was identified as arch13. After the machine has been
announced we can now add the real name.
gas/ChangeLog:
2019-10-08 Andreas Krebbel <krebbel@linux.ibm.com>
* config/tc-s390.c (s390_parse_cpu): Add z15 as alternate CPU
name.
* doc/as.texi: Add z15 to CPU string list.
* doc/c-s390.texi: Likewise.
opcodes/ChangeLog:
2019-10-08 Andreas Krebbel <krebbel@linux.ibm.com>
* s390-mkopc.c (main): Enable z15 as CPU string in the opcode
table.
GDB Administrator [Tue, 8 Oct 2019 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Mon, 7 Oct 2019 18:23:34 +0000 (13:23 -0500)]
Move declaration of vtbl_ptr_name to the header.
There are conflicting comments about whether this was
introduced in GCC 2.4.5 or GCC 2.6 and I don't know
which one is correct...
gdb/ChangeLog:
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* c-lang.h (vtbl_ptr_name): Declare.
* cp-valprint.c (vtbl_ptr_name): Remove "extern" now that we get
it from the header.
* stabsread.c (define_symbol): Remove declaration of vtbl_ptr_name.
Christian Biesinger [Mon, 7 Oct 2019 17:33:06 +0000 (12:33 -0500)]
Use gdb_static_assert in charset.c
It currently has a "manual" static assert.
gdb/ChangeLog:
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* charset.c (your_gdb_wchar_t_is_bogus): Replace with a
gdb_static_assert.
Weimin Pan [Mon, 7 Oct 2019 16:22:14 +0000 (16:22 +0000)]
Move top-level Makefile.def/Makefile.in to the top-level ChangeLog
Jozef Lawrynowicz [Mon, 7 Oct 2019 15:34:31 +0000 (16:34 +0100)]
Add support for new functionality in the msp430 backend of GCC.
This functionality will generate a new GNU object attribute for the "data region"
has been added. This object attribute is used
mark whether the compiler has generated code assuming that data could be in the
upper or lower memory regions.
Code which assumes data is always in the lower memory region is incompatible
with code which uses the full memory range for data.
The patch also adds a new assembler directive ".mspabi_attribute" to handle the
existing MSPABI object attributes. GCC will now emit both .gnu_attribute and
.mspabi_attribute directives to indicate what options the source file was
compiled with.
The assembler will now check the values set in these directives against the
options that the it has been invoked with. If there is a discrepancy, the
assembler will exit with an error.
bfd * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to..
(elf32_msp430_merge_msp430_attributes): Add support for merging the GNU
object attribute for data region.
binutils* readelf.c (display_msp430_gnu_attribute): New.
(process_arch_specific): Use msp430 specific handler for GNU
attributes.
gas * config/tc-msp430.c (md_parse_option): Set lower_data_region_only to
FALSE if the data region is set to "upper", "either" or "none".
(msp430_object_attribute): New.
(md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute.
(msp430_md_end): Replace hard-coded attribute values with enums.
Handle data region object attribute.
* doc/as.texi: Document MSP430 Data Region object attribute.
* doc/c-msp430.texi: Document the .mspabi_attribute directive.
* testsuite/gas/msp430/attr-430-small-bad.d: New test.
* testsuite/gas/msp430/attr-430-small-bad.l: New test.
* testsuite/gas/msp430/attr-430-small-good.d: New test.
* testsuite/gas/msp430/attr-430-small.s: New test.
* testsuite/gas/msp430/attr-430x-large-any-bad.d: New test.
* testsuite/gas/msp430/attr-430x-large-any-bad.l: New test.
* testsuite/gas/msp430/attr-430x-large-any-good.d: New test.
* testsuite/gas/msp430/attr-430x-large-any.s: New test.
* testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test.
* testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test.
* testsuite/gas/msp430/attr-430x-large-lower-good.d: New test.
* testsuite/gas/msp430/attr-430x-large-lower.s: New test.
* testsuite/gas/msp430/msp430.exp: Run new tests.
include * elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names
and values.
ld * testsuite/ld-msp430-elf/attr-gnu-main.s: New test.
* testsuite/ld-msp430-elf/attr-gnu-obj.s: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test.
* testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test.
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
Alan Modra [Mon, 7 Oct 2019 12:44:31 +0000 (23:14 +1030)]
Re: PowerPC PIC vs. DLL TLS issues
A bug crept into commit
f749f26eea, which could cause linker
segfaults when creating PIEs. This patch fixes it.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate
space for local got non-tls relocs when PIE.
Andrew Burgess [Mon, 7 Oct 2019 12:10:55 +0000 (13:10 +0100)]
gdb/testsuite/ada: Handle missing debug info case
Update a test script to handle the case where missing Ada debug
information means we can't catch exceptions. This was discussed on
the list here:
https://sourceware.org/ml/gdb-patches/2019-08/msg00607.html
And is similar to code that already exists in the test scripts
gdb.ada/catch_ex.exp and gdb.ada/mi_catch_ex.exp.
gdb/testsuite/ChangeLog:
* gdb.ada/catch_ex_std.exp: Handle being unabled to catch Ada
exceptions due to missing debug information.
Andrew Burgess [Mon, 7 Oct 2019 11:34:51 +0000 (12:34 +0100)]
gdb: Rename structures within ctfread.c
Commit:
commit
30d1f0184953478d14641c495261afd06ebfabac
Date: Mon Oct 7 00:46:52 2019 +0000
gdb: CTF support
Introduces some structures with names that are already in use within
GBB, this violates C++'s one-definition rule. Specifically the
structures 'nextfield' and 'field_info' are now defined in
dwarf2read.c and ctfread.c.
This commit renames the new structures (in ctfread.c), adding a 'ctf_'
prefix. Maybe we should consider renaming the DWARF versions too in
the future to avoid accidental conflicts.
gdb/ChangeLog:
* ctfread.c (struct nextfield): Renamed to ...
(struct ctf_nextfield): ... this.
(struct field_info): Renamed to ...
(strut ctf_field_info): ... this.
(attach_fields_to_type): Update for renamed structures.
(ctf_add_member_cb): Likewise.
(ctf_add_enum_member_cb): Likewise.
(process_struct_members): Likewise.
(process_enum_type): Likewise.
Tom de Vries [Mon, 7 Oct 2019 10:50:04 +0000 (12:50 +0200)]
[gdb/testsuite] Update expected _gdb_major/_gdb_minor in default.exp
Now that commit "
225f296a023 Change gdb/version.in to 9.0.50.DATE-git (new
version numbering scheme)" has changed the gdb version number, we see:
...
FAIL: gdb.base/default.exp: show convenience ($_gdb_major = 8 not found)
...
Fix this by updating the expected _gdb_major/_gdb_minor to 9.1.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-07 Tom de Vries <tdevries@suse.de>
* gdb.base/default.exp: Expect _gdb_major/_gdb_minor to be 9.1.
Andrew Burgess [Tue, 1 Oct 2019 14:29:20 +0000 (15:29 +0100)]
gdb/testsuite: Add gdb_test_name variable
This commit adds a new feature to gdb_test_multiple, an automatically
created variable gdb_test_name. The idea is to make it easier to
write tests using gdb_test_multiple, and avoid places where the string
passed to pass/fail within an action element is different to the
message passed to the top level gdb_test_multiple.
As an example, previously you might write this:
gdb_test_multiple "print foo" "test foo" {
-re "expected output 1" {
pass "test foo"
}
-re "expected output 2" {
fail "test foo"
}
}
This is OK, but it's easy for the pass/fail strings to come out of
sync, or contain a typo. A better version would look like this:
set testname "test foo"
gdb_test_multiple "print foo" $testname {
-re "expected output 1" {
pass $testname
}
-re "expected output 2" {
fail $testname
}
}
This is better, but its a bit of a drag having to create a new
variable each time.
After this patch you can now write this:
gdb_test_multiple "print foo" "test foo" {
-re "expected output 1" {
pass $gdb_test_name
}
-re "expected output 2" {
fail $gdb_test_name
}
}
The $gdb_test_name is setup by gdb_test_multiple, and cleaned up once
the test has completed. Nested calls to gdb_test_multiple are
supported, though $gdb_test_name will only ever contain the inner most
test message (which is probably what you want).
My only regret is that '$gdb_test_name' is so long, but I wanted
something that was unlikely to clash with any existing variable name,
or anything that a user is likely to want to use.
I've tested this on x86-64/GNU Linux and see no test regressions, and
I've converted one test script over to make use of this new technique
both as an example, and to ensure that the new facility doesn't get
broken. I have no plans to convert all tests over to this technique,
but I hope others will find this useful for writing tests in the
future.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_test_multiple): Add gdb_test_name mechanism.
* gdb.base/annota1.exp: Update to use gdb_test_name.
Tom de Vries [Mon, 7 Oct 2019 07:51:18 +0000 (09:51 +0200)]
[gdb/doc] Fix some typos
Fix typos 'prevsiouly -> previously' and 'corresonding -> corresponding' in the
docs.
gdb/doc/ChangeLog:
2019-10-07 Tom de Vries <tdevries@suse.de>
* gdb.texinfo: Fix typo.
* guile.texi: Same.
* python.texi: Same.
Jan Beulich [Mon, 7 Oct 2019 06:40:03 +0000 (08:40 +0200)]
add missing ChangeLog entry for
d241b91073
Jan Beulich [Mon, 7 Oct 2019 06:38:01 +0000 (08:38 +0200)]
x86/Intel: correct MOVSD and CMPSD handling
First and foremost the EsSeg attribute was misplaced for CMPSD. Then
both it and MOVSD were lacking Dword on both of their operands.
Finally string insns with multiple operands and requiring use of ES:
had the wrong operand number reported in the diagnostic.
Alan Modra [Mon, 7 Oct 2019 03:07:23 +0000 (13:37 +1030)]
Bogus "final link failed" messages
This patch is a result of noticing messages like the following:
tmpdir/tls32.o: in function `_start':
(.text+0x1c): unresolvable R_PPC_REL24 relocation against symbol `__tls_get_addr_opt'
./ld-new: final link failed: symbol needs debug section which does not exist
The "needs debug section" comes from attempting to use debug info to
find source line information to print the first error message. That
error isn't of interest to the user, and any previous bfd_error value
which might be of interest is overwritten. So save and restore
bfd_error around the fancy error reporting code.
That still doesn't leave us with a clean bfd_error. Now we get
./ld-new: final link failed: nonrepresentable section on output
An unresolvable relocation surely doesn't mean there is some bfd
section that ld doesn't know how to output! Digging into that showed
a _bfd_elf_section_from_bfd_section failure attempting to find an elf
section correcsponding to ".interp". So don't go looking for elf
sections on linker created bfd sections.
And then fix the linker testsuite which expected the bogus message..
bfd/
* elflink.c (elf_fixup_link_order): Don't attempt to find
an elf_section for linker created bfd sections.
ld/
* ldmisc.c (vfinfo): Save and restore bfd_error around bfd
function calls that might set it.
* testsuite/ld-elf/indirect.exp: Don't expect "nonrepresentable
section" message.
Alan Modra [Mon, 7 Oct 2019 03:04:40 +0000 (13:34 +1030)]
PowerPC TLS tests
This patch adds some --no-tls-optimize tests and performs some of the
existing dynamic tests with tls markers in order to catch any
regression in PLT counting.
* testsuite/ld-powerpc/tlsexe.r: Adjust for added TLSMARK symbol.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlsso32.r: Likewise.
* testsuite/ld-powerpc/tls32no.d,
* testsuite/ld-powerpc/tls32no.g: New test files.
* testsuite/ld-powerpc/tlsexe32no.d,
* testsuite/ld-powerpc/tlsexe32no.g,
* testsuite/ld-powerpc/tlsexe32no.r: New test files.
* testsuite/ld-powerpc/tlsexeno.d,
* testsuite/ld-powerpc/tlsexeno.g,
* testsuite/ld-powerpc/tlsexeno.r: New test files.
* testsuite/ld-powerpc/tlsexetocno.d,
* testsuite/ld-powerpc/tlsexetocno.g: New test files.
* testsuite/ld-powerpc/tlsno.d,
* testsuite/ld-powerpc/tlsno.g: New test files.
* testsuite/ld-powerpc/tlstocno.d,
* testsuite/ld-powerpc/tlstocno.g: New test files.
* testsuite/ld-powerpc/powerpc.exp: Run new tests.
Alan Modra [Mon, 7 Oct 2019 02:51:02 +0000 (13:21 +1030)]
PowerPC TLS miscounting PLT for __tls_get_addr
ppc*_elf_tls_optimize decrements the PLT refcount for __tls_get_addr
when a GD or LD sequence can be optimized. Without tls marker relocs
this must be done when processing the argument setup relocations.
With marker relocs it's better done when processing the marker reloc.
But don't count them both ways.
Seen as "unresolvable R_PPC_REL24 relocation against symbol
`__tls_get_addr_opt'" (and other branch relocs).
* elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD
with non-local symbol. Don't double count __tls_get_addr calls
with marker relocs.
* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
Alan Modra [Mon, 7 Oct 2019 02:47:59 +0000 (13:17 +1030)]
PowerPC section flag tidy
has_tls_get_addr_call is no longer named correctly as the flag is
only set on finding a __tls_get_addr call without tlsld/tlsgd marker
relocations.
* elf32-ppc.c (nomark_tls_get_addr): Rename from has_tls_get_addr_call
throughout.
* elf64-ppc.c (nomark_tls_get_addr): Likewise.
Alan Modra [Mon, 7 Oct 2019 02:44:11 +0000 (13:14 +1030)]
ld-arm/tls-gdesc-neg test
Fixes a failure on armeb-linuxeabi.
* testsuite/ld-arm/tls-gdesc-neg.d: Relax target match.
Weimin Pan [Mon, 7 Oct 2019 00:46:52 +0000 (00:46 +0000)]
gdb: CTF support
This patch adds the CTF (Compact Ansi-C Type Format) support in gdb.
Two submissions on which this gdb work depends were posted earlier
in May:
* On the binutils mailing list - adding libctf which creates, updates,
reads, and manipulates the CTF data.
* On the gcc mailing list - expanding gcc to directly emit the CFT data
with a new command line option -gt.
CTF is a reduced form of debugging information whose main purpose is to
describe the type of C entities such as structures, unions, typedefs and
function arguments at the global scope only. It does not contain debug
information about source lines, location expressions, or local variables.
For more information on CTF, see the documentation in the libdtrace-ctf
source tree, available here:
<https://raw.githubusercontent.com/oracle/libdtrace-ctf/master/doc/ctf-format>.
This patch expands struct elfinfo by adding the .ctf section, which
contains CTF debugging info, and modifies elf_symfile_read() to read it.
If both DWARF and CTF exist in a program, only DWARF will be read. CTF data
will be read only when there is no DWARF. The two-stage symbolic reading
and setting strategy, partial and full, was used.
File ctfread.c contains functions to transform CTF data into gdb's internal
symbol table structures by iterately reading entries from CTF sections
of "data objects", "function info", "variable info", and "data types"
when setting up either partial or full symbol table. If the ELF symbol table
is available, e.g. not stripped, the CTF reader will associate the found
type information with these symbol entries. Due to the proximity between DWARF
and CTF (CTF being a much simplified subset of DWARF), some DWARF implementation
was reused to support CTF.
Test cases ctf-constvars.exp, ctf-cvexpr.exp, ctf-ptype.exp, and ctf-whatis.exp
have been added to verify the correctness of this support.
This patch has missing features and limitations which we will add and
address in the future patches.
gdb/ChangeLog
+2019-10-07 Weimin Pan <weimin.pan@oracle.com>
+
+ * gdb/ctfread.c: New file.
+ * gdb/ctfread.h: New file.
+ * gdb/elfread.c: Include ctfread.h.
+ (struct elfinfo text_p): New member ctfsect.
+ (elf_locate_sections): Mark CTF section.
+ (elf_symfile_read): Call elfctf_build_psymtabs.
+ * gdb/Makefile.in (LIBCTF): Add.
+ (CLIBS): Use it.
+ (CDEPS): Likewise.
+ (DIST): Add ctfread.c.
+ * Makefile.def (dependencies): Add all-libctf to all-gdb
+ * Makefile.in: Add "all-gdb: maybe-all-libctf"
+
gdb/testsuite/ChangeLog
+2019-10-07 Weimin Pan <weimin.pan@oracle.com>
+
+ * gdb.base/ctf-whatis.exp: New file.
+ * gdb.base/ctf-whatis.c: New file.
+ * gdb.base/ctf-ptype.exp: New file.
+ * gdb.base/ctf-ptype.c: New file.
+ * gdb.base/ctf-constvars.exp: New file.
+ * gdb.base/ctf-constvars.c: New file.
+ * gdb.base/ctf-cvexpr.exp: New file.
+
Weimin Pan [Mon, 7 Oct 2019 00:16:06 +0000 (00:16 +0000)]
Renaming of ctf (the trace format) files
GDB Administrator [Mon, 7 Oct 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Sun, 6 Oct 2019 15:32:00 +0000 (08:32 -0700)]
Change gdb/version.in to 9.0.50.DATE-git (new version numbering scheme)
gdb/ChangeLog:
* version.in: Change version number to "9.0.50.DATE-git".
GDB Administrator [Sun, 6 Oct 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 5 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Fri, 4 Oct 2019 14:23:24 +0000 (16:23 +0200)]
[gdb/testsuite] Fix local-static.exp with gcc-4.8
With gdb.cp/local-static.exp and gcc 4.8, I see:
...
gdb compile failed, src/gdb/testsuite/gdb.cp/local-static.c: In function 'main':
src/gdb/testsuite/gdb.cp/local-static.c:148:3: error: 'for' loop initial \
declarations are only allowed in C99 mode
for (int i = 0; i < 1000; i++)
^
src/gdb/testsuite/gdb.cp/local-static.c:148:3: note: use option -std=c99 or \
-std=gnu99 to compile your code
UNTESTED: gdb.cp/local-static.exp: c: failed to prepare
...
Fix this by moving the declaration of int i out of the for loop.
gdb/testsuite/ChangeLog:
2019-10-04 Tom de Vries <tdevries@suse.de>
* gdb.cp/local-static.c (main): Move declaration of int i out of the
for loop.
Alan Modra [Thu, 3 Oct 2019 23:18:41 +0000 (08:48 +0930)]
PowerPC PIC vs. DLL TLS issues
1) GOT entries generated for any of the GOT TLS relocations don't need
dynamic relocations for locally defined symbols in PIEs. In the case
of a tls_index doubleword, the dtpmod entry is known to be 1, and the
dtprel entry is also known at link time and relative. Similarly,
dtprel and tprel words are known at link time and relative. (GOT
entries for other than TLS symbols are not relative and thus need
dynamic relocations in PIEs.)
2) Local dynamic TLS code is really only meant for accesses local to
the current binary. There was a cheapskate test for this before using
the common tlsld_got slot, but the test wasn't exactly correct and
might confuse anyone looking at the code. The proper test,
SYMBOL_REFERENCES_LOCAL isn't so expensive that it should be avoided.
3) The same cheap test for local syms when optimising TLS sequences
should be SYMBOL_REFERENCES_LOCAL too.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars.
(ppc64_elf_tls_optimize): Correct is_local condition.
(allocate_got): Don't reserve dynamic relocations for any of the
tls got relocs in PIEs when the symbol is local.
(allocate_dynrelocs): Correct validity test for local sym using
tlsld_got slot.
(ppc64_elf_size_dynamic_sections): Don't reserve dynamic relocations
for any of the tls got relocs in PIEs.
(ppc64_elf_layout_multitoc): Likewise.
(ppc64_elf_relocate_section): Correct validity test for local sym
using tlsld_got slot. Don't emit dynamic relocations for any of
the tls got relocs in PIEs when the symbol is local.
* elf32-ppc.c (ppc_elf_tls_optimize): Correct is_local condition.
(got_relocs_needed): Delete.
(allocate_dynrelocs): Correct validity test for local sym using
tlsld_got slot. Don't reserve dynamic relocations for any of the
tls got relocs in PIEs when the symbol is local.
(ppc_elf_size_dynamic_sections): Don't reserve dynamic relocations
for any of the tls got relocs in PIEs.
(ppc_elf_relocate_section): Correct validity test for local sym
using tlsld_got slot. Don't emit dynamic relocations for any of
the tls got relocs in PIEs when the symbol is local.
ld/
* testsuite/ld-powerpc/tlsso.d: Adjust to suit tlsld_got usage change.
* testsuite/ld-powerpc/tlsso.g: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlsso32.d: Likewise.
* testsuite/ld-powerpc/tlsso32.g: Likewise.
* testsuite/ld-powerpc/tlsso32.r: Likewise.
Szabolcs Nagy [Wed, 2 Oct 2019 18:46:46 +0000 (19:46 +0100)]
[PR ld/22263][PR ld/25056] arm: Avoid dynamic TLS relocs in PIE
Dynamic relocs are only needed in an executable for TLS symbols if
those are defined in an external module and even then TLS access
can be relaxed to use IE model instead of GD.
Several bfd_link_pic checks are turned into bfd_link_dll checks
to fix TLS handling in PIE, for the same fix some other targets
used !bfd_link_executable checks, but that includes relocatable
objects so dll seems safer (in most cases either should work, since
dynamic relocations are not applied in relocatable objects).
On arm* fixes
FAIL: Build pr22263-1
bfd/
PR ld/22263
PR ld/25056
* elf32-arm.c (elf32_arm_tls_transition): Use bfd_link_dll instead of
bfd_link_pic for TLS checks.
(elf32_arm_final_link_relocate): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
Szabolcs Nagy [Thu, 3 Oct 2019 18:11:50 +0000 (19:11 +0100)]
[PR ld/25062] arm: sign extend the addend of R_ARM_TLS_GOTDESC
On 64-bit host the 32-bit addend was loaded without sign extension into
an unsigned long.
bfd/ChangeLog:
PR ld/25062
* elf32-arm.c (elf32_arm_final_link_relocate): Sign extend data.
ld/ChangeLog:
PR ld/25062
* testsuite/ld-arm/arm-elf.exp: Update.
* testsuite/ld-arm/tls-gdesc-neg.d: New test.
* testsuite/ld-arm/tls-gdesc-neg.s: New test.
Tom Tromey [Thu, 3 Oct 2019 23:21:52 +0000 (17:21 -0600)]
Avoid crash on single-field union in Rust
PR rust/24976 points out a crash in gdb when a single-field union is
used in Rust.
The immediate problem was a NULL pointer dereference in
quirk_rust_enum. However, that code is also erroneously treating a
single-field union as if it were a univariant enum. Looking at the
output of an older Rust compiler, it turns out that univariant enums
are distinguished by having a single *anonymous* field. This patch
changes quirk_rust_enum to limit its fixup to this case.
Tested with a new-enough version of the Rust compiler to cause the
crash; plus by using an older executable that uses the old univariant
encoding.
gdb/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* dwarf2read.c (quirk_rust_enum): Handle single-element unions.
gdb/testsuite/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* gdb.rust/simple.rs (Union2): New type.
(main): Use Union2.
* gdb.rust/simple.exp: Add test.
GDB Administrator [Fri, 4 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Mon, 2 Sep 2019 22:31:10 +0000 (23:31 +0100)]
gdb/fortran: Allow for matching symbols with missing scope
This commit allows symbol matching within Fortran code without having
to specify all of the symbol's scope. For example, given this Fortran
code:
module aaa
contains
subroutine foo
print *, "hello."
end subroutine foo
end module aaa
subroutine foo
print *, "hello."
end subroutine foo
program test
call foo
contains
subroutine foo
print *, "hello."
end subroutine foo
subroutine bar
use aaa
call foo
end subroutine bar
end program test
The user can now do this:
(gdb) b foo
Breakpoint 1 at 0x4006c2: foo. (3 locations)
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x00000000004006c2 in aaa::foo at nest.f90:4
1.2 y 0x0000000000400730 in foo at nest.f90:9
1.3 y 0x00000000004007c3 in test::foo at nest.f90:16
The user asks for a breakpoint on 'foo' and is given a breakpoint on
all three possible 'foo' locations. The user is, of course, still
able to specify the scope in order to place a single breakpoint on
just one of the foo functions (or use 'break -qualified foo' to break
on just the global foo).
gdb/ChangeLog:
* f-lang.c (f_language_defn): Use cp_get_symbol_name_matcher and
cp_search_name_hash.
* NEWS: Add entry about nested function support.
gdb/testsuite/ChangeLog:
* gdb.fortran/nested-funcs-2.exp: Run tests with and without the
nested function prefix.
Andrew Burgess [Thu, 15 Aug 2019 13:57:13 +0000 (14:57 +0100)]
gdb/fortran: Nested subroutine support
This patch is a rebase and update of the following three patches:
https://sourceware.org/ml/gdb-patches/2018-11/msg00298.html
https://sourceware.org/ml/gdb-patches/2018-11/msg00302.html
https://sourceware.org/ml/gdb-patches/2018-11/msg00301.html
I have merged these together into a single commit as the second patch,
adding scope support to nested subroutines, means that some of the
changes in the first patch are now no longer useful and would have to
be backed out. The third patch is tightly coupled to the changes in
the second of these patches and I think deserves to live together with
it.
There is an extra change in cp-namespace.c that is new, this resolves
an issue with symbol lookup when placing breakpoints from within
nested subroutines.
There is also an extra test added to this commit 'nested-funcs-2.exp'
that was written by Richard Bunt from ARM, this offers some additional
testing of breakpoints on nested functions.
After this commit it is possible to place breakpoints on nested
Fortran subroutines and functions by using a fully scoped name, for
example, given this simple Fortran program:
program greeting
call message
contains
subroutine message
print *, "Hello World"
end subroutine message
end program greeting
It is possible to place a breakpoint in 'message' with:
(gdb) break greeting::message
Breakpoint 1 at 0x4006c9: file basic.f90, line 5.
What doesn't work with this commit is placing a breakpoint like this:
(gdb) break message
Function "message" not defined.
Making this work will come in a later commit.
gdb/ChangeLog:
* cp-namespace.c (cp_search_static_and_baseclasses): Only search
for nested static variables when searchin VAR_DOMAIN.
* dwarf2read.c (add_partial_symbol): Add nested subroutines to the
global scope, update comment.
(add_partial_subprogram): Call add_partial_subprogram recursively
for nested subroutines when processinng Fortran.
(load_partial_dies): Process the child entities of a subprogram
when processing Fortran.
(partial_die_parent_scope): Handle building scope
for Fortran nested functions.
(process_die): Record that nested functions have a scope.
(new_symbol): Always record Fortran subprograms on the global
symbol list.
(determine_prefix): How to build the prefix for Fortran
subprograms.
gdb/testsuite/ChangeLog:
* gdb.fortran/nested-funcs.exp: Tests for placing breakpoints on
nested functions.
* gdb.fortran/nested-funcs.f90: Update expected results.
* gdb.fortran/nested-funcs-2.exp: New file.
* gdb.fortran/nested-funcs-2.f90: New file.
gdb/doc/ChangeLog:
* doc/gdb.texinfo (Fortran Operators): Describe scope operator.
Andrew Burgess [Mon, 16 Sep 2019 01:53:11 +0000 (21:53 -0400)]
gdb/testsuite: Reduce test name duplication in gdb.python tests
This commit removes some, but not all, of the test name duplication
within the gdb.python tests. On my local machine this takes the
number of duplicate test names in this set of tests from 174 to 85.
It is possible that different setups might encounter more duplicate
tests.
gdb/testsuite/ChangeLog:
* gdb.python/py-parameter.exp: Make test names unique.
* gdb.python/py-template.exp: Likewise.
* gdb.python/py-value.exp: Likewise.
Andrew Burgess [Mon, 16 Sep 2019 01:50:17 +0000 (21:50 -0400)]
gdb/testsuite: Reduce test name duplication in gdb.base tests
This commit removes some, but not all, of the test name duplication
within the gdb.base tests. On my local machine this takes the number
of duplicate test names in this set of tests from 454 to 145. It is
possible that different setups might encounter more duplicate tests.
gdb/testsuite/ChangeLog:
* gdb.base/break-interp.exp: Reduce test name duplication.
* gdb.base/call-sc.exp: Likewise.
* gdb.base/callfuncs.exp: Likewise.
* gdb.base/charset.exp: Likewise.
* gdb.base/dump.exp: Likewise.
* gdb.base/ena-dis-br.exp: Likewise.
* gdb.base/relational.exp: Likewise.
* gdb.base/step-over-syscall.exp: Likewise.
* gdb.base/structs.exp: Likewise.
Andrew Burgess [Sun, 15 Sep 2019 17:42:54 +0000 (13:42 -0400)]
gdb/testsuite: Make test names unique in gdb.linespec tests
Make test names unique in the gdb.linespec tests. On my local machine
this removed 43 duplicate test names. It is possible that different
setups might still encounter some duplicates.
gdb/testsuite/ChangeLog:
* gdb.linespec/explicit.exp: Make test names unique.
* gdb.linespec/ls-errs.exp: Likewise.
Andrew Burgess [Sun, 15 Sep 2019 17:21:32 +0000 (13:21 -0400)]
gdb/testsuite: Make test names unique in gdb.reverse tests
Make test names unique in the gdb.reverse tests. On my local machine
this removed 825 duplicate test names. It is possible that different
setups might still encounter some duplicates.
gdb/testsuite/ChangeLog:
* gdb.reverse/break-precsave.exp: Make test names unique.
* gdb.reverse/break-reverse.exp: Likewise.
* gdb.reverse/finish-precsave.exp: Likewise.
* gdb.reverse/finish-reverse.exp: Likewise.
* gdb.reverse/machinestate-precsave.exp: Likewise.
* gdb.reverse/machinestate.exp: Likewise.
* gdb.reverse/readv-reverse.exp: Likewise.
* gdb.reverse/recvmsg-reverse.exp: Likewise.
* gdb.reverse/sigall-precsave.exp: Likewise.
* gdb.reverse/sigall-reverse.exp: Likewise.
* gdb.reverse/step-indirect-call-thunk.exp: Likewise.
* gdb.reverse/watch-precsave.exp: Likewise.
* gdb.reverse/watch-reverse.exp: Likewise.
Nick Alcock [Thu, 26 Sep 2019 14:26:48 +0000 (15:26 +0100)]
libctf: fix tabdamage
A little tabdamage predating the linker patch series has crept in.
New in v5.
libctf/
* ctf-open.c (ctf_bufopen_internal): Fix tabdamage.
* ctf-types.c (ctf_type_lname): Likewise.
Nick Alcock [Thu, 26 Sep 2019 14:24:13 +0000 (15:24 +0100)]
binutils: spaces -> tabs in CTF parts of objdump and readelf
For readelf particularly, this is more or less whistling in the dark:
there are hundreds of lines where spaces are used where tabs were used
on adjacent lines.
New in v5.
binutils/
* objdump.c (main): Fix tabdamage.
* readelf.c (CTF_DUMP): Likewise.
(options): Likewise.
(dump_section_as_ctf): Likewise.
Nick Alcock [Tue, 17 Sep 2019 05:59:31 +0000 (06:59 +0100)]
libctf: fix refcount leak in ctf_import
Calling ctf_import (fp, NULL) to cancel out a pre-existing import leaked
the refcnt increment on the parent, so it could never be freed.
New in v4.
libctf/
* ctf-open.c (ctf_import): Do not leak a ctf_file_t ref on every
ctf_import after the first for a given file.
Nick Alcock [Tue, 17 Sep 2019 05:57:00 +0000 (06:57 +0100)]
libctf: make ctf_dump not crash on OOM
ctf_dump calls ctf_str_append extensively but never checks to see if it
returns NULL (on OOM). If it ever does, we truncate the string we are
appending to and leak it!
Instead, create a variant of ctf_str_append that returns the *original
string* on OOM, and use it in ctf-dump. It is far better to omit a tiny
piece of a dump on OOM than to omit a bigger piece, and it is also
better to do this in what is after all purely debugging code than it is
to uglify ctf-dump.c with huge numbers of checks for the out-of-memory
case. Slightly truncated debugging output is better than no debugging
output at all and an out-of-memory message.
New in v4.
libctf/
* ctf-impl.h (ctf_str_append_noerr): Declare.
* ctf-util.c (ctf_str_append_noerr): Define in terms of
ctf_str_append.
* ctf-dump.c (str_append): New, call it.
(ctf_dump_format_type): Use str_append, not ctf_str_append.
(ctf_dump_label): Likewise.
(ctf_dump_objts): Likewise.
(ctf_dump_funcs): Likewise.
(ctf_dump_var): Likewise.
(ctf_dump_member): Likewise.
(ctf_dump_type): Likewise.
(ctf_dump): Likewise.
Nick Alcock [Tue, 17 Sep 2019 05:54:23 +0000 (06:54 +0100)]
libctf: remove ctf_malloc, ctf_free and ctf_strdup
These just get in the way of auditing for erroneous usage of strdup and
add a huge irregular surface of "ctf_malloc or malloc? ctf_free or free?
ctf_strdup or strdup?"
ctf_malloc and ctf_free usage has not reliably matched up for many
years, if ever, making the whole game pointless.
Go back to malloc, free, and strdup like everyone else: while we're at
it, fix a bunch of places where we weren't properly checking for OOM.
This changes the interface of ctf_cuname_set and ctf_parent_name_set,
which could strdup but could not return errors (like ENOMEM).
New in v4.
include/
* ctf-api.h (ctf_cuname_set): Can now fail, returning int.
(ctf_parent_name_set): Likewise.
libctf/
* ctf-impl.h (ctf_alloc): Remove.
(ctf_free): Likewise.
(ctf_strdup): Likewise.
* ctf-subr.c (ctf_alloc): Remove.
(ctf_free): Likewise.
* ctf-util.c (ctf_strdup): Remove.
* ctf-create.c (ctf_serialize): Use malloc, not ctf_alloc; free, not
ctf_free; strdup, not ctf_strdup.
(ctf_dtd_delete): Likewise.
(ctf_dvd_delete): Likewise.
(ctf_add_generic): Likewise.
(ctf_add_function): Likewise.
(ctf_add_enumerator): Likewise.
(ctf_add_member_offset): Likewise.
(ctf_add_variable): Likewise.
(membadd): Likewise.
(ctf_compress_write): Likewise.
(ctf_write_mem): Likewise.
* ctf-decl.c (ctf_decl_push): Likewise.
(ctf_decl_fini): Likewise.
(ctf_decl_sprintf): Likewise. Check for OOM.
* ctf-dump.c (ctf_dump_append): Use malloc, not ctf_alloc; free, not
ctf_free; strdup, not ctf_strdup.
(ctf_dump_free): Likewise.
(ctf_dump): Likewise.
* ctf-open.c (upgrade_types_v1): Likewise.
(init_types): Likewise.
(ctf_file_close): Likewise.
(ctf_bufopen_internal): Likewise. Check for OOM.
(ctf_parent_name_set): Likewise: report the OOM to the caller.
(ctf_cuname_set): Likewise.
(ctf_import): Likewise.
* ctf-string.c (ctf_str_purge_atom_refs): Use malloc, not ctf_alloc;
free, not ctf_free; strdup, not ctf_strdup.
(ctf_str_free_atom): Likewise.
(ctf_str_create_atoms): Likewise.
(ctf_str_add_ref_internal): Likewise.
(ctf_str_remove_ref): Likewise.
(ctf_str_write_strtab): Likewise.
Nick Alcock [Fri, 9 Aug 2019 21:53:50 +0000 (22:53 +0100)]
libctf: get the encoding of non-ints/fps in the dynamic space right
If you call ctf_type_encoding() on a slice, you are meant to get the
encoding of the slice with the format of the underlying type. If
you call it on a non-int, non-fp, non-slice, you're meant to get the
error ECTF_INTNOTFP.
None of this was implemented for types in the dynamic space (which, now,
is *all* types in writable containers). Instead, we were always
returning the encoding as if it were a float, which for all other types
consulted the wrong part of a discriminated union and returned garbage.
(Curiously, existing users were more disturbed by the lack of an error
in the non-int/fp/slice case than they were about getting garbage back.)
libctf/
* ctf-types.c (ctf_type_encoding): Fix the dynamic case to
work right for non-int/fps.