This patch changes decode_compound_collector to use std::vector instead of
VEC, eliminating a cleanup in the process.
gdb/ChangeLog:
* linespec.c (decode_compound_collector::decode_compound_collector):
Remove initialization for `m_symtabs'.
(decode_compound_collector::release_symbols): Change return type
to std::vector. Update all callers.
(class decode_compound_collector) <m_symbols>: Change type to
std::vector.
(lookup_prefix_sym): Change return type to std::vector. Update all
callers.
(compare_symbols): Remove.
(std_compare_symbols): Rename to `compare_symbols'.
(find_method): Change `sym_classes' parameter to std::vector.
Update all callers. Use std::sort to sort sym_classes.
(find_linespec_symbols): Remove cleanup.
This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.
gdb/ChangeLog:
* linespec.c (struct linespec) <minimal_symbols>: Change type to
std::vector. Update all users.
(convert_linespec_to_sals): Use std::sort to sort minimal symbols.
(struct collect_info) <minimal_symbols>: Likewise.
(compare_msymbols): Return bool. Change parameters to const
bound_minimal_symbol references.
(find_method, find_function_symbols, find_linespec_symbols): Change
`minsyms' parameter to std::vector. Update all callers.
This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.
gdb/ChangeLog:
* linespec.c (struct linespec) <label_symbols>: Change type to
std::vector. Update all users.
(find_label_symbols_in_block): Change `result' parameter to
std::vector. Update all callers.
(find_label_symbols): Return std::vector. Update all callers.
This patch changes the `function_symbols' members in linespec.c structures
from a VEC to a std::vector.
gdb/ChangeLog:
* linespec.c (struct linespec) <function_symbols>: Change type to
std::vector. Update all users.
(struct collect_info) <function_symbols>: Likewise.
(convert_linespec_to_sals): Use std::sort to sort function_symbols.
(std_compare_symbols): New function.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block): Change `symbols' parameter to
std::vector. Update all callers.
(find_label_symbols): Likewise for `function_symbols' and
`label_funcs_ret'.
This patch changes the `file_symtabs' members in linespec.c structures
from a VEC to a std::vector (or unique_ptr thereof), eliminating a cleanup
in the process.
gdb/ChangeLog:
* linespec.c (symtab_vector_up): Define.
(struct linespec) <file_symtabs>: Change type to std::vector *.
Update all uses.
(struct collect_info) <file_symtabs>: Likewise.
(collect_symtabs_from_filename): Return symtab_vector_up.
Update all callers.
(decode_objc): Remove cleanup.
(symtab_collector::symtab_collector): Initialize `m_symtabs'.
(symtab_collector::release_symtabs): Return symtab_vector_up.
Update all callers.
(class symtab_collector) <m_symtabs>: Change type to symtab_vector_up.
Update all users.
(collect_symtabs_from_filename, symtabs_from_filename): Return
symtab_vector_up. Update all callers.
One of the buildbot builders had a failure on a recent try run:
../../binutils-gdb/gdb/csky-tdep.c: In function CORE_ADDR csky_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, CORE_ADDR, frame_info*, csky_unwind_cache*, lr_type_t):
../../binutils-gdb/gdb/csky-tdep.c:1107:23: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
"0x%lx\n", addr);
^
../../binutils-gdb/gdb/csky-tdep.c:1419:12: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
addr);
^
The fix is to use core_addr_to_string_nz rather than %lx in
csky-tdep.c.
Tested by rebuilding. I'm checking this in.
gdb/ChangeLog
2018-08-29 Tom Tromey <tom@tromey.com>
* csky-tdep.c (csky_analyze_prologue): Use
core_addr_to_string_nz.
Sergio pointed out that the Windows builder was failing due to the
-Wnarrowing patch, with:
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225477' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
{-1, GDB_SIGNAL_UNKNOWN}};
^
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225725' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483651' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483652' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225614' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
Looking into this, I found two things.
First, in struct xlate_exception, it is better to have "them" be of
type DWORD, as that's the type actually in use.
Second, struct xlate_exception and xlate are not used in this file,
because the code in windows_nat_target::resume is #if'd out.
This patch changes the type of "them", but also similarly #if's out
this object.
In order to avoid a narrowing warning from the -1 entry, at Pedro's
suggestion I have removed this and changed windows_nat_target::resume
to use ranged for.
Tested by rebuilding using the mingw toolchain on x86-64 Fedora 28. I
also tested it by temporarily removing the "#if 0"s and rebuilding.
gdb/ChangeLog
2018-08-29 Tom Tromey <tom@tromey.com>
* windows-nat.c (struct xlate_exception) <them>: Change type to
DWORD.
(xlate): Fix formatting. Remove last entry.
(struct xlate_exception, xlate): Comment out.
(windows_nat_target::resume): Use ranged for.
Partial write %PSR (PWRPSR) is a SPARC V8e option that allows the WRPSR
instruction to only affect the %PSR.ET field. When available it is enabled
by setting the rd field of the WRPSR instruction to a value other than 0.
For Leon processors with support for partial write %PSR (currently GR740
and GR716) the rd value must be 1.
opcodes/ChangeLog:
2018-08-29 Martin Aberg <maberg@gaisler.com>
* sparc-opc.c (sparc_opcodes): Add Leon specific partial write
psr (PWRPSR) instruction.
gas/ChangeLog:
2018-08-29 Daniel Cederman <cederman@gaisler.com>
* testsuite/gas/sparc/leon.d: New test.
* testsuite/gas/sparc/leon.s: New test.
* testsuite/gas/sparc/sparc.exp: Execute the pwrpsr test.
The linux kernel uses NT_PRFPREG. Glibc before BZ 14890 defines NT_FPREGSET.
After it defines both. Avoid glibc version dependency by using the gdb header
file instead of the glibc header file, and the macro name that gdb defines
which is NT_FPREGSET.
gdb/
* riscv-linux-nat.c: Include elf/common.h instead of elf.h.
(riscv_linux_nat_target::fetch_registers): Use NT_FPREGSET instead
of NT_PRFPREG.
(riscv_linux_nat_target::store_registers): Likewise.
This commit causes GDB in batch mode to exit with nonzero status
if the last command to be executed fails.
gdb/ChangeLog:
PR gdb/13000:
* gdb/main.c (captured_main_1): Exit with nonzero status
in batch mode if the last command to be executed failed.
* NEWS: Mention the above.
gdb/testsuite/ChangeLog:
PR gdb/13000:
* gdb.base/batch-exit-status.exp: New file.
* gdb.base/batch-exit-status.good-commands: Likewise.
* gdb.base/batch-exit-status.bad-commands: Likewise.
... to fix this ARI warning:
gdb/csky-tdep.c:1612: gettext: trailing new line: A message should not have a trailing new line
gdb/csky-tdep.c:1612: warning (_("Invalid breakpoint address 0x%x is an odd number.\n"),
gdb/ChangeLog:
* csky-tdep.c (csky_memory_insert_breakpoint): Remove newline at
end of warning message.
Use aapcs_is_vfp_call_or_return_candidate to detect float register
args, then pass in registers if there is room.
gdb/
* aarch64-tdep.c
(aapcs_is_vfp_call_or_return_candidate): Make static
(pass_in_v_or_stack): Remove function.
(pass_in_v_vfp_candidate): New function.
(aarch64_push_dummy_call): Check for float register candidates.
aapcs_is_vfp_call_or_return_candidate is as an eventual replacement
for is_hfa_or_hva.
This function is based on the GCC code
gcc/config/aarch64/aarch64.c:aarch64_vfp_is_call_or_return_candidate ()
gdb/
* aarch64-tdep.c (HA_MAX_NUM_FLDS): New macro.
(aapcs_is_vfp_call_or_return_candidate_1): New function.
(aapcs_is_vfp_call_or_return_candidate): Likewise.
The PR reports that building with -Wodr -flto complains about different
versions of struct ipa_sym_addresses, in common/agent.c and
gdbserver/tracepoint.c. This patch renames the version in common to
ipa_sym_addresses_common to avoid the name clash. Because the IPA_SYM
assumed the name ipa_sym_addresses, it now requires the includer to
define the IPA_SYM_STRUCT_NAME macro to define the name of the structure
holding the IPA symbol addresses.
gdb/ChangeLog:
PR build/23399
* common/agent.c (IPA_SYM_STRUCT_NAME): Define.
(struct ipa_sym_addresses): Rename to...
(struct ipa_sym_addresses_common): ... this.
* common/agent.h (IPA_SYM): Use IPA_SYM_STRUCT_NAME.
gdb/gdbserver/ChangeLog:
PR build/23399
* tracepoint.c (IPA_SYM_STRUCT_NAME): Define.
gdb/testsuite/ChangeLog
2018-08-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/commands.exp: Test multi breakpoints command clearing.
breakpoint.c is modified to fix the regression introduced
when clearing the commands of several breakpoints by giving an empty
list of commands, by just typing "end".
GDB should read an empty list of command once, but it reads
it for each breakpoint, as an empty list of command is NULL,
and NULL is interpreted as 'not having read the command list yet'.
The fix consists in having a boolean set to true once the
command list has been read.
gdb/ChangeLog
2018-08-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* breakpoint.c (commands_command_1): New boolean cmd_read
to detect cmd was already read.
This changes some uses of VEC in a few parsers to std::vector instead.
Tested by the buildbot.
gdb/ChangeLog
2018-08-28 Tom Tromey <tom@tromey.com>
* c-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, c_parse): Update.
* d-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, d_parse): Update.
* go-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, go_parse): Update.
This patch changes the home-made stack implementation with a vector,
which makes it a bit more concise and readable.
Regtested on the buildbot.
gdb/ChangeLog:
* parser-defs.h (struct type_stack) <elements>: Change type to
std::vector<union type_stack_elt>.
<depth, size>: Remove.
* parse.c (parse_exp_in_context_1): Adjust.
(type_stack_reserve): Remove.
(check_type_stack_depth): Remove.
(insert_into_type_stack): Adjust to std::vector.
(insert_type): Likewise.
(push_type): Likewise.
(push_type_int): Likewise.
(insert_type_address_space): Likewise.
(pop_type): Likewise.
(pop_type_int): Likewise.
(pop_typelist): Likewise.
(pop_type_stack): Likewise.
(append_type_stack): Likewise.
(push_type_stack): Likewise.
(get_type_stack): Likewise.
(type_stack_cleanup): Likewise.
(push_typelist): Likewise.
(follow_types): Likewise.
(_initialize_parse): Likewise.
Since only the GNU_PROPERTY_X86_UINT32_VALID bit may be set in data-only
relocatable objects which don't contain any instructions, linker
shouldn't mask out the GNU_PROPERTY_X86_UINT32_VALID bit when merging
GNU_PROPERTY_X86_XXX bits. Otherwise, linker output doesn't contain
GNU_PROPERTY_X86_XXX property with any data-only relocatable inputs.
This patch keeps the GNU_PROPERTY_X86_UINT32_VALID bit and updates
readelf to print "<None>" if GNU_PROPERTY_X86_XXX property only has
the GNU_PROPERTY_X86_UINT32_VALID bit.
bfd/
* elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Don't mask
out the GNU_PROPERTY_X86_UINT32_VALID bit.
binutils/
* readelf.c (decode_x86_isa): Print <None> if bitmask only
contains the GNU_PROPERTY_X86_UINT32_VALID bit.
(decode_x86_feature_1): Likewise.
(decode_x86_feature_2): Likewise.
(print_gnu_property_note): Don't mask out the
GNU_PROPERTY_X86_UINT32_VALID bit.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
gas/
* testsuite/gas/i386/i386.exp: Run property-1 and
x86-64-property-1.
* testsuite/gas/i386/property-1.d: New file.
* testsuite/gas/i386/property-1.s: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
ld/
* testsuite/ld-i386/i386.exp: Run property-x86-5.
* testsuite/ld-i386/property-x86-5.d: New file.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-5a.s: Likewise.
* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run property-x86-5 and
property-x86-5-x32.
Commit 6d52907e22 (MI: Print frame architecture when printing frames
on an MI channel) added frame's architecture to MI frame output. However
the frame architecture was not correctly printed in the output of
"-stack-list-frames" with frame filters enabled (via "-enable-frame-filters").
This was because with frame filters enabled, the actual frame printing is
done in "py_print_frame" rather than "print_frame". This issue is now fixed.
gdb/Changelog:
2018-08-27 Jan Vrany <jan.vrany@fit.cvut.cz>
* python/py-framefilter.c (py_print_frame): Print frame architecture
when printing on an MI output.
gdb/testsuite/Changelog:
2018-08-27 Jan Vrany <jan.vrany@fit.cvut.cz>
* gdb.python/py-framefilter-mi.exp: Update regexp to
check for "arch" field in frame output.
This avoids -Wnarrowing warnings in
aarch64_linux_iterate_over_regset_sections, by adding some casts to
int.
gdb/ChangeLog
2018-08-27 Tom Tromey <tom@tromey.com>
* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections) <sve_regmap>: Add
casts to int.
This avoids -Wnarrowing warnings in ppc64-tdep.c, by adding a few
casts to unsigned.
gdb/ChangeLog
2018-08-27 Tom Tromey <tom@tromey.com>
* ppc64-tdep.c (insn_d, insn_ds, insn_xfx): Add casts to
unsigned.
(ppc64_standard_linkage1, ppc64_standard_linkage2)
(ppc64_standard_linkage3, ppc64_standard_linkage4)
(ppc64_standard_linkage5, ppc64_standard_linkage6)
(ppc64_standard_linkage7, ppc64_standard_linkage8): Add casts to
unsigned.
This fixes a couple of -Wnarrowing warnings in xtensa-tdep.h, by
introducing some casts to unsigned.
gdb/ChangeLog
2018-08-27 Tom Tromey <tom@tromey.com>
* xtensa-tdep.h (XTREG_END): Add cast to unsigned.
(XTENSA_GDBARCH_TDEP_INSTANTIATE): Likewise.
Code like this:
CORE_ADDR breaks[2] = {-1, -1};
... gives a warning with -Wnarrowing. This patch changes all
instances of this to use CORE_ADDR_MAX instead.
gdb/ChangeLog
2018-08-27 Tom Tromey <tom@tromey.com>
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Use
CORE_ADDR_MAX.
* mips-tdep.c (mips_deal_with_atomic_sequence)
(micromips_deal_with_atomic_sequence): Use CORE_ADDR_MAX.
* arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw)
(arm_deal_with_atomic_sequence_raw): Use CORE_ADDR_MAX.
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Use
CORE_ADDR_MAX.
* aarch64-tdep.c (aarch64_software_single_step): Use
CORE_ADDR_MAX.
This adds a couple of casts to avoid -Wnarrowing warnings coming from
the use of quote_char().
gdb/ChangeLog
2018-08-27 Tom Tromey <tom@tromey.com>
* linespec.c (complete_linespec_component): Add cast to "char".
* completer.c (completion_tracker::build_completion_result): Add
cast to "char".
This removes a VEC type. It requires converting ada_tasks_inferior_data
to C++ (initializing fields, allocating with new). It seems, however,
that the allocated ada_tasks_inferior_data structures are never freed
(that should be fixed separately).
gdb/ChangeLog:
* ada-tasks.c (ada_task_info_s): Remove typedef.
(DEF_VEC_O(ada_task_info_s)): Remove.
(struct ada_tasks_inferior_data): Initialize fields.
<task_list>: Make an std::vector.
(get_ada_tasks_inferior_data): Allocate with new.
(ada_get_task_number): Adjust.
(get_task_number_from_id): Likewise.
(valid_task_id): Likewise.
(ada_get_task_info_from_ptid): Likewise.
(iterate_over_live_ada_tasks): Likewise.
(add_ada_task): Likewise.
(read_known_tasks): Likewise.
(ada_build_task_list): Likewise.
(print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command_1): Likewise.
This removes the need for manual memory management. It may also be a
bit more efficient, since the returned string can be moved all the way
into the destination, in ada_lookup_name_info::matches.
gdb/ChangeLog:
* ada-lang.c (add_angle_brackets): Return std::string.
git commit 702d16713 broke expressions using CONSTANT(COMMONPAGESIZE)
in ALIGN or SUBALIGN of output section statements, because these
optional fields were evaluated at script parse time and the patch in
question delayed setting of config.commonpagesize. The right thing to
do is keep the tree representation of those fields for later
evaluation.
PR 23571
* ldlang.h (section_alignment): Make it an expression tree.
(subsection_alignment): Likewise.
* ldlang.c (topower): Delete.
(output_section_statement_newfunc): Adjust initialization.
(init_os): Evaluate section_alignment.
(lang_size_sections_1): Likewise.
(size_input_section): Evaluate subsection_alignment.
(lang_enter_output_section_statement): Don't evaluate here.
(lang_new_phdr): Use exp_get_vma rather than exp_get_value_int.
* ldexp.h (exp_get_value_int): Delete.
(exp_get_power): Declare.
* ldexp.c (exp_get_value_int): Delete.
(exp_get_power): New function.
* emultempl/pe.em (place_orphan): Build expression for section
alignment.
* emultempl/pep.em (place_orphan): Likewise.
* testsuite/ld-scripts/pr23571.d,
* testsuite/ld-scripts/pr23571.t: New test.
* testsuite/ld-scripts/align.exp: Run it.
The pythread variable could be used without being initialized, fix it by
initializing it to nullptr.
gdb/ChangeLog:
* python/py-threadevent.c (py_get_event_thread): Initialize
pythread.