Tom Tromey [Thu, 3 May 2018 22:36:21 +0000 (16:36 -0600)]
Make psymbols and psymtabs independent of the program space
This patch finally makes partial symbols and partial symtabs
independent of the program space.
Specifically:
It changes add_psymbol_to_list to accept a section index, and changes
the psymbol readers to pass this. At the same time it removes the
code to add the objfile's section offset to the psymbol.
It adds an objfile argument to the psymtab textlow and texthigh
accessors and changes some code to use the raw variants instead.
It removes the "relocate" method from struct quick_symbol_functions,
as it is no longer needed any more.
It changes partial_symbol::address so that the relevant offset is now
applied at the point of use.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c (add_address_entry): Don't add objfile
offsets.
* dbxread.c (find_stab_function): Rename from
find_stab_function_addr. Return a bound_minimal_symbol.
(read_dbx_symtab): Use raw_text_low, raw_text_high.
Don't add objfile offsets.
(end_psymtab): Use raw_text_low, raw_text_high,
MSYMBOL_VALUE_RAW_ADDRESS.
(read_ofile_symtab): Update.
(process_one_symbol): Update.
* dwarf2read.c (create_addrmap_from_index): Don't add objfile
offsets.
(dw2_relocate): Remove.
(dw2_find_pc_sect_symtab): Bias PC by the text offset before
searching addrmap.
(dwarf2_gdb_index_functions, dwarf2_debug_names_functions):
Update.
(process_psymtab_comp_unit_reader, add_partial_symbol)
(add_partial_subprogram, dwarf2_ranges_read): Update.
(load_partial_dies): Update.
(add_address_entry): Don't add objfile offsets.
(dwarf2_build_include_psymtabs): Update.
(create_addrmap_from_aranges): Don't add objfile offsets.
(dw2_find_pc_sect_compunit_symtab): Update.
* mdebugread.c (parse_symbol): Don't add objfile offsets.
(parse_lines): Remove 'pst' parameter, replace with 'textlow'.
Update.
(parse_partial_symbols): Don't add objfile offsets. Use
raw_text_low, raw_text_high. Update.
(handle_psymbol_enumerators, psymtab_to_symtab_1): Update.
* objfiles.c (objfile_relocate1): Don't relocate psymtabs_addrmap
or call 'relocate' quick function. Clear psymbol_map.
* psympriv.h (struct partial_symbol) <address>: Add section
offset.
<set_unrelocated_address>: Rename from set_address.
<raw_text_low, raw_text_high>: New methods.
<text_low, text_high>: Add objfile parameter.
(add_psymbol_to_bcache): Add 'section' parameter. Call
set_unrelocated_address.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_psymbol): Update.
(fixup_psymbol_section, relocate_psymtabs): Remove.
(dump_psymtab, psym_functions): Update.
(add_psymbol_to_bcache, add_psymbol_to_list): Add 'section'
parameter.
(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
(start_psymtab_common): Update.
* symfile-debug.c (debug_qf_relocate): Remove.
(debug_sym_quick_functions): Update.
* symfile.h (struct quick_symbol_functions) <relocate>: Remove.
* xcoffread.c (scan_xcoff_symtab): Don't add objfile offsets.
Update.
Tom Tromey [Thu, 3 May 2018 22:36:20 +0000 (16:36 -0600)]
Add validity bits for psymtab high and low fields
Right now some psymtab code checks whether a psymtab's textlow or
texthigh fields are valid by comparing against 0.
I imagine this is mildly wrong in the current environment, but once
psymtabs are relocated dynamically, it will no longer be correct,
because it will be much more normal to see a psymtab with a textlow of
zero -- this will just mean it appears at the start of the text
section.
This patch introduces validity bits to handle this situation more
nicely, and changes users of the code to follow.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* dbxread.c (end_psymtab): Use text_high_valid and
text_low_valid.
* mdebugread.c (parse_partial_symbols): Use text_low_valid.
(psymtab_to_symtab_1): Use text_high_valid and text_low_valid.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Update comment.
<text_low_valid, text_high_valid>: New fields.
<set_text_low, set_text_high>: Update.
* xcoffread.c (scan_xcoff_symtab): Use text_low_valid.
Tom Tromey [Thu, 3 May 2018 22:36:19 +0000 (16:36 -0600)]
Introduce accessors for psymtab high and low fields
This introduces accessors for the partial symbol table textlow and
texthigh fields. This lets us later arrange to relocate these values
at their point of use.
I did this conversion by renaming the fields. I didn't rename the
fields back afterward, thinking that on the off chance that someone
has a patch touching this area, then a merge would helpfully break
their compile.
I looked at making the fields private, but this interferes with the
memset in allocate_psymtab, and I didn't want to chase this down.
This conversion can be done later if need be.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dbxread.c (read_dbx_symtab, end_psymtab, read_ofile_symtab):
Update.
* dwarf2read.c (dwarf2_create_include_psymtab): Don't initialize
textlow and texthigh fields.
(process_psymtab_comp_unit_reader, dwarf2_build_include_psymtabs):
Update.
* mdebugread.c (parse_lines, parse_partial_symbols)
(psymtab_to_symtab_1): Update.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Rename fields. Update comment. Now private.
<text_low, text_high, set_text_low, set_text_high>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, relocate_psymtabs, dump_psymtab)
(start_psymtab_common, maintenance_info_psymtabs)
(maintenance_check_psymtabs): Update.
* xcoffread.c (xcoff_end_psymtab): Don't initialize textlow and
texthigh fields.
(scan_xcoff_symtab): Update.
Tom Tromey [Thu, 3 May 2018 22:36:18 +0000 (16:36 -0600)]
Introduce partial_symbol::address
This introduces a partial_symbol::address method. This method takes
an objfile argument. This is necessary so that we can later relocate
a partial symbol at its point of use. It also adds an accessor to
compute the unrelocated value; and a method to be used for setting the
field.
Note that the new method doesn't actually perform any relocation yet.
That will come in a subsequent patch. However, the comments are
written to reflect the intended, rather than the temporary, semantics.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* psympriv.h (struct partial_symbol) <unrelocated_address,
address, set_address>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymbol)
(fixup_psymbol_section, relocate_psymtabs): Update.
(print_partial_symbols): Add 'objfile' parameter. Update.
(dump_psymtab, add_psymbol_to_bcache, psym_fill_psymbol_map):
Update.
Tom Tromey [Thu, 3 May 2018 22:36:17 +0000 (16:36 -0600)]
Change representation of psymbol to flush out accessors
This is the psymbol analog to the patch to change the representation
of minimal symbols:
https://sourceware.org/ml/gdb-patches/2013-10/msg00524.html
It has the same rationale: namely, that we're going to change the code
to apply psymbol offsets at runtime. This will be done by adding an
argument to the SYMBOL_VALUE_ADDRESS macro -- but since we can't
convert all the symbol types at once, we need a new approach.
Because gdb now is in C++, this patch changes partial_symbol to
inherit from general_symbol_info, rather than renaming the field.
This simplifies code in some places.
Also, as noted before, these macros implement a kind of "phony
polymorphism" that is not actually useful in practice; so this patch
removes the macros in favor of simply referring directly to members.
In a few cases -- obj_section in this patch and the symbol address in
the future -- methods will be used instead.
Note that this removes the blanket memset from add_psymbol_to_bcache.
This hasn't really been needed since bcache was modified to allow
holes in objects and since psymtab took advantage of that. This
deletion was required due to changing partial_symbol to derive from
general_symbol_info.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c (write_psymbols, debug_names::insert)
(debug_names::write_psymbols): Update.
* psympriv.h (struct partial_symbol): Derive from
general_symbol_info.
<obj_section>: New method.
(PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.n
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, fixup_psymbol_section)
(match_partial_symbol, lookup_partial_symbol, relocate_psymtabs)
(print_partial_symbols, recursively_search_psymtabs)
(compare_psymbols, psymbol_hash, psymbol_compare)
(add_psymbol_to_bcache, maintenance_check_psymtabs)
(psymbol_name_matches, psym_fill_psymbol_map): Update.
Tom Tromey [Thu, 3 May 2018 22:36:16 +0000 (16:36 -0600)]
Remove dead code in end_psymtab
I noticed that there is a bit of dead code in end_psymtab.
This deletes it.
Normally I would investigate a fix for the code. However, considering
that the code has been this way a long time (since the first import to
sourceware) and considering that dbxread.c is not as important any
more, I think it's safe to just consider that there's no bug.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* dbxread.c (end_psymtab): Remove dead code.
Tom de Vries [Thu, 26 Jul 2018 08:16:06 +0000 (10:16 +0200)]
[gdb/testsuite] Add comment in gdb.base/vla-optimized-out.c
2018-07-26 Tom de Vries <tdevries@suse.de>
* gdb.base/vla-optimized-out.c: Add comment about origin of test-case.
Alex Chadwick [Mon, 23 Jul 2018 23:51:44 +0000 (09:21 +0930)]
PowerPC Improve support for Gekko & Broadway
This is a relatively straightforward patch to improve support for the
IBM Gekko and IBM Broadway processors. Broadway is functionally
equivalent to the IBM 750CL, while Gekko's functionality is a subset
of theirs. The patch simplifies this reality and adds -mgekko and
-mbroadway as aliases for -m750cl. I didn't feel it was worth wasting
a PPC_OPCODE_* bit to differentiate Gekko. The patch adds a number of
simplified mnemonics for special purpose register access. Notably,
Broadway adds 4 additional IBAT and DBAT registers but these are not
assigned sequential SPR numbers.
gas/
* config/tc-ppc.c (md_show_usage): Add -mgekko and -mbroadway.
* doc/as.texi (Target PowerPC options): Add -mgekko and -mbroadway.
* doc/c-ppc.texi (PowerPC-Opts): Likewise.
* testsuite/gas/ppc/broadway.d,
* testsuite/gas/ppc/broadway.s: New test for broadway.
* testsuite/gas/ppc/ppc.exp: Run new test.
include/
* opcode/ppc.h (PPC_OPCODE_750): Adjust comment.
opcodes/
* ppc-dis.c (ppc_opts): Add -mgekko and -mbroadway.
(powerpc_init_dialect): Handle bfd_mach_ppc_750.
* ppc-opc.c (insert_sprbat, extract_sprbat): New functions to
support disjointed BAT.
(powerpc_operands): Allow extra bit in SPRBAT_MASK. Add SPRGQR.
(XSPRGQR_MASK, GEKKO, BROADWAY): Define.
(powerpc_opcodes): Add 750cl extended mnemonics for spr access.
Alan Modra [Thu, 26 Jul 2018 07:42:07 +0000 (17:12 +0930)]
Re: Enhance powerpc ld -r --relax
git commit
491993044ba6 broke the powerpc vxworks testsuite.
* testsuite/ld-powerpc/vxworks-relax-2.rd: Update for 2018-07-25
ppc_elf_relax_section changes.
Andrew Burgess [Fri, 13 Jul 2018 11:01:16 +0000 (12:01 +0100)]
gdb: Add switch to disable DWARF stack unwinders
Add a maintenance command to disable the DWARF stack unwinders.
Normal users would not need this feature, but it is useful to allow
extended testing of fallback stack unwinding strategies, for example,
prologue scanners.
This is a partial implementation of the idea discussed in pr gdb/8434,
which talks about a generic ability to disable any frame unwinder.
Being able to arbitrarily disable any frame unwinder would be a more
complex patch, and I was unsure how useful such a feature would really
be, however, I can see (and have) a real need to disable DWARF
unwinders. That's why this patch only targets that specific set of
unwinders.
If in the future we find ourselves adding more switches to disable
different unwinders, then we should probably move to a more generic
solution, and remove this patch.
gdb/ChangeLog:
* dwarf2-frame-tailcall.c (tailcall_frame_sniffer): Exit early if
DWARF unwinders are disabled.
* dwarf2-frame.c: Add dwarf2read.h include.
(dwarf2_frame_sniffer): Exit early if DWARF unwinders are
disabled.
(dwarf2_frame_unwinders_enabled_p): Define.
(show_dwarf_unwinders_enabled_p): New function.
(_initialize_dwarf2_frame): Register switch to control DWARF
unwinder use.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Declare.
* dwarf2read.c (set_dwarf_cmdlist): Remove static keyword.
(show_dwarf_cmdlist): Remove static keyword.
* dwarf2read.h (set_dwarf_cmdlist): Declare.
(show_dwarf_cmdlist): Declare.
* NEWS: Document new feature.
gdb/doc/ChangeLog:
* gdb.texinfo (Maintenance Commands): Add description of
maintenance command to control dwarf unwinders.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Add check that dwarf unwinders control flag
is visible.
Alan Modra [Thu, 26 Jul 2018 02:41:11 +0000 (12:11 +0930)]
Implement PowerPC64 .localentry for value 1
This adds support for ".localentry 1", a new st_other
STO_PPC64_LOCAL_MASK encoding that signifies a function with a single
entry point like ".localentry 0", but unlike a ".localentry 0"
function does not preserve r2.
include/
* elf/ppc64.h: Specify byte offset to local entry for values
of two to six in STO_PPC64_LOCAL_MASK. Clarify r2 return
value for such functions when entering via global entry point.
Specify meaning of a value of one in STO_PPC64_LOCAL_MASK.
bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Use a ppc_stub_long_branch_r2off
for calls to symbols with STO_PPC64_LOCAL_MASK bits set to 1.
gas/
* config/tc-ppc.c (ppc_elf_localentry): Allow .localentry values
of 1 and 7 to directly set value into STO_PPC64_LOCAL_MASK bits.
ld/testsuite/
* ld-powerpc/elfv2.s: Add .localentry f5,1 testcase.
* ld-powerpc/elfv2exe.d: Update.
* ld-powerpc/elfv2so.d: Update.
GDB Administrator [Thu, 26 Jul 2018 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Tue, 3 Jul 2018 15:08:42 +0000 (17:08 +0200)]
[gdb/breakpoints] Fix sigsegv in info prog at exec catchpoint
With the test-case contained in this patch and compiled for debug we run into
a segfault with trunk gdb:
...
$ gdb catch-follow-exec -batch -ex "catch exec" \
-ex "set follow-exec-mode new" -ex "run" -ex "info prog"
Catchpoint 1 (exec)
process xxx is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process xxx]
Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), in _start () from
/lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...
The patch fixes the segfault by returning an error in info_program_command
if get_last_target_status returns minus_one_ptid.
The test-case is non-standard, because the standard approach runs into
PR23368, a problem with gdb going to the background.
Build and reg-tested on x86_64-linux.
2018-07-26 Tom de Vries <tdevries@suse.de>
PR breakpoints/23366
* infcmd.c (info_program_command): Handle ptid == minus_one_ptid.
* gdb.base/catch-follow-exec.c: New test.
* gdb.base/catch-follow-exec.exp: New file.
H.J. Lu [Wed, 25 Jul 2018 22:28:07 +0000 (15:28 -0700)]
x86: Expand Broadcast to 3 bits
Expand Broadcast to 3 bits so that the number of bytes to broadcast
can be computed as 1 << (Broadcast - 1). Use it to simplify x86
assembler.
gas/
* config/tc-i386.c (Broadcast_Operation): Add bytes.
(build_evex_prefix): Use i.broadcast->bytes.
(match_broadcast_size): New function.
(check_VecOperands): Use the broadcast field to compute the
number of bytes to broadcast directly. Set i.broadcast->bytes.
Use match_broadcast_size.
opcodes/
* i386-gen.c (adjust_broadcast_modifier): New function.
(process_i386_opcode_modifier): Add an argument for operands.
Adjust the Broadcast value based on operands.
(output_i386_opcode): Pass operand_types to
process_i386_opcode_modifier.
(process_i386_opcodes): Pass NULL as operands to
process_i386_opcode_modifier.
* i386-opc.h (BYTE_BROADCAST): New.
(WORD_BROADCAST): Likewise.
(DWORD_BROADCAST): Likewise.
(QWORD_BROADCAST): Likewise.
(i386_opcode_modifier): Expand broadcast to 3 bits.
* i386-tbl.h: Regenerated.
Tom de Vries [Wed, 18 Jul 2018 16:33:07 +0000 (18:33 +0200)]
[gdb/symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count
This patch generates a warning if DW_AT_upper_bound or DW_AT_count is defined,
but can't be translated. This is triggered for current gcc in lto mode for
vla test-cases.
Build and reg-tested on x86_64-linux.
2018-07-26 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (read_subrange_type): Warn if DW_AT_upper_bound or
DW_AT_count can't be translated to a dynamic prop.
Tom de Vries [Fri, 20 Jul 2018 14:41:00 +0000 (16:41 +0200)]
[gdb/exp] Fix exception when printing optimized out vla
When compiling vla-optimized-out.c with -O3 and a recent gcc, and trying to
print the vla a in f1, we run into this gdb exception:
...
Cannot find matching parameter at DW_TAG_call_site 0x4003be at main
...
This is a regression introduced by
42dc7699a2 "[gdb/exp] Fix printing of type
of optimized out vla".
This patch fixes the regression by wrapping the ctx.eval call in
dwarf2_locexpr_baton_eval in try/catch, similar to what is done in
dwarf2_evaluate_loc_desc_full.
Build and reg-tested on x86_64-linux.
2018-07-25 Tom de Vries <tdevries@suse.de>
* dwarf2loc.c (dwarf2_locexpr_baton_eval): Wrap ctx.eval call in
try/catch.
* gdb.base/vla-optimized-out-o3.exp: New file. Reuse
vla-optimized-out.c.
Jan Vrany [Thu, 31 May 2018 08:56:33 +0000 (09:56 +0100)]
Notify about breakpoint modification when enabling/disabling single location
When a single breakpoint location enableness was modified by a CLI
command, observers were not notified about it. This issue is now fixed.
gdb/ChangeLog:
* breakpoint.c (enable_disable_bp_num_loc): Notify observers.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-breakpoint-location-ena-dis.cc: New file.
* gdb.mi/mi-breakpoint-location-ena-dis.exp: New file.
Joel Brobecker [Wed, 25 Jul 2018 14:57:27 +0000 (10:57 -0400)]
list Tom Tromey as GDB Global Maintainer
gdb/ChangeLog:
* MAINTAINERS (Global Maintainers): Add Tom Tromey.
Thomas Preud'homme [Wed, 25 Jul 2018 08:51:51 +0000 (09:51 +0100)]
Clarify doc for .arch/.cpu
Documentation for .arch and .cpu directives currently says that it
accepts the same name as -march/-mcpu command-line options respectively.
However it only accept the architecture/CPU part of those options: it
does not accept specifying an extension which is done via
.arch_extension. This patch clarifies that the extension is not
accepted.
2018-07-25 Thomas Preud'homme <thomas.preudhomme@linaro.org>
gas/
* doc/c-arm.texi (.arch directive): Clarify that name must not include
an extension.
(.cpu directive): Likewise.
Nick Clifton [Wed, 25 Jul 2018 09:56:45 +0000 (10:56 +0100)]
Fix potential memory leaks in some of the binutils source files.
* rdcoff.c (parse_coff_struct_type): Free fields array upon early
exit.
(parse_coff_enum_type): Free names and vals arrays upon early
exit.
* rddbg.c (read_section_stabs_debugging_info): Free shandle and
strings and stabs arrays upon early exit.
* readelf.c (get_32bit_section_headers): Free shdrs structure upon
early exit.
(get_64bit_section_headers): Likewise.
(get_32bit_elf_symbols): Generate an error if multiple symbol
table index sections are associated with the same symbol section.
(get_64bit_elf_symbols): Likewise.
(process_dynamic_section): Generate an error if there are multiple
dynamic symbol table sections, multiple dynamic string tables or
multiple dynamic symbol information sections.
Alan Modra [Wed, 25 Jul 2018 05:54:55 +0000 (15:24 +0930)]
Enhance powerpc ld -r --relax
One of the ill effects of ld -r is to mash together sections. That
can result in reduced icache performance at runtime due to unexpected
movement of code. Another problem is that sections can become too
large to link on targets that have limited relative addressing. ld -r
--relax attempts to overcome the large section problem for branches by
inserting trampolines, but the powerpc support added lots of
unnecessary trampolines. This patch trims them somewhat.
bfd/
* elf32-ppc.c (ppc_elf_relax_section): Ignore common or undef locals.
Avoid trashing toff with added when used as a symbol index.
Ignore R_PPC_PLTREL24 addends in unused example code. Avoid
creating unnecessary fixups when relocatable.
ld/
* testsuite/ld-powerpc/big.s: New file.
* testsuite/ld-powerpc/relaxrl.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run new test.
* testsuite/ld-powerpc/relaxr.d: Adjust.
Alan Modra [Wed, 25 Jul 2018 02:10:48 +0000 (11:40 +0930)]
Suppress string diagnostics for pre-release GCC
Extends commit
898ade12ee8 to cover other targets.
* elf32-arm.c (elf32_arm_nabi_write_core_note): Disable
-Wstringop-truncation warning for gcc-8.0 too.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Comment fix.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
GDB Administrator [Wed, 25 Jul 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Tue, 24 Jul 2018 19:48:58 +0000 (12:48 -0700)]
Set CU language before processing any DIEs (symtab/23010 et al)
This patch is another attempt at really fixing the multitude of assertions
being seen where symbols of one language are being added to symbol lists of
another language.
In this specific case, the backtrace command (thread apply all bt full) that
is looking for the compunit containing the PC of the thread. That calls
get_prev_frame several times. This function calls (eventually)
dwarf2_frame_prev_register. That eventually ends up calling
find_pc_compunit_symtab.
In this function (find_pc_sect_compunit_symtab actually), we loop over all
compunits, calling the "quick" function dw2_find_pc_sect_compunit_symtab.
That function calls dw2_instantiate_symtab to read in all the CU's symbols.
Now the fun begins.
dw2_do_instantiate_symtab queues the per_cu for reading, using a default
"pretend" language of language_minimal with the expectation that this will
be set later.
The DIEs of this (only queued) CU are then processed.
The first DIE is DW_TAG_compile_unit. That's handled by read_file_scope.
(Nearly) The first thing read_file_scope does is:
get_scope_pc_bounds (die, &lowpc, &highpc, cu);
This function loops over the children of the current DIE (a compile_unit),
looking for bounds. The first such child is a subprogram, and we attempt to
get its bounds. We use dwarf2_attr to get at DW_AT_high_pc.
This subprogram has DW_AT_specification set, so dwarf_attr (via
follow_die_ref/follow_die_offset) will follow that, but follow_die_offset
*also* attempts to load the containing CU for the spec DIE. That spec DIE
lives inside a CU that is a partial_unit and has no language attribute. So
it simply inherits the language from the CU that elicited the read. [That
all happens in follow_die_offset.]
The original CU's language is still language_minimal -- we haven't gotten to
the line in read_file_scope that actually sets the language yet!
And that is the cause of these problems. The call to prepare_one_comp_unit
needs to be the *first* thing that is done when reading a CU so that the
CU's language can be recorded (and inherited by any referenced
partial_units).
Since a test reproducer for this has been so elusive, this patch also adds a
wrapper function around add_symbol_to_list which asserts when adding a
symbol of one language to a list containing symbols of a different language.
gdb/ChangeLog:
2017-07-24 Keith Seitz <keiths@redhat.com>
PR symtab/23010
* dwarf2read.c (dw2_add_symbol_to_list): New function.
(fixup_go_packaging, new_symbol): Use dw2_add_symbol_to_list
instead of add_symbol_to_list.
(read_file_scope): Call prepare_one_comp_unit before reading
any other DIEs.
Simon Marchi [Tue, 24 Jul 2018 18:14:17 +0000 (14:14 -0400)]
Fix indentation in scoped_mmap.h
gdb/ChangeLog:
* common/scoped_mmap.h (class scoped_mmap): Fix indentation.
Tom Tromey [Sun, 22 Jul 2018 15:34:42 +0000 (09:34 -0600)]
Remove some unnecessary declarations and configury
configure checks for declarations of free, malloc, and realloc; but
the results are only used in a single spot: utils.c. I think these
checks are long since obsolete, so this patch removes them.
Grepping the entire tree for these HAVE_DECL_ symbols, the only uses
of possible interest to gdb come from bfd/sysdep.h; but this is not
(nor should be) included by gdb. (And furthermore I think the code
there is probably also obsolete.)
gdb/ChangeLog
2018-07-24 Tom Tromey <tom@tromey.com>
* utils.c (malloc, realloc, free): Don't declare.
* configure, config.in: Rebuild.
* configure.ac: Don't check for declarations of free, malloc, or
realloc.
H.J. Lu [Tue, 24 Jul 2018 16:47:47 +0000 (09:47 -0700)]
x86: Use unsigned int to iterate through vector operands
Use unsigned int to iterate through multi-length vector operands to avoid
sign-extension.
* config/tc-i386.c (build_vex_prefix): Use unsigned int to
iterate through multi-length vector operands.
(build_evex_prefix): Likewise.
Nick Clifton [Tue, 24 Jul 2018 13:07:54 +0000 (14:07 +0100)]
Updated French translation for ld/ and Swedish translation for binutils/
bin * po/sv.po: Updated Swedish translation.
ld * po/fr.po: Updated French translation.
Alan Modra [Mon, 23 Jul 2018 23:41:35 +0000 (09:11 +0930)]
PR23431, Messages composed from pieces can't be properly translated
PR 23431
* dwarf.c (display_formatted_table): Replace "what" parameter
with "is_dir". Expand messages. Fix capitalisation.
* testsuite/binutils-all/dw5.W: Update expected output.
Alan Modra [Tue, 24 Jul 2018 07:05:52 +0000 (16:35 +0930)]
PR23430, Indices misspelled
PR 23430
include/
* elf/common.h (SHT_SYMTAB_SHNDX): Fix comment typo.
bfd/
* dwarf2.c (dwarf_debug_section_enum): Fix comment typo.
* elf.c (bfd_section_from_shdr, elf_sort_sections): Likewise.
binutils/
* elfcomm.h (struct archive_info): Rename uses_64bit_indicies
to uses_64bit_indices.
* elfcomm.c (setup_archive): Update uses of above.
* readelf.c (process_archive): Likewise.
(get_section_type_name): Rename indicies to indices.
(get_32bit_elf_symbols, get_64bit_elf_symbols): Likewise.
(process_section_groups): Likewise.
cpu/
* or1kcommon.cpu (spr-reg-indices): Fix description typo.
opcodes/
* or1k-desc.h: Regenerate.
Jan Beulich [Tue, 24 Jul 2018 07:46:27 +0000 (09:46 +0200)]
x86-64: correct AVX512F vcvtsi2s{d,s} handling
Just like for their AVX counterparts and CVTSI2S{D,S}, a memory source
here is ambiguous and hence
- in source files should be qualified with a suitable suffix or operand
size specifier (not doing so is an error in Intel mode, and will gain
a diagnostic in AT&T mode in the future),
- in disassembly should be properly suffixed (the Intel operand size
specifiers were emitted correctly already).
GDB Administrator [Tue, 24 Jul 2018 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Mon, 23 Jul 2018 04:45:48 +0000 (21:45 -0700)]
xtensa: ld: convert tests to run_dump_test
Three tests with individual .exp files can be implemented in less
verbose way with run_dump_test infrastructure. Convert them.
ld/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/ld-xtensa/coalesce.d: New file.
* testsuite/ld-xtensa/coalesce.exp: Remove file.
* testsuite/ld-xtensa/diff_overflow.d: New file.
* testsuite/ld-xtensa/diff_overflow.exp: Remove file.
* testsuite/ld-xtensa/lcall.d: New file.
* testsuite/ld-xtensa/lcall.exp: Remove file.
* testsuite/ld-xtensa/xtensa.exp (coalesce, diff_overflow)
(lcall): New tests.
Max Filippov [Fri, 20 Jul 2018 04:00:29 +0000 (21:00 -0700)]
xtensa: ld: add tests for static linkage relaxation
ld/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/ld-xtensa/relax-static-defs.s: New file.
* testsuite/ld-xtensa/relax-static-local-pie.d: New file.
* testsuite/ld-xtensa/relax-static-local-shared.d: New file.
* testsuite/ld-xtensa/relax-static-local.s: New file.
* testsuite/ld-xtensa/relax-static-pie.d: New file.
* testsuite/ld-xtensa/relax-static-shared.d: New file.
* testsuite/ld-xtensa/relax-static.s: New file.
* testsuite/ld-xtensa/relax-undef-weak-local-pie.d: New file.
* testsuite/ld-xtensa/relax-undef-weak-local-shared.d: New file.
* testsuite/ld-xtensa/relax-undef-weak-local.s: New file.
* testsuite/ld-xtensa/relax-undef-weak-pie.d: New file.
* testsuite/ld-xtensa/relax-undef-weak-shared.d: New file.
* testsuite/ld-xtensa/relax-undef-weak.s: New file.
* testsuite/ld-xtensa/xtensa.exp: New file.
Max Filippov [Sun, 22 Jul 2018 01:32:32 +0000 (18:32 -0700)]
xtensa: ld: rename xtensa.exp to xtensa-linux.exp
xtensa.exp in fact only checks xtensa*-*-linux* configurations, rename
it to xtensa-linux.exp to allow xtensa.exp to check xtensa*-*-*.
ld/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/ld-xtensa/xtensa.exp: Rename to xtensa-linux.exp.
Max Filippov [Mon, 23 Jul 2018 01:59:11 +0000 (18:59 -0700)]
xtensa: move dynamic relocations sections consistency check
The function elf_xtensa_finish_dynamic_sections checks that sizes of
sections .rela.dyn and .rela.plt match number of corresponding relocation
records, but the check is only done when .rela.plt is non-empty, so, e.g.
it is never run for the static PIE.
Rearrange the test so that .rela.dyn and .rela.plt are checked always.
bfd/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move
relocation sections consistency check to always check both
.rela.dyn and .rela.plt when they exist. Rearrange variable
definition and assignment places.
Max Filippov [Sun, 22 Jul 2018 20:52:28 +0000 (13:52 -0700)]
xtensa: fix relaxation of undefined weak references in shared objects
The change
c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak
undefined symbol") didn't properly handle shrinking of relocation
sections due to coalescing of references to a dynamic undefined weak
symbol in a shared object, which resulted in the following assertion
failure in ld when linking uClibc-ng libthread_db for xtensa:
BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269
in elf_xtensa_finish_dynamic_sections
Shrink dynamic relocations section for dynamic undefined weak symbols
when linking a shared object.
bfd/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
relocations section for dynamic undefined weak symbols when
linking a shared object.
Tom Tromey [Mon, 16 Jul 2018 00:07:40 +0000 (18:07 -0600)]
Avoid ubsan complaint in BFD
I built gdb with ubsan and ran the test suite.
One complaint was due to bfd_get_elf_phdrs passing NULL to memcpy.
This patch avoids the complaint.
bfd/ChangeLog
2018-07-23 Tom Tromey <tom@tromey.com>
* elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
H.J. Lu [Mon, 23 Jul 2018 13:32:20 +0000 (06:32 -0700)]
x86: Add a test for missing broadcast
For
.intel_syntax noprefix
vcvtps2qq xmm0, DWORD PTR [rax]
we should get
Error: broadcast is needed for operand of such type for `vcvtps2qq'
* testsuite/gas/i386/inval-avx512f.s: Add a test for missing
broadcast.
* testsuite/gas/i386/x86-64-inval-avx512f.s: Likewise.
* testsuite/gas/i386/inval-avx512f.l: Updated.
* testsuite/gas/i386/x86-64-inval-avx512f.l: Likewise.
H.J. Lu [Mon, 23 Jul 2018 12:43:43 +0000 (05:43 -0700)]
x86: Remove broadcast_not_on_src_operand
Remove broadcast_not_on_src_operand since it is unused.
* config/tc-i386.c (i386_error): Remove
broadcast_not_on_src_operand.
(match_template): Likewse.
Claudiu Zissulescu [Mon, 23 Jul 2018 09:09:43 +0000 (11:09 +0200)]
[ARC] Fix decoding of w6 signed short immediate.
gas/
Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gas/arc/st.d: Fix test.
opcodes/
Claudiu Zissulescu <claziss@synopsys.com>
* arc-opc.c (extract_w6): Fix extending the sign.
Claudiu Zissulescu [Mon, 23 Jul 2018 09:09:43 +0000 (11:09 +0200)]
[ARC] Allow vewt instruction for ARC EM family.
opcode/
Claudiu Zissulescu <claziss@synopsys.com>
* arc-tbl.h (vewt): Allow it for ARC EM family.
claziss [Mon, 23 Jul 2018 09:09:43 +0000 (11:09 +0200)]
[ARC] Fix case-sensitivity for extension instructions.
In ARC assembler, we accept case insensitive mnemonics, but this was
not the case for extension instruction, fix it and add a test.
gas/
Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (tokenize_extinsn): Convert to lower case the
name of extension instructions.
* testsuite/gas/arc/textinsn_case.d: New file.
* testsuite/gas/arc/textinsn_case.s: Likewise.
Andreas Krebbel [Mon, 23 Jul 2018 08:29:37 +0000 (10:29 +0200)]
S/390: Suppress string diagnostics for pre-release GCC
Building for S/390 currently fails when using a GCC 8.1 pre-release
version like 8.0.1 (as it is used by F28). Fixed with the attached patch.
bfd/ChangeLog:
2018-07-23 Andreas Krebbel <krebbel@linux.ibm.com>
* elf32-s390.c (elf_s390_write_core_note): Make GCC version 8.0 to
be covered by the check as well.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
Alan Modra [Mon, 23 Jul 2018 03:01:18 +0000 (12:31 +0930)]
PowerPC64 fails reloc-discard test
PowerPC64 fails here due to emitting a warning about discarded dynamic
relocations. That's a good thing, since accidentally discarding
dynamic relocations will likely result in a non-working binary.
* testsuite/ld-elf/reloc-discard-warn.d: New.
* testsuite/ld-elf/reloc-discard.d: Skip test on PowerPC64.
Alan Modra [Mon, 23 Jul 2018 03:29:23 +0000 (12:59 +0930)]
power9 mfupmc/mtupmc
PR 23419
* ppc-opc.c (powerpc_opcodes): Add mtupmc/mfupmc/mfpmc extended
opcode variants for mtspr/mfspr encodings.
Simon Marchi [Mon, 23 Jul 2018 03:23:11 +0000 (23:23 -0400)]
Remove some unused variables
Found using the newly-enabled -Wunused-variable.
gdb/ChangeLog:
* aarch64-linux-nat.c
(aarch64_linux_nat_target::stopped_data_address): Remove unused
variable.
* arm-linux-nat.c (fetch_regs): Likewise.
(store_regs): Likewise.
(fetch_vfp_regs): Likewise.
(store_vfp_regs): Likewise.
(arm_linux_nat_target::insert_hw_breakpoint): Likewise.
(arm_linux_nat_target::remove_hw_breakpoint): Likewise.
(arm_linux_nat_target::insert_watchpoint): Likewise.
(arm_linux_nat_target::remove_watchpoint): Likewise.
* mips-linux-nat.c (mips_linux_nat_target::insert_watchpoint):
Likewise.
* nat/aarch64-sve-linux-ptrace.c (aarch64_sve_get_sveregs):
Likewise.
* ppc-linux-nat.c (fetch_register): Likewise.
(fetch_all_gp_regs): Likewise.
(fetch_ppc_registers): Likewise.
(store_all_gp_regs): Likewise.
(store_ppc_registers): Likewise.
(hwdebug_insert_point): Likewise.
(can_use_watchpoint_cond_accel): Likewise.
* remote-sim.c (gdb_os_write_stdout): Likewise.
gdb/gdbserver/ChangeLog:
* linux-mips-low.c (mips_collect_ptrace_register): Remove unused
variable.
(mips_supply_ptrace_register): Likewise.
GDB Administrator [Mon, 23 Jul 2018 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 9 Jul 2018 03:05:41 +0000 (21:05 -0600)]
Add -Wunused-variable to warnings.m4
This adds -Wunused-variable to the build. This required a special
check in configure in order to work around a bug in GCC 4.9. Simon
ound the correct test to use, so I've added him to the ChangeLog.
gdb/ChangeLog
2018-07-22 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* warning.m4 (AM_GDB_WARNINGS): Add -Wunused-variable and special
test for it.
* configure: Rebuild.
gdb/gdbserver/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
Tom Tromey [Mon, 9 Jul 2018 02:31:58 +0000 (20:31 -0600)]
Conditionally define xmltarget_${name} variable in regdat.sh
This changes regdat.sh to emit the xmltarget_${name} variable inside
the #ifndef IN_PROCESS_AGENT block. This avoids a -Wunused-variable
warning for some builds. Thanks to Pedro for investigating this one.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* regformats/regdat.sh: Define xmltarget_${name} inside
#ifndef IN_PROCESS_AGENT.
Tom Tromey [Sun, 8 Jul 2018 18:09:22 +0000 (12:09 -0600)]
Remove unused variables from gdbserver
This removes a few unused variables from gdbserver.
The x86-tdesc.h change is a bit unusual for this series. This file
was not defining the multiple-include guard symbol, so I've added that
here. Also, it is hard to determine when i386_expedite_regs will be
needed, so this patch simply marks it ATTRIBUTE_UNUSED.
gdb/gdbserver/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* win32-low.c (win32_create_inferior): Remove unused variables.
* gdbreplay.c (remote_open): Remove unused variable.
* remote-utils.c (remote_prepare): Remove unused variable.
* x86-tdesc.h (X86_TDESC_H): Define.
(amd64_expedite_regs): Define conditionally.
(i386_expedite_regs): Mark ATTRIBUTE_UNUSED.
* linux-x86-tdesc.c (i386_tdescs): Move inside #if.
* remote-utils.c (readchar): Remove unused variable.
Tom Tromey [Sun, 8 Jul 2018 18:18:19 +0000 (12:18 -0600)]
Remove unused declaration from value.c
This removes an unused declaration from value_fetch_lazy_bitfield.
Because it is not completely clear if the check_typedef call is needed
somewhere beneath this function, this is broken out into a separate
patch.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* value.c (value_fetch_lazy_bitfield): Remove unused variable.
Tom Tromey [Sun, 8 Jul 2018 18:18:09 +0000 (12:18 -0600)]
Pass the correct argument to the observer in reread_symbols
This is actually a patch I found via another route. Joel had asked me
to write a test, but I still have not found the time to do this.
Meanwhile, -Wunused-variable also found this error.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Notify iter, not objfile.
Tom Tromey [Sun, 8 Jul 2018 18:17:51 +0000 (12:17 -0600)]
Fix ravenscar-thread.c to use arch_ops
The change to turn target ops into methods accidentally introduced a
bug in ravenscar-thread.c, changing some calls that were using
"arch_ops" to use the target beneath.
This patch changes ravenscar-thread.c to use these variables where
appropriate.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* ravenscar-thread.c (ravenscar_thread_target::store_registers):
Use arch_ops.
(ravenscar_thread_target::prepare_to_store): Likewise.
Tom Tromey [Sun, 8 Jul 2018 18:17:36 +0000 (12:17 -0600)]
Call value_fetch_lazy when needed in pretty-printers
This removes some unused variables, and replaces the calls to
value_contents_for_printing with a call to value_fetch_lazy, when
needed.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Remove
unused variable. Call value_fetch_lazy when needed.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
Remove unused variable. Call value_fetch_lazy when needed.
Tom Tromey [Sun, 8 Jul 2018 18:17:23 +0000 (12:17 -0600)]
Remove declarations from m32c-tdep.c
This removes some unused declarations from m32c-tdep.c. Initially I
had thought that this entire code block was dead, but Simon pointed
out that it is not; so this patch simply removes some declarations.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* m32c-tdep.c (mark_dma): Return void.
(make_regs): Remove unused declarations.
Tom Tromey [Sun, 8 Jul 2018 18:16:20 +0000 (12:16 -0600)]
Call some functions in guile/ for effect
This changes a couple of spots in guile/ to remove a variable
declaration but to still call a function for effect.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* guile/scm-cmd.c (gdbscm_dont_repeat): Call
cmdscm_get_valid_command_smob_arg_unsafe for effect.
* guile/scm-block.c (gdbscm_make_block_syms_iter): Call
bkscm_get_valid_block_smob_arg_unsafe for effect.
Tom Tromey [Sun, 8 Jul 2018 18:16:00 +0000 (12:16 -0600)]
Use a previously unused variable in bfin-tdep.c
This changes bfin_push_dummy_call to use the result of check_typedef.
Calling check_typedef for effect was probably ok as well, but this
seemed a little nicer.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* bfin-tdep.c (bfin_push_dummy_call): Use arg_type, not
value_type.
Tom Tromey [Sun, 8 Jul 2018 18:39:36 +0000 (12:39 -0600)]
Unused variable fixes related to conditional compilation
This patch fixes various unused variable warnings that are related to
conditional compilation. In these cases, either the variable is now
protected by the same #if as its uses, or the declaration is simply
lowered into the conditionally-compiled block.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* windows-nat.c (saved_context): Conditionally define.
* remote.c (remote_target::remote_btrace_maybe_reopen):
Conditionally declare "warned".
* inflow.c (sigquit_ours): Conditionally define.
(new_tty): Move "tty" declaration inside #if.
* guile/guile.c (guile_datadir): Conditionally define.
* charset.c (set_be_le_names): Move some declarations inside #if.
* btrace.c (parse_xml_btrace): Move "errcode" declaration inside
#if.
(parse_xml_btrace_conf): Likewise.
Tom Tromey [Mon, 16 Jul 2018 15:33:42 +0000 (09:33 -0600)]
Remove an unused variable from spu_get_overlay_table
This removes an unused variable from spu_get_overlay_table, replacing
it with an explanatory comment.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* spu-tdep.c (spu_get_overlay_table): Remove unused variable.
Tom Tromey [Sun, 8 Jul 2018 18:15:04 +0000 (12:15 -0600)]
Simple unused variable removals
This patch holds all the straightforward unused variable deletions.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* guile/scm-value.c (gdbscm_value_call): Remove unused variables.
* guile/scm-math.c (vlscm_unop_gdbthrow, vlscm_binop_gdbthrow)
(vlscm_convert_typed_value_from_scheme): Remove unused variable.
* buildsym-legacy.c (get_macro_table): Remove unused variable.
* stack.c (frame_apply_level_command): Remove unused variable.
* tic6x-tdep.c (tic6x_push_dummy_call): Remove unused variable.
* sparc64-tdep.c (adi_examine_command): Remove unused variable.
* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Remove
unused variable.
* nios2-tdep.c (nios2_push_dummy_call): Remove unused variable.
* mep-tdep.c (mep_push_dummy_call): Remove unused variable.
* ada-lang.c (ada_lookup_symbol_list_worker): Remove unused
variable.
* amd64-tdep.c (amd64_supply_xsave): Remove unused variable.
* arm-tdep.c (arm_record_data_proc_misc_ld_str): Remove unused
variable.
* breakpoint.c (check_no_tracepoint_commands, update_watchpoint):
Remove unused variable.
* cli/cli-script.c (recurse_read_control_structure): Remove unused
variable.
* common/tdesc.c (print_xml_feature::visit): Remove unused
variable.
* compile/compile-object-load.c (store_regs): Remove unused
variables.
* complaints.c (clear_complaints): Remove unused variable.
* corelow.c (core_target_open): Remove unused variable.
* fbsd-tdep.c (fbsd_core_info_proc_status): Remove unused
variable.
* guile/scm-frame.c (gdbscm_frame_read_var): Remove unused
variable.
* guile/scm-symtab.c (stscm_print_sal_smob): Remove unused
variable.
* guile/scm-type.c (gdbscm_field_baseclass_p): Remove unused
variable.
* guile/scm-utils.c (gdbscm_parse_function_args): Remove unused
variable.
* hppa-tdep.c (hppa_stub_frame_unwind_cache): Remove unused
variable.
* ia64-tdep.c (examine_prologue): Remove unused variable.
* infcall.c (run_inferior_call): Remove unused variable.
* inferior.c (exit_inferior): Remove unused variable.
* infrun.c (infrun_thread_ptid_changed): Remove unused variable.
* linespec.c (decode_line_2): Remove unused variable.
* linux-nat.c (super_close): Remove.
* linux-tdep.c (linux_info_proc): Remove unused variable.
* mi/mi-main.c (mi_execute_command): Remove unused variable.
* microblaze-linux-tdep.c (microblaze_linux_sigtramp_cache):
Remove unused variable.
* parse.c (find_minsym_type_and_address): Remove unused variable.
* printcmd.c (info_symbol_command, printf_floating): Remove unused
variable.
* python/py-breakpoint.c (bppy_set_commands): Remove unused
variable.
* python/py-unwind.c (unwind_infopy_dealloc): Remove unused
variables.
* record-btrace.c (record_btrace_target::store_registers): Remove
unused variable.
(cmd_show_record_btrace_cpu): Remove unused variable.
* riscv-tdep.c (riscv_register_reggroup_p)
(riscv_push_dummy_call, riscv_return_value): Remove unused
variable.
* rust-exp.y (literal): Remove unused variable.
* rust-lang.c (rust_evaluate_subexp) <OP_RUST_ARARAY>: Remove
unused variable.
<STRUCTOP_ANONYMOUS>: Likewise.
* s390-linux-tdep.c (s390_linux_init_abi_31)
(s390_linux_init_abi_64): Remove unused variable.
* ser-ming2.c (ser_windows_read_prim, pipe_select_thread)
(file_select_thread, net_windows_open, _initialize_ser_windows):
Remove unused variables.
* symtab.c (find_pc_sect_line): Remove unused variable.
* target-memory.c (compute_garbled_blocks): Remove unused
variable.
(target_write_memory_blocks): Remove unused variable.
* target.c (target_stack::unpush): Remove unused variables.
* tracepoint.c (start_tracing, all_tracepoint_actions)
(merge_uploaded_trace_state_variables)
(print_one_static_tracepoint_marker): Remove unused variable.
* unittests/basic_string_view/element_access/char/1.cc (test01):
Remove unused variable.
* windows-nat.c (windows_continue, windows_add_all_dlls)
(do_initial_windows_stuff, windows_nat_target::create_inferior):
Remove unused variables.
H.J. Lu [Sun, 22 Jul 2018 19:00:39 +0000 (12:00 -0700)]
x86: Determine vector length from the last vector operand
Determine VEX/EVEXE vector length from the last multi-length vector
operand.
* config/tc-i386.c (build_vex_prefix): Determine vector
length from the last multi-length vector operand.
(build_evex_prefix): Likewise.
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.