Commit Graph

94590 Commits

Author SHA1 Message Date
Pedro Alves 1d39de443a Remove stale inline function handling from selftest_setup
Before commit 70ee000084 ("[gdb] Allow function arguments in bp
print match in selftest_setup"), this pattern in selftest_setup:

	-re "Starting program.*Breakpoint \[0-9\]+,.* at .*main.c:.*$function.*$gdb_prompt $" {
	    # $function may be inlined, so the program stops at the line
	    # calling $function.
	    pass "$description"
	}

happened to match if captured_main_1 was inlined and captured_main was
not, because captured_main calls captured_main_1 first thing, which
coincidentally matches "$function.*":

 Breakpoint 1, captured_main (data=<optimized out>) at src/gdb/main.c:1147
 1147      captured_main_1 (context);

That would probably be better "$function .*", with a space, but I
think that even better is to remove the "may be inlined" case too now,
because since ddfe970e6b ("Don't elide all inlined frames") GDB
presents the stop at the inline function instead of at the caller.

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

	* lib/selftest-support.exp (selftest_setup): Remove inlined
	function handling.
2018-06-14 11:40:23 +01:00
Tom de Vries 70ee000084 [gdb] Allow function arguments in bp print match in selftest_setup
2018-06-14  Tom de Vries  <tdevries@suse.de>

	* lib/selftest-support.exp (selftest_setup): Allow function arguments in
	matching of breakpoint printing.
2018-06-14 12:06:10 +02:00
Tom de Vries 11f4b608e6 [gdb/testsuite] Add missing ChangeLog entries 2018-06-14 11:08:32 +02:00
Alan Modra 7f923b7fd2 ELF dynsyms
Many ELF targets arrange to emit a number of section symbols in
.dynsym for use by dynamic relocations.  This happens before the
dynamic relocations are output, and the need for those symbols
determined.  In most cases they are not needed.  A proper analysis of
the need for dynamic section symbols is target specific and tedious,
so this patch just excludes them in the obvious case when no
dynamic relocations are present.

The patch also runs the new pr23161 and pr23162 tests on more targets.

bfd/
	* elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs".
	* elflink.c (_bfd_elf_init_2_index_sections): Comment fix.
	(_bfd_elf_add_dynamic_entry): Set "dynamic_relocs".
	(_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when
	"dynamic_relocs" is not set.
	* elfxx-mips.c (count_section_dynsyms): Likewise.
ld/
	* testsuite/ld-elf/readelf.exp: Delete DUMP and selection of
	variant ver_def.vd.
	* testsuite/ld-elf/ver_def-tic6x.vd: Delete.
	* testsuite/ld-elf/shared.exp: Run most pr23161 and pr23162 tests for
	linux, nacl and gnu targets.
	* testsuite/ld-mips-elf/mips-elf.exp: Set base_syms to 1.
	* testsuite/ld-elf/pr23161a.rd: Don't check reloc type.  Allow any
	order of __bss_start, _edata and _end.
	* testsuite/ld-elf/pr23161b.rd: Don't check plt and dyn relocs.
	Allow and order of __bss_start, _edata and _end.
	* testsuite/ld-elf/pr23162.rd: Fail if __bss_start, _edata or _end
	relocs are present rather than testing for no relocations.
	* testsuite/ld-aarch64/gc-plt-relocs.d,
	* testsuite/ld-aarch64/ifunc-1-local.d,
	* testsuite/ld-aarch64/ifunc-1.d,
	* testsuite/ld-aarch64/ifunc-2-local.d,
	* testsuite/ld-aarch64/ifunc-2.d,
	* testsuite/ld-aarch64/ifunc-21.d,
	* testsuite/ld-aarch64/ifunc-3a.d,
	* testsuite/ld-arm/farcall-mixed-lib-v4t.d,
	* testsuite/ld-arm/farcall-mixed-lib.d,
	* testsuite/ld-arm/gc-hidden-1.d,
	* testsuite/ld-arm/tls-gdesc-got.d,
	* testsuite/ld-arm/tls-lib-loc.d,
	* testsuite/ld-arm/tls-longplt-lib.d,
	* testsuite/ld-arm/tls-thumb1.d,
	* testsuite/ld-cris/libdso-10.d,
	* testsuite/ld-cris/libdso-11.d,
	* testsuite/ld-cris/libdso-13b.d,
	* testsuite/ld-cris/libdso-14.d,
	* testsuite/ld-cris/libdso-15.d,
	* testsuite/ld-cris/pic-gc-72.d,
	* testsuite/ld-cris/pic-gc-73.d,
	* testsuite/ld-cris/tls-gc-71.d,
	* testsuite/ld-mips-elf/mips16-pic-4a.nd,
	* testsuite/ld-mips-elf/pic-and-nonpic-3a.dd,
	* testsuite/ld-mips-elf/pie-n32.d,
	* testsuite/ld-mips-elf/pie-n64.d,
	* testsuite/ld-mips-elf/pie-o32.d: Update for removed dynamic
	section symbols.
2018-06-14 11:32:01 +09:30
Alan Modra ff91d2f0e2 PR23282, Reinstate seek optimization
PR 23282
	* bfdio.c (bfd_seek): Optimize away seeks to current position.
2018-06-14 11:32:01 +09:30
Simon Marchi ab89b5a57c Fix GDB sparc build
Cross-compiling for sparc64 bumped into a few issues, fixed by this
patch.

1. Include target.h in sparc-nat.h fixes:

/home/emaisin/src/binutils-gdb/gdb/sparc-nat.h:45:8: error: ‘target_xfer_status’ does not name a type
 extern target_xfer_status sparc_xfer_wcookie (enum target_object object,

2. Remove extra semi-colon at sparc64-linux-nat.c:40 fixes:

/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:41:3: error: expected unqualified-id before ‘{’ token
   { sparc_store_inferior_registers (this, regcache, regnum); }

3. Remove "this" argument fixes:

/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::fetch_registers(regcache*, int)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:38:59: error: cannot convert ‘sparc64_linux_nat_target*’ to ‘regcache*’ for argument ‘1’ to ‘void sparc_fetch_inferior_registers(regcache*, int)’
   { sparc_fetch_inferior_registers (this, regcache, regnum); }
                                                           ^
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::store_registers(regcache*, int)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:41:59: error: cannot convert ‘sparc64_linux_nat_target*’ to ‘regcache*’ for argument ‘1’ to ‘void sparc_store_inferior_registers(regcache*, int)’
   { sparc_store_inferior_registers (this, regcache, regnum); }
                                                           ^
4. Use sparc64_forget_process instead of sparc_forget_process fixes:

/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::low_forget_process(pid_t)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:47:30: error: ‘sparc_forget_process’ was not declared in this scope
   { sparc_forget_process (pid); }
                              ^

gdb/ChangeLog:

	* sparc-nat.h: Include target.h.
	* sparc64-linux-nat.c (class sparc64_linux_nat_target)
	<fetch_registers>: Remove this argument in function call.
	<store_registers>: Remove this argument in function call, remove
	extra semicolon.
	<low_forget_process>: Call sparc64_forget_process instead of
	sparc_forget_process.
2018-06-13 21:57:55 -04:00
GDB Administrator 7be6cc9284 Automatic date update in version.in 2018-06-14 00:00:36 +00:00
Scott Egerton 730c31740a MIPS: Add CRC ASE support
Add support for the CRC Application Specific Extension for Release 6 of
the MIPS Architecture.

[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 143-148

[2] "MIPS Architecture for Programmers Volume II-A: The MIPS64
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00087, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 165-170

ChangeLog:

bfd/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* elfxx-mips.c (print_mips_ases): Add CRC.

binutils/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* readelf.c (print_mips_ases): Add CRC.

gas/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>
            Maciej W. Rozycki  <macro@mips.com>

	* config/tc-mips.c (options): Add OPTION_CRC and OPTION_NO_CRC.
	(md_longopts): Likewise.
	(md_show_usage): Add help for -mcrc and -mno-crc.
	(mips_ases): Define availability for CRC and CRC64.
	(mips_convert_ase_flags): Map ASE_CRC to AFL_ASE_CRC.
	* doc/as.texinfo: Document -mcrc, -mno-crc.
	* doc/c-mips.texi: Document -mcrc, -mno-crc, .set crc and
	.set no-crc.
	* testsuite/gas/mips/ase-errors-1.l: Add error checks for CRC
	ASE.
	* testsuite/gas/mips/ase-errors-2.l: Likewise.
	* testsuite/gas/mips/ase-errors-1.s: Likewise.
	* testsuite/gas/mips/ase-errors-2.s: Likewise.
	* testsuite/gas/mips/crc.d: New test.
	* testsuite/gas/mips/crc64.d: New test.
	* testsuite/gas/mips/crc-err.d: New test.
	* testsuite/gas/mips/crc64-err.d: New test.
	* testsuite/gas/mips/crc-err.l: New test stderr output.
	* testsuite/gas/mips/crc64-err.l: New test stderr output.
	* testsuite/gas/mips/crc.s: New test source.
	* testsuite/gas/mips/crc64.s: New test source.
	* testsuite/gas/mips/crc-err.s: New test source.
	* testsuite/gas/mips/crc64-err.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

include/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* elf/mips.h (AFL_ASE_CRC): New macro.
	(AFL_ASE_MASK): Update to include AFL_ASE_CRC.
	* opcode/mips.h (ASE_CRC): New macro.
	* opcode/mips.h (ASE_CRC64): Likewise.

opcodes/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* mips-dis.c (mips_arch_choices): Add CRC and CRC64 ASEs.
	* mips-opc.c (CRC, CRC64): New macros.
	(mips_builtin_opcodes): Define crc32b, crc32h, crc32w,
	crc32cb, crc32ch and crc32cw for CRC.  Define crc32d and
	crc32cd for CRC64.
2018-06-13 15:39:05 +01:00
Tom de Vries a08ac84b96 [gdb/testsuite] Fix hang in fork-running-state.c
When I run make check:
...
$ cd build/gdb
$ make check 2>&1 | tee ../CHECKLOG.gdb
...
I see after ~30m the summary of the test run printed, but make still hangs.

This seems to be due to some sleeping processes:
...
$ ps  fx | grep fork-run
 6475 ?        S      0:00 gdb.base/fork-running-state/fork-running-state
 6451 ?        S      0:00 gdb.base/fork-running-state/fork-running-state
 6427 ?        S      0:00 gdb.base/fork-running-state/fork-running-state
...

Killing the sleeping processes like this:
...
kill -9 $(ps -A  | grep fork-running-st | awk '{print $1}')
...
allows make to finish.

If I isolate one debug session from fork-running-state.exp that causes one of
these sleeping processes, we get:
...
(gdb) set non-stop on
(gdb) break main
Breakpoint 1 at 0x400665: file src/gdb/testsuite/gdb.base/fork-running-state.c,
line 52.
(gdb) run
Starting program: build/gdb/testsuite/outputs/gdb.base/fork-running-state/
fork-running-state

Breakpoint 1, main () at src/gdb/testsuite/gdb.base/fork-running-state.c:52
52        save_parent = getpid ();
(gdb) set detach-on-fork on
(gdb) set follow-fork parent
(gdb) continue &
Continuing.
[Detaching after fork from child process 18797]
(gdb) info threads
  Id   Target Id         Frame
* 1    process 18793 "fork-running-st" (running)
(gdb) set print inferior-events off
(gdb) kill inferior 1
...
So, AFAIU, the hanging process is the child process that gdb detaches from.

There's an alarm set in main before the fork, but alarms are not preserved in
the fork child:
...
$ man alarm
   ...
NOTES
       Alarms created by alarm() are preserved across execve(2) and are not
       inherited by children created via fork(2).
...
So, AFAIU, once the parent is killed, there's no alarm to terminate the child.

The patch fixes this by moving the setting of the alarm into the
fork_main/fork_child functions, making sure that an alarm will trigger for
the child.

Tested with make check on x86_64.

2018-06-13  Tom de Vries  <tdevries@suse.de>

	PR testsuite/23269
	* gdb.base/fork-running-state.c (main): Move setting of alarm ...
	(fork_child): ... here, and ...
	(fork_parent): ... here.
2018-06-13 14:15:52 +02:00
Tom de Vries c75d3d4144 [gdb/testsuite] Update gdb startup text in selftest.exp
Atm selftest.exp fails for me.

One of the reasons is that in c61b06a19a (Remove
some text from --version output) an eol was added after "There is NO
WARRANTY, to the extent permitted by law".

This patch updates the matching of the gdb startup message in selftest.exp
accordingly.

Tested selftest.exp (with two other selftest.exp related fixes applied).

2018-06-12  Tom de Vries  <tdevries@suse.de>

	* gdb.gdb/selftest.exp (test_with_self): Update gdb startup text.
2018-06-13 14:10:02 +02:00
Nick Clifton 7a486e6d2e Fix problems with objdump.1: Unbalanced group in command synopsis. You probably forgot to open or close a [ ] or { } group properly.
* doc/binutils.texi (objdump): Add missing closing square
	parenthesis to listing of objcopy's command line options.
2018-06-13 11:51:15 +01:00
Rainer Orth 62c808aef6 Fix procfs.c compilation
procfs.c currently doesn't compile on Solaris:

/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function `void _initialize_procfs()':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3734:15: error: invalid initialization of reference of type `const target_info&' from expression of type `procfs_target*'
   add_target (&the_procfs_target);
               ^~~~~~~~~~~~~~~~~~
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
                 from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:2305:13: note: in passing argument 1 of `void add_target(const target_info&, void (*)(const char*, int), void (*)(cmd_list_element*, completion_tracker&, const char*, const char*))'
 extern void add_target (const target_info &info,
             ^~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function `virtual char* procfs_target::make_corefile_notes(bfd*, int*)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: too many arguments to function `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > target_read_alloc(target_ops*, target_object, const char*)'
     NULL, &auxv);
                ^
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
                 from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:341:40: note: declared here
 extern gdb::optional<gdb::byte_vector> target_read_alloc
                                        ^~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: cannot convert `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >' to `int' in assignment
     NULL, &auxv);
                ^

Fixed as follows.  Built and ran make check on 64-bit Solaris 11.5/x86
(amd64-pc-solaris2.11) only.

	* procfs.c (_initialize_procfs): Use add_inf_child_target.
	(procfs_target::make_corefile_notes): Adjust to new
	target_read_alloc return type.
2018-06-13 11:05:51 +02:00
GDB Administrator c75c496d6d Automatic date update in version.in 2018-06-13 00:00:44 +00:00
Andrew Burgess 1840d81a20 gdb: Run INF_EXEC_COMPLETE handler for additional cases
When making an inferior call, and non-stop mode is off, then, once the
inferior call is complete all threads will be stopped, and we should
run the INF_EXEC_COMPLETE handler.  This will result in a call to
'target_async(0)' to remove the event handlers for the target.

This was discussed by Yao Qi in this mailing list thread:

    https://sourceware.org/ml/gdb/2017-10/msg00032.html

Without this then the target event handlers are left in place even
when the target is stopped, which is different to what happens during
a standard stop proceedure (for example when one thread hits a
breakpoint).

gdb/ChangeLog:

	PR gdb/22882
	* infrun.c (fetch_inferior_event): If GDB is not proceeding then
	run INF_EXEC_COMPLETE handler, even when not calling normal_stop.
	Move should_notify_stop local into more inner scope.
2018-06-12 21:15:33 +01:00
Andrew Burgess 9516f85aea gdb: Mark async event handler when event is already pending
In PR22882 inferior functions are called on different threads while
scheduler-locking is turned on.  This results in a hang.  This was
discussed in this mailing list thread:

    https://sourceware.org/ml/gdb/2017-10/msg00032.html

The problem is that when the thread is set running in order to execute
the inferior call, a call to target_async is made.  If the target is
not already registered as 'target_async' then this will install the
async event handler, AND unconditionally mark the handler as having an
event pending.

However, if the target is already registered as target_async then the
event handler is not installed (its already installed) and the
handler is NOT marked as having an event pending.

If we try to set running a thread that already has a pending event,
then we do want to set target_async, however, there will not be an
external event incoming (the thread is already stopped) so we rely on
manually marking the event handler as having a pending event in order
to see the threads pending stop event.  This is fine, if, at the point
where we call target_async, the target is not already marked as async.
But, if it is, then the event handler will not be marked as ready, and
the threads pending stop event will never be processed.

A similar pattern of code can be seen in linux_nat_target::resume,
where, when a thread has a pending event, the call to target_async is
followed by a call to async_file_mark to ensure that the pending
thread event will be processed, even if target_async was already set.

gdb/ChangeLog:

	PR gdb/22882
	* infrun.c (resume_1): Add call to mark_async_event_handler.

gdb/testsuite/ChangeLog:

	* gdb.threads/multiple-successive-infcall.exp: Remove kfail case,
	rewrite test to describe action performed, rather than possible
	failure.
2018-06-12 21:15:33 +01:00
Andrew Burgess defd21729f gdb: Fix an infrun debug log message
Run the test gdb.threads/multiple-successive-infcall.exp by hand, if
you turn on 'debug infrun 1', you'll see that the debug line fixed in
this commit is printed and contains the wrong $pc value.  Fixed in
this commit.

gdb/ChangeLog:

	* infrun.c (do_target_wait): Change old version of $pc printed.
2018-06-12 21:15:32 +01:00
Hans-Peter Nilsson 1d3bf4a0a0 testsuite/ld-cris/libdso-1.d: Correct recent address pattern update. 2018-06-12 18:37:19 +02:00
Nick Clifton 212b9bc7b4 Fix the PR22983 test so that it will work regardless of the order of the symbols in the dynamic symbol table.
See email thread starting here for more details:
  https://sourceware.org/ml/binutils/2018-06/msg00036.html

	PR 22983
	* testsuite/ld-plugin/lto.exp: Use individual tests to check for
	the presence of each expected symbol.
	* testsuite/ld-plugin/pr22983.1.d: New file.
	* testsuite/ld-plugin/pr22983.2.d: New file.
	* testsuite/ld-plugin/pr22983.3.d: New file.
	* testsuite/ld-plugin/pr22983.4.d: New file.
2018-06-12 13:22:24 +01:00
Nick Clifton d89c18895b Fix syntax error in AArch64 default linker scripts when invoked with -shared.
* emulparams/aarch64elf.sh (OTHER_BSS_END_SYMBOLS): Make the
	definition of the __bss_end__ symbol conditional upon CREATE_SHLIB.
2018-06-12 12:45:49 +01:00
Simon Marchi 7b23e0874d Rename some functions, index -> gdb_index
Since we now have two index formats, DWARF5/debug_names and gdb_index, I
wanted to rename some functions to make it clear that they deal with the
gdb_index format specifically.

gdb/ChangeLog:

	* dwarf2read.c (read_index_from_section): Rename to...
	(read_gdb_index_from_section): ... this, update all callers.
	(dwarf2_read_index): Rename to...
	(dwarf2_read_gdb_index): ... this, update all callers.
2018-06-11 21:51:26 -04:00
John David Anglin 69c67a0b2a Fix gdb build on hppa-linux
Fixes:

  CXX    hppa-linux-nat.o
../../src/gdb/hppa-linux-nat.c:277:17: error: no 'void hppa_linux_nat_target::fetch_inferior_registers(regcache*, int)' member function declared in class 'hppa_linux_nat_target'
        int regno)
                 ^
../../src/gdb/hppa-linux-nat.c:224:1: error: 'void fetch_register(regcache*, int)' defined but not used [-Werror=unused-function]
 fetch_register (struct regcache *regcache, int regno)
 ^~~~~~~~~~~~~~

gdb/ChangeLog:

	* gdb/hppa-linux-nat.c
	(hppa_linux_nat_target::fetch_inferior_registers): Rename to
	hppa_linux_nat_target::fetch_registers.
2018-06-11 21:15:33 -04:00
GDB Administrator 90b345f613 Automatic date update in version.in 2018-06-12 00:00:49 +00:00
Eli Zaretskii 41fc26a2cb Fix build of GDB documentation.
gdb/doc/ChangeLog
2018-06-11  Eli Zaretskii  <eliz@gnu.org>

	* gdb.texinfo (Maintenance Commands): Add a missing @anchor.
2018-06-11 20:30:11 +03:00
Maciej W. Rozycki 092a534fe1 MIPS/GAS: Correct `-O0' and `-O' option help, add `-O1' and `-O2'
Match commit 4ffff32f75 ("Match mips_optimize to the -O option
supplied") and adjust `--help' output for `-O0', `-O', `-O1' and `-O2'
options.

	gas/
	* config/tc-mips.c (md_show_usage): Correct help text for `-O0'
	and `-O'.  Mention `-O1'.  Add `-O2' and its description.
2018-06-11 15:27:42 +01:00
Alan Hayward fefa175e8f Enable Aarch64 SVE for gdbserver
gdbserver/
	* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
	(initialize_low_tracepoint): Likewise
	* linux-aarch64-low.c (aarch64_arch_setup): Get VQ.
	* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Add null VQ
	param.
	* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add VQ
	checks.
	* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add VQ.
2018-06-11 13:25:15 +01:00
Nick Clifton 5a485b3899 Updated Spanish translations for the binutils/ and ld/ subdirectories.
* po/es.po: Updated Spanish translation.
2018-06-11 10:51:16 +01:00
Alan Hayward b91ad3ff94 Increase gdbsever PBUFSIZ
PBUFSIZ is no longer big enough for SVE. Increase accordingly.

gdbserver/
            * server.h (PBUFSIZ): Increase size
2018-06-11 10:29:45 +01:00
Alan Hayward 65d4cadafd Add Aarch64 SVE dwarf regnums
This is as per the spec:
https://developer.arm.com/products/architecture/a-profile/docs/100985/0000

gdb/
	* aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings.
	* aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define.
	(AARCH64_DWARF_SVE_FFR): Likewise.
	(AARCH64_DWARF_SVE_P0): Likewise.
	(AARCH64_DWARF_SVE_Z0): Likewise.
2018-06-11 10:24:20 +01:00
Alan Hayward f868386e72 Add regcache raw_compare method
gdb/
	* common/common-regcache.h (raw_compare): New function.
	* regcache.c (regcache::raw_compare): Likewise.
	* regcache.h (regcache::raw_compare): New declaration.

gdbserver/
	* regcache.c (regcache::raw_compare): New function.
	* regcache.h (regcache::raw_compare): New declaration.
2018-06-11 10:09:30 +01:00
Alan Hayward 9c86188316 Add reg_buffer_common
A purely virtual class containing functions from gdb/regcache.h

Both the gdb regcache structures and gdbserver regcache inherit
directly from reg_buffer_common. This will allow for common
functions which require the use of a regcache.

gdb/
	* common/common-regcache.h (reg_buffer_common): New structure.
	* regcache.c (reg_buffer::invalidate): Move from detached_regcache.
	(reg_buffer::raw_supply): Likewise.
	(reg_buffer::raw_supply_integer): Likewise.
	(reg_buffer::raw_supply_zeroed): Likewise.
	(reg_buffer::raw_collect): Likewise.
	(reg_buffer::raw_collect_integer): Likewise.
	* regcache.h (reg_buffer::invalidate): Move from detached_regcache.
	(reg_buffer::raw_supply): Likewise.
	(reg_buffer::raw_supply_integer): Likewise.
	(reg_buffer::raw_supply_zeroed): Likewise.
	(reg_buffer::raw_collect): Likewise.
	(reg_buffer::raw_collect_integer): Likewise.

gdbserver/
	* regcache.c (new_register_cache): Use new.
	(free_register_cache): Use delete.
	(register_data): Use const.
	(supply_register): Move body inside regcache.
	(regcache::raw_supply): New override function.
	(collect_register): Move body inside regcache.
	(regcache::raw_collect): New override function.
	(regcache::get_register_status): New override function.
	* regcache.h (struct regcache): Inherit from reg_buffer_common.
2018-06-11 10:09:16 +01:00
Tom Tromey 953edf2b6c Remove use of queue from remote.c
This removes a use of the queue data structure (common/queue.h) from
remote.c.

The queue is replaced with a std::vector.  A queue was not needed, as
the code never de-queued items.

This removes quite a bit of boilerplate code, mostly involved with
marshalling arguments to be passed through the queue iterator.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

	* remote.c (stop_reply_p): Remove typedef.  Don't declare queue.
	(class remote_state) <stop_reply_queue>: Now std::vector.
	(remote_state::~remote_state)
	(remote_target::stop_reply_queue_length): Update.
	(struct queue_iter_param, remove_child_of_pending_fork)
	(struct check_pending_event_prevents_wildcard_vcont_callback_data)
	(check_pending_event_prevents_wildcard_vcont_callback)
	(remove_stop_reply_for_inferior)
	(remove_stop_reply_of_remote_state)
	(remote_notif_remove_once_on_match)
	(stop_reply_match_ptid_and_ws)
	(remote_kill_child_of_pending_fork): Remove.
	(remote_target::remove_new_fork_children)
	(remote_target::check_pending_events_prevent_wildcard_vcont)
	(remote_target::discard_pending_stop_replies)
	(remote_target::discard_pending_stop_replies_in_queue)
	(remote_target::remote_notif_remove_queued_reply)
	(remote_target::queued_stop_reply)
	(remote_target::push_stop_reply, remote_target::peek_stop_reply)
	(remote_target::wait, remote_target::kill_new_fork_children)
	(remote_target::async): Update.
2018-06-10 22:31:19 -06:00
Tom Tromey 1ddbba9df5 Remove cleanups from record-full.c
This removes cleanups from record-full.c.  In this case, the cleanups
were only ever run when an exception was thrown.  So, I replaced these
with try/catch, rather than introduce a new specialized RAII type.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

	* record-full.c (record_full_arch_list_cleanups): Remove.
	(record_full_message): Use try/catch.
	(record_full_wait_cleanups): Remove.
	(record_full_wait_1): Use try/catch.
	(record_full_restore): Likewise.
2018-06-10 22:19:44 -06:00
Tom Tromey 219605fd6a Remove a VEC from record-full.c
This replaces a VEC in record-full.c with a std::vector.  This version
of the patch also catches a memory leak in the original code noticed
by Simon.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

	* record-full.c (record_full_breakpoint_p): Remove typedef.  Don't
	declare VEC.  Add constructor.
	<in_target_beneath>: Now bool.
	(record_full_breakpoints): Now a std::vector, static.
	(record_full_sync_record_breakpoints)
	(record_full_init_record_breakpoints)
	(record_full_target::insert_breakpoint)
	(record_full_target::remove_breakpoint): Update.  Don't use XNEW.
2018-06-10 22:12:32 -06:00
Simon Marchi 71b7376497 Remove more "struct" keywords in range-based for loops
GCC 6.3.0 produces this kind of errors:

  CXX    dwarf2read.o
/home/simark/src/binutils-gdb/gdb/dwarf2read.c: In function 'void process_cu_includes(dwarf2_per_objfile*)':
/home/simark/src/binutils-gdb/gdb/dwarf2read.c:10220:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct dwarf2_per_cu_data *iter : dwarf2_per_objfile->just_read_cus)
        ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

	* dwarf2read.c (process_cu_includes): Remove struct keyword.
	* serial.c (serial_interface_lookup): Remove struct keyword.
2018-06-10 22:34:08 -04:00
GDB Administrator 65a68903e2 Automatic date update in version.in 2018-06-11 00:01:03 +00:00
Tom Tromey 4360561f5a Fix some missed "beneath" conversions
The buildbot pointed out that arm-linux-nat.c was not properly using
"beneath" as a method.  A search showed a few more places with this
issue.

Tested by the buildbot, though of course this only checked
arm-linux-nat.c.  Nevertheless I'm checking this in under the obvious
rule.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

	* procfs.c (procfs_target::xfer_partial): Use "beneath" as a
	method.
	* nto-procfs.c (nto_procfs_target::xfer_partial): Use "beneath" as
	a method.
	* go32-nat.c (go32_nat_target::xfer_partial): Use "beneath" as a
	method.
	* arm-linux-nat.c (arm_linux_nat_target::read_description): Use
	"beneath" as a method.
	* arm-fbsd-nat.c (arm_fbsd_nat_target::read_description):
	Use "beneath" as a method.
2018-06-10 09:58:34 -06:00
Tom Tromey d14b92bf8a Remove cleanups from tracefile.c
This removes cleanups from tracefile.c, by introducing a unique_ptr
specialization.

This code could be made even simpler via a deeper C++-ification, but I
have not attempted that.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

	* tracefile.c (struct trace_file_writer_deleter): New.
	<operator()>: Rename from trace_file_writer_xfree.
	(trace_file_writer_up): New typedef.
	(tsave_command, trace_save_tfile, trace_save_ctf): Update.
2018-06-10 07:31:22 -06:00
Simon Marchi 835dcf9261 Use std::unique_ptr in reg_buffer
Using std::unique_ptr allows to remove the manual xfree in the
destructor.

If I understand correctly, using the () after the new operator will make
sure the allocated objects will be value initialized, which for scalars
means they are zero-initialized.  So it should have the same behavior as
XCNEWVEC.

gdb/ChangeLog:

	* regcache.h (reg_buffer) <~reg_buffer>: Use default destructor.
	<m_registers, m_register_status>: Change type to
	std::unique_ptr.
	* regcache.c (reg_buffer::reg_buffer): Use new instead of
	XCNEWVEC.
2018-06-09 22:30:42 -04:00
Simon Marchi aac0d564ce Change type of reg_buffer::m_register_status to register_status
The type of reg_buffer::m_register_status is an array of signed char,
probably to ensure that each element takes up only one byte.  Instead,
since we use C++11, we can force the underlying type of register_status
to be signed char and use the enum type.

gdb/ChangeLog:

	* common/common-regcache.h (enum register_status): Add
	underlying type "signed char".
	* regcache.h (reg_buffer) <m_register_status>: Change type to
	register_status *.
	* regcache.c (reg_buffer::reg_buffer): Alocate arrays of
	register_status instead of signed char.
	(reg_buffer::save): Use REG_UNKNOWN instead of 0.
	(reg_buffer::get_register_status): Remove cast.
	(readable_regcache::raw_read): Remove cast.
	(readable_regcache::cooked_read): Remove cast.
2018-06-09 22:08:06 -04:00
GDB Administrator 09897e3330 Automatic date update in version.in 2018-06-10 00:01:24 +00:00
Tom Tromey 4059184490 Remove use of queue.h from gdbserver/event-loop.c
This removes a use of queue.h from gdbserver/event-loop.c, replacing
it with std::queue.

I was not completely sure whether std::queue is even that useful.
Perhaps plain std::list could be used just as easily.

Tested by the buildbot.

gdb/gdbserver/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

	* event-loop.c (gdb_event, gdb_event_p): Remove typedefs.  Don't
	declare queue.
	(event_queue): Use std::queue.
	(gdb_event_xfree): Remove.
	(initialize_event_loop, process_event, wait_for_event): Update.
2018-06-09 16:12:15 -06:00
Tom Tromey 77ad739445 Remove two more uses of make_cleanup_close
This removes two more uses of make_cleanup_close, replacing them with
relatively straightforward uses of scoped_fd.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

	* source.c (reverse_search_command, forward_search_command): Use
	scoped_fd.
2018-06-09 16:09:52 -06:00
Tom Tromey 191cca6383 Remove a VEC from serial.c
This replaces a VEC in serial.c with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

	* serial.c (serial_ops_p): Remove typedef.  Don't declare VEC.
	(serial_ops_list): Now static, std::vector.
	(serial_interface_lookup, serial_add_interface): Update.
2018-06-09 16:07:57 -06:00
Tom Tromey c5d0225d25 Remove a VEC from dwarf2read.c
This removes a VEC from dwarf2read.c, replacing it with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (process_cu_includes): Update.
	(process_full_comp_unit): Update.
	* dwarf2read.h (struct dwarf2_per_objfile) <just_read_cus>: Now a
	std::vector.
2018-06-09 16:05:48 -06:00
Maciej W. Rozycki d68033ea86 MIPS/LD/testsuite: Add microMIPS lazy binding stub tests
Adapt the existing regular MIPS lazy binding stub tests for microMIPS
code verification.  Check both regular and `--insn32' variants.

Correct indentation issues in the conditional updated.

	ld/
	* testsuite/ld-mips-elf/stub-dynsym-micromips-1-7fff.d: New
	test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-1-8000.d: New
	test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-1-fff0.d: New
	test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-1-10000.d: New
	test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-1-2fe80.d: New
	test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-7fff.d:
	New test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-8000.d:
	New test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-fff0.d:
	New test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-10000.d:
	New test.
	* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-2fe80.d:
	New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.  Fix
	indentation.
2018-06-09 01:09:23 +01:00
Maciej W. Rozycki 653e0a1e04 MIPS/LD/testsuite: Fix lazy binding stub test symbol count comment
Update the symbol count in the comment associated with lazy binding stub
tests to match `base_syms', complementing commit 889acb80ac
("MIPS/Linux/LD/testsuite: Linker script _gp scope updates"),
<https://sourceware.org/ml/binutils/2012-08/msg00066.html>, and commit
2f9efdfcdb ("mips/bfd/ld: Fix --as-needed on mips and update related
ld tests"), <https://sourceware.org/ml/binutils/2013-09/msg00131.html>.

	ld/
	* testsuite/ld-mips-elf/mips-elf.exp: Update symbol count in the
	comment associated with lazy binding stub tests.
2018-06-09 01:09:23 +01:00
Maciej W. Rozycki 2f8b83ee96 MIPS/LD: Add missing `mips-*-windiss' target emulation dependency
As from commit 2ebd05b80b ("MIPS/LD: Correct `mips-*-windiss' target
emulation configuration") we have:

EXTRA_EM_FILE=mipself

in `emulparams/elf32mipswindiss.sh', however no corresponding Makefile
`mipself.em' dependency for `eelf32mipswindiss.c'.  Add it.

	ld/
	* Makefile.am (eelf32mipswindiss.c): Add `mipself.em' dependency.
	* Makefile.in: Regenerate.
2018-06-09 01:09:22 +01:00
GDB Administrator 30d42fef63 Automatic date update in version.in 2018-06-09 00:00:45 +00:00
Stan Cox 6341380d5c Add missing client_state struct references to win target.
gdbserver/ChangeLog
	* win32-low.c (win32_create_inferior):  last_ptid and last_status
	moved to client_state.
2018-06-08 16:40:52 -04:00
Pedro Alves 03349c9345 Make gdbreplay use more common routines
This makes gdbreplay share a bit more code with gdbserver, and paves
the way to share more in future.  Including common-defs.h pulls in
defines and headers that gdb and gdbserver assume are always
defined/available too, such as for example _(), ansidecl.h or a set of
system headers.  Including that revealed (static vs extern conflict)
gdbreplay had a local copy of perror_with_name (which exited directly
instead of throwing an error).  So I removed gdbreplay's local copy,
and then added enough .o files until gdbreplay linked successfully.

Also, use xstrdup instead of strdup.

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

	* Makefile.in (GDBREPLAY_OBS): Add common/cleanups.o,
	common/common-exceptions.o, common/common-utils.o,
	common/errors.o, common/print-utils.o and utils.o.
	* gdbreplay.c: Include "common-defs.h" instead of the two
	'config.h's here.  Don't include stdio.h, errno.h, stdlib.h,
	string.h or alloca.h.
	(perror_with_name): Delete.
	(remote_open): Use xstrdup instead of strdup.
	(main): Rename to ...
	(captured_main): ... this.
	(main): New.
2018-06-08 20:48:28 +01:00