Commit Graph

41505 Commits

Author SHA1 Message Date
Andrew Burgess 78a3b0fab8 gdb/riscv: Provide non-DWARF stack unwinder
Collects information during the prologue scan and uses this to unwind
registers when no DWARF information is available.

This patch has been tested by disabling the DWARF stack unwinders, and
running the complete GDB testsuite against a range of RISC-V targets.
The results are comparable to running with the DWARF unwinders in
place.

gdb/ChangeLog:

	* riscv-tdep.c: Add 'prologue-value.h' include.
	(struct riscv_unwind_cache): New struct.
	(riscv_debug_unwinder): New global.
	(riscv_scan_prologue): Update arguments, capture register details
	from prologue scan.
	(riscv_skip_prologue): Reformat arguments line, move end of
	prologue calculation into riscv_scan_prologue.
	(riscv_frame_cache): Update return type, create
	riscv_unwind_cache, scan the prologue, and fill in remaining cache
	details.
	(riscv_frame_this_id): Use frame id computed in riscv_frame_cache.
	(riscv_frame_prev_register): Use the trad_frame within the
	riscv_unwind_cache.
	(_initialize_riscv_tdep): Add 'set/show debug riscv unwinder'
	flag.
2018-09-03 15:48:41 +01:00
Andrew Burgess 23e60e7a4e gdb: Extend the trad-frame API
Adds two new functions to the trad-frame API and update the internals
of trad-frame to use the new functions.  These functions will be used
in later commits.

gdb/ChangeLog:

	* trad-frame.h (trad_frame_set_realreg): Declare.
	(trad_frame_set_addr): Declare.
	* trad-frame.c (trad_frame_set_realreg): Define new function.
	(trad_frame_set_addr): Define new function.
	(trad_frame_set_reg_realreg): Use new function.
	(trad_frame_set_reg_addr): Use new function.
2018-09-03 15:48:41 +01:00
Keith Seitz 5c889512f3 Fix ARI violations in c++compile
This patch fixes two violations of the ARI (use of ATTRIBUTE_UNUSED and
"%ll").

gdb/ChangeLog

	* compile/compile-cplus-types.c (compile_cplus_debug_output_1): Use
	pulongest instead of "%lld".
	* compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol): Remove
	ATTRIBUTE_UNUSED.
2018-09-01 12:04:29 -07:00
Tom Tromey c8c8163573 Set TYPE_LENGTH on a variant part
gdb represents a DW_TAG_variant_part as a union.  While normally DWARF
would not set the size of a DW_TAG_variant_part, gdb's representation
requires the TYPE_LENGTH to be set.

This patch arranges to set the TYPE_LENGTH of a variant part if it has
not already been set.

This fixes some Rust regressions when testing against a version of
rustc that emits DW_TAG_variant_part.

gdb/ChangeLog
2018-08-31  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (dwarf2_add_field): Set the TYPE_LENGTH of the
	variant part type.
2018-08-31 12:59:16 -06:00
Tom Tromey aef9346c25 Fix a small bug in gdb.rust/simple.rs
I noticed that gdb.rust/simple.rs had two local variables named "v".
This didn't previous cause problems, but with a newer rust compiler
this resulted in a test failure.  (It should have failed all along, so
I suppose earlier passes were due to a compiler bug.)

This patch renames the second variable.

gdb/testsuite/ChangeLog
2018-08-31  Tom Tromey  <tom@tromey.com>

	* gdb.rust/simple.rs: Rename second variable "v".
2018-08-31 12:59:16 -06:00
Pedro Alves 0c8885885a Regenerate gdbarch.h
The previous commit included a stale gdbarch.h from an earlier version
of that patch by mistake.

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

	* gdbarch.h: Regenerate.
2018-08-31 18:56:10 +01:00
Pedro Alves 7ea65f08fa Add comment describing continuable/steppable/non-steppable watchpoints
These weren't described anywhere in the sources.

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

	* gdbarch.sh (have_nonsteppable_watchpoint): Add comment.
	* target.h (Hardware watchpoint interfaces): Describe
	continuable/steppable/non-steppable watchpoints.
	* gdbarch.h, gdbarch.c: Regenerate.
2018-08-31 18:47:36 +01:00
Pedro Alves 7eb65fafed Eliminate target_have_continuable_watchpoint
target_have_continuable_watchpoint isn't used anywhere so remove it.
The property isn't necessary because checking for "continuable" is the
same as checking for "!steppable && !non-steppable".

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

	* nto-procfs.c (nto_procfs_target::have_continuable_watchpoint):
	Delete.
	* s390-linux-nat.c
	(s390_linux_nat_target::have_continuable_watchpoint): Delete.
	* target.h (target_ops::have_continuable_watchpoint): Delete.
	(target_have_continuable_watchpoint): Delete.
	* x86-nat.h (x86_nat_target::have_continuable_watchpoint): Delete.
	* target-delegates.c: Regenerate.
2018-08-31 18:47:12 +01:00
Sergio Durigan Junior dab999b116 Update gnulib/Makefile.in:aclocal_m4_deps
It was pointed by Pedro that gnulib/Makefile.in should be updated
accordingly after our local gnulib is also updated.  The specific part
that needs to be refreshed is the "aclocal_m4_deps" variable, which
lists the .m4 files present under the "gnulib/import/m4/" directory.
This patch does that.

No regressions introduced.

gdb/ChangeLog:
2018-08-31  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gnulib/Makefile.in (aclocal_m4_deps): Update according to
	the files present in "gnulib/import/m4/".
2018-08-31 12:01:32 -04:00
Andrew Burgess ff3a05b3f8 gdb/riscv: Extend instruction decode to cover more instructions
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.
2018-08-30 16:35:55 +01:00
Andrew Burgess 0b3f9efc04 gdb/riscv: remove extra caching of misa register
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.
2018-08-30 16:35:54 +01:00
Andrew Burgess c67f2e1518 gdb: Ensure compiler doesn't optimise variable out in test
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.
2018-08-30 16:33:49 +01:00
Simon Marchi a0dc02a6df Fix compile-cplus-types.c build errors
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.
2018-08-30 11:09:48 -04:00
Keith Seitz fdad7678b7 Use host_address_to_string in compile_cplus_instance::enter_scope
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.
2018-08-30 07:47:03 -07:00
Keith Seitz 078a020797 C++ compile support
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.
2018-08-29 15:12:24 -07:00
Keith Seitz fcaad03cc0 Add new search_symbols_multiple API
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.
2018-08-29 15:12:23 -07:00
Keith Seitz 7e41c8db84 Use block_symbol in linespec APIs
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.
2018-08-29 15:12:23 -07:00
Keith Seitz 63e8c3daad Remove VEC definitions from linespec.c
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.
2018-08-29 15:12:23 -07:00
Keith Seitz 4dedf84da9 Change decode_compound_collector to use std::vector
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.
2018-08-29 15:12:23 -07:00
Keith Seitz c2a031c582 Change `minimal_symbols' to std::vector in linespec.c structures
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.
2018-08-29 15:12:23 -07:00
Keith Seitz 3553eadc8c Change `label_symbols' to std::vector in linespec.c structures
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.
2018-08-29 15:12:23 -07:00
Keith Seitz 7243d0118a Change `function_symbols' to std::vector
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'.
2018-08-29 15:12:23 -07:00
Keith Seitz 2a90824133 Change `file_symtabs' to std::vector
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.
2018-08-29 15:12:23 -07:00
Tom Tromey f6c4e3e8a3 Use core_addr_to_string_nz in csky_analyze_prologue
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.
2018-08-29 15:33:23 -06:00
Tom Tromey 73c13fe69a Fix windows-nat.c for -Wnarrowing
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.
2018-08-29 14:24:54 -06:00
Jim Wilson 4d3928d7e0 Fix riscv-linux native gdb build failure.
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.
2018-08-29 10:52:42 -07:00
Sergio Durigan Junior 7a6dbc2fdb Update gnulib to current upstream master
It has been a while since we don't update our gnulib copy against
their upstream master branch, so I thought I'd propose this patch.  It
also fixes (at least) one bug reported against GDB:

  https://sourceware.org/bugzilla/show_bug.cgi?id=23558

The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB.  With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.

This has been reported against upstream gnulib and the fix has been
pushed here:

  https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=a96d2e67052c879b1bcc5bc461722beac75fc372

I regtested this patch on Fedora 28 x86-64, and there were no
regressions.

OK?

gdb/ChangeLog:

2018-08-29  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/23555
	PR gdb/23558
	* gnulib/aclocal.m4: Regenerate.
	* gnulib/config.in: Regenerate.
	* gnulib/configure: Regenerate.
	* gnulib/import/Makefile.am: Update.
	* gnulib/import/Makefile.in: Update.
	* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
	* gnulib/import/_Noreturn.h: ... this.
	* gnulib/import/alloca.in.h: Update.
	* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
	* gnulib/import/arg-nonnull.h: ... this.
	* gnulib/import/assure.h: Update.
	* gnulib/import/at-func.c: Update.
	* gnulib/import/basename-lgpl.c: Update.
	* gnulib/import/extra/snippet/c++defs.h: Rename to...
	* gnulib/import/c++defs.h: ... this.
	* gnulib/import/canonicalize-lgpl.c: Update.
	* gnulib/import/cdefs.h: Update.
	* gnulib/import/chdir-long.c: Update.
	* gnulib/import/chdir-long.h: Update.
	* gnulib/import/cloexec.c: Update.
	* gnulib/import/cloexec.h: Update.
	* gnulib/import/close.c: Update.
	* gnulib/import/closedir.c: Update.
	* gnulib/import/config.charset: Update.
	* gnulib/import/dirent-private.h: Update.
	* gnulib/import/dirent.in.h: Update.
	* gnulib/import/dirfd.c: Update.
	* gnulib/import/dirname-lgpl.c: Update.
	* gnulib/import/dirname.h: Update.
	* gnulib/import/dosname.h: Update.
	* gnulib/import/dup-safer-flag.c: Update.
	* gnulib/import/dup-safer.c: Update.
	* gnulib/import/dup.c: Update.
	* gnulib/import/dup2.c: Update.
	* gnulib/import/errno.in.h: Update.
	* gnulib/import/error.c: Update.
	* gnulib/import/error.h: Update.
	* gnulib/import/exitfail.c: Update.
	* gnulib/import/exitfail.h: Update.
	* gnulib/import/extra/update-copyright: Update.
	* gnulib/import/fchdir.c: Update.
	* gnulib/import/fcntl.c: Update.
	* gnulib/import/fcntl.in.h: Update.
	* gnulib/import/fd-hook.c: Update.
	* gnulib/import/fd-hook.h: Update.
	* gnulib/import/fd-safer-flag.c: Update.
	* gnulib/import/fd-safer.c: Update.
	* gnulib/import/fdopendir.c: Update.
	* gnulib/import/filename.h: Update.
	* gnulib/import/filenamecat-lgpl.c: Update.
	* gnulib/import/filenamecat.h: Update.
	* gnulib/import/flexmember.h: Update.
	* gnulib/import/float+.h: Update.
	* gnulib/import/float.c: Update.
	* gnulib/import/float.in.h: Update.
	* gnulib/import/fnmatch.c: Update.
	* gnulib/import/fnmatch.in.h: Update.
	* gnulib/import/fnmatch_loop.c: Update.
	* gnulib/import/fpucw.h: Update.
	* gnulib/import/frexp.c: Update.
	* gnulib/import/frexpl.c: Update.
	* gnulib/import/fstat.c: Update.
	* gnulib/import/fstatat.c: Update.
	* gnulib/import/getcwd-lgpl.c: Update.
	* gnulib/import/getcwd.c: Update.
	* gnulib/import/getdtablesize.c: Update.
	* gnulib/import/getlogin_r.c: Update.
	* gnulib/import/getprogname.c: Update.
	* gnulib/import/getprogname.h: Update.
	* gnulib/import/gettext.h: Update.
	* gnulib/import/gettimeofday.c: Update.
	* gnulib/import/glob-libc.h: Update.
	* gnulib/import/glob.c: Update.
	* gnulib/import/glob.in.h: Update.
	* gnulib/import/glob_internal.h: Update.
	* gnulib/import/glob_pattern_p.c: Update.
	* gnulib/import/globfree.c: Update.
	* gnulib/import/hard-locale.c: Update.
	* gnulib/import/hard-locale.h: Update.
	* gnulib/import/intprops.h: Update.
	* gnulib/import/inttypes.in.h: Update.
	* gnulib/import/isnan.c: Update.
	* gnulib/import/isnand-nolibm.h: Update.
	* gnulib/import/isnand.c: Update.
	* gnulib/import/isnanl-nolibm.h: Update.
	* gnulib/import/isnanl.c: Update.
	* gnulib/import/itold.c: Update.
	* gnulib/import/libc-config.h: Update.
	* gnulib/import/limits.in.h: Update.
	* gnulib/import/localcharset.c: Update.
	* gnulib/import/localcharset.h: Update.
	* gnulib/import/localtime-buffer.c: Update.
	* gnulib/import/localtime-buffer.h: Update.
	* gnulib/import/lstat.c: Update.
	* gnulib/import/m4/00gnulib.m4: Update.
	* gnulib/import/m4/__inline.m4: Update.
	* gnulib/import/m4/absolute-header.m4: Update.
	* gnulib/import/m4/alloca.m4: Update.
	* gnulib/import/m4/builtin-expect.m4: Update.
	* gnulib/import/m4/canonicalize.m4: Update.
	* gnulib/import/m4/chdir-long.m4: Update.
	* gnulib/import/m4/close.m4: Update.
	* gnulib/import/m4/closedir.m4: Update.
	* gnulib/import/m4/configmake.m4: Update.
	* gnulib/import/m4/d-ino.m4: Update.
	* gnulib/import/m4/d-type.m4: Update.
	* gnulib/import/m4/dirent_h.m4: Update.
	* gnulib/import/m4/dirfd.m4: Update.
	* gnulib/import/m4/dirname.m4: Update.
	* gnulib/import/m4/double-slash-root.m4: Update.
	* gnulib/import/m4/dup.m4: Update.
	* gnulib/import/m4/dup2.m4: Update.
	* gnulib/import/m4/eealloc.m4: Update.
	* gnulib/import/m4/environ.m4: Update.
	* gnulib/import/m4/errno_h.m4: Update.
	* gnulib/import/m4/error.m4: Update.
	* gnulib/import/m4/exponentd.m4: Update.
	* gnulib/import/m4/exponentl.m4: Update.
	* gnulib/import/m4/extensions.m4: Update.
	* gnulib/import/m4/extern-inline.m4: Update.
	* gnulib/import/m4/fchdir.m4: Update.
	* gnulib/import/m4/fcntl-o.m4: Update.
	* gnulib/import/m4/fcntl.m4: Update.
	* gnulib/import/m4/fcntl_h.m4: Update.
	* gnulib/import/m4/fdopendir.m4: Update.
	* gnulib/import/m4/filenamecat.m4: Update.
	* gnulib/import/m4/flexmember.m4: Update.
	* gnulib/import/m4/float_h.m4: Update.
	* gnulib/import/m4/fnmatch.m4: Update.
	* gnulib/import/m4/fnmatch_h.m4: Update.
	* gnulib/import/m4/fpieee.m4: Update.
	* gnulib/import/m4/frexp.m4: Update.
	* gnulib/import/m4/frexpl.m4: Update.
	* gnulib/import/m4/fstat.m4: Update.
	* gnulib/import/m4/fstatat.m4: Update.
	* gnulib/import/m4/getcwd-abort-bug.m4: Update.
	* gnulib/import/m4/getcwd-path-max.m4: Update.
	* gnulib/import/m4/getcwd.m4: Update.
	* gnulib/import/m4/getdtablesize.m4: Update.
	* gnulib/import/m4/getlogin.m4: Update.
	* gnulib/import/m4/getlogin_r.m4: Update.
	* gnulib/import/m4/getpagesize.m4: Update.
	* gnulib/import/m4/getprogname.m4: Update.
	* gnulib/import/m4/gettimeofday.m4: Update.
	* gnulib/import/m4/glibc21.m4: Update.
	* gnulib/import/m4/glob.m4: Update.
	* gnulib/import/m4/glob_h.m4: Update.
	* gnulib/import/m4/gnulib-cache.m4: Update.
	* gnulib/import/m4/gnulib-common.m4: Update.
	* gnulib/import/m4/gnulib-comp.m4: Update.
	* gnulib/import/m4/gnulib-tool.m4: Update.
	* gnulib/import/m4/hard-locale.m4: Update.
	* gnulib/import/m4/include_next.m4: Update.
	* gnulib/import/m4/inttypes-pri.m4: Update.
	* gnulib/import/m4/inttypes.m4: Update.
	* gnulib/import/m4/isnand.m4: Update.
	* gnulib/import/m4/isnanl.m4: Update.
	* gnulib/import/m4/largefile.m4: Update.
	* gnulib/import/m4/limits-h.m4: Update.
	* gnulib/import/m4/localcharset.m4: Update.
	* gnulib/import/m4/locale-fr.m4: Update.
	* gnulib/import/m4/locale-ja.m4: Update.
	* gnulib/import/m4/locale-zh.m4: Update.
	* gnulib/import/m4/localtime-buffer.m4: Update.
	* gnulib/import/m4/longlong.m4: Update.
	* gnulib/import/m4/lstat.m4: Update.
	* gnulib/import/m4/malloc.m4: Update.
	* gnulib/import/m4/malloca.m4: Update.
	* gnulib/import/m4/math_h.m4: Update.
	* gnulib/import/m4/mbrtowc.m4: Update.
	* gnulib/import/m4/mbsinit.m4: Update.
	* gnulib/import/m4/mbsrtowcs.m4: Update.
	* gnulib/import/m4/mbstate_t.m4: Update.
	* gnulib/import/m4/memchr.m4: Update.
	* gnulib/import/m4/memmem.m4: Update.
	* gnulib/import/m4/mempcpy.m4: Update.
	* gnulib/import/m4/memrchr.m4: Update.
	* gnulib/import/m4/mkdir.m4: Update.
	* gnulib/import/m4/mkstemp.m4: Update.
	* gnulib/import/m4/mmap-anon.m4: Update.
	* gnulib/import/m4/mode_t.m4: Update.
	* gnulib/import/m4/msvc-inval.m4: Update.
	* gnulib/import/m4/msvc-nothrow.m4: Update.
	* gnulib/import/m4/multiarch.m4: Update.
	* gnulib/import/m4/nocrash.m4: Update.
	* gnulib/import/m4/off_t.m4: Update.
	* gnulib/import/m4/onceonly.m4: Update.
	* gnulib/import/m4/open-cloexec.m4: Update.
	* gnulib/import/m4/open.m4: Update.
	* gnulib/import/m4/openat.m4: Update.
	* gnulib/import/m4/opendir.m4: Update.
	* gnulib/import/m4/pathmax.m4: Update.
	* gnulib/import/m4/rawmemchr.m4: Update.
	* gnulib/import/m4/readdir.m4: Update.
	* gnulib/import/m4/readlink.m4: Update.
	* gnulib/import/m4/realloc.m4: Update.
	* gnulib/import/m4/rename.m4: Update.
	* gnulib/import/m4/rewinddir.m4: Update.
	* gnulib/import/m4/rmdir.m4: Update.
	* gnulib/import/m4/save-cwd.m4: Update.
	* gnulib/import/m4/secure_getenv.m4: Update.
	* gnulib/import/m4/setenv.m4: Update.
	* gnulib/import/m4/signal_h.m4: Update.
	* gnulib/import/m4/ssize_t.m4: Update.
	* gnulib/import/m4/stat-time.m4: Update.
	* gnulib/import/m4/stat.m4: Update.
	* gnulib/import/m4/std-gnu11.m4: Update.
	* gnulib/import/m4/stdbool.m4: Update.
	* gnulib/import/m4/stddef_h.m4: Update.
	* gnulib/import/m4/stdint.m4: Update.
	* gnulib/import/m4/stdio_h.m4: Update.
	* gnulib/import/m4/stdlib_h.m4: Update.
	* gnulib/import/m4/strchrnul.m4: Update.
	* gnulib/import/m4/strdup.m4: Update.
	* gnulib/import/m4/strerror.m4: Update.
	* gnulib/import/m4/string_h.m4: Update.
	* gnulib/import/m4/strstr.m4: Update.
	* gnulib/import/m4/strtok_r.m4: Update.
	* gnulib/import/m4/sys_socket_h.m4: Update.
	* gnulib/import/m4/sys_stat_h.m4: Update.
	* gnulib/import/m4/sys_time_h.m4: Update.
	* gnulib/import/m4/sys_types_h.m4: Update.
	* gnulib/import/m4/tempname.m4: Update.
	* gnulib/import/m4/time_h.m4: Update.
	* gnulib/import/m4/unistd-safer.m4: Update.
	* gnulib/import/m4/unistd_h.m4: Update.
	* gnulib/import/m4/warn-on-use.m4: Update.
	* gnulib/import/m4/wchar_h.m4: Update.
	* gnulib/import/m4/wchar_t.m4: Update.
	* gnulib/import/m4/wctype_h.m4: Update.
	* gnulib/import/m4/wint_t.m4: Update.
	* gnulib/import/malloc.c: Update.
	* gnulib/import/malloc/scratch_buffer.h: Update.
	* gnulib/import/malloc/scratch_buffer_grow.c: Update.
	* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
	* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
	* gnulib/import/malloca.c: Update.
	* gnulib/import/malloca.h: Update.
	* gnulib/import/malloca.valgrind: Update.
	* gnulib/import/math.in.h: Update.
	* gnulib/import/mbrtowc.c: Update.
	* gnulib/import/mbsinit.c: Update.
	* gnulib/import/mbsrtowcs-impl.h: Update.
	* gnulib/import/mbsrtowcs-state.c: Update.
	* gnulib/import/mbsrtowcs.c: Update.
	* gnulib/import/memchr.c: Update.
	* gnulib/import/memmem.c: Update.
	* gnulib/import/mempcpy.c: Update.
	* gnulib/import/memrchr.c: Update.
	* gnulib/import/mkdir.c: Update.
	* gnulib/import/mkstemp.c: Update.
	* gnulib/import/msvc-inval.c: Update.
	* gnulib/import/msvc-inval.h: Update.
	* gnulib/import/msvc-nothrow.c: Update.
	* gnulib/import/msvc-nothrow.h: Update.
	* gnulib/import/open.c: Update.
	* gnulib/import/openat-die.c: Update.
	* gnulib/import/openat-priv.h: Update.
	* gnulib/import/openat-proc.c: Update.
	* gnulib/import/openat.c: Update.
	* gnulib/import/openat.h: Update.
	* gnulib/import/opendir.c: Update.
	* gnulib/import/pathmax.h: Update.
	* gnulib/import/pipe-safer.c: Update.
	* gnulib/import/rawmemchr.c: Update.
	* gnulib/import/readdir.c: Update.
	* gnulib/import/readlink.c: Update.
	* gnulib/import/realloc.c: Update.
	* gnulib/import/ref-add.sin: Update.
	* gnulib/import/ref-del.sin: Update.
	* gnulib/import/rename.c: Update.
	* gnulib/import/rewinddir.c: Update.
	* gnulib/import/rmdir.c: Update.
	* gnulib/import/same-inode.h: Update.
	* gnulib/import/save-cwd.c: Update.
	* gnulib/import/save-cwd.h: Update.
	* gnulib/import/scratch_buffer.h: Update.
	* gnulib/import/secure_getenv.c: Update.
	* gnulib/import/setenv.c: Update.
	* gnulib/import/signal.in.h: Update.
	* gnulib/import/stat-time.c: Update.
	* gnulib/import/stat-time.h: Update.
	* gnulib/import/stat-w32.c: Update.
	* gnulib/import/stat-w32.h: Update.
	* gnulib/import/stat.c: Update.
	* gnulib/import/stdbool.in.h: Update.
	* gnulib/import/stddef.in.h: Update.
	* gnulib/import/stdint.in.h: Update.
	* gnulib/import/stdio.in.h: Update.
	* gnulib/import/stdlib.in.h: Update.
	* gnulib/import/str-two-way.h: Update.
	* gnulib/import/strchrnul.c: Update.
	* gnulib/import/strdup.c: Update.
	* gnulib/import/streq.h: Update.
	* gnulib/import/strerror-override.c: Update.
	* gnulib/import/strerror-override.h: Update.
	* gnulib/import/strerror.c: Update.
	* gnulib/import/string.in.h: Update.
	* gnulib/import/stripslash.c: Update.
	* gnulib/import/strnlen1.c: Update.
	* gnulib/import/strnlen1.h: Update.
	* gnulib/import/strstr.c: Update.
	* gnulib/import/strtok_r.c: Update.
	* gnulib/import/sys_stat.in.h: Update.
	* gnulib/import/sys_time.in.h: Update.
	* gnulib/import/sys_types.in.h: Update.
	* gnulib/import/tempname.c: Update.
	* gnulib/import/tempname.h: Update.
	* gnulib/import/time.in.h: Update.
	* gnulib/import/unistd--.h: Update.
	* gnulib/import/unistd-safer.h: Update.
	* gnulib/import/unistd.in.h: Update.
	* gnulib/import/unsetenv.c: Update.
	* gnulib/import/verify.h: Update.
	* gnulib/import/extra/snippet/warn-on-use.h: Update.
	* gnulib/import/wchar.in.h: Update.
	* gnulib/import/wctype.in.h: Update.
	* gnulib/import/xalloc-oversized.h: Update.
	* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
	"53e2c179f26a890fa6685af4b6c1397ee370433b".
2018-08-29 12:27:19 -04:00
Gary Benson b0f492b90f Indicate batch mode failures by exiting with nonzero status
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.
2018-08-29 16:11:50 +01:00
Simon Marchi 2362e7f76a Remove newline at end of warning message
... 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.
2018-08-29 10:26:11 -04:00
Alan Hayward 36eb4c5f9b infcall-nested-structs: Test up to five fields
Aarch64 can pass structures of up to four members of identical
types in float registers (See AAPCS 5.3 and 5.4). Expand test to
cover this.

Remove the need to specify an additional sets of structures if tB
is not defined.

gdb/testsuite/
	* gdb.base/infcall-nested-structs.c (struct struct01): Remove.
	(struct struct02): Likewise.
	(struct struct03): Likewise.
	(struct struct04): Likewise.
	(struct struct_01_01): New struct.
	(struct struct_01_02): Likewise.
	(struct struct_01_03): Likewise.
	(struct struct_01_04): Likewise.
	(struct struct_02_01): Likewise.
	(struct struct_02_02): Likewise.
	(struct struct_02_03): Likewise.
	(struct struct_02_04): Likewise.
	(struct struct_04_01): Likewise.
	(struct struct_04_02): Likewise.
	(struct struct_04_03): Likewise.
	(struct struct_04_04): Likewise.
	(struct struct_05_01): Likewise.
	(struct struct_05_02): Likewise.
	(struct struct_05_03): Likewise.
	(struct struct_05_04): Likewise.
	(cmp_struct01): Remove function.
	(cmp_struct02): Likewise.
	(cmp_struct03): Likewise.
	(cmp_struct04): Likewise.
	(cmp_struct_01_01): Add Function.
	(cmp_struct_01_02): Likewise.
	(cmp_struct_01_03): Likewise.
	(cmp_struct_01_04): Likewise.
	(cmp_struct_02_01): Likewise.
	(cmp_struct_02_02): Likewise.
	(cmp_struct_02_03): Likewise.
	(cmp_struct_02_04): Likewise.
	(cmp_struct_04_01): Likewise.
	(cmp_struct_04_02): Likewise.
	(cmp_struct_04_03): Likewise.
	(cmp_struct_04_04): Likewise.
	(cmp_struct_05_01): Likewise.
	(cmp_struct_05_02): Likewise.
	(cmp_struct_05_03): Likewise.
	(cmp_struct_05_04): Likewise.
	(call_all): Add new structs.
	* gdb.base/infcall-nested-structs.exp: Likewise.
2018-08-29 11:43:53 +01:00
Alan Hayward 4f4aedebed Aarch64: Float register detection for return values
Use aapcs_is_vfp_call_or_return_candidate to detect float register
args.

gdb/
	PR gdb/22943:
	* aarch64-tdep.c (is_hfa_or_hva): Remove function.
	(aarch64_extract_return_value): Use
	aapcs_is_vfp_call_or_return_candidate.
	(aarch64_return_in_memory): Likewise.
	(aarch64_store_return_value): Likewise.
2018-08-29 11:41:45 +01:00
Alan Hayward 0e745c6011 Aarch64: Float register detection for _push_dummy_call
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.
2018-08-29 11:40:05 +01:00
Alan Hayward ea92689a17 Aarch64: Func to detect args passed in float regs
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.
2018-08-29 11:28:10 +01:00
Simon Marchi ad202fcc22 Get rid of -Wodr warning (PR build/23399)
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.
2018-08-28 17:23:16 -04:00
Philippe Waroquiers ead9aa39bf Modify gdb.base/commands.exp to test multi breakpoints command clearing.
gdb/testsuite/ChangeLog
2018-08-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/commands.exp: Test multi breakpoints command clearing.
2018-08-28 22:40:59 +02:00
Philippe Waroquiers 999700cd99 Fix regression for multi breakpoints command line 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.
2018-08-28 22:40:59 +02:00
Tom Tromey 5fe3f3e463 Remove some uses of VEC from parsers
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.
2018-08-28 11:28:15 -06:00
Simon Marchi 858d8004b0 Implement struct type_stack with a vector
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.
2018-08-28 11:13:26 -04:00
Hafiz Abid Qadeer 416a69af89 Mention csky target in the NEWS.
2018-08-28  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* NEWS: Mention csky target.
2018-08-28 12:11:39 +01:00
Hafiz Abid Qadeer 9d24df82ec Add support for new target 'csky'.
2018-08-28  Jiangshuai Li  <jiangshuai_li@c-sky.com>
	    Hafiz Abid Qadeer  <abidh@codesourcery.com>
	    Don Breazeal  <donb@codesourcery.com>

	* csky-linux-tdep.c: New file.
	* csky-tdep.c: Likewise.
	* csky-tdep.h: Likewise.
	* Makefile.in (ALL_TARGET_OBS): Add csky-linux-tdep.o and
	csky-tdep.o.
	(HFILES_NO_SRCDIR): Add csky-tdep.h.
	(ALLDEPFILES): Add csky-linux-tdep.c and csky-tdep.c
	* configure.tgt: Add csky support.
2018-08-28 12:08:11 +01:00
Jan Vrany 3bf9c013e4 MI: Fix printing of frame architecture with Python frame filters enabled
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.
2018-08-27 17:12:41 -04:00
Tom Tromey d3d8724aac Remove -Wno-narrowing from warnings.m4
This removes -Wno-narrowing from warnings.m4.
This is PR build/23087.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

	PR build/23087:
	* configure: Rebuild.
	* warning.m4 (AM_GDB_WARNINGS): Remove -Wno-narrowing.

gdb/gdbserver/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

	PR build/23087:
	* configure: Rebuild.
2018-08-27 12:00:12 -06:00
Tom Tromey 1885053bcb Avoid -Wnarrowing warnings in aarch64-linux-tdep.c
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.
2018-08-27 12:00:12 -06:00
Tom Tromey b4f183d23e Avoid -Wnarrowing warnings in gdbserver
This avoids -Wnarrowing warnings in gdbserver, by introducing some
casts to unsigned char.

gdb/gdbserver/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

	* linux-s390-low.c (s390_emit_ext, s390_emit_litpool)
	(s390_emit_const, s390_emit_reg, s390_emit_zero_ext)
	(s390_emit_stack_adjust, s390_emit_set_r2, s390x_emit_ext)
	(s390x_emit_const, s390x_emit_reg, s390x_emit_zero_ext)
	(s390x_emit_stack_adjust): Add casts to unsigned char.
2018-08-27 12:00:11 -06:00
Tom Tromey 8406672eca Avoid -Wnarrowing warnings in ppc64-tdep.c
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.
2018-08-27 12:00:11 -06:00
Tom Tromey ec40cf90a0 Fix two -Wnarrowing warnings in xtensa-tdep.h
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.
2018-08-27 12:00:10 -06:00
Tom Tromey 7bc02706c3 Avoid -Wnarrowing warnings in struct tramp_frame instances
This avoids -Wnarrowing warnings in struct tramp_frame instances,
replacing uses of -1 with a new ULONGEST_MAX.  It also redefined
TRAMP_SENTINEL_INSN to avoid the same warning.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

	* tramp-frame.h (TRAMP_SENTINEL_INSN): Redefine.
	* tilegx-linux-tdep.c (tilegx_linux_rt_sigframe): Use
	ULONGEST_MAX.
	* tic6x-linux-tdep.c (tic6x_linux_rt_sigreturn_tramp_frame): Use
	ULONGEST_MAX.
	* sparc64-linux-tdep.c (sparc64_linux_rt_sigframe): Use
	ULONGEST_MAX.
	* sparc-linux-tdep.c (sparc32_linux_sigframe)
	(sparc32_linux_rt_sigframe): Use ULONGEST_MAX.
	* ppc-nbsd-tdep.c (ppcnbsd_sigtramp, ppcnbsd2_sigtramp): Use
	ULONGEST_MAX.
	* ppc-linux-tdep.c (ppc32_linux_sigaction_tramp_frame)
	(ppc64_linux_sigaction_tramp_frame)
	(ppc32_linux_sighandler_tramp_frame)
	(ppc64_linux_sighandler_tramp_frame): Use ULONGEST_MAX.
	* nios2-linux-tdep.c (nios2_r1_linux_rt_sigreturn_tramp_frame)
	(nios2_r2_linux_rt_sigreturn_tramp_frame): Use ULONGEST_MAX.
	* mn10300-linux-tdep.c (am33_linux_sigframe)
	(am33_linux_rt_sigframe): Use ULONGEST_MAX.
	* mips64-obsd-tdep.c (mips64obsd_sigframe): Use ULONGEST_MAX.
	* mips-linux-tdep.c (mips_linux_o32_sigframe)
	(mips_linux_o32_rt_sigframe, mips_linux_n32_rt_sigframe)
	(mips_linux_n64_rt_sigframe, micromips_linux_o32_sigframe)
	(micromips_linux_o32_rt_sigframe, micromips_linux_n32_rt_sigframe)
	(micromips_linux_n64_rt_sigframe): Use ULONGEST_MAX.
	* mips-fbsd-tdep.c (mips_fbsd_sigframe, mipsn32_fbsd_sigframe)
	(mips64_fbsd_sigframe): Use ULONGEST_MAX.
	* microblaze-linux-tdep.c
	(microblaze_linux_sighandler_tramp_frame): Use ULONGEST_MAX.
	* i386-nbsd-tdep.c (i386nbsd_sigtramp_sc16, i386nbsd_sigtramp_sc2)
	(i386nbsd_sigtramp_si2, i386nbsd_sigtramp_si31)
	(i386nbsd_sigtramp_si4): Use ULONGEST_MAX.
	* hppa-nbsd-tdep.c (hppanbsd_sigtramp_si4): Use ULONGEST_MAX.
	* common/common-types.h (ULONGEST_MAX): New define.
	(CORE_ADDR_MAX): Fix formatting.
	* bfin-linux-tdep.c (bfin_linux_sigframe): Use ULONGEST_MAX.
	* arm-obsd-tdep.c (armobsd_sigframe): Use ULONGEST_MAX.
	* arm-linux-tdep.c (arm_linux_sigreturn_tramp_frame)
	(arm_linux_rt_sigreturn_tramp_frame)
	(arm_eabi_linux_sigreturn_tramp_frame)
	(arm_eabi_linux_rt_sigreturn_tramp_frame)
	(thumb2_eabi_linux_sigreturn_tramp_frame)
	(thumb2_eabi_linux_rt_sigreturn_tramp_frame)
	(arm_linux_restart_syscall_tramp_frame)
	(arm_kernel_linux_restart_syscall_tramp_frame): Use ULONGEST_MAX.
	* arm-fbsd-tdep.c (arm_fbsd_sigframe): Use ULONGEST_MAX.
	* aarch64-linux-tdep.c (aarch64_linux_rt_sigframe): Use
	ULONGEST_MAX.
	* aarch64-fbsd-tdep.c (aarch64_fbsd_sigframe): Use ULONGEST_MAX.
2018-08-27 12:00:10 -06:00
Tom Tromey 70ab8ccd4f Use CORE_ADDR_MAX in various "breaks" arrays
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.
2018-08-27 12:00:09 -06:00
Tom Tromey 896a7aa6a1 Avoid -Wnarrowing warnings from quote_char()
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".
2018-08-27 12:00:09 -06:00
Simon Marchi dd33d41d54 Fix indentation in solist.h
gdb/ChangeLog:

	* solist.h (struct solist, struct target_so_ops): Fix
	indentation.
2018-08-26 20:06:21 -04:00