Since x86 assembler may generate .note.gnu.property section and S-records
can't handle .note.gnu.property sections, add -mx86-used-note=no to
S-records tests on ELF/x86 targets to avoid .note.gnu.property section.
* testsuite/ld-srec/srec.exp: Append -Wa,-mx86-used-note=no to
CC and CXX on ELF/x86 targets.
Since x86 assembler may generate .note.gnu.property section, pass
-mx86-used-note=no to assembler for section2 test on ELF/x86 targets
to avoid .note.gnu.property section.
* testsuite/gas/elf/elf.exp: Pass -mx86-used-note=no to
assembler for section2 test on ELF/x86 targets.
Since cfi/cfi-label.d is ELF/x86 specific, we can pass -mx86-used-note=no
to assembler.
* testsuite/gas/cfi/cfi-label.d: Pass -mx86-used-note=no to
assembler.
Since x86 assembler may generate .note.gnu.property section, adjust
binutils tests to handle it.
* testsuite/binutils-all/readelf.s-64: Adjusted for
.note.gnu.property section.
* testsuite/binutils-all/strip-3.d: Also strip
.note.gnu.property section.
Add -mx86-used-note=[yes|no] option to generate (or not) GNU property
notes with GNU_PROPERTY_X86_FEATURE_2_USED and GNU_PROPERTY_X86_ISA_1_USED
properties. If the assembly input contains no instructions, set the
GNU_PROPERTY_X86_UINT32_VALID bit in GNU_PROPERTY_X86_FEATURE_2_USED
property. Add a --enable-x86-used-note configure time option to set the
default behavior. Set the default if the configure option is not used
to "no".
* NEWS: Mention -mx86-used-note=[no|yes].
* configure.ac: Add --enable-x86-used-note. Define
DEFAULT_X86_USED_NOTE.
* config.in: Regenerated.
* configure: Likewise.
* config/tc-i386.c (x86_isa_1_used): New.
(x86_feature_2_used): Likewise.
(x86_used_note): Likewise.
(_i386_insn): Add has_regmmx, has_regxmm, has_regymm and
has_regzmm.
(build_modrm_byte): Set i.has_regmmx, i.has_regzmm.
i.has_regymm and i.has_regxmm.
(x86_cleanup): New function.
(output_insn): Update x86_isa_1_used and x86_feature_2_used.
(OPTION_X86_USED_NOTE): New.
(md_longopts): Add -mx86-used-note=.
(md_parse_option): Handle OPTION_X86_USED_NOTE.
(md_show_usage): Display -mx86-used-note=.
* config/tc-i386.h (x86_cleanup): New prototype.
(md_cleanup): New.
* doc/c-i386.texi: Document -mx86-used-note=.
2018-08-29 Kito Cheng <kito@andestech.com>
gas/
* config/tc-riscv.c (riscv_subset_supports): New argument:
xlen_required.
(riscv_multi_subset_supports): New function, able to check more
than one extension.
(riscv_ip): Use riscv_multi_subset_supports instead of
riscv_subset_supports.
(riscv_set_arch): Update call-site for riscv_subset_supports.
(riscv_after_parse_args): Likewise.
include/
*opcode/riscv.h (MAX_SUBSET_NUM): New.
(riscv_opcode): Add xlen_requirement field and change type of
subset.
opcodes/
* riscv-dis.c (riscv_disassemble_insn): Check XLEN by
riscv_opcode.xlen_requirement.
* riscv-opc.c (riscv_opcodes): Update for struct change.
Skip elf/section14 test for h8300 targets since the h8300 port issues a
warning message for new sections created without atrributes.
* testsuite/gas/elf/section14.d: Skip h8300 targets.
Extends the instruction decoder used during prologue scan and software
single step to cover more instructions. These instructions are
encountered when running the current GDB testsuite with the DWARF
stack unwinders turned off.
gdb/ChangeLog:
* riscv-tdep.c (riscv_insn::decode): Decode c.addi4spn, c.sd,
c.sw, c.swsp, and c.sdsp.
The RISC-V had a mechanism in place to cache the contents of the misa
register per-inferior, the original intention behind this was to
reduce the number of times the misa register had to be read (as the
contents should be constant), but it was pointed out on the mailing
list[1] that the register cache will mean the register is only
accessed once each time GDB stops, and any additional caching is
probably just unneeded extra complexity.
As such, until it can be shown that there's a real need for additional
caching, this commit removes all of the additional caching of the misa
register, and just accesses the misa register like a normal register.
[1] https://sourceware.org/ml/gdb-patches/2018-03/msg00136.html
gdb/ChangeLog:
* riscv-tdep.c (struct riscv_inferior_data): Delete.
(riscv_read_misa_reg): Don't cache value read into inferior data.
(riscv_new_inferior_data): Delete.
(riscv_inferior_data_cleanup): Delete.
(riscv_inferior_data): Delete.
(riscv_invalidate_inferior_data): Delete.
(_initialize_riscv_tdep): Remove initialisation of inferior data.
In the test gdb.base/funcargs.exp, there's this function:
void recurse (SVAL a, int depth)
{
a.s = a.i = a.l = --depth;
if (depth == 0)
hitbottom ();
else
recurse (a, depth);
}
The test script places a breakpoint in hitbottom, and runs the
executable which calls recurse with an initial depth of 4.
When GDB hits the breakpoint in hitbottom the testscript performs a
backtrace, and examines 'a' at each level.
The problem is that 'a' is not live after either the call to
'hitbottom' or the call to 'recurse', and as a result the test fails.
In the particular case I was looking at GCC for RISC-V 32-bit, the
variable 'a' is on the stack and GCC selects the register $ra (the
return address register) to hold the pointer to 'a'. This is fine,
because, by the time the $ra register is needed to hold a return
address (calling hitbottom or recurse) then 'a' is dead.
In this patch I propose that a use of 'a' is added after the calls to
hitbottom and recurse, this should cause the compiler to keep 'a'
around, which should ensure GDB can find it.
gdb/testsuite/ChangeLog:
* gdb.base/funcargs.c (use_a): New function.
(recurse): Call use_a.
I see these errors when building with clang:
CXX compile/compile-cplus-types.o
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs]
fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
~~ ^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags<gcc_cp_qualifiers>::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare]
if (quals != GCC_CP_REF_QUAL_NONE)
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
Fix the first one by using host_address_to_string.
Fix the second one by comparing to 0 instead. I think the current
comparison simply uses the wrong enum type. Comparing to 0 seems like
the right thing to do, because we want to check whether any flags are
specified.
gdb/ChangeLog:
* compile/compile-cplus-types.c
(compile_cplus_instance::leave_scope): Take the address of scope
object.
(compile_cplus_instance::convert_qualified_base): Compare quals
to 0.
Since SHT_FINI_ARRAY and SHT_PREINIT_ARRAY sections are relocatable,
this patch fixes readelf and adds a testcase.
binutils/
* readelf.c (process_section_headers): Treat SHT_FINI_ARRAY and
SHT_PREINIT_ARRAY as relocatable sections.
gas/
* testsuite/gas/elf/elf.exp: Run section14.
* testsuite/gas/elf/section14.d: New file.
* testsuite/gas/elf/section14.s: Likewise.
This patch fixes a problem being reported by the buildbot with an
invalid argument to a "%p" printf format. Instead of "%p", the
debug output is changed to use "%s" and host_address_to_string.
gdb/ChangeLog
* compile/compile-cplus-types.c (compile_cplus_instance::enter_scope):
Use "%s" and host_address_to_string instead of "%p" in printf.
This patch adds *basic* support for C++ to the compile feature. It does
most simple type conversions, including everything that C compile does and
your basic "with-classes" type of C++.
I've written a new compile-support.exp support file which adds a new test
facility for automating and simplifying "compile print" vs "compile code"
testing. See testsuite/lib/compile-support.exp and CompileExpression
for more on that. The tests use this facility extensively.
This initial support has several glaring omissions:
- No template support at all
I have follow-on patches for this, but they add much complexity
to this "basic" support. Consequently, they will be submitted separately.
- Cannot print functions
The code template needs tweaking, and I simply haven't gotten to it yet.
- So-called "special function" support is not included
Using constructors, destructors, operators, etc will not work. I have
follow-on patches for that, but they require some work because of the
recent churn in symbol searching.
- There are several test suite references to "compile/1234" bugs.
I will file bugs and update the test suite's bug references before pushing
these patches.
The test suite started as a copy of the original C-language support, but
I have written tests to exercise the basic functionality of the plug-in.
I've added a new option for outputting debug messages for C++ type-conversion
("debug compile-cplus-types").
gdb/ChangeLog:
* Makefile.in (SUBDIR_GCC_COMPILE_SRCS): Add compile-cplus-symbols.c
and compile-cplus-types.c.
(HFILES_NO_SRCDIR): Add gcc-cp-plugin.h.
* c-lang.c (cplus_language_defn): Set C++ compile functions.
* c-lang.h (cplus_get_compile_context, cplus_compute_program):
Declare.
* compile/compile-c-support.c: Include compile-cplus.h.
(load_libcompile): Templatize.
(get_compile_context): "New" function.
(c_get_compile_context): Use get_compile_context.
(cplus_get_compile_context): New function.
(cplus_push_user_expression, cplus_pop_user_expression)
(cplus_add_code_header, cplus_add_input, cplus_compile_program)
(cplus_compute_program): Define new structs/functions.
* compile/compile-cplus-symmbols.c: New file.
* compile/compile-cplus-types.c: New file.
* compile/compile-cplus.h: New file.
* compile/compile-internal.h (debug_compile_oracle, GCC_TYPE_NONE):
Declare.
* compile/compile-object-load.c (get_out_value_type): Use
strncmp_iw when comparing symbol names.
(compile_object_load): Add mst_bss and mst_data.
* compile/compile.c (_initialize_compile): Remove
-Wno-implicit-function-declaration from `compile_args'.
* compile/gcc-cp-plugin.h: New file.
* NEWS: Mention C++ compile support and new debug options.
gdb/testsuite/ChangeLog:
* gdb.compile/compile-cplus-anonymous.cc: New file.
* gdb.compile/compile-cplus-anonymous.exp: New file.
* gdb.compile/compile-cplus-array-decay.cc: New file.
* gdb.compile/compile-cplus-array-decay.exp: New file.
* gdb.compile/compile-cplus-inherit.cc: New file.
* gdb.compile/compile-cplus-inherit.exp: New file.
* gdb.compile/compile-cplus-member.cc: New file.
* gdb.compile/compile-cplus-member.exp: New file.
* gdb.compile/compile-cplus-method.cc: New file.
* gdb.compile/compile-cplus-method.exp: New file.
* gdb.compile/compile-cplus-mod.c: "New" file.
* gdb.compile/compile-cplus-namespace.cc: New file.
* gdb.compile/compile-cplus-namespace.exp: New file.
* gdb.compile/compile-cplus-nested.cc: New file.
* gdb.compile/compile-cplus-nested.exp: New file.
* gdb.compile/compile-cplus-print.c: "New" file.
* gdb.compile/compile-cplus-print.exp: "New" file.
* gdb.compile/compile-cplus-virtual.cc: New file.
* gdb.compile/compile-cplus-virtual.exp: New file.
* gdb.compile/compile-cplus.c: "New" file.
* gdb.compile/compile-cplus.exp: "New" file.
* lib/compile-support.exp: New file.
doc/ChangeLog:
* gdb.texinfo (Compiling and injecting code in GDB): Document
set/show "compile-oracle" and "compile-cplus-types" commands.
This patch adds a new symbol searching API based on linespec.c's parser
implementation. This allows users to find "all* matching symbols instead
of the first found match (a la lookup_symbol).
gdb/ChangeLog:
* linespec.c (collect_info::add_symbol): Make virtual.
(struct symbol_searcher_collect_info): New struct.
(symbol_searcher::find_all_symbols): New method.
* symtab.h (class symbol_searcher): New class.
This patch changes the linespec.c APIs to use block_symbol instead of just
a symbol. lookup_symbol et al already return block_symbol's.
gdb/ChangeLog:
* linespec.c (struct linespec) <function_symbols, label_symbols>:
Change to vector of block_symbol. Update all users.
(struct collect_info) <symbols>: Likewise.
(collect_info::add_symbol): Take block_symbol as argument.
Update all callers.
(decode_compound_collector) <m_symbols>: Change type to vector
of block_symbol. Update all users.
(decode_compound_collector::operator ()): Change parameter type
to block_symbol.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block, find_label_symbols): Change symbol
vectors to block_symbol vectors.
* symtab.h (symbol_found_callback_ftype): Change parameter type to
block_symbol.
Since they are now no longer necessary, this patch removes the typedefs
and VEC definitions for bound_minimal_symbol_d and symbolp.
gdb/ChangeLog:
* linespec.c (symbolp): Remove typedef and VEC definitions.
(bound_minimal_symbol_d): Likewise.
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.