Commit Graph

38285 Commits

Author SHA1 Message Date
Tom Tromey 9c37b5aed9 Remove Java support
This patch removes the Java support from gdb.  gcj has not seen much
development or use for years now, and was recently removed from GCC.
This patch changes gdb to follow; in the unlikely event that there are
still users using gcj, they can continue to use an older gdb to debug.
Or, they can debug in C++ mode.

Built and regtested on x86-64 Fedora 24.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* MAINTAINERS: Remove Java test maintainer.
	* varobj.h (java_varobj_ops): Don't declare.
	* valprint.h (struct value_print_options)
	<pascal_static_field_print>: Update comment.
	* utils.c (producer_is_gcc): Remove java reference.
	* symtab.h (struct general_symbol_info): Remove java references.
	(SYMBOL_SEARCH_NAME): Likewise.
	* objfiles.c (allocate_objfile): Update comment.
	* linespec.c (find_linespec_symbols): Remove java references.
	* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_baseclass_offset): Remove
	java references.
	* gdbtypes.h (struct cplus_struct_type) <is_java>: Remove.
	(TYPE_CPLUS_REALLY_JAVA): Remove.
	* c-varobj.c (enum vsections): Update comment.
	* symtab.c (symbol_set_language, symbol_set_names)
	(symbol_natural_name, symbol_demangled_name)
	(demangle_for_lookup, symbol_matches_domain)
	(default_make_symbol_completion_list_break_on_1): Remove java
	references.
	(JAVA_PREFIX, JAVA_PREFIX_LEN): Remove.
	* psymtab.c (match_partial_symbol, psymtab_search_name)
	(lookup_partial_symbol): Remove java references.
	* dwarf2read.c (find_slot_in_mapped_hash): Remove java references.
	(add_partial_symbol, dwarf2_compute_name, dwarf2_physname)
	(dwarf2_add_member_fn, is_vtable_name, read_structure_type)
	(process_structure_scope, read_subroutine_type)
	(read_subrange_type, load_partial_dies)
	(new_symbol_full, determine_prefix, typename_concat)
	(dwarf2_name): Remove java references.
	(set_cu_language): Treat Java as C++.
	* c-typeprint.c (c_type_print_args): Remove java reference.
	* defs.h (enum language) <language_java>: Remove.
	* Makefile.in (SFILES, HFILES_NO_SRCDIR, COMMON_OBS, YYFILES)
	(YYOBJ, local-maintainer-clean): Don't mention java files.
	* jv-exp.y, jv-lang.c, jv-lang.h, jv-typeprint.c, jv-valprint.c,
	jv-varobj.c: Remove.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* guile.texi (Types In Guile): Remove Java mentions.
	* python.texi (Types In Python): Remove Java mentions.
	* gdb.texinfo (Address Locations, Supported Languages)
	(Index Section Format): Remove Java mentions.

2016-10-06  Tom Tromey  <tom@tromey.com>

	* gdb.compile/compile.exp: Change java tests to rust.
	* gdb.base/setshow.exp: Change java tests to rust.
	* gdb.base/default.exp: Remove java from language list.
	* README (Examples): Update language example.
	* gdb.python/py-lookup-type.exp (test_lookup_type): Remove java
	test.
	* lib/gdb.exp (skip_java_tests): Remove.
	* lib/java.exp: Remove.
	* gdb.java: Remove.
2016-10-06 10:10:40 -06:00
Maciej W. Rozycki 78b86327b5 mips-tdep: Make FCRs always 32-bit
Fix a regression from commit f8b73d13b7 ("Target-described register
support for MIPS"),
<https://sourceware.org/ml/gdb-patches/2007-05/msg00340.html>,
<https://sourceware.org/ml/gdb-patches/2007-06/msg00256.html>, which
caused Floating Point Control Registers (FCRs) to be shown as 64-bit
with 64-bit targets.

This came from the legacy register format where all raw registers
matched the width of the architecture regardless of their actual size.
The correct size was then set in `mips_register_type' for cooked
registers presented to the user, which in the case of FCRs meant the
cooked size was always forced to 32 bits, reflecting their actual
hardware size, even though the raw format carried them in 64-bit
quantities on 64-bit targets.  The upper 32 bits carried in the raw FCR
format have always been don't-cares, not actually retrieved from
hardware and never written back.

With the introduction of XML register descriptions the layout of
previously defined raw registers has been preserved, so as to keep
existing register handling code unchanged and make it easier for GDB and
`gdbserver' to interact with each other whether neither, either or both
parties talking over RSP support XML register descriptions.  For the
XML-described case however `mips_register_type' is not used in raw to
cooked register conversion, so any special cases coded there are not
taken into account.

Instead a new function, `mips_pseudo_register_type', has been introduced
to handle size conversion, however lacking the special case for FCRs for
the Linux and the now defunct IRIX target.  The correct size has been
maintained for embedded targets however, due to the bundling of FCRs
with the embedded registers under the `rawnum >= MIPS_EMBED_FP0_REGNUM +
32' condition.

Add the missing case to `mips_pseudo_register_type' then, referring to
the FCR indices explicitly, and observing that between
`MIPS_EMBED_FP0_REGNUM + 32' and `MIPS_FIRST_EMBED_REGNUM' there is an
unused register slot whose contents are ignored so with the removal of
embedded FCRs from under that condition we don't have to care about it
and we can refer to the embedded registers starting from
MIPS_FIRST_EMBED_REGNUM instead.

Add a test case too so that we have means to check automatically that
the correct user-visible size of FCRs is maintained.

	gdb/
	* mips-tdep.c (mips_pseudo_register_type): Make FCRs always
	32-bit.

	gdb/testsuite/
	* gdb.arch/mips-fcr.exp: New test.
	* gdb.arch/mips-fcr.c: Source for the new test.
2016-10-06 16:56:57 +01:00
Maciej W. Rozycki a6912260f8 mips-tdep: Rearrange comments in `mips_pseudo_register_type'
Rearrange comments throughout `mips_pseudo_register_type', placing them
ahead the condtionals they apply to consistently.

	gdb/
	* mips-tdep.c (mips_pseudo_register_type): Rearrange comments
	throughout.
2016-10-06 16:54:29 +01:00
Maciej W. Rozycki 7470adbb87 testsuite: solib-disc: Use `standard_output_file'
Correct a commit 2151ccc56c ("Always organize test artifacts in a
directory hierarchy") regression causing:

Running .../gdb/testsuite/gdb.base/solib-disc.exp ...
gdb compile failed, Assembler messages:
Fatal error: can't create .../gdb/testsuite/gdb.base/so-disc-shr.c.o: No such file or directory

by using `standard_output_file' to construct output file names
throughout.

	gdb/testsuite/
	* gdb.base/solib-disc.exp: Use `standard_output_file'
	throughout.
2016-10-06 15:15:54 +01:00
Markus Metzger c620c3e48d stack: fix gdb.dwarf2/dw2-undefined-ret-addr.exp regression
Commit a038fa3e14 stack: check frame_unwind_caller_id adds a frame_id check to
frame_info and treats a missing frame_id as NOT_AVAILABLE_ERROR.  This causes a
regression in gdb.dwarf2/dw2-undefined-ret-addr.exp.

Treat a missing frame_id as OPTIMIZED_OUT_ERROR instead.

See also https://sourceware.org/ml/gdb-patches/2016-07/msg00273.html.
2016-10-06 14:32:44 +02:00
Pedro Alves 4a556533cf Fix PR11094: JIT breakpoint is not properly recreated on reruns
Even though this was supposedly in the gdb 7.2 timeframe, the testcase
in PR11094 crashes current GDB with a segfault:

  Program received signal SIGSEGV, Segmentation fault.
  0x00000000005ee894 in event_location_to_string (location=0x0) at
  src/gdb/location.c:412
  412       if (EL_STRING (location) == NULL)
  (top-gdb) bt
  #0  0x00000000005ee894 in event_location_to_string (location=0x0) at
  src/gdb/location.c:412
  #1  0x000000000057411a in print_breakpoint_location (b=0x18288e0, loc=0x0) at
  src/gdb/breakpoint.c:6201
  #2  0x000000000057483f in print_one_breakpoint_location (b=0x18288e0,
  loc=0x182cf10, loc_number=0, last_loc=0x7fffffffd258, allflag=1)
      at src/gdb/breakpoint.c:6473
  #3  0x00000000005751e1 in print_one_breakpoint (b=0x18288e0,
  last_loc=0x7fffffffd258, allflag=1) at
  src/gdb/breakpoint.c:6707
  #4  0x000000000057589c in breakpoint_1 (args=0x0, allflag=1, filter=0x0) at
  src/gdb/breakpoint.c:6947
  #5  0x0000000000575aa8 in maintenance_info_breakpoints (args=0x0, from_tty=0)
  at src/gdb/breakpoint.c:7026
  [...]

This is GDB trying to print the location spec of the JIT event
breakpoint, but that's an internal breakpoint without one.

If I add a NULL check, then we see that the JIT breakpoint is now
pending (because its location has shlib_disabled set):

  (gdb) maint info breakpoints
  Num     Type           Disp Enb Address            What
  [...]
  -8      jit events     keep y   <PENDING>           inf 1
  [...]

But that's incorrect.  GDB should have managed to recreate the JIT
breakpoint's location for the second run.  So the problem is
elsewhere.

The problem is that if the JIT loads at the same address on the second
run, we never recreate the JIT breakpoint, because we hit this early
return:

  static int
  jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
				  struct jit_program_space_data *ps_data)
  {
    [...]
    if (ps_data->cached_code_address == addr)
      return 0;

    [...]
      delete_breakpoint (ps_data->jit_breakpoint);
    [...]
    ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr);

Fix this by deleting the breakpoint and discarding the cached code
address when the objfile where the previous JIT breakpoint was found
is deleted/unloaded in the first place.

The test that was originally added for PR11094 doesn't trip on this
because:

  #1 - It doesn't test the case of the JIT descriptor's address _not_
       changing between reruns.

  #2 - And then it doesn't do "maint info breakpoints", or really
       anything with the JIT at all.

  #3 - and even then, to trigger the problem the JIT descriptor needs
       to be in a separate library, while the current test puts it in
       the main program.

The patch extends the test to cover all combinations of these
scenarios.

gdb/ChangeLog:
2016-10-06  Pedro Alves  <palves@redhat.com>

	* jit.c (free_objfile_data): Delete the JIT breakpoint and clear
	the cached code address.

gdb/testsuite/ChangeLog:
2016-10-06  Pedro Alves  <palves@redhat.com>

	* gdb.base/jit-simple-dl.c: New file.
	* gdb.base/jit-simple-jit.c: New file, factored out from ...
	* gdb.base/jit-simple.c: ... this.
	* gdb.base/jit-simple.exp (jit_run): Delete.
	(build_jit): New proc.
	(jit_test_reread): Recompile either the main program or the shared
	library, depending on what is being tested.  Skip changing address
	if caller wants to.  Compare before/after addresses.  If testing
	standalone, explicitly load the binary.  Test "maint info
	breakpoints".
	(top level): Add "standalone vs shared lib" and "change address"
	vs "same address" axes.
2016-10-06 12:53:52 +01:00
Pedro Alves 5a122fbc30 Fix a few gdb.base/jit-simple.exp problems
I noticed that we sometimes get this:

  (gdb) print &__jit_debug_descriptor
  $1 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1
  [...]
  (gdb) run
  [...]
  Starting program: build/gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple
  Unsupported JIT protocol version 4 in descriptor (expected 1)

  Breakpoint 2, main () at src/gdb/testsuite/gdb.base/jit-simple.c:36
  36        return 0;
  (gdb) print &__jit_debug_descriptor
  $2 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1

All tests PASSed, but note the "Unsupported JIT protocol version 4"
message.

Also notice that "__jit_debug_descriptor" has the same address before
and after the rerun, while the test is built in a way that should make
that address change between runs.

The test doesn't catch any of this because it doesn't compare
before/after addresses.

And then notice the "blah 1" test messages.  "blah" is clearly a WIP
message, but it should be at least "blah 2" the second time.  :-)

The reason this sometimes happens is that the test recompiles the
program and expects gdb to reload it automaticallyt on "run".  However,
if the original program and the new recompilation happen to be in the
same second, then gdb does not realize that the binary needs to be
reloaded.  (This is an old problem out of scope of this series.)  If
that happens, then GDB ends up using the wrong symbols for the program
that it spawns, reads the JIT descriptor out of the wrong address,
finds garbage, and prints that "unsupported version" notice.

Fix that in the same way gdb.base/reread.exp handles it -- by sleeping
one second before recompiling.

gdb/testsuite/ChangeLog:
2016-10-06  Pedro Alves  <palves@redhat.com>

	* gdb.base/jit-simple.exp (top level) Delete get_compiler_info
	call.
	(jit_run): Delete.
	(jit_test_reread): Use with_test_prefix.  Reload the main binary
	explicitly.  Compare the before/after addresses of the JIT
	descriptor.
2016-10-06 12:53:51 +01:00
Doug Evans ee8da4b839 Make "end" field in feature specs required again.
Newer gdbservers may be talking to older gdbs,
and older gdbs will flag a missing "end" as an error.
So just make "end" required again, and for compatibility
change the default field type to "bool".

gdb/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

	* features/aarch64-core.xml (cpsr_flags): Elide "type" and specify
	"end" in all fields.
	* features/aarch64.c: Regenerate.
	* features/i386/32bit-mpx.xml (_bndcfgu): Specify type of "preserved"
	and "enabled" fields. Correct size of "enabled" field.
	* features/i386/64bit-mpx.xml (_bndcfgu): Specify type of "preserved"
	and "enabled" fields.
	* features/i386/i386-avx-mpx-linux.c: Regenerate.
	* features/i386/i386-avx-mpx.c: Regenerate.
	* features/i386/i386-avx512-linux.c: Regenerate.
	* features/i386/i386-avx512.c: Regenerate.
	* features/i386/i386-mpx-linux.c: Regenerate.
	* features/i386/i386-mpx.c: Regenerate.
	* features/arc-arcompact.c: Regenerate.
	* features/arc-v2.c: Regenerate.
	* xml-tdesc.c (tdesc_start_field): Require "end" spec.  Single bit
	fields default to "bool" type.

	Revert 2016-03-15  Doug Evans  <dje@google.com>
	* features/i386/32bit-core.xml (i386_eflags): Remove "end" spec.
	* features/i386/32bit-sse.xml (i386_eflags): Ditto.
	* features/i386/64bit-core.xml (i386_eflags): Ditto.
	* features/i386/64bit-sse.xml (i386_eflags): Ditto.
	* features/i386/x32-core.xml (i386_eflags): Ditto.

gdb/doc/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

	* gdb.texinfo (Target Description Format): Update docs on "end"
	field spec and field default type.

gdb/testsuite/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

	* gdb.xml/extra-regs.xml: Update, end field now required, default type
	for single bitfields is bool.
	* gdb.xml/tdesc-regs.exp: Ditto.
2016-10-06 12:12:33 +01:00
Jan Kratochvil f389f6fef7 testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
gcc-6.2.1-2.fc24.x86_64

(gdb) backtrace 10^M
(gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10

(gdb) disas/s
Dump of assembler code for function main:
.../gdb/testsuite/gdb.arch/i386-signal.c:
30      {
   0x000000000040057f <+0>:     push   %rbp
   0x0000000000400580 <+1>:     mov    %rsp,%rbp
31        setup ();
   0x0000000000400583 <+4>:     callq  0x400590 <setup>
=> 0x0000000000400588 <+9>:     mov    $0x0,%eax
32      }
   0x000000000040058d <+14>:    pop    %rbp
   0x000000000040058e <+15>:    retq
End of assembler dump.

The .exp patch is an obvious typo fix I think.  The regex was written to
accept "ADDR in main" and I find it OK as checking .debug_line validity is not
the purpose of this testfile.

gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
all so there was no problem with .debug_line.

gdb/testsuite/ChangeLog
2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
2016-10-05 21:56:46 +02:00
Tom Tromey 39b5a3b9b3 PR remote/20655 - small fix in handle_tracepoint_bkpts
handle_tracepoint_bkpts has two parallel "if"s.  This changes the
second one to check ipa_error_tracepoint, which seems to be what was
intended.

2016-10-05  Tom Tromey  <tom@tromey.com>

	PR remote/20655:
	* tracepoint.c (handle_tracepoint_bkpts): Check
	ipa_error_tracepoint, not ipa_stopping_tracepoint.
2016-10-05 10:31:34 -06:00
Tom Tromey e742d386c4 PR gdb/20653 - small cleanup in string_to_explicit_location
This bug points out that string_to_explicit_location compares a char*
against '\0'; whereas comparing against NULL is more normal.

2016-10-05  Tom Tromey  <tom@tromey.com>

	PR breakpoints/20653:
	* location.c (string_to_explicit_location): Use NULL, not '\0'.
2016-10-05 10:31:34 -06:00
Tom Tromey 3e611445bf PR symtab/20652 - fix psymbol_compare
This fixes an oversight in psymbol_compare.

2016-10-05  Tom Tromey  <tom@tromey.com>

	PR symtab/20652:
	* psymtab.c (psymbol_compare): Correctly compare "ginfo.value"
	fields.
2016-10-05 10:31:34 -06:00
Yao Qi fdebf1a415 Skip complex types tests if gdb_skip_float_test
If the target doesn't support float, we don't run float complex types
tests.

gdb/testsuite:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

	* lib/gdb.exp (support_complex_tests): Return zero if
	gdb_skip_float_test return true.
2016-10-05 17:04:31 +01:00
Anton Kolesov dba4849269 Fix incorrect formatting of a ChangeLog entry
My previous commit had an invalid formatting of a ChangeLog entry.  This commit
fixes that.
2016-10-05 17:04:17 +03:00
Andreas Arnez f206f69cb4 Allow DW_OP_GNU_uninit in dwarf_expr_require_composition
In DWARF expression handling, some operators are required to be either
at the end of an expression or followed by a composition operator.  So
far only the operators DW_OP_reg0-31 were allowed to be followed by
DW_OP_GNU_uninit instead, and particularly DW_OP_regx was not, which is
obviously inconsistent.

This patch allows DW_OP_GNU_uninit after all operators requiring a
composition, to simplify the code and make it more consistent.  This
policy may be more permissive than necessary, but in the worst case just
leads to a DWARF location description resulting in an uninitialized
value instead of an error message.

gdb/ChangeLog:

	* dwarf2expr.c (dwarf_expr_require_composition): Allow
	DW_OP_GNU_uninit.
	(execute_stack_op): Use dwarf_expr_require_composition instead of
	copying its logic.
2016-10-05 12:36:29 +02:00
Anton Kolesov ed2f09e183 arc: Remove annoying debug message
The logging message is called too often - once for each register when it's
value has to be evaluated. This floods the screen for commands like "info
register all", but doesn't give really any help at debugging GDB issues.
Between increasing the debug level of this message and removing it altogether I
think that removing it is preferable.

gdb/ChangeLog:

	arc-tdep.c (arc_frame_prev_register): Remove annoying log message.
2016-10-05 13:07:44 +03:00
Yao Qi c1d0b70ae5 Update the path arm-*.xml files for aarch64
0a69eedb (Clean up the XML files for ARM) breaks the GDBserver build
on aarch64 because some arm-*.xml files can't be found.

This patch is to fix the build failure.

gdb/gdbserver:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv: Update the path of arm-*.xml files.
2016-10-05 10:00:24 +01:00
Yao Qi 5878efd480 Regenerate some regformats/rs6000/*.dat files
If I remove all regformats/*.dat files and run
make GDB=/scratch/yao/gdb/build-git/all-targets/gdb/gdb all, some
powerpc .dat files are not generated.

This patch fixes it by adding them to WHICH, so these .dat files can
be generated.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile (WHICH): Add
	rs6000/powerpc-isa205-32l, rs6000/powerpc-isa205-64l,
	rs6000/powerpc-isa205-altivec32l, rs6000/powerpc-isa205-altivec64l,
	rs6000/powerpc-isa205-vsx32l and rs6000/powerpc-isa205-vsx64l.
	* regformats/rs6000/powerpc-isa205-32l.dat: Regenerated.
	* regformats/rs6000/powerpc-isa205-64l.dat: Likewise.
	* regformats/rs6000/powerpc-isa205-altivec32l.dat: Likewise.
	* regformats/rs6000/powerpc-isa205-altivec64l.dat: Likewise.
	* regformats/rs6000/powerpc-isa205-vsx32l.dat: Likewise.
	* regformats/rs6000/powerpc-isa205-vsx64l.dat: Likewise.
2016-10-05 09:31:13 +01:00
Yao Qi defaaad599 Generate s390 target description c files
If I delete all target description c files under features/ directory,
and run make GDB=/scratch/yao/gdb/build-git/all-targets/gdb/gdb cfiles,
some s390 target description c files are not generated.

This patch adds these s390 xml files to XMLTOC, so these c files can
be generated.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile (XMLTOC): Add s390-tevx-linux64.xml,
	s390-vx-linux64.xml, s390x-tevx-linux64.xml and
	s390x-vx-linux64.xml.
2016-10-05 09:31:13 +01:00
Yao Qi 414c838a72 Simplify i386, amd64 and x32 expedite registers
Nowadays, there are a lot of duplication about
i386/{i386, amd64, x32}*-expedite in features/Makefile.  However,
in features/Makefile, we have

 echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
	  >> $(outdir)/$*.tmp

which means for a given bar/foo-baz.xml, we'll look for either
bar/foo-baz-expedite or foo-expedite.  In x86 expedite registers, we
use the former now, but it will be much simpler if we use the latter.
This is what this patch does.  This patch removes them, and defines
three generic expedite.  Re-run 'make GDB=/path/build/gdb all' to
regenerate regformats/*.dat files, and they are not changed.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile: Remove i386/*-expedite. Add i386-expedite,
	amd64-expedite, and x32-expedite.
2016-10-05 09:31:13 +01:00
Yao Qi 0a69eedb6d Clean up the XML files for ARM
This patch is move features/arm-*.xml to features/arm/, and it is based
on Terry's patch posted here
https://sourceware.org/ml/gdb-patches/2014-06/msg00794.html

One comment to Terry's patch is about losing "arm" prefix, and the new
patch fixes this problem.

gdb:

2016-10-05  Terry Guo  <terry.guo@arm.com>
	    Yao Qi  <yao.qi@linaro.org>

	* arm-tdep.c: Adjust includes.
	* features/Makefile (WHICH): Add "arm/" directory to arm
	target descriptions.
	(XMLTOC): Likewise.
	(arm/arm-with-iwmmxt.dat): Adjust the path for
	dependencies.
	* features/arm-core.xml: Moved to ...
	* features/arm/arm-core.xml: ... it.
	* features/arm-fpa.xml: Moved to ...
	* features/arm/arm-fpa.xml: ... it.
	* features/arm-m-profile.xml: Moved to ...
	* features/arm/arm-m-profile.xm: ... it.
	* features/arm-vfpv2.xml: Moved to ...
	* features/arm/arm-vfpv2.xm: ... it.
	* features/arm-vfpv3.xml: Moved to ...
	* features/arm/arm-vfpv3.xml: ... it.
	* features/arm-with-iwmmxt.c: Moved to ...
	* features/arm/arm-with-iwmmxt.c: ... it.
	* features/arm-with-iwmmxt.xml: Moved to ...
	* features/arm/arm-with-iwmmxt.xml: ... it.
	* features/arm-with-m-fpa-layout.c: Moved to ...
	* features/arm/arm-with-m-fpa-layout.c: ... it.
	* features/arm-with-m-fpa-layout.xml: Moved to ...
	* features/arm/arm-with-m-fpa-layout.xml: ... it.
	* features/arm-with-m-vfp-d16.c: Moved to ...
	* features/arm/arm-with-m-vfp-d16.c: ... it.
	* features/arm-with-m-vfp-d16.xml: Moved to ...
	* features/arm/arm-with-m-vfp-d16.xml: ... it.
	* features/arm-with-m.c: Moved to ...
	* features/arm/arm-with-m.c: ... it.
	* features/arm-with-m.xml: Moved to ...
	* features/arm/arm-with-m.xm: ... it.
	* features/arm-with-neon.c: Moved to ...
	* features/arm/arm-with-neon.c: ... it.
	* features/arm-with-neon.xml: Moved to ...
	* features/arm/arm-with-neon.xml: ... it.
	* features/arm-with-vfpv2.c: Moved to ...
	* features/arm/arm-with-vfpv2.c: ... it.
	* features/arm-with-vfpv2.xml: Moved to ...
	* features/arm/arm-with-vfpv2.xml: ... it.
	* features/arm-with-vfpv3.c: Moved to ...
	* features/arm/arm-with-vfpv3.c: ... it.
	* features/arm-with-vfpv3.xml: Moved to ...
	* features/arm/arm-with-vfpv3.xml: ... it.
	* features/xscale-iwmmxt.xml: Moved to ...
	* features/arm/xscale-iwmmxt.xml: ... it.

gdb/gdbserver:

2016-10-05  Terry Guo  <terry.guo@arm.com>
	    Yao Qi  <yao.qi@linaro.org>

	* Makefile.in: Adjust the path of rules.
	* configure.srv: Update the path of xml files.
	* regformats/arm-with-iwmmxt.dat: Regenerated.
	* regformats/arm-with-neon.dat: Likewise.
	* regformats/arm-with-vfpv2.dat: Likewise.
	* regformats/arm-with-vfpv3.dat Likewise.
2016-10-05 09:31:13 +01:00
Antoine Tremblay 9c36d9544f Add test for user context selection sync
This patch adds a test to verify that events are sent properly to all
UIs when the user selection context (inferior, thread, frame) changes.

The goal of the C test file is to provide two threads that are stopped with the
same predictable backtrace (so that we can test frame switching).  The barrier
helps us know when the child threads are started.  Then, scheduler-locking is
used to bring each thread one by one to the position we expect them to be
during the test.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/20487
	* gdb.mi/user-selected-context-sync.exp: New file.
	* gdb.mi/user-selected-context-sync.c: New file.
2016-10-03 16:56:24 -04:00
Antoine Tremblay 4034d0ff52 Emit inferior, thread and frame selection events to all UIs
With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.

This patch addresses PR gdb/20487.

In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame.  The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event.  The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.

Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console.  The format of
the frame attribute is the same as what is found in the *stopped events.

Here's a detailed example for each command and the events they generate:

thread
------

1. CLI command:

     thread 1.3

   MI event:

     =thread-selected,id="3",frame={...}

2. MI command:

     -thread-select 3

   CLI event:

     [Switching to thread 1.3 ...]

3. MI command (CLI-in-MI):

     thread 1.3

   MI event/reply:

     &"thread 1.3\n"
     ~"#0  child_sub_function () ...
     =thread-selected,id="3",frame={level="0",...}
     ^done

frame
-----

1. CLI command:

     frame 1

   MI event:

     =thread-selected,id="3",frame={level="1",...}

2. MI command:

     -stack-select-frame 1

   CLI event:

     #1  0x00000000004007f0 in child_function...

3. MI command (CLI-in-MI):

     frame 1

   MI event/reply:

     &"frame 1\n"
     ~"#1  0x00000000004007f9 in ..."
     =thread-selected,id="3",frame={level="1"...}
     ^done

inferior
--------

Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.

1. CLI command:

     inferior 2

   MI event:

     =thread-selected,id="3"

Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification.  Since there is no threads to
select, the =thread-selected event does not apply...

2. MI command (CLI-in-MI):

     inferior 2

   MI event/reply:

     &"inferior 2\n"
     ~"[Switching to inferior 2 ...]"
     =thread-selected,id="4",frame={level="0"...}
     ^done

Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed.  It is used to implement the select-frame command in
this patch.

The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement.  It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again.  It therefore protects again emitting the
event twice.

No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.

gdb/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/20487
	* NEWS: Mention new frame field of =thread-selected event.
	* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
	(add_com_suppress_notification): New function definition.
	(cmd_func): Set and restore the suppress_notification flag.
	* cli/cli-deicode.h (struct cmd_list_element)
	<suppress_notification>: New field.
	* cli/cli-interp.c (cli_suppress_notification): New global variable.
	(cli_on_user_selected_context_changed): New function.
	(_initialize_cli_interp): Attach to user_selected_context_changed
	observer.
	* command.h (struct cli_suppress_notification): New structure.
	(cli_suppress_notification): New global variable declaration.
	(add_com_suppress_notification): New function declaration.
	* defs.h (enum user_selected_what_flag): New enum.
	(user_selected_what): New enum flag type.
	* frame.h (print_stack_frame_to_uiout): New function declaration.
	* gdbthread.h (print_selected_thread_frame): New function declaration.
	* inferior.c (print_selected_inferior): New function definition.
	(inferior_command): Remove printing of inferior/thread/frame switch
	notifications, notify user_selected_context_changed observer.
	* inferior.h (print_selected_inferior): New function declaration.
	* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
	suppression to stack-select-frame and thread-select commands.
	* mi/mi-interp.c (struct mi_suppress_notification)
	<user_selected_context>: Initialize.
	(mi_user_selected_context_changed): New function definition.
	(_initialize_mi_interp): Attach to user_selected_context_changed.
	* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
	(mi_execute_command): Handle notification suppression.  Notify
	user_selected_context_changed observer on thread change instead of printing
	event directly.  Don't send it if command already sends the notification.
	(command_notifies_uscc_observer): New function.
	(mi_cmd_execute): Don't handle notification suppression.
	* mi/mi-main.h (struct mi_suppress_notification)
	<user_selected_context>: New field.
	* stack.c (print_stack_frame_to_uiout): New function definition.
	(select_frame_command): Notify user_selected_context_changed
	observer.
	(frame_command): Call print_selected_thread_frame if there's no frame
	change or notify user_selected_context_changed observer if there is.
	(up_command): Notify user_selected_context_changed observer.
	(down_command): Likewise.
	(_initialize_stack): Suppress user_selected_context notification for
	command select-frame.
	* thread.c (thread_command): Notify
	user_selected_context_changed if the thread has changed, print
	thread info directly if it hasn't.
	(do_captured_thread_select): Do not print thread switch event.
	(print_selected_thread_frame): New function definition.
	* tui/tui-interp.c (tui_on_user_selected_context_changed):
	New function definition.
	(_initialize_tui_interp): Attach to user_selected_context_changed
	observer.

gdb/doc/ChangeLog:

	PR gdb/20487
	* gdb.texinfo (Context management): Update mention of frame
	change notifications.
	(gdb/mi Async Records): Document frame field in
	=thread-select event.
	* observer.texi (GDB Observers): New user_selected_context_changed
	observer.

gdb/testsuite/ChangeLog:

	PR gdb/20487
	* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
	=thread-select-event check.
2016-10-03 16:54:58 -04:00
Yao Qi 17e1648598 PR 20627: Use resume_stop to stop lwp
Commit 049a8570 (Use target_continue{,_no_signal} instead of target_resume)
replaces the code stopping lwp with target_continue_no_signal in
target_stop_and_wait, like this,

-  resume_info.thread = ptid;
-  resume_info.kind = resume_stop;
-  resume_info.sig = GDB_SIGNAL_0;
-  (*the_target->resume) (&resume_info, 1);
+  target_continue_no_signal (ptid);

the replacement is not equivalent, and it causes PR 20627.  This patch
is just to revert that change.

Regression testing it on x86_64-linux.

gdb/gdbserver:

2016-09-30  Yao Qi  <yao.qi@linaro.org>

	PR gdbserver/20627
	* target.c (target_stop_and_wait): Don't call
	target_continue_no_signal, use resume_stop instead.
2016-09-30 18:39:12 +01:00
Peter Bergner a4297203ea Update tests to account for the L operand being compulsory.
* gdb.arch/powerpc-power.exp <cmprb>: Update tests to account for
	the compulsory L operand changes.
	* gdb.arch/powerpc-power.s: Likewise.
2016-09-29 15:21:55 -05:00
Jan Kratochvil bb805577d2 PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
Regression: gdb --pid $(pidof qemu-system-x86_64) stopped working with gdb 7.11.1
https://sourceware.org/bugzilla/show_bug.cgi?id=20609

It was reported for qemu-system-x86_64 but it happens for any multithreaded
inferior with a JIT debugging hook.

136613ef0c6850427317e57be1b644080ff6decb is the first bad commit
Author: Pedro Alves <palves@redhat.com>
    Fix PR gdb/19828: gdb -p <process from a container>: internal error
Message-ID: <cbdf2e04-4fa8-872a-2a23-08c9c1b26e00@redhat.com>
https://sourceware.org/ml/gdb-patches/2016-05/msg00450.html

jit_breakpoint_re_set() is specific by trying to insert a breakpoint into the
main executable, not into a shared library.  During attachment GDB thinks it
needs to use 'breakpoint always-inserted' from
breakpoints_should_be_inserted_now() as a newly attached thread is
'thread_info->executing' due to 'lwp_info->must_set_ptrace_flags' enabled and
the task not yet stopped.  This did not happen before the 'bad commit' above
which adds tracking of such thread.

GDB then fails to insert the breakpoints to invalid address as PIE executable
gets properly relocated during later phase of attachment.  One can see in the
backtraces below:
 -> jit_breakpoint_re_set_internal()
later:
 -> svr4_exec_displacement()

One can suppress the initial breakpoint_re_set() call as there will be another
breakpoint_re_set() done from the final post_create_inferior() call in
setup_inferior().

BTW additionally 'threads_executing' cache bool is somehow stale (somewhere is
missing update_threads_executing()).  I was trying to deal with that in my
first/second attempt below but in my final third attempt (attached) I have
left it as it is.

First attempt trying not to falsely require 'breakpoint always-inserted':
  https://people.redhat.com/jkratoch/rhbz1375553-fix1.patch
Reduced first attempt:
  https://people.redhat.com/jkratoch/rhbz1375553-fix2.patch

The third attempt suppresses breakpoint insertion until PIE executable gets
relocated by svr4_exec_displacement().  Applied.

gdb/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
	* exec.c (exec_file_locate_attach): Add parameter defer_bp_reset.
	Use it.
	* gdbcore.h (exec_file_locate_attach): Add parameter defer_bp_reset.
	* infcmd.c (setup_inferior): Update caller.
	* remote.c (remote_add_inferior): Likewise.

gdb/testsuite/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
	* gdb.base/jit-attach-pie.c: New file.
	* gdb.base/jit-attach-pie.exp: New file.
2016-09-29 17:39:39 +02:00
Pedro Alves 6d61dee599 Fix PR 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed
If you run an infcall from the command line, and immediately after run
some other command, GDB incorrectly processes the other command before
the infcall finishes.

The problem is that the fix for PR gdb/20418 (Problems with
synchronous commands and new-ui, git 3eb7562a98) moved the
add_file_handler/delete_file_handler calls out of
target_terminal_$foo, and missed adjusting the infcall code.

gdb/ChangeLog:
2016-09-28  Pedro Alves  <palves@redhat.com>

	* infcall.c (run_inferior_call): Remove input from the event
	loop while running the infcall.

gdb/testsuite/ChangeLog:
2016-09-28  Pedro Alves  <palves@redhat.com>

	* gdb.base/infcall-input.c: New file.
	* gdb.base/infcall-input.exp: New file.
2016-09-28 17:44:57 -04:00
Tom Tromey 4435e1cc62 Small improvements to the remote protocol manual
I was reading the gdb RSP manual recently and I found a number of
small problems in the documentation.  This patch attempts to improve
these areas.  Specfically:

* The term "memory breakpoint" is used only in this section of the
  manual, and there inconsistently.  I found this term confusing --
  initially I thought it might be a watchpoint.  This patch changes it
  to use the term "software breakpoint", which is used in the rest of
  the manual.

* The z0 packet didn't document how "kind" was written.  And, it had a
  stray link to the architecture-specific protocol details node.  This
  patch moves this link to a better spot.

* The z1 patch didn't document that it accepts cmd_list.

* I couldn't find any text saying what response is given to a command
  like vCont in non-stop mode.  The answer is that OK is sent, and
  then a stop reply is sent as a notification.  This patch adds a note
  about this.

* The "create" stop reply did not document that the "R" argument is
  ignored.

* The "W", "X", and "w" packets did not document how the "AA" part is
  formatted.

* The %Stop notification example said "%%Stop", but I think this is
  incorrect.

2016-09-28  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Packets) <z0>: Use "software breakpoint" rather
	than "memory breakpoint".  Further document "kind".  Move
	protocol-details link earlier.
	<z1>: Document the cmd_list argument.  Fix typo.
	<g>: Remove incorrect sentence.
	(Stop Reply Packets): Document "OK" response to requests when in
	non-stop mode.
	<swbreak>: Use "software breakpoint" rather than "memory
	breakpoint".
	<create>: Document that "R" is ignored.
	<W, X, w>: Document formatting of "AA".
	(Notification Packets): Use "%Stop", not "%%Stop".
2016-09-28 11:06:32 -06:00
Fredrik Hederstierna ca90e76046 Detect the magic address of EXC_RETURN in ARM coretx-m profile
On ARMv6-M and ARMv7-M, the exception return address is sort of magic
address defined by the manual.  This patch is to let GDB well handle
these magic addresses.

2016-09-27  Fredrik Hederstierna  <fredrik.hederstierna@verisure.com>

	* arm-tdep.c (arm_m_addr_is_magic): New function.
	(arm_addr_bits_remove): Call arm_m_addr_is_magic.
	(arm_m_exception_unwind_sniffer): Likewise.
2016-09-27 02:02:47 +01:00
Yao Qi edeeb60243 Call debug_exit in linux_wait_1
When I read the GDBserver debug message, I find the "entering" of
linux_wait_1 doesn't match the "existing" of linux_wait_1.  Looks
we don't call debug_exit somewhere in linux_wait_1 on return.

gdb/gdbserver:

2016-09-26  Yao Qi  <yao.qi@linaro.org>

	* linux-low.c (linux_wait_1): Call debug_exit.
2016-09-26 04:01:19 +01:00
Jon Turney 9eee20eb54 Fix a use of target_mourn_inferior in windows-nat.c
One use of target_mourn_interior seems to have been missed in bc1e6c81

gdb/ChangeLog:

2016-09-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (windows_delete_thread): Adjusting call to
	target_mourn_inferior to include ptid_t argument.
2016-09-24 14:49:38 +01:00
Tom Tromey a97e29d248 Use std::string rather than dyn-string
This patch changes some code in cli-cmds.c to use std::string rather
than dyn-string, removing some cleanups.  Since this was the last use
of dyn-string in gdb, this patch also removes
make_cleanup_dyn_string_delete.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_dyn_string_delete): Remove declaration.
	* utils.c: Don't include dyn-string.h.
	(do_dyn_string_delete, make_cleanup_dyn_string_delete): Remove.
	* cli/cli-cmds.c: Include <string>.  Don't include dyn-string.h.
	(argv_to_string): Rename.  Change return type to std::string.
	(alias_command): Use std::string.
2016-09-23 11:37:09 -06:00
Tom Tromey cfe826d45e Use std::vector in objfiles.c
This patch changes a spot in objfiles.c to use a std::vector, removing
a cleanup.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* objfiles.c: Include <vector>.
	(objfile_relocate): Use std::vector.
2016-09-23 11:37:08 -06:00
Tom Tromey ab8b80a885 Use std::string, std::vector in rust-lang.c
This patch changes some spots in rust-lang.c to use std::string or
std::vector, removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* rust-lang.c: Include <string> and <vector>.
	(rust_evaluate_funcall): Use std::vector, std::string.
	(rust_evaluate_subexp): Use std::string.
	(rust_lookup_symbol_nonlocal): Use std::string.
2016-09-23 11:37:08 -06:00
Tom Tromey 05d49c372d Use std::string in cp-namespace.c
This changes a few spots in cp-namespace.c to use std::string,
removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* cp-namespace.c: Include <string>.
	(cp_search_static_and_baseclasses)
	(cp_lookup_symbol_imports_or_template, find_symbol_in_baseclass):
	Use std::string.
2016-09-23 11:37:07 -06:00
Tom Tromey 5809899dad Use std::string in break-catch-sig.c
This changes one spot in break-catch-sig.c to use std::string,
removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* break-catch-sig.c: Include <string>.
	(signal_catchpoint_print_one): Use std::string.
2016-09-23 11:37:06 -06:00
Tom Tromey 3e25a500a1 Remove some unnecessary code
This patch removes some unnecessary code.  In particular,
terminate_minimal_symbol_table is declared in minsyms.h, so it doesn't
need to be declared in objfiles.h as well.  And,
restore_ui_out_closure was rendered unnecessary by an earlier patch,
so the structure definition can be removed now.

I'm checking this in as obvious.

Tested by rebuilding on x86-64 Fedora 24 with --enable-targets=all;
which would notice any missing includes of minsyms.h.

2016-09-23  Tom Tromey  <tom@tromey.com>

	* utils.c (struct restore_ui_out_closure): Remove.
	* objfiles.h (terminate_minimal_symbol_table): Don't declare.
2016-09-23 11:31:35 -06:00
Yao Qi 97e64e5ab1 Replace sprintf with xsnprintf in nat/linux-osdata.c
I see the following build warning when I build GDB with GCC trunk.

../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_fds(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:767:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
 linux_xfer_osdata_fds (gdb_byte *readbuf,
 ^~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:800:51: note: format output between 7 and 262 bytes into a destination of size 17
        sprintf (procentry, "/proc/%s", dp->d_name);
                                                   ^
../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_threads(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:555:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
 linux_xfer_osdata_threads (gdb_byte *readbuf,
 ^~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:588:51: note: format output between 7 and 262 bytes into a destination of size 17
        sprintf (procentry, "/proc/%s", dp->d_name);
                                                   ^
cc1plus: all warnings being treated as errors

The warning is a false positive, but we can workaround it by replacing
sprintf with xsnprintf.  On the other hand, it is always preferred to
use xsnprintf.

gdb:

2016-09-23  Yao Qi  <yao.qi@linaro.org>

	* nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
	sprintf with xsnprintf.
	(linux_xfer_osdata_fds): Likewise.
2016-09-23 17:27:26 +01:00
Pedro Alves 503b1c39dc gdb: Replace operator new / operator new[]
If xmalloc fails allocating memory, usually because something tried a
huge allocation, like xmalloc(-1) or some such, GDB asks the user what
to do:

  .../src/gdb/utils.c:1079: internal-error: virtual memory exhausted.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)

If the user says "n", that throws a QUIT exception, which is caught by
one of the multiple CATCH(RETURN_MASK_ALL) blocks somewhere up the
stack.

The default implementations of operator new / operator new[] call
malloc directly, and on memory allocation failure throw
std::bad_alloc.  Currently, if that happens, since nothing catches it,
the exception escapes out of main, and GDB aborts from unhandled
exception.

This patch replaces the default operator new variants with versions
that, just like xmalloc:

 #1 - Raise an internal-error on memory allocation failure.

 #2 - Throw a QUIT gdb_exception, so that the exact same CATCH blocks
      continue handling memory allocation problems.

A minor complication of #2 is that operator new can _only_ throw
std::bad_alloc, or something that extends it:

  void* operator new (std::size_t size) throw (std::bad_alloc);

That means that if we let a gdb QUIT exception escape from within
operator new, the C++ runtime aborts due to unexpected exception
thrown.

So to bridge the gap, this patch adds a new gdb_quit_bad_alloc
exception type that inherits both std::bad_alloc and gdb_exception,
and throws _that_.

If we decide that we should be catching memory allocation errors in
fewer places than all the places we currently catch them (everywhere
we use RETURN_MASK_ALL currently), then we could change operator new
to throw plain std::bad_alloc then.  But I'm considering such a change
as separate matter from this one -- it'd make sense to do the same to
xmalloc at the same time, for instance.

Meanwhile, this allows using new/new[] instead of xmalloc/XNEW/etc.
without losing the "virtual memory exhausted" internal-error
safeguard.

Tested on x86_64 Fedora 23.

gdb/ChangeLog:
2016-09-23  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SFILES): Add common/new-op.c.
	(COMMON_OBS): Add common/new-op.o.
	(new-op.o): New rule.
	* common/common-exceptions.h: Include <new>.
	(struct gdb_quit_bad_alloc): New type.
	* common/new-op.c: New file.

gdb/gdbserver/ChangeLog:
2016-09-23  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SFILES): Add common/new-op.c.
	(OBS): Add common/new-op.o.
	(new-op.o): New rule.
2016-09-23 16:42:24 +01:00
Yao Qi f73842fc84 Close gdbserver in mi_gdb_exit
In commit 6423214f (testsuite: Don't use expect_background to reap
gdbserver), we override gdb_exit in lib/gdbserver-support.exp, so
that we can close gdbserver first.  However, we don't close gdbserver
in mi_gdb_exit.  This makes a problem in my aarch64 mulit-arch testing,
in which I run some mi tests, mi-watch.exp for example, in different
variations (aarch64 and arm),

Schedule of variations:
    junor0-2
    junor0-2-arm/-marm
    junor0-2-arm/-mthumb

When the test is done in the first variation (aarch64), test case is
recompiled for arm, but GDBserver with aarch64 program is still
running.  When the second variation is started, GDB loads arm program,
but GDBserver still loads aarch64 program because the old GDBserver
process is using it.  We'll get,

47-target-select remote junor0-2:2350^M
&"warning: Selected architecture arm is not compatible with reported target architecture aarch64\n"^M
&"warning: Architecture rejected target-supplied description\n"

This patch fixes this problem by closing GDBserver in mi_gdb_exit.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

	* lib/gdbserver-support.exp: Rename mi_gdb_exit.
	(gdb_exit): Rename it to ...
	(gdbserver_gdb_exit): ...  Close GDBserver.
	(gdb_exit): New proc, call gdbserver_gdb_exit.
	(mi_gdb_exit): Likewise.
2016-09-22 16:04:03 +01:00
Edjunior Barbosa Machado de6784544a Fix build breakage from commit 6ec2b2
I was notified by buildbot that my patch (commit 6ec2b2) has broken the build
on x86_64:

../../binutils-gdb/gdb/rs6000-tdep.c: In function int ppc_process_record_op31(gdbarch*, regcache*, CORE_ADDR, uint32_t):
../../binutils-gdb/gdb/rs6000-tdep.c:4705:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*)
         tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
                                                  ^
../../binutils-gdb/gdb/rs6000-tdep.c:4718:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*)
         tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
                                                  ^
The patch below should fix it.

gdb/ChangeLog:
2016-09-22  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* rs6000-tdep.c (ppc_process_record_op31): Fix
	regcache_raw_read_unsigned call using the correct parameter type.
2016-09-22 11:36:37 -03:00
Yao Qi 90681dabc7 Use gdbserver-base in remote-gdbserver-on-localhost.exp
This patch is to make remote-gdbserver-on-localhost.exp use gdbserver-base
and remove duplicated code.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

	* boards/gdbserver-base.exp (gdb_server_prog): Set the absolute
	path.
	* boards/remote-gdbserver-on-localhost.exp: Use gdbserver-base.
	Remove duplication.
2016-09-22 14:36:54 +01:00
Anton Kolesov fa42dd2e83 arc: Fix ARI warning for printf(%p)
Replace printf ("%p") with printf ("%s", host_address_to_string ()). Printing
host addrss might make sense here because pointers can be null and this would
affect how function behaves.

This particular warning is printed only when option -Wari is passed to
contrib/ari/gdb_ari.sh

gdb/ChangeLog:

	* arc-tdep.c: Fix ARI warning for printf(%p).
2016-09-22 14:26:44 +03:00
Yao Qi 9c211fd8d6 Check the right proc name
In lib/gdbserver-support.exp, we rename gdb_exit to
gdbserver_orig_gdb_exit, but we check the existence gdbserver_gdb_exit.
We should check gdbserver_orig_gdb_exit instead.  Looks it is a typo
or an oversight.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

	* lib/gdbserver-support.exp: Check the existence of
	gdbserver_orig_gdb_exit rather than gdbserver_gdb_exit.
2016-09-22 10:04:19 +01:00
Anton Kolesov 31da3f27d7 Add myself as a write-after-approval GDB maintainer
gdb/ChangeLog:

	* MAINTAINERS (Write After Approval): Add Anton Kolesov.
2016-09-21 21:09:15 +03:00
Anton Kolesov ad0a504f7e arc: New Synopsys ARC port
ARC is a family of licensable processors developed by Synopsys.

This is an initial patch that doesn't yet support some of the features, that
are already available in Synopsys' fork of GDB, namely:

  * longjmp support
  * signal frame handling
  * prologue analysis
  * Linux targets support
  * native Linux support

ARC cores are configurable and extensible, which means from debugger
perspective that some registers and debug capabilities are optional, therefore
it is up to the GDB stub to determine exact list of register available on
target and supply it to GDB via XML target descriptions.  List of registers
that is known to GDB and is required is intentionally kept small to simplify
requirements to GDB stub and implementation of a GDB client.

gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Add arc-tdep.o.
	(HFILES_NO_SRCDIR): Add arc-tdep.h.
	(ALLDEPFILES): Add arc-tdep.c.
	* NEWS: Mention new ARC port.
	* configure.tgt: Add ARC.
	* arc-tdep.c: New file.
	* arc-tdep.h: New file.
	* features/Makefile (XMLTOC): Add arc-v2.xml and arc-arcompact.xml.
	* features/arc-v2.xml: New file.
	* features/arc-v2.c: New file (generated).
	* features/arc-arcompact.xml: New file.
	* features/arc-arcompact.c: New file (generated).

gdb/doc/ChangeLog:

	* gdb.texinfo (Embedded Processors): Document ARC.
	(Synopsys ARC): New section.
	(Standard Target Features): Document ARC features.
	(ARC Features): New section.

gdb/testsuite/ChangeLog:

	* gdb.xml/tdesc-regs.exp: set core-regs for arc*-*-elf32.
2016-09-21 21:07:06 +03:00
Edjunior Barbosa Machado 8aabe2e254 ppc: Fix return of instruction handlers in ppc_process_record_op63
some instruction handlers in ppc_process_record_op63() seem to be missing
return or incorrectly using break. This patch aims to fix that.

gdb/ChangeLog:
2016-09-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* rs6000-tdep.c (ppc_process_record_op63): Fix return of instruction
	handlers.
2016-09-21 14:47:43 -03:00
Tom Tromey 36cf1806a8 PR gdb/20604 - fix "quit" when an invalid expression is used
This fixes PR gdb/20604.  The bug here is that passing an invalid
expression to "quit" -- e.g., "quit()" -- causes gdb to enter a
non-functioning state.

The immediate problem is that quit_force resets the terminal before
evaluating the expression.  However, it seemed to me that it doesn't
really make sense to pass the quit_force argument to kill_or_detach
(which passes it to to_detach), first because conflating the exit
status for "quit" and the signal to pass when detaching doesn't make
sense, and second because to_detach implementations generally only
accept a constant here, while "quit" accepts an expression.  So, I
removed that.

As an aside, I think the "detach SIGNO" functionality is not
documented.

Built and regtested on x86-64 Fedora 24.

2016-09-21  Tom Tromey  <tom@tromey.com>

	PR gdb/20604:
	* top.h (quit_force): Update.
	* top.c (quit_force): Changed type of first argument.  Don't
	evaluate expression.  Pass NULL to kill_or_detach.
	* cli/cli-cmds.c (quit_command): Evaluate "args".

2016-09-21  Tom Tromey  <tom@tromey.com>

	PR gdb/20604:
	* gdb.base/quit.exp: New file.
2016-09-21 11:39:37 -06:00
Simon Marchi 74172ecf37 Update and add .gitignore's
This patch adds a bunch of generated files to gdb's gitignore files.
There are still a bunch of "stamp" files that are not ignored, but I
think the rule for them should be put in the top-level gitignore.

Users and developers are encouraged to build out-of-tree, but some
people prefer the simplicity to build in-tree, so it should be useful
for them.

gdb/ChangeLog:

	* .gitignore: Ignore more files.
	* data-directory/.gitignore: Likewise.

gdb/doc/ChangeLog:

	* .gitignore: New file.

gdb/gdbserver/ChangeLog:

	* .gitinore: Ignore more files.

gdb/testsuite/ChangeLog:

	* .gitignore: New file.
2016-09-21 13:12:21 -04:00
Edjunior Barbosa Machado 6ec2b213de ppc: Add Power ISA 3.0/POWER9 instructions record support
gdb/ChangeLog:
2016-09-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* rs6000-tdep.c (PPC_DQ): New macro.
	(ppc_process_record_op4): Add Power ISA 3.0 instructions.
	(ppc_process_record_op19): Likewise.
	(ppc_process_record_op31): Likewise.
	(ppc_process_record_op59): Likewise.
	(ppc_process_record_op60): Likewise.
	(ppc_process_record_op63): Likewise.
	(ppc_process_record): Likewise.
	(ppc_process_record_op61): New function.
2016-09-21 13:30:39 -03:00