Simon Marchi [Sun, 22 Jul 2018 02:21:57 +0000 (22:21 -0400)]
Fix -Wunused-variable warnings related to conditional compilation
Some variables are not used when !HAVE_ELF, so avoid declaring them in
that case.
gdb/ChangeLog:
* arm-tdep.c (arm_gdbarch_init): Declare attr_arch and
attr_profile in HAVE_ELF.
* rs6000-tdep.c (bfd_uses_spe_extensions): Declare vector_abi in
HAVE_ELF.
GDB Administrator [Sun, 22 Jul 2018 00:01:12 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 21 Jul 2018 17:57:54 +0000 (10:57 -0700)]
gas/config/tc-i386.c: Break long line
* config/tc-i386.c (match_simd_size): Break long line.
(match_mem_size): Likewise.
Eric Botcazou [Sat, 21 Jul 2018 13:00:40 +0000 (15:00 +0200)]
Initialize GOT slot for local symbol in non-PIC link.
On ARM/VxWorks 7, the R_ARM_TARGET2 relocation used for exception handling
is R_ARM_GOT_PREL; moreover in Ada you can define local exceptions. In this
case, you may end up with a GOT relocation against a local symbol in a
non-PIC link and the ARM linker leaves the GOT slot uninitialized, unlike
for example the i386 or the SPARC linkers in the same situation.
bfd/
* elf32-arm.c (elf32_arm_final_link_relocate) <R_ARM_GOT32>: Small
cleanup for the case of a global symbol that binds locally. Also
install a value in the GOT slot in the case of a local symbol in
a non-PIC link.
Simon Marchi [Sat, 21 Jul 2018 02:19:04 +0000 (22:19 -0400)]
Rename some frame unwind function parameters
I am currently working with these functions, and though this renaming
could help to reason about the code. Some functions take a frame and
will return the value associated to that frame, others will return the
value associated to the previous frame. Those usually conveniently
contain "unwind" in their name, but naming the variable next_frame
instead of frame helps remembering which frame we are dealing with.
I also included a little typo fix at the top of frame.h.
gdb/ChangeLog:
* frame.c (frame_register_unwind): Change parameter name.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
* frame.h (frame_register_unwind): Likewise.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
(frame_unwind_arch): Likewise.
GDB Administrator [Sat, 21 Jul 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Fri, 20 Jul 2018 23:14:01 +0000 (00:14 +0100)]
Update my e-mail address, limit maintenance to MIPS I-IV ISAs
binutils/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
gdb/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
sim/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
H.J. Lu [Fri, 20 Jul 2018 19:47:25 +0000 (12:47 -0700)]
x86: Rename match_reg_size to match_operand_size
match_reg_size checks size for both memory and register operands. This
patch renamed match_reg_size to match_operand_size and updated comments
for
commit
3ac21baa8498d3aa9951f79e2c3336d532eeff7b
Author: Jan Beulich <jbeulich@novell.com>
Date: Mon Jul 16 08:19:21 2018 +0200
x86: fix operand size checking
which added one argument to match_reg_size, match_simd_size and
match_mem_size.
* config/tc-i386.c (match_reg_size): Renamed to ...
(match_operand_size): This. Update comments.
(match_simd_size): Update comments. Replace match_reg_size
with match_operand_size.
(match_mem_size): Likewise.
(operand_size_match): Replace match_reg_size with
match_operand_size.
H.J. Lu [Fri, 20 Jul 2018 16:52:35 +0000 (09:52 -0700)]
ld: Discard .rel.* and .rela.* sections
On many targets, like x86, .rel.dyn/.rela.dyn section is combined from
different .rel/.rela sections by -z combreloc. To discard dynamic
relocation section, we need to discard .rel.* and .rela.* sections
instead of .rel.dyn and .rela.dyn sections.
Note: This test fails for targets which issue a warning when dynamic
section is discarded.
* testsuite/ld-elf/reloc-discard.ld: Discard .rel.* and .rela.*
sections instead of .rel.dyn and .rela.dyn sections.
Maciej W. Rozycki [Fri, 20 Jul 2018 16:28:08 +0000 (17:28 +0100)]
MIPS/Linux/native: Convert to `get_ptrace_pid' for PID extraction
Use `get_ptrace_pid' to get the ptrace PID from `inferior_ptid' rather
than extracting it by hand.
gdb/
* mips-linux-nat.c (mips_linux_nat_target::read_description):
Call `get_ptrace_pid' rather than extracting the ptrace PID by
hand.
H.J. Lu [Fri, 20 Jul 2018 16:18:47 +0000 (09:18 -0700)]
x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if needed
When -z separate-code, which is enabled by default for Linux/x86, is
used to create executable, ld won't place any data in the code-only
PT_LOAD segment. If there are no data sections placed before the
code-only PT_LOAD segment, the program headers won't be mapped into
any PT_LOAD segment. When the executable tries to access it (based
on the program header address passed in AT_PHDR), it will lead to
segfault. This patch inserts a GNU_PROPERTY_X86_ISA_1_USED note if
there may be no data sections before the text section so that the
first PT_LOAD segment won't be code-only and will contain the program
header.
Testcases are adjusted to either pass "-z noseparate-code" to ld or
discard the .note.gnu.property section. A Linux/x86 run-time test is
added.
bfd/
PR ld/23428
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the
separate code program header is needed, make sure that the first
read-only PT_LOAD segment has no code by adding a
GNU_PROPERTY_X86_ISA_1_USED note.
ld/
PR ld/23428
* testsuite/ld-elf/linux-x86.S: New file.
* testsuite/ld-elf/linux-x86.exp: Likewise.
* testsuite/ld-elf/pr23428.c: Likewise.
* testsuite/ld-elf/sec64k.exp: Pass "-z noseparate-code" to ld
for Linux/x86 targets.
* testsuite/ld-i386/abs-iamcu.d: Likewise.
* testsuite/ld-i386/abs.d: Likewise.
* testsuite/ld-i386/pr12718.d: Likewise.
* testsuite/ld-i386/pr12921.d: Likewise.
* testsuite/ld-x86-64/abs-k1om.d: Likewise.
* testsuite/ld-x86-64/abs-l1om.d: Likewise.
* testsuite/ld-x86-64/abs.d: Likewise.
* testsuite/ld-x86-64/pr12718.d: Likewise.
* testsuite/ld-x86-64/pr12921.d: Likewise.
* testsuite/ld-linkonce/zeroeh.ld: Discard .note.gnu.property
section.
* testsuite/ld-scripts/print-memory-usage.t: Likewise.
* testsuite/ld-scripts/size-2.t: Likewise.
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use ld
to create executable if language is "asm".
Keith Seitz [Sun, 8 Jul 2018 16:19:10 +0000 (10:19 -0600)]
Rename remaining members of buildsym_compunit to start with "m_"
This renames all the remaining members of buildsym_compunit to start
with "m_" to follow the general naming convention.
gdb/ChangeLog
2018-07-20 Keith Seitz <keiths@redhat.com>
* buildsym.h (struct buildsym_compunit) <m_objfile, m_subfiles,
m_main_subfile, m_comp_dir, m_producer, m_debugformat,
m_compunit_symtab, m_language>: Add "m_" prefix.
Update all uses.
* buildsym.c: Update all uses.
Tom Tromey [Wed, 23 May 2018 04:47:15 +0000 (22:47 -0600)]
Remove record_line_ftype
The record_line_ftype typedef was only used in the DWARF reader, and
we removed those uses a few patches ago. So, remove the typedef.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym-legacy.h (record_line): Don't use record_line_ftype.
* buildsym.h (record_line_ftype): Remove typedef.
Tom Tromey [Wed, 23 May 2018 04:44:44 +0000 (22:44 -0600)]
Remove some unused buildsym functions
Now that the DWARF reader uses the builder-based API, we can remove a
few "legacy" functions that were only ever called by it.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym-legacy.h (augment_type_symtab): Don't declare.
(end_expandable_symtab): Likewise.
(end_symtab_get_static_block): Likewise.
(end_symtab_from_static_block): Likewise.
* buildsym-legacy.c (augment_type_symtab): Remove.
(end_expandable_symtab): Remove.
(end_symtab_get_static_block): Remove.
(end_symtab_from_static_block): Remove.
Tom Tromey [Tue, 22 May 2018 21:22:53 +0000 (15:22 -0600)]
Convert the DWARF reader to new-style buildysm
This converts the DWARF reader to use the new-style buildsym API. A
new buildsym_compunit is created for each CU and is used to construct
the symbol table. In some cases the CU must be passed to functions
which previously did not accept it. FWIW I tend to think that most
methods in the DWARF reader ought to be methods on the dwarf2_cu
object.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* dwarf2read.c: Include buildsym.h.
(struct dwarf2_cu) <builder>: New method.
(fixup_go_packaging): Update.
(process_full_comp_unit, process_full_type_unit): Update. Don't
use scoped_free_pendings.
(using_directives): Add "cu" parameter, remove "language".
(read_import_statement, setup_type_unit_groups, )
(read_func_scope, read_lexical_block_scope)
(dwarf2_record_block_ranges, read_namespace): Update.
(lnp_state_machine::lnp_state_machine): Add cu parameter.
(lnp_state_machine::handle_end_sequence): Update.
(class lnp_state_machine) <m_cu>: New member.
<m_record_line_callback>: Remove.
<m_currently_recording_lines>: New member.
(lnp_state_machine::handle_set_file): Update.
(noop_record_line): Remove.
(dwarf_record_line_p): Add cu parameter.
(dwarf_record_line_1, dwarf_finish_line): Likewise.
(lnp_state_machine::record_line)
(lnp_state_machine::lnp_state_machine)
(lnp_state_machine::check_line_address, dwarf_decode_lines_1)
(dwarf_decode_lines): Update.
(dwarf2_start_subfile): Add cu parameter.
(dwarf2_start_symtab, new_symbol): Update.
(macro_start_file, dwarf_decode_macro_bytes): Add cu parameter.
Remove dwarf2_per_objfile parameter.
(dwarf_decode_macros): Update.
Tom Tromey [Tue, 22 May 2018 20:44:09 +0000 (14:44 -0600)]
Parameterize cp_scan_for_anonymous_namespaces
This changes cp_scan_for_anonymous_namespaces to use the
buildsym_compunit API, rather than the function-based API.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* stabsread.c (define_symbol): Update.
* buildsym-legacy.h (get_buildsym_compunit): Declare.
* dwarf2read.c (new_symbol): Update.
* cp-support.h (cp_scan_for_anonymous_namespaces): Update.
* cp-namespace.c: Include buildsym.h.
(cp_scan_for_anonymous_namespaces): Add "compunit" parameter.
* buildsym-legacy.c (get_buildsym_compunit): New function.
Tom Tromey [Tue, 22 May 2018 20:39:24 +0000 (14:39 -0600)]
Introduce buildsym-legacy.h
This introduces a new header, buildsym-legacy.h, and changes all the
symbol readers to use it. The idea is to put the function-based
interface, that relies on the buildsym_compunit global, into a
separate header. Then when a symbol reader is updated to use the new
interface, it can simply not include buildsym-legacy.h, so it's easy
to be sure that the new API is used everywhere.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* xcoffread.c: Include buildsym-legacy.h.
* windows-nat.c: Include buildsym-legacy.h.
* stabsread.c: Include buildsym-legacy.h.
* mdebugread.c: Include buildsym-legacy.h.
* buildsym-legacy.h: New file.
* buildsym-legacy.c: New file, from buildsym.c.
* go32-nat.c: Include buildsym-legacy.h.
* dwarf2read.c: Include buildsym-legacy.h.
* dbxread.c: Include buildsym-legacy.h.
* cp-namespace.c: Include buildsym-legacy.h.
* coffread.c: Include buildsym-legacy.h.
* buildsym.h: Move some contents to buildsym-legacy.h.
* buildsym.c: Include buildsym-legacy.h. Move many functions to
buildsym-legacy.c.
* Makefile.in (HFILES_NO_SRCDIR): Add buildsym-legacy.h.
Tom Tromey [Tue, 22 May 2018 20:27:43 +0000 (14:27 -0600)]
Move struct buildsym_compunit to buildsym.h
This moves struct buildsym_compunit to buildsym.h. Now that the
members are private, and it no longer affects any global state in
buildsym.c, an instance can be used directly for symtab creation.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.h (struct buildsym_compunit): Move from buildsym.c.
* buildsym.c (struct buildsym_compunit): Move to buildsym.h.
(buildsym_compunit::buildsym_compunit)
(buildsym_compunit::~buildsym_compunit)
(buildsym_compunit::get_macro_table): Define.
Tom Tromey [Tue, 22 May 2018 20:23:32 +0000 (14:23 -0600)]
Remove reset_symtab_globals
This patch arranges for the remaining buildsym global --
buildsym_compunit -- to only be cleared by the wrapper functions, not
by methods on struct buildsym_compunit. In the process,
reset_symtab_globals is removed.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c (reset_symtab_globals): Remove.
(buildsym_compunit::end_symtab_from_static_block): Update.
(buildsym_compunit::augment_type_symtab): Update.
(end_symtab_from_static_block): Call free_buildsym_compunit.
(augment_type_symtab, end_symtab, end_expandable_symtab):
Likewise.
Tom Tromey [Tue, 22 May 2018 20:13:46 +0000 (14:13 -0600)]
Do not use buildsym.h in some files
A few files no longer need to include buildsym.h.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* arch-utils.c: Do not include buildsym.h.
* mipsread.c: Do not include buildsym.h.
* machoread.c: Do not include buildsym.h.
* elfread.c: Do not include buildsym.h.
Tom Tromey [Mon, 21 May 2018 15:29:29 +0000 (09:29 -0600)]
Add many methods to buildsym_compunit
This adds many methods to buildsym_compunit and makes the data members
private. Essentially the entire buildsym API is now available as a
method on buildsym_compunit. However, standalone functions are still
provided, as this is what the sybmol readers actually use.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c (buildsym_compunit::buildsym_compunit): Do more
initialization.
(buildsym_compunit): Add new constructor.
(struct buildsym_compunit) <get_last_source_file, finish_block,
record_block_range, start_subfile, patch_subfile_names,
push_subfile, pop_subfile, record_line, get_compunit_symtab,
set_last_source_start_addr, get_last_source_start_addr,
get_local_using_directives, set_local_using_directives,
get_global_using_directives, outermost_context_p,
get_current_context_stack, get_context_stack_depth,
get_current_subfile, get_local_symbols, get_file_symbols,
get_global_symbols, record_debugformat, record_producer,
push_context, pop_context, end_symtab_get_static_block,
end_symtab_from_static_block, end_symtab, end_expandable_symtab>:
New public methods.
<record_pending_block, finish_block_internal, make_blockvector,
watch_main_source_file_lossage, end_symtab_with_blockvector>: New
private methods.
Update all users.
Tom Tromey [Thu, 12 Jul 2018 04:55:17 +0000 (22:55 -0600)]
Remove parameter from record_pending_block
This removes a redundant parameter from record_pending_block. It also
moves record_pending_block earlier in the file, so that a forward
declaration is no longer needed.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c (record_pending_block): Move earlier. Remove objfile
parameter.
(finish_block_internal): Update.
Tom Tromey [Mon, 21 May 2018 15:21:18 +0000 (09:21 -0600)]
Remove EXTERN from buildsym.h
Nothing in buildsym.h relies on the "EXTERN" method of
declaration/definition, so remove the traces.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.h (EXTERN): Don't define or undef.
* buildsym.c (EXTERN): Don't define.
Tom Tromey [Mon, 21 May 2018 15:20:31 +0000 (09:20 -0600)]
Remove a TODO
This removes a TODO comment -- the work has been done.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c: Remove TODO comment.
Tom Tromey [Mon, 21 May 2018 15:16:16 +0000 (09:16 -0600)]
Remove buildsym_init
Now that buildsym_init does nothing, it can be removed.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* coffread.c (coff_symtab_read): Update.
* xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
(xcoff_new_init): Update.
* mipsread.c (mipscoff_new_init): Update.
* mdebugread.c (mdebug_build_psymtabs): Update.
* elfread.c (elf_new_init): Update.
* dwarf2read.c (process_full_comp_unit, process_full_type_unit):
Update.
* dbxread.c (dbx_new_init, dbx_psymtab_to_symtab_1)
(coffstab_build_psymtabs, elfstab_build_psymtabs)
(stabsect_build_psymtabs): Update.
* buildsym.h (buildsym_init): Don't declare.
* buildsym.c: Update comment.
(prepare_for_building): Remove.
(start_symtab, restart_symtab): Update.
(reset_symtab_globals): Update comment.
(buildsym_init): Remove.
Tom Tromey [Mon, 21 May 2018 15:12:54 +0000 (09:12 -0600)]
Move the symbol lists to buildsym_compunit
This moves the global symbol lists into buildsym_compunit, adds
accessors, and updates all the users.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab, process_xcoff_symbol): Update.
* stabsread.c (patch_block_stabs, define_symbol, read_type)
(read_enum_type, common_block_start, common_block_end)
(cleanup_undefined_types_1, finish_global_stabs): Update.
* mdebugread.c (psymtab_to_symtab_1): Update.
* dwarf2read.c (fixup_go_packaging, read_func_scope)
(read_lexical_block_scope, new_symbol): Update.
* dbxread.c (process_one_symbol): Update.
* coffread.c (coff_symtab_read, process_coff_symbol)
(coff_read_enum_type): Update.
* buildsym.h (file_symbols, global_symbols, local_symbols): Don't
declare.
(get_local_symbols, get_file_symbols, get_global_symbols): New
functions.
* buildsym.c (~buildsym_compunit): Clean up m_file_symbols and
m_global_symbols.
<m_file_symbols, m_local_symbols, m_global_symbols>: New members.
(~scoped_free_pendings): Update.
(finish_block, prepare_for_building, reset_symtab_globals)
(end_symtab_get_static_block, end_symtab_with_blockvector)
(augment_type_symtab, push_context): Update.
(get_local_symbols, get_file_symbols, get_global_symbols): New
functions.
(buildsym_init): Update.
Tom Tromey [Tue, 22 May 2018 05:30:47 +0000 (23:30 -0600)]
Set list_in_scope later in DWARF reader
Currently the DWARF reader sets the list_in_scope member of the CU
when first starting to process symbols. Future changes will make this
assert -- code will not be able to refer to these lists until after
start_symtab has been called. This patch prepares for the problem by
arranging to initialize list_in_scope in dwarf2_start_symtab.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* dwarf2read.c (process_full_comp_unit): Do not set list_in_scope.
(process_full_type_unit): Likewise.
(dwarf2_start_symtab): Set list_in_scope.
Tom Tromey [Tue, 22 May 2018 05:23:02 +0000 (23:23 -0600)]
Do not look at file symbols when reading psymtabs
The DWARF reader was setting the list_in_scope member when reading
partial symbols. however, this member is only useful when reading
full symbols. Future patches will make this assert, so remove these
unneeded initializations.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* dwarf2read.c (process_psymtab_comp_unit_reader)
(build_type_psymtabs_reader): Do not set list_in_scope.
Tom Tromey [Mon, 21 May 2018 14:35:43 +0000 (08:35 -0600)]
Remove free_pendings
buildsym.c currently keeps a free list of "struct pending"s. However,
this didn't seem necessary to me, and so this patch removes the free
list.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c (free_pendings): Remove.
(add_symbol_to_list, scoped_free_pendings)
(finish_block_internal, buildsym_init): Update.
Tom Tromey [Mon, 21 May 2018 06:41:21 +0000 (00:41 -0600)]
Remove the "listhead" argument from finish_block
finish_block is only ever called with "&local_symbols" as the
"listhead" argument. So, remove this argument.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab): Update.
* dwarf2read.c (read_func_scope, read_lexical_block_scope):
Update.
* dbxread.c (process_one_symbol): Update.
* coffread.c (coff_symtab_read): Update.
* buildsym.h (finish_block): Update.
* buildsym.c (finish_block): Remove "listhead" argument.
(end_symtab_get_static_block): Update.
Tom Tromey [Mon, 21 May 2018 06:34:26 +0000 (00:34 -0600)]
Move pending_blocks and pending_block_obstack to buildsym_compunit
This moves the pending_blocks and pending_block_obstack into
buildsym_compunit.
The obstack could perhaps be merged with the addrmap obstack, but I
did not do that in this series.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.h (class scoped_free_pendings): Remove constructor.
* buildsym.c (struct buildsym_compunit) <free_pending_blocks>: New
method.
<m_pending_block_obstack, m_pending_blocks>: New members.
(pending_block_obstack, pending_blocks): Remove.
(scoped_free_pendings::scoped_free_pendings): Default.
(~scoped_free_pendings): Update.
(free_pending_blocks): Remove.
(finish_block_internal, record_pending_block, make_blockvector)
(end_symtab_get_static_block, augment_type_symtab, push_context)
(buildsym_init): Update.
Tom Tromey [Mon, 21 May 2018 06:28:56 +0000 (00:28 -0600)]
Move pending addrmap globals to buildsym_compunit
This moves the pending addrmap-related globals into buildsym_compunit.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym.c (struct buildsym_compunit) <m_pending_addrmap,
m_pending_addrmap_obstack, m_pending_addrmap_interesting>: New
members.
(pending_addrmap, pending_addrmap_obstack)
(pending_addrmap_interesting): Remove.
(scoped_free_pendings, record_block_range, make_blockvector)
(prepare_for_building, reset_symtab_globals, buildsym_init):
Update.
Tom Tromey [Mon, 21 May 2018 06:15:12 +0000 (00:15 -0600)]
Move current_subfile to buildsym_compunit
This moves the global current_subfile into buildsym_compunit.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (process_linenos): Update.
* stabsread.c (define_symbol, read_type, read_enum_type): Update.
* mdebugread.c (psymtab_to_symtab_1): Update.
* dwarf2read.c (setup_type_unit_groups)
(lnp_state_machine::handle_set_file, dwarf_record_line_p)
(lnp_state_machine::record_line, dwarf_decode_lines): Update.
* dbxread.c (process_one_symbol): Update.
* coffread.c (coff_symtab_read, enter_linenos)
(process_coff_symbol): Update.
* buildsym.h (current_subfile): Don't declare.
(get_current_subfile): Declare.
* buildsym.c (struct buildsym_compunit) <m_current_subfile>: New
member.
(start_subfile, free_buildsym_compunit, push_subfile)
(prepare_for_building, start_symtab): Update.
(get_current_subfile): New function.
Tom Tromey [Mon, 21 May 2018 05:58:35 +0000 (23:58 -0600)]
Move the context stack to buildsym_compunit
This moves the context stack globals to be members of
buildsym_compunit, changing the type to a std::vector in the process.
Because the callers expect the context stack object to be valid after
being popped, at Simon's suggestion I've changed pop_context to return
the object rather than the pointer.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* coffread.c (coff_symtab_read): Update.
* xcoffread.c (read_xcoff_symtab): Update.
* dwarf2read.c (new_symbol): Update.
(read_func_scope, read_lexical_block_scope): Update.
* dbxread.c (process_one_symbol): Update.
* buildsym.h (context_stack, context_stack_depth): Don't declare.
(outermost_context_p): Remove macro.
(outermost_context_p, get_current_context_stack)
(get_context_stack_depth): Declare.
(pop_context): Return struct context_stack.
* buildsym.c (struct buildsym_compunit) <m_context_stack: New
member.
(context_stack_size): Remove.
(INITIAL_CONTEXT_STACK_SIZE): Remove.
(prepare_for_building, end_symtab_get_static_block)
(augment_type_symtab, push_context): Update.
(pop_context): Return struct context_stack.
(outermost_context_p, get_current_context_stack)
(get_context_stack_depth): New functions.
(buildsym_init): Update.
Tom Tromey [Sat, 2 Jun 2018 04:20:23 +0000 (22:20 -0600)]
Make the Rust parser pure
This makes the Rust parser a pure parser and removes all the
(non-constant) globals from rust-exp.y. This seemed like a nice
simplification to me and I think it should probably be applied to all
the parsers. Perhaps it would be good to go even one step farther and
have all parsers derive from parser_state.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* rust-exp.y: Now a pure parser. Update all rules.
(%union): Move earlier.
(current_parser, work_obstack): Remove globals.
(rust_parser, ~rust_parser): Update.
(class rust_parser) <copy_name, concat3, crate_name, super_name,
lex_character, lex_number, lex_string, lex_identifier,
rust_lookup_type, convert_params_to_types, convert_ast_to_type,
convert_name, convert_params_to_expression,
convert_ast_to_expression, ast_basic_type, ast_operation,
ast_compound_assignment, rust_op, ast_literal, ast_dliteral,
ast_structop, ast_structop_anonymous, ast_unary, ast_cast,
ast_call_ish, ast_path, ast_string, ast_struct, ast_range,
ast_array_type, ast_slice_type, ast_reference_type,
ast_pointer_type, ast_function_type, ast_tuple_type>: New methods.
(rust_parse): Update.
(rustyyerror, rustyylex): Add parser parameter.
(rust_lex_test_one, rust_lex_int_test, rust_lex_exception_test)
(rust_lex_stringish_test, rust_lex_test_sequence)
(rust_lex_test_trailing_dot, rust_lex_test_completion)
(rust_lex_test_push_back, rust_lex_tests): Update.
Andre Simoes Dias Vieira [Thu, 19 Jul 2018 15:18:28 +0000 (16:18 +0100)]
[PATCH, LD, AArch64] Fix ifunc testisms
This patch fixes some ifunc testisms after H.J. Lu's patch to enable the
use of IFUNC pointers in position dependent code for binutils. See PR
LD/23169 in binutils bugzilla.
The aarch64 ifunc error message test was changed to no longer expect
this error message as this is now an accepted combination. This patch
also disables the executable tests added by H.J. Lu for aarch64, just as
Alan Modra did with his patch, as these tests only seem to work on some
architectures.
ld/ChangeLog:
2018-07-19 Andre Vieira <andre.simoesdiasvieira@arm.com>
* testsuite/ld-aarch64/ifunc-9.d: Remove no longer expected error.
* testsuite/ld-ifunc/ifunc.exp: Disable tests for aarch64.
Tom de Vries [Fri, 20 Jul 2018 14:40:10 +0000 (16:40 +0200)]
[gdb/testsuite] Make noclone conditional in vla-optimized-out.c
Make the noclone attribute on f1 in vla-optimized-out.c conditional. This
makes the test-case by default identical to
gcc/testsuite/gcc.dg/guality/vla-1.c.
Tested on x86_64-linux.
2018-07-20 Tom de Vries <tdevries@suse.de>
* gdb.base/vla-optimized-out.c: Make noclone attribute conditional on
NOCLONE macro.
* gdb.base/vla-optimized-out.exp: Use additional_flags -DNOCLONE.
Nick Clifton [Fri, 20 Jul 2018 14:05:34 +0000 (15:05 +0100)]
Close memory and resource leaks detected by coverity in the binutils directory.
* objcopy.c (add_specific_symbols): Free buffer on exit.
(add_redefine_syms_file): Close file handle on exit.
(copy_object): Close file handle on early exit.
Free buffer on early exit.
Free gaps buffers once they are no longer needed.
* dwarf.c (display_debug_frames): Free allocated memory on exit.
(load_separate_debug_info): Free allocate memory on early exit.
Chenghua Xu [Fri, 20 Jul 2018 12:21:33 +0000 (13:21 +0100)]
MIPS/GAS: Split Loongson MMI Instructions from loongson2f/3a
The MMI instruction set has been implemented in many Loongson
processors. There is a lot of software optimized for MMI. This patch
splits MMI from loongson2f/3a, and adds GAS and disassembler options for
MMI instructions.
2018-07-20 Chenghua Xu <paul.hua.gm@gmail.com>
Maciej W. Rozycki <macro@mips.com>
bfd/
* elfxx-mips.c (print_mips_ases): Add MMI extension.
binutils/
* readelf.c (print_mips_ases): Add MMI extension.
gas/
* NEWS: Mention MultiMedia extensions Instructions (MMI)
support.
* config/tc-mips.c (options): Add OPTION_LOONGSON_MMI and
OPTION_NO_LOONGSON_MMI.
(md_longopts): Likewise.
(mips_ases): Define availability for MMI.
(mips_convert_ase_flags): Map ASE_LOONGSON_MMI to
AFL_ASE_LOONGSON_MMI.
(mips_cpu_info_table): Add ASE_LOONGSON_MMI for loongson2f/3a.
(md_show_usage): Add help for -mloongson-mmi and
-mno-loongson-mmi.
* doc/as.texi: Document -mloongson-mmi, -mno-loongson-mmi.
* doc/c-mips.texi: Document -mloongson-mmi, -mno-loongson-mmi,
.set loongson-mmi and .set noloongson-mmi.
* testsuite/gas/mips/loongson-2f.d: Move mmi test to ...
* testsuite/gas/mips/loongson-2f-mmi.d: Here. Add ISA/ASE
flag verification.
* testsuite/gas/mips/loongson-2f.s: Move mmi test to ...
* testsuite/gas/mips/loongson-2f-mmi.s: Here.
* testsuite/gas/mips/loongson-3a.d: Move mmi test to ...
* testsuite/gas/mips/loongson-3a-mmi.d: Here. Add ISA/ASE
flag verification.
* testsuite/gas/mips/loongson-3a.s: Move mmi test to ...
* testsuite/gas/mips/loongson-3a-mmi.s: Here.
* testsuite/gas/mips/mips.exp: Run loongson-2f-mmi and
loongson-3a-mmi tests.
include/
* elf/mips.h (AFL_ASE_MMI): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_MMI.
* opcode/mips.h (ASE_LOONGSON_MMI): New macro.
opcodes/
* mips-dis.c (mips_arch_choices): Add MMI to loongson2f and
loongson3a descriptors.
(parse_mips_ase_option): Handle -M loongson-mmi option.
(print_mips_disassembler_options): Document -M loongson-mmi.
* mips-opc.c (LMMI): New macro.
(mips_opcodes): Replace IL2F|IL3A marking with LMMI for MMI
instructions.
Maciej W. Rozycki [Fri, 20 Jul 2018 12:21:33 +0000 (13:21 +0100)]
MIPS/LD: Fix crashing with a discarded dynamic relocation section
Fix a crash that occurs in `_bfd_mips_elf_finish_dynamic_sections' if a
dynamic relocation section has been created, but marked to be discarded
by an assignment to the /DISCARD/ output section in a linker script.
In that case the output section is the absolute section, which has no
ELF section data attached, so trying to set its `sh_size' parameter
causes a null pointer dereference.
This is only done as the value for the DT_RELSZ dynamic entry is being
set, so fix the problem by not creating DT_REL, DT_RELSZ or DT_RELENT
dynamic entries in the first place if the dynamic relocation section
will not be output, as with no dynamic relocation data present these
would not serve their purpose anyway.
Add a generic ELF test case to verify that no dynamic relocation data is
reported in the dynamic segment.
bfd/
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not
create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the
dynamic relocation section will be discarded from output.
(_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that
the dynamic relocation section will be retained in output.
ld/
* testsuite/ld-elf/reloc-discard.d: New test.
* testsuite/ld-elf/reloc-discard.ld: New test linker script.
* testsuite/ld-elf/reloc-discard.s: New test source.
Rainer Orth [Fri, 20 Jul 2018 09:15:57 +0000 (11:15 +0200)]
Specify architecture for SPARC gas tests
A couple of SPARC gas tests FAIL on Solaris/SPARC (both
sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11):
FAIL: sparc PAUSE
FAIL: sparc CBCOND
FAIL: sparc CFR
FAIL: sparc CRYPTO
FAIL: sparc HPC+VIS3
FAIL: sparc IMA
FAIL: sparc OSA2015 %mwait asr and MWAIT instruction
FAIL: sparc OSA2015 %mcdper asr
FAIL: sparc SPARC5 and VIS4.0
FAIL: OSA2015 crypto instructions
FAIL: SPARC6
FAIL: FPCMPSHL OSA2017 instructions
FAIL: OSA2017 ONADD/ONSUB/ONMUL/ONDIV instructions.
FAIL: OSA2017 RLE instructions
FAIL: sparc64 rdasr
FAIL: sparc64 rdpr
FAIL: sparc64 rdhpr
FAIL: sparc64 wrasr
FAIL: sparc64 wrpr
It turns out there's a common pattern here: failures happen for all
tests that use SPARC ISA extensions beyond sparcv9, e.g. for the sparc
PAUSE test:
regexp_diff match failure
regexp "^ 0: b7 80 40 02 wr %g1, %g2, %pause$"
line " 0: b7 80 40 02 wr %g1, %g2, %asr27"
[...]
regexp_diff match failure
regexp "^ 8: b7 80 20 08 pause 8$"
line " 8: b7 80 20 08 wr 8, %asr27"
[...]
The fix is easy, actually: just as the tests specify the ISA extension
to use as a gas flag, the same needs to be done for objdump. For the
test above, which has -Av9v, this means passing -msparc:v9v to objdump.
Doing so makes all but two (unrelated; to be reported separately)
failures go away.
This doesn't happen on Linux/SPARC, where gas emits GNU object attributes
matching the hardcare capabilities used. Since gas doesn't yet implement
Solaris-style object capabilites, the explicit -march is needed, but only
passed on Solaris.
Tested on both sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.
* testsuite/gas/sparc/sparc.exp (set_tests_arch): New proc.
Prefix v9c, v9d, v9v, v9m, v9m8 tests with corresponding
set_tests_arch.
DJ Delorie [Fri, 20 Jul 2018 01:34:37 +0000 (21:34 -0400)]
Remove myself from target-specific MAINTAINERS
[binutils]
* MAINTAINERS (RL78, RX): Remove myself as maintainer.
[sim]
* MAINTAINERS (rl78, m32c, rx, v850): Remove myself as maintainer.
GDB Administrator [Fri, 20 Jul 2018 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 19 Jul 2018 15:34:55 +0000 (16:34 +0100)]
Eliminate remaining gdb/guile cleanups
The remaining gdb/guile cleanups all handle the memory returned by
gdbscm_scm_to_c_string.
This commit makes gdbscm_scm_to_c_string return a
gdb::unique_xmalloc_ptr instead of a naked pointer, and eliminates the
remaining cleanups.
gdb/ChangeLog:
2018-07-19 Pedro Alves <palves@redhat.com>
* guile/guile-internal.h (gdbscm_scm_to_c_string): Now returns a
gdb::unique_xmalloc_ptr.
* guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x):
Adjust to use dbscm_wrap and gdb::unique_xmalloc_ptr.
* guile/scm-exception.c (gdbscm_exception_message_to_string): Use
copy-initialization.
* guile/scm-pretty-print.c (ppscm_print_children): Use
gdb::unique_xmalloc_ptr instead of cleanups.
(gdbscm_apply_val_pretty_printer): Remove cleanups.
* guile/scm-string.c (gdbscm_scm_to_c_string): Now returns a
gdb::unique_xmalloc_ptr.
* guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p):
Adjust to use gdb::unique_xmalloc_ptr.
* guile/scm-utils.c (extract_arg): Adjust.
* guile/scm-value.c (gdbscm_value_field): Adjust to use
gdb::unique_xmalloc_ptr instead of a cleanup.
Tom Tromey [Thu, 19 Jul 2018 14:49:58 +0000 (08:49 -0600)]
Remove make_cleanup_value_free_to_mark
Pedro's patch to introduce gdbscm_wrap removed the last caller of
make_cleanup_value_free_to_mark. This patch removes this function.
I'm checking this in as obvious. Tested by rebuilding, and by
grepping.
gdb/ChangeLog
2018-07-19 Tom Tromey <tom@tromey.com>
* utils.c (do_value_free_to_mark)
(make_cleanup_value_free_to_mark): Remove.
* utils.h (make_cleanup_value_free_to_mark): Remove.
Tom de Vries [Thu, 19 Jul 2018 14:24:16 +0000 (16:24 +0200)]
[gdb/testsuite] Fix regexp in list-thread-groups-available.exp
I ran into a gdb.mi/list-thread-groups-available.exp failure:
...
Running gdb/testsuite/gdb.mi/list-thread-groups-available.exp ...
FAIL: gdb.mi/list-thread-groups-available.exp:
list available thread groups (unexpected output)
PASS: gdb.mi/list-thread-groups-available.exp:
list available thread groups with filter
...
When doing an experiment of running it 100 times in a row, the failure
reproduced 3 times.
Analyzing the original failure led to insufficient quoting of square brackets
in a regexp. This patch fixes the regexp, which resulted in 0 failures in a
100-in-a-row run.
Tested on x86_64-linux.
2018-07-19 Tom de Vries <tdevries@suse.de>
* gdb.mi/list-thread-groups-available.exp (cores_re): Fix quoting in
regular expression.
Eli Zaretskii [Thu, 19 Jul 2018 13:54:06 +0000 (16:54 +0300)]
Fix GDB build using mingw.org's MinGW
libiberty/
2018-07-18 Eli Zaretskii <eliz@gnu.org>
PR gdb/23434
* libiberty/simple-object-elf.c (ENOTSUP): If not defined by
errno.h, redirect ENOTSUP to ENOSYS.
Nick Clifton [Thu, 19 Jul 2018 13:23:31 +0000 (14:23 +0100)]
Stop potential memory leaks in dwarf CIE reader.
* dwarf.c (read_cie): Free allocated memory before returning with
a failure result.
Pedro Alves [Thu, 19 Jul 2018 09:56:47 +0000 (10:56 +0100)]
gdbscm_wrap, really forward args
Commit
557e56be2648 ("Eliminate most remaining cleanups under
gdb/guile/") missed adding the && to Args to really forward the
arguments properly. Noticed by inspection.
gdb/ChangeLog:
2018-07-19 Pedro Alves <palves@redhat.com>
* guile/guile-internal.h (gdbscm_wrap): Really make 'args' a
forwarding reference.
Andreas Krebbel [Thu, 19 Jul 2018 08:00:51 +0000 (10:00 +0200)]
S/390: Set the htm flag on PPA
The PPA instruction will be emitted by GCC transactional execution
builtins so it needs to be accepted with just -mhtm and without
-march=zEC12.
opcodes/ChangeLog:
2018-07-19 Andreas Krebbel <krebbel@linux.ibm.com>
* s390-opc.txt (PPA): Add the htm flag.
Jan Beulich [Thu, 19 Jul 2018 06:36:19 +0000 (08:36 +0200)]
x86: fold narrowing VCVT* templates
When multiple (here: two) forms of an insn take different width inputs
but produce identical size outputs (here: RegXMM), the templates can be
combined.
Also drop IgnoreSize (and the now redundant size specifiers) wherever
applicable.
Jan Beulich [Thu, 19 Jul 2018 06:35:38 +0000 (08:35 +0200)]
x86: fold VFPCLASSP{D,S} templates
These are special because they may not have a register operand to derive
the vector length from, which requires to also deal with the braodcast
case when determining vector length in build_evex_prefix().
Also drop IgnoreSize (and the now redundant size specifiers) from their
suffixed counterparts.
Jan Beulich [Thu, 19 Jul 2018 06:34:45 +0000 (08:34 +0200)]
x86: fold various AVX512* templates
Jan Beulich [Thu, 19 Jul 2018 06:34:01 +0000 (08:34 +0200)]
x86: fold various AVX512DQ templates
Jan Beulich [Thu, 19 Jul 2018 06:32:17 +0000 (08:32 +0200)]
x86: fold various AVX512BW templates
Jan Beulich [Thu, 19 Jul 2018 06:31:24 +0000 (08:31 +0200)]
x86: fold various AVX512CD templates
Jan Beulich [Thu, 19 Jul 2018 06:29:35 +0000 (08:29 +0200)]
x86: fold various AVX512VL templates into their AVX512F counterparts
Jan Beulich [Thu, 19 Jul 2018 06:28:29 +0000 (08:28 +0200)]
x86: pre-process opcodes table before parsing
Instead of expanding macro-like constructs in i386-gen, have the C pre-
processor do this for us. Besides being a prerequisite for the next
template folding steps, this also paves the way for removing various
hidden dependencies between #define-s in i386-opc.h and plain literal
numbers used in i386-opc.tbl.
The #undef of None is solely to leave the generated i386-tbl.h entirely
unchanged.
GDB Administrator [Thu, 19 Jul 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 18 Jul 2018 22:41:06 +0000 (23:41 +0100)]
Eliminate cleanup in gdbscm_execute_gdb_command
Note: the "may be modified" comment is no longer true nowadays.
gdb/ChangeLog:
2018-07-18 Pedro Alves <palves@redhat.com>
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
gdbscm_wrap. Use gdb::unique_xmalloc_ptr<char> instead of a
cleanup.
Pedro Alves [Wed, 18 Jul 2018 21:55:59 +0000 (22:55 +0100)]
Eliminate most remaining cleanups under gdb/guile/
The main complication with the Guile code is that we have two types of
exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ
exceptions. Code that is facing the Guile interpreter must not throw
GDB exceptions, instead Scheme exceptions must be thrown. Also,
because Guile exceptions are SJLJ based, Guile-facing code must not
use local objects with dtors, unless wrapped in a scope with a
TRY/CATCH, because the dtors won't otherwise be run when a Guile
exceptions is thrown.
This commit adds a new gdbscm_wrap wrapper function than encapsulates
a pattern I noticed in many of the functions using
GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS. The wrapper is written
such that you can pass either a lambda to it, or a function plus a
variable number of forwarded args. I used a lambda when its body
would be reasonably short, and a separate function in the larger
cases.
This also convers a few functions that were using
GDBSCM_HANDLE_GDB_EXCEPTION to use gdbscm_wrap too because they
followed a similar pattern.
A few cases of make_cleanup calls are replaced with explicit xfree
calls. The make_cleanup/do_cleanups calls in those cases are
pointless, because do_cleanups won't be called when a Scheme exception
is thrown.
We also have a couple cases of Guile-facing code using RAII-type
objects to manage memory, but those are incorrect, exactly because
their dtor won't be called if a Guile exception is thrown.
gdb/ChangeLog:
2018-07-18 Pedro Alves <palves@redhat.com>
* guile/guile-internal.h: Add comment about mixing GDB and Scheme
exceptions.
(GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS): Delete.
(gdbscm_wrap): New.
* guile/scm-frame.c (gdbscm_frame_read_register): Use xfree
directly instead of a cleanup.
* guile/scm-math.c (vlscm_unop_gdbthrow): New, factored out from ...
(vlscm_unop): ... this. Reimplement using gdbscm_wrap.
(vlscm_binop_gdbthrow): New, factored out from ...
(vlscm_binop): ... this. Reimplement using gdbscm_wrap.
(vlscm_rich_compare): Use gdbscm_wrap.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Use xfree directly
instead of a cleanup.
(gdbscm_lookup_global_symbol): Use xfree directly instead of a
cleanup.
* guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p):
Use xfree directly instead of a cleanup.
* guile/scm-value.c (gdbscm_make_value, gdbscm_make_lazy_value):
Adjust to use gdbscm_wrap and scoped_value_mark.
(gdbscm_value_optimized_out_p): Adjust to use gdbscm_wrap.
(gdbscm_value_address, gdbscm_value_dereference)
(gdbscm_value_referenced_value): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_value_dynamic_type): Use scoped_value_mark.
(vlscm_do_cast, gdbscm_value_field): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_value_subscript, gdbscm_value_call): Adjust to use
gdbscm_wrap and scoped_value_mark.
(gdbscm_value_to_string): Use xfree directly instead of a
cleanup. Move 'buffer' unique_ptr to TRY scope.
(gdbscm_value_to_lazy_string): Use xfree directly instead of a
cleanup. Move 'buffer' unique_ptr to TRY scope. Use
scoped_value_mark.
(gdbscm_value_fetch_lazy_x): Use gdbscm_wrap.
(gdbscm_parse_and_eval): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_history_ref, gdbscm_history_append_x): Adjust to use
gdbscm_wrap.
Tom de Vries [Tue, 3 Jul 2018 09:06:45 +0000 (11:06 +0200)]
[gdb/exp] Fix printing of type of optimized out vla
Consider this snippet from gcc/testsuite/gcc.dg/guality/vla-1.c:
...
int __attribute__((noinline))
f1 (int i)
{
char a[i + 1];
a[0] = 5; /* { dg-final { gdb-test .+1 "i" "5" } } */
return a[0]; /* { dg-final { gdb-test . "sizeof (a)" "6" } } */
}
...
When we compile the test-case with -O1 -g, and query the size of optimized
out vla 'a', we get:
...
$ ./gdb -batch -ex "b f1" -ex "r" -ex "p sizeof (a)" vla-1.exe
Breakpoint 1 at 0x4004a8: file vla-1.c, line 17.
Breakpoint 1, f1 (i=i@entry=5) at vla-1.c:17
17 return a[0];
$1 = 0
...
while we expect a size of '6'.
The problem is that default_read_var_value does not resolve the dynamic type
of a variable if the variable is optimized out.
This patch fixes that, and consequently gdb prints '6', as expected.
Tested on x86_64-linux.
2018-07-18 Tom de Vries <tdevries@suse.de>
* findvar.c (default_read_var_value): Also resolve dynamic type for
LOC_OPTIMIZED_OUT vars.
* gdb.base/vla-optimized-out.c: New test.
* gdb.base/vla-optimized-out.exp: New file.
Maciej W. Rozycki [Wed, 18 Jul 2018 18:17:39 +0000 (19:17 +0100)]
microMIPS: Add SYSCALL instruction decoding
Fix a bug with commit
4cc0665f24bb ("microMIPS support"),
<https://sourceware.org/ml/gdb-patches/2012-05/msg00724.html>, and add
missing microMIPS SYSCALL instruction decoding needed to determine the
location to put a breakpoint at when single-stepping though a syscall.
gdb/
* mips-tdep.c (micromips_next_pc): Add SYSCALL instruction
decoding.
Maciej W. Rozycki [Wed, 18 Jul 2018 16:51:54 +0000 (17:51 +0100)]
BFD/XCOFF: Fix storage class setting for weak defined symbols
Fix an issue with commit
8602d4fea60d ("Add AIX weak support"),
<https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the
correct condition to set the storage class for weak defined symbols.
The context here is as follows:
else if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->smclas == XMC_XO)
{
BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section));
isym.n_value = h->root.u.def.value;
isym.n_scnum = N_UNDEF;
if (h->root.type == bfd_link_hash_undefweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else
isym.n_sclass = C_EXT;
aux.x_csect.x_smtyp = XTY_ER;
}
so clearly the inner condition can never be true. Correct the condition
then to check for the `bfd_link_hash_defweak' symbol type instead here,
and in a similar place a little further down in the same function.
bfd/
* xcofflink.c (xcoff_write_global_symbol): Fix symbol type
checks for defined weak symbols.
Maciej W. Rozycki [Wed, 18 Jul 2018 13:08:37 +0000 (14:08 +0100)]
MIPS/GAS/testsuite: Correct whitespace issues with Loongson tests
Remove CR characters, trailing whitespace and space characters appearing
immediately before a tab character, and replace spaces with tabs, all
across Loongson GAS tests.
gas/
* testsuite/gas/mips/loongson-2e.d: Correct whitespace issues.
* testsuite/gas/mips/loongson-2f.d: Likewise.
* testsuite/gas/mips/loongson-2f-2.d: Likewise.
* testsuite/gas/mips/loongson-2f-3.d: Likewise.
* testsuite/gas/mips/loongson-3a.d: Likewise.
* testsuite/gas/mips/loongson-3a-2.d: Likewise.
* testsuite/gas/mips/loongson-2e.s: Likewise.
* testsuite/gas/mips/loongson-2f.s: Likewise.
* testsuite/gas/mips/loongson-2f-3.s: Likewise.
* testsuite/gas/mips/loongson-3a.s: Likewise.
* testsuite/gas/mips/loongson-3a-2.s: Likewise.
H.J. Lu [Wed, 18 Jul 2018 12:33:36 +0000 (05:33 -0700)]
x86: Split vcvtps2{,u}qq and vcvttps2{,u}qq
After
commit
1b54b8d7e4fc8055f9220a5287e8a94d8a65a88d
Author: Jan Beulich <jbeulich@novell.com>
Date: Mon Dec 18 09:36:14 2017 +0100
x86: fold RegXMM/RegYMM/RegZMM into RegSIMD
... qualified by their respective sizes, allowing to drop FirstXmm0 at
the same time.
folded RegXMM, RegYMM and RegZMM into RegSIMD, it's no longer impossible
to distinguish if Xmmword can represent a memory reference when operand
specification contains SIMD register. For example, template operands
specification like these
RegXMM|...|Xmmword|...
and
RegXMM|...
The Xmmword bitfield is always set by RegXMM which is represented by
"RegSIMD|Xmmword". This patch splits each of vcvtps2qq, vcvtps2uqq,
vcvttps2qq and vcvttps2uqq into 2 templates: one template only has
RegXMM source operand and the other only has mempry source operand.
gas/
PR gas/23418
* testsuite/gas/i386/xmmword.s: Add tests for vcvtps2qq,
vcvtps2uqq, vcvttps2qq and vcvttps2uqq.
* testsuite/gas/i386/xmmword.l: Updated.
opcodes/
PR gas/23418
* i386-opc.h (Byte): Update comments.
(Word): Likewise.
(Dword): Likewise.
(Fword): Likewise.
(Qword): Likewise.
(Tbyte): Likewise.
(Xmmword): Likewise.
(Ymmword): Likewise.
(Zmmword): Likewise.
* i386-opc.tbl: Split vcvtps2qq, vcvtps2uqq, vcvttps2qq and
vcvttps2uqq.
* i386-tbl.h: Regenerated.
Andreas Krebbel [Thu, 21 Dec 2017 12:12:03 +0000 (13:12 +0100)]
S/390: Improve partial relro support for 64 bit
Currently on S/390 the .got.plt always comes first which prevents the
GNU_RELRO segment from being extended across the non-plt GOT entries.
Just swapping both unfortunately is not that simple since our ABI
requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very
beginning of the entire GOT. Of the 3 magic GOT entries the first is
accessed via got pointer while second and third are being accessed via
DT_PLTGOT. In order to keep them together we make DT_PLTGOT to point
to the .got instead of .got.plt. However, this violates an assumption
in the dynamic linker prelink undo code about the GOTPLT entries
starting at DT_PLTGOT + 3. We got rid of this requirement with a
Glibc patch already in version 2.24:
https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html
So the S/390 relro GOT layout will look like this with this patch:
+----------------------------------+
|got[0]: DYNAMIC | <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got
|got[1]: link_map parm |
|got[2]: &_dl_runtime_resolve |
+----------------------------------+
| | non-plt GOT entries
| |
| |
+----------------------------------+
| | <--- .gotplt, PLT GOT entries
| |
| |
| |
+----------------------------------+
The patch detects the current layout in size_dynamic_section in order
to deal also with linker scripts not generated by this ld version.
With partial relro enabled we pick a linker script where .got and
.got.plt are swapped which then triggers the rest of the logic.
ld/ChangeLog:
2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com>
* emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and
SEPARATE_GOTPLT.
* testsuite/ld-s390/gotreloc_64-relro-1.dd: New test.
* testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ...
* testsuite/ld-s390/gotreloc_64-1.dd: ... this.
* testsuite/ld-s390/s390.exp: Split the GOT testcase into two.
bfd/ChangeLog:
2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com>
* elf-s390-common.c (s390_gotplt_after_got_p): New function.
(s390_got_pointer): New function.
(s390_got_offset): New function.
(s390_gotplt_offset): New function.
* elf64-s390.c (allocate_dynrelocs): Adjust comment.
(elf_s390_size_dynamic_sections): Move space for magic GOT entries
from .got.plt to .got if necessary and pick the right location for
_GLOBAL_OFFSET_TABLE_.
(elf_s390_relocate_section): Use the wrapper functions from
elf-s390-common.c to deal with both possible layouts (either .got
or .got.plt first).
(elf_s390_finish_dynamic_sections): Likewise.
(elf_s390_finish_dynamic_symbol): Make the location of the GOT
magic entries conditional.
Andreas Krebbel [Mon, 11 Jun 2018 11:23:00 +0000 (13:23 +0200)]
ld: Enable using separate linker script for -z relro
With this patch dedicated linker scripts can be generated for partial
relro triggered by defining GENERATE_RELRO_SCRIPT in the target
specific scripts.
This is necessary for e.g. S/390 where usually the .got.plt comes
first and prevents the relro segment from being extended across the
non-plt GOT entries.
The patch started with the work from Marcin taken from the mwk user
branches. However, the patch needed substantial changes due to the
'separate code' feature which got committed in the meantime.
ld/ChangeLog:
2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com>
Marcin Kościelnicki <koriakin@0x04.net>
* emultempl/elf32.em: Add code to pick dedicated linker scripts
for partial relro.
* genscripts.sh: Generate dedicated linker scripts for partial relro.
Nick Clifton [Wed, 18 Jul 2018 07:37:38 +0000 (08:37 +0100)]
Updated French translation for gold and Spanish translation for ld.
ld * po/es.po: Updated Spanish translation.
gold * po/fr.po: Updated French translation.
GDB Administrator [Wed, 18 Jul 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 27 May 2018 05:34:02 +0000 (23:34 -0600)]
Return unique_xmalloc_ptr from gdbscm_scm_to_string
This changes gdbscm_scm_to_string to return a unique_xmalloc_ptr and
then fixes all the callers. This allows for the removal of some
cleanups.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
* guile/scm-param.c (pascm_set_func, pascm_show_func)
(compute_enum_list, pascm_set_param_value_x)
(gdbscm_parameter_value): Update.
* guile/guile-internal.h (gdbscm_scm_to_string): Update.
(gdbscm_scm_to_host_string): Update.
* guile/scm-math.c (vlscm_convert_typed_value_from_scheme):
Update.
* guile/scm-cmd.c (cmdscm_add_completion): Update.
* guile/scm-pretty-print.c (ppscm_print_string_repr): Update.
* guile/scm-string.c (gdbscm_scm_to_string): Return
unique_xmalloc_ptr.
(gdbscm_scm_to_host_string): Likewise.
Tom Tromey [Sun, 27 May 2018 05:26:39 +0000 (23:26 -0600)]
Return unique_xmalloc_ptr from gdbscm_safe_eval_string
This changes gdbscm_safe_eval_string to return a unique_xmalloc_ptr.
This allows for the removal of some cleanups. It also fixes a
potential latent memory leak in gdbscm_set_backtrace.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
* guile/guile.c (gdbscm_eval_from_control_command): Update.
* guile/guile-internal.h (gdbscm_safe_eval_string): Update.
* guile/scm-objfile.c (gdbscm_execute_objfile_script): Update.
* guile/scm-safe-call.c (gdbscm_safe_eval_string): Return
unique_xmalloc_ptr.
Tom Tromey [Sun, 27 May 2018 05:21:23 +0000 (23:21 -0600)]
Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptr
This changes gdbscm_exception_message_to_string to return a
unique_xmalloc_ptr, allowing for the removal of some cleanups.
unique_xmalloc_ptr was chosen because at the root of the call chains
is a function from Guile that returns a malloc'd string.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
* guile/scm-param.c (pascm_signal_setshow_error): Update.
* guile/guile-internal.h (gdbscm_exception_message_to_string):
Update.
* guile/scm-cmd.c (cmdscm_function): Update.
* guile/scm-pretty-print.c
(ppscm_print_exception_unless_memory_error): Update.
* guile/scm-exception.c (gdbscm_exception_message_to_string):
Return unique_xmalloc_ptr.
Tom Tromey [Sun, 27 May 2018 05:16:13 +0000 (23:16 -0600)]
Use std::string in ppscm_make_pp_type_error_exception
This changes ppscm_make_pp_type_error_exception to use std::string,
removing a cleanup.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
* guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception):
Use string_printf.
Maciej W. Rozycki [Tue, 17 Jul 2018 19:04:53 +0000 (20:04 +0100)]
BFD: Use `bfd_is_abs_symbol' to determine whether a symbol is absolute
Use `bfd_is_abs_symbol' to determine whether a symbol is absolute,
avoiding a problem with ordinary symbols defined in a linker script
outside an output section definition. Such symbols have its owning
section set to the absolute section up to the final link phase. A flag
has been added to the link hash to identify such symbols. Rather than
checking the flag by hand, use the macro that does it uniformly for all
users.
bfd/
* elf32-nds32.c (nds32_elf_relax_loadstore): Use
`bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking
whether the symbol is absolute.
(nds32_elf_relax_lo12): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
(elfNN_aarch64_check_relocs): Likewise.
* xcofflink.c (xcoff_need_ldrel_p): Likewise.
(bfd_xcoff_import_symbol): Likewise.
(xcoff_write_global_symbol): Likewise.
Maciej W. Rozycki [Tue, 17 Jul 2018 19:04:53 +0000 (20:04 +0100)]
LD: Export relative-from-absolute symbol marking to BFD
It is usually possible to tell absolute and ordinary symbols apart in
BFD throughout the link, by checking whether the section that owns the
symbol is absolute or not.
That however does not work for ordinary symbols defined in a linker
script outside an output section statement. Initially such symbols are
entered into to the link hash as absolute symbols, owned by the absolute
section. A flag is set in the internal linker expression defining such
symbols to tell the linker to convert them to section-relative ones in
the final phase of the link. That flag is however not accessible to BFD
linker code, including BFD target code in particular.
Add a flag to the link hash then to copy the information held in the
linker expression. Define a macro, `bfd_is_abs_symbol', for BFD code to
use where determining whether a symbol is absolute or ordinary is
required before the final link phase.
This macro will correctly identify the special `__ehdr_start' symbol as
ordinary throughout link, for example, even though early on it will be
assigned to the absolute section. Of course this does not let BFD code
identify what the symbol's ultimate section will be before the final
link phase has converted this symbol (in `update_definedness').
include/
* bfdlink.h (bfd_link_hash_entry): Add `rel_from_abs' member.
bfd/
* linker.c (bfd_is_abs_symbol): New macro.
* bfd-in2.h: Regenerate.
ld/
* ldexp.c (exp_fold_tree_1) <etree_assign, etree_provide>
<etree_provided>: Copy expression's `rel_from_abs' flag to the
link hash.
Jim Wilson [Tue, 17 Jul 2018 16:44:42 +0000 (09:44 -0700)]
RISC-V: Don't decrement pc after break.
gdb/
* riscv-tdep.c (riscv_has_feature): Delete comment that refers to
set_gdbarch_decr_pc_after_break. Call riscv_read_misa_reg always.
(riscv_gdbarch_init): Delete local has_compressed_isa. Delete now
unecessary braces after EF_RISCV_RVC test. Delete call to
set_gdbarch_decr_pc_after_break.
Jim Wilson [Tue, 17 Jul 2018 16:42:23 +0000 (09:42 -0700)]
RISC-V: Correct legacy misa register number.
gdb/
* riscv-tdep.h (DECLARE_CSR): Use RISCV_FIRST_CSR_REGNUM instead of
RISCV_LAST_FP_REGNUM + 1.
(RSICV_CSR_LEGACY_MISA_REGNUM): Add RISCV_FIRST_CSR_REGNUM.
Tom Tromey [Thu, 28 Jun 2018 17:19:33 +0000 (11:19 -0600)]
Remove --disable-gdbcli
I think it doesn't really make sense to allow building gdb without the
CLI. Perhaps at one time this was a goal, but libgdb is long gone and
the CLI is intrinsic to gdb.
So, this patch removes the implementation of this configure option.
It is still recognized (this is autoconf's default), but does nothing.
This simplifies configure.ac and Makefile.in a bit.
Tested by rebuilding.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
* configure.ac: Remove --disable-gdbcli.
* configure: Rebuild.
* Makefile.in (SUBDIR_CLI_DEPS, SUBDIR_CLI_LDFLAGS)
(SUBDIR_CLI_CFLAGS): Remove.
(SFILES): Use SUBDIR_CLI_SRCS.
(COMMON_OBS): Use SUBDIR_CLI_OBS.
Tom Tromey [Fri, 29 Jun 2018 21:10:04 +0000 (15:10 -0600)]
Use scoped_free_pendings in coff_symtab_read
PR gdb/18624 concerns an assertion failure that occurs when setting a
breakpoint in a Go program on Windows.
What happens here is that coff_symtab_read uses buildsym but does not
instantiate scoped_free_pendings. So, the struct pending objects are
never released. Later, dwarf2read.c calls buildsym_init, which
asserts.
This patch fixes the problem by instantiating scoped_free_pendings in
coff_symtab_read.
Tested using the test executable from the PR. I don't know how to
test this more fully.
gdb/ChangeLog
2018-07-17 Tom Tromey <tom@tromey.com>
PR gdb/18624:
* coffread.c (coff_symtab_read): Use scoped_free_pendings.
GDB Administrator [Tue, 17 Jul 2018 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 16 Jul 2018 21:50:36 +0000 (14:50 -0700)]
RISC-V: Add osabi support.
gdb/
* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
Pedro Franco de Carvalho [Mon, 16 Jul 2018 15:42:22 +0000 (12:42 -0300)]
Fix typo in NT_PPC_TM_CVSX note description
2018-07-16 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
binutils/
* readelf.c (get_note_type): Fix typo in NT_PPC_TM_CVSX note
description.
Edjunior Barbosa Machado [Mon, 16 Jul 2018 15:42:22 +0000 (12:42 -0300)]
Add grok/write functions for new ppc core note sections
This patch adds functions for grokking and writing more register core
note sections (NT_PPC_TAR, NT_PPC_PPR, NT_PPC_DSCR, NT_PPC_EBB,
NT_PPC_PMU, NT_PPC_TM_CGPR, NT_PPC_TM_CFPR, NT_PPC_TM_CVMX,
NT_PPC_TM_CVSX, NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR,
NT_PPC_TM_CDSCR).
2018-07-16 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
bfd/
* elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
* elf.c (elfcore_write_ppc_tar): New function.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
(elfcore_write_register_note): Call them.
(elfcore_grok_ppc_tar): New function.
(elfcore_grok_ppc_ppr): Likewise.
(elfcore_grok_ppc_dscr): Likewise.
(elfcore_grok_ppc_ebb): Likewise.
(elfcore_grok_ppc_pmu): Likewise.
(elfcore_grok_ppc_tm_cgpr): Likewise.
(elfcore_grok_ppc_tm_cfpr): Likewise.
(elfcore_grok_ppc_tm_cvmx): Likewise.
(elfcore_grok_ppc_tm_cvsx): Likewise.
(elfcore_grok_ppc_tm_spr): Likewise.
(elfcore_grok_ppc_tm_ctar): Likewise.
(elfcore_grok_ppc_tm_cppr): Likewise.
(elfcore_grok_ppc_tm_cdscr): Likewise.
(elfcore_grok_note): Call them.
Simon Marchi [Mon, 16 Jul 2018 18:30:56 +0000 (14:30 -0400)]
Add missing ChangeLog entry
I forgot (yes, again) the ChangeLog entry in my latest patch.
Simon Marchi [Mon, 16 Jul 2018 18:27:50 +0000 (14:27 -0400)]
Remove unused variables in ia64*tdep.c
gdb/ChangeLog:
* ia64-libunwind-tdep.c (libunwind_frame_cache): Remove unused
variable.
(libunwind_frame_sniffer): Likewise.
(libunwind_frame_prev_register): Likewise.
(libunwind_sigtramp_frame_sniffer): Likewise.
* ia64-tdep.c (ia64_access_reg): Likewise.
(ia64_access_rse_reg): Likewise.
(ia64_libunwind_sigtramp_frame_this_id): Likewise.
* ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Likewise.
Simon Marchi [Mon, 16 Jul 2018 18:15:09 +0000 (14:15 -0400)]
Fix compilation error in ia64-vms-tdep.c with libunwind-ia64
I found this when doing a --enable-targets=all build with libunwind-ia64
properly configured.
CXX ia64-vms-tdep.o
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c: In function ‘int ia64_vms_find_proc_info_x(unw_addr_space_t, unw_word_t, unw_proc_info_t*, int, void*)’:
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:79:33: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
pi->unwind_info, pi->unwind_info_size);
^
In file included from /home/emaisin/src/binutils-gdb/gdb/target.h:70:0,
from /home/emaisin/src/binutils-gdb/gdb/exec.h:23,
from /home/emaisin/src/binutils-gdb/gdb/gdbcore.h:29,
from /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:25:
/home/emaisin/src/binutils-gdb/gdb/target/target.h:35:12: note: initializing argument 2 of ‘int target_read_memory(CORE_ADDR, gdb_byte*, ssize_t)’
extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
^
gdb/ChangeLog:
* ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Add cast.
Simon Marchi [Mon, 16 Jul 2018 18:07:09 +0000 (14:07 -0400)]
remote-sim.c: Remove unused variables
gdb/ChangeLog:
* remote-sim.c (gdbsim_target::close,
gdbsim_target::mourn_inferior): Remove unused variables.
Simon Marchi [Mon, 16 Jul 2018 18:08:26 +0000 (14:08 -0400)]
Add missing ChangeLog entry
I forgot to append the ChangeLog entry to the last commit...
Simon Marchi [Sat, 7 Jul 2018 15:10:49 +0000 (11:10 -0400)]
Fix compilation error in ia64-tdep.c with libunwind-ia64
Commit
9018be22e022 ("Make target_read_alloc & al return vectors")
failed to update the code in ia64-tdep.c, for HAVE_LIBUNWIND_IA64_H.
This patch fixes that.
gdb/ChangeLog:
* ia64-tdep.c (ktab_buf): New global.
(getunwind_table): Return a gdb::optional<gdb::byte_vector>.
(get_kernel_table): Adjust.
Tom Tromey [Mon, 21 May 2018 05:42:01 +0000 (23:42 -0600)]
Use outermost_context_p in more places
This changes a few explicit checks of context_stack_depth to use
outermost_context_p instead. This simplifies some future work.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* xcoffread.c (read_xcoff_symtab): Use outermost_context_p.
* dwarf2read.c (using_directives, new_symbol): Use
outermost_context_p.
* dbxread.c (process_one_symbol): Use outermost_context_p.
* coffread.c (coff_symtab_read): Use outermost_context_p.
Tom Tromey [Mon, 21 May 2018 05:28:39 +0000 (23:28 -0600)]
Move the using directives to buildsym_compunit
This moves the globals local_using_directives and
global_using_directives to be members of buildsym_compunit, and adds
the necessary accessors.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* dwarf2read.c (using_directives, read_func_scope)
(read_lexical_block_scope): Update.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
* buildsym.h (local_using_directives, global_using_directives):
Don't declare.
(get_local_using_directives, set_local_using_directives)
(get_global_using_directives): Declare.
* buildsym.c (struct buildsym_compunit) <m_local_using_directives,
m_global_using_directives>: New members.
(finish_block_internal, prepare_for_building)
(reset_symtab_globals, end_symtab_get_static_block)
(push_context): Update.
(get_local_using_directives, set_local_using_directives)
(get_global_using_directives): New functions.
(buildsym_init): Update.
Tom Tromey [Mon, 21 May 2018 04:45:44 +0000 (22:45 -0600)]
Make free_pending_blocks static
free_pending_blocks can be static because scoped_free_pendings (et al)
arrange for it to be NULL in the "steady state". This removes a
couple of unnecessary calls to free_pending_blocks and changes it to
be static.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Don't call
free_pending_blocks.
* dbxread.c (dbx_symfile_read): Don't call free_pending_blocks.
* buildsym.h (class scoped_free_pendings): Add constructor.
(free_pending_blocks): Don't declare.
* buildsym.c (scoped_free_pendings::scoped_free_pendings): New.
(free_pending_blocks): Now static.
Tom Tromey [Mon, 21 May 2018 02:48:44 +0000 (20:48 -0600)]
Move the subfile stack to buildsym_compunit
This moves the global subfile_stack to be a member of
buildsym_compunit. It also change this to be a std::vector, which
simplifies the code.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* buildsym.h (push_subfile, pop_subfile): Update declarations.
* buildsym.c (struct buildsym_compunit) <m_subfile_stack>: New
member.
(struct subfile_stack): Remove.
(subfile_stack): Remove.
(push_subfile, pop_subfile, buildsym_init): Update.
Tom Tromey [Sun, 20 May 2018 22:15:14 +0000 (16:15 -0600)]
Use gdb_assert in two places in buildsym.c
This changes buildsym.c to use gdb_assert rather than internal_error
in a couple of spots.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* buildsym.c (push_subfile): Use gdb_assert.
(pop_subfile): Use gdb_assert.
Tom Tromey [Sun, 20 May 2018 18:07:44 +0000 (12:07 -0600)]
Remove merge_symbol_lists
I discovered that merge_symbol_lists is unused, so this removes it.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* buildsym.h (merge_symbol_lists): Remove.
* buildsym.c (merge_symbol_lists): Remove.
Tom Tromey [Sun, 20 May 2018 18:06:43 +0000 (12:06 -0600)]
Move scan_file_globals declaration to stabsread.h
scan_file_globals is defined in stabsread.c, so move its declaration
to stabsread.h.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* stabsread.c (scan_file_globals): Update comment.
* stabsread.h (scan_file_globals): Move from buildsym.h.
* buildsym.h (scan_file_globals): Move to stabsread.h.
Tom Tromey [Sun, 20 May 2018 17:25:20 +0000 (11:25 -0600)]
Remove buildsym_new_init
buildsym_new_init is just an alias for buildsym_init. This removes
it. In the long run buildsym_init will also go away; this patch just
helps make things a bit clearer in the meantime.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_new_init): Update.
* mipsread.c (mipscoff_new_init): Update.
* mdebugread.c (mdebug_build_psymtabs): Update.
* elfread.c (elf_new_init): Update.
* dbxread.c (dbx_new_init, coffstab_build_psymtabs)
(elfstab_build_psymtabs, stabsect_build_psymtabs): Update.
* buildsym.h (buildsym_new_init): Don't declare.
* buildsym.c (buildsym_new_init): Remove.
Tom Tromey [Sun, 20 May 2018 17:19:14 +0000 (11:19 -0600)]
Move within_function to stabsread
The global within_function is only used by a few symbol readers. This
patch moves the global out of buildsym and into stabsread, which
seemed like a better fit. It also arranges for the existing readers
to clear the global at the appropriate time.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* stabsread.h (within_function): Move from buildsym.h.
* stabsread.c (start_stabs): Clear within_function.
* coffread.c (coff_start_symtab): Clear within_function.
* buildsym.h (within_function): Move to stabsread.h.
* buildsym.c (prepare_for_building): Update.
Tom Tromey [Sun, 20 May 2018 17:16:57 +0000 (11:16 -0600)]
Move processing_gcc to stabsread
processing_gcc is also only used by stabsread -- it is set by the
DWARF reader, but this turns out not to be needed. So, this patch
moves processing_gcc and removes the assignment from the DWARF reader.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* stabsread.h (processing_gcc_compilation): Move from buildsym.h.
* dwarf2read.c (dwarf2_start_symtab): Don't set
processing_gcc_compilation.
* buildsym.h (processing_gcc_compilation): Move to stabsread.h.