Mike Frysinger [Mon, 30 Mar 2015 05:06:57 +0000 (01:06 -0400)]
sim: d10v: link in missing testsuite
Looks like historical restructuring in this dir lost the d10v-elf subdir
and no one noticed in the meantime. Re-add it to the testsuite.
There are some failures, but better some tests get run than none at all.
Mike Frysinger [Mon, 30 Mar 2015 04:13:38 +0000 (00:13 -0400)]
sim: cr16: convert to nrun
A lot of cpu state is stored in global variables, as is memory handling.
The sim_size support needs unwinding at some point. But at least this
is an improvement on the status quo.
Mike Frysinger [Mon, 30 Mar 2015 04:10:27 +0000 (00:10 -0400)]
sim: cr16: delete NEED_UI_LOOP_HOOK handling
This hook is used only when linked into gdb, and cr16 doesn't have a gdb
port anymore. Punt it.
Mike Frysinger [Mon, 30 Mar 2015 04:08:46 +0000 (00:08 -0400)]
sim: cr16: delete dead code
This code is getting in the way of porting to nrun, so just drop it.
If anyone actually cares about this cpu, they can revive it.
Mike Frysinger [Mon, 30 Mar 2015 02:41:14 +0000 (22:41 -0400)]
sim: cr16: clean up misc warnings
Mike Frysinger [Mon, 30 Mar 2015 02:42:33 +0000 (22:42 -0400)]
sim: cr16: use common configure options
In preparation for converting to nrun, call the common functions that
are needed. This doesn't produce any new warnings, and the generated
code should be the same.
Mike Frysinger [Mon, 30 Mar 2015 01:00:20 +0000 (21:00 -0400)]
sim: cr16: add _start symbol to tests [BZ #12385]
The current cr16 testsuite sets up _START, but the linker looks for the
_start symbol. Add the latter as an alias to the former.
GDB Administrator [Mon, 30 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sun, 29 Mar 2015 21:40:30 +0000 (17:40 -0400)]
sim: microblaze: convert to nrun
This port already was storing its cpu state in the sim_cpu structure, so
converting it over was pretty easy. It is allocating memory itself still,
but we'll fix that up in the future at some point.
Mike Frysinger [Sun, 29 Mar 2015 21:20:37 +0000 (17:20 -0400)]
sim: mcore/microblaze: delete dead code
The mcore port had a few structs/defines that were never used.
Similarly, the microblaze port, because it was copied from mcore, has
that same dead code, and more. The watchpoint logic was never actually
used. Punt it all.
Mike Frysinger [Sun, 29 Mar 2015 20:43:48 +0000 (16:43 -0400)]
sim: microblaze: start a testsuite
Since the sim doesn't have any debug support in it, we can only exit
cleanly. But this is still better than nothing.
Change the default microblaze sim to not dump the debug load output
when running. No other does this, and it breaks the testsuite.
Mike Frysinger [Sun, 29 Mar 2015 20:41:59 +0000 (16:41 -0400)]
sim; testsuite: allow tests to set no output
If a test doesn't write anything at all to stdout, the current test
framework can't support that. Even if you put a blank output line:
# output:
the setup happily clobbers that with a default pass/fail string.
Tweak the parsing logic so we only set the output to pass/fail when
the test has no output marker.
Mike Frysinger [Sun, 29 Mar 2015 19:59:01 +0000 (15:59 -0400)]
sim: common: sim-arange: fix extern inline handling
With newer versions of gcc (5.x), the extern inline we're using with the
sim-arange module no longer works. Since this code really wants the gnu
inline semantics, use that attribute explicitly.
Reported-by: DJ Delorie <dj@redhat.com>
Reported-by: Joel Sherrill <joel.sherrill@oarcorp.com>
Mike Frysinger [Sun, 29 Mar 2015 15:48:46 +0000 (11:48 -0400)]
sim: testsuite: make subdir unconditional
Since the testsuite subdir has to handle dynamic arch values already,
there's no real value in requiring arches to opt in to it. Most have
a testsuite now anyways, and we're requiring it in the future.
Mike Frysinger [Sun, 29 Mar 2015 08:18:03 +0000 (04:18 -0400)]
sim: microblaze: use common configure options
In preparation for converting to nrun, call the common functions that
are needed. This doesn't produce any new warnings, and the generated
code should be the same.
H.J. Lu [Sun, 29 Mar 2015 14:46:30 +0000 (07:46 -0700)]
Add the missing opcodes/ChangeLog entry
H.J. Lu [Sun, 15 Mar 2015 12:41:46 +0000 (05:41 -0700)]
Regenerate opcodes/Makefile.in
* Makefile.in: Regenerated.
H.J. Lu [Sun, 29 Mar 2015 14:36:27 +0000 (07:36 -0700)]
Fix a typo in bfd/ChangeLog
H.J. Lu [Sun, 29 Mar 2015 14:12:38 +0000 (07:12 -0700)]
Add --with-system-zlib in bfd
This patch adds --with-system-zlib and remove --with-zlib in bfd.
* Makefile.am (ZLIB): New.
(ZLIBINC): Likewise.
(AM_CFLAGS): Add $(ZLIBINC).
(libbfd_la_LIBADD): Add $(ZLIB).
* compress.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
(decompress_contents): Don't check HAVE_ZLIB_H.
(decompress_contents): Likewise.
(bfd_compress_section_contents): Likewise.
(bfd_get_full_section_contents): Likewise.
(bfd_init_section_decompress_status): Likewise.
(bfd_init_section_compress_status): Likewise.
* configure.ac (AM_ZLIB): Removed
(zlibdir): New. AC_SUBST.
(zlibinc): Likewise.
Add --with-system-zlib.
* Makefile.in: Regenerated.
* acinclude.m4: Likewise.
* config.in: Likewise.
* configure: Likewise.
* doc/Makefile.in: Likewise.
Mike Frysinger [Sun, 29 Mar 2015 07:53:01 +0000 (03:53 -0400)]
sim: mcore: convert to nrun
A lot of cpu state is stored in global variables, as is memory handling.
The sim_size support needs unwinding at some point. But at least this
is an improvement on the status quo.
Mike Frysinger [Sun, 29 Mar 2015 07:39:01 +0000 (03:39 -0400)]
sim: mcore: use common configure options
In preparation for converting to nrun, call the common functions that
are needed. This doesn't produce any new warnings, and the generated
code should be the same.
Mike Frysinger [Sun, 29 Mar 2015 07:35:29 +0000 (03:35 -0400)]
sim: mcore: add a basic testsuite
Mike Frysinger [Sun, 29 Mar 2015 07:29:29 +0000 (03:29 -0400)]
sim: mcore: drop sbrk support
The sbrk syscall assumes the sbrk region starts after the bss and the
current implementation requires a bss section to exist. Since there
is no requirement for programs to have a bss in general, we want to
drop this check. However, there is still the sbrk syscall that wants
to know about the region.
Since libgloss doesn't actually use the sbrk syscall (it implements
sbrk in its own way), and the sim really shouldn't enforce a specific
memory layout on programs, lets simply delete sbrk support. Now it
always returns an error.
Mike Frysinger [Sun, 29 Mar 2015 07:36:13 +0000 (03:36 -0400)]
sim: avr: fix _start testsuite symbol
Make sure we use the symbol the linker expects by default, and we export
it so it can be found.
GDB Administrator [Sun, 29 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 28 Mar 2015 21:36:03 +0000 (17:36 -0400)]
sim: sh: convert to nrun
A lot of cpu state is stored in global variables, as is memory handling.
The sim_size support needs unwinding at some point. But at least this
is an improvement on the status quo.
Mike Frysinger [Sat, 28 Mar 2015 19:11:31 +0000 (15:11 -0400)]
sim: sh: clean up some warnings
Mostly converting old style prototypes. Also include a few missing
headers, and add static/casts where appropriate.
Mike Frysinger [Sat, 28 Mar 2015 18:55:11 +0000 (14:55 -0400)]
sim: sh: fix broken handling in DSR reg
A missing */ caused a case statement to be incorrect masked out which
also hide an error where the wrong value was being checked. Fix both.
Mike Frysinger [Sat, 28 Mar 2015 18:09:11 +0000 (14:09 -0400)]
sim: sh: clean up gencode
The build line was missing the normal BUILD_xxx flags. Once we added
that, we get warnings that weren't shown before. As we fix those, we
notice that the -d option segfaults because it tries to write readonly
memory. Fix that too as part of the const/prototype clean up.
Mike Frysinger [Sat, 28 Mar 2015 17:39:31 +0000 (13:39 -0400)]
sim: sh: use common configure options
In preparation for converting to nrun, call the common functions that
are needed. This also produces a bunch of warnings, but one thing at
a time.
H.J. Lu [Sat, 28 Mar 2015 13:48:43 +0000 (06:48 -0700)]
A zlib to tarball
* src-release.sh (do_proto_toplev): Configure with --target
--with-target-subdir and --disable-multilib.
(BINUTILS_SUPPORT_DIRS): Add zlib.
(GAS_SUPPORT_DIRS): Likewise.
(GDB_SUPPORT_DIRS): Likewise.
(SIM_SUPPORT_DIRS): Likewise.
Mike Frysinger [Sat, 28 Mar 2015 09:34:55 +0000 (05:34 -0400)]
sim: avr: convert to nrun.o
Looks like a lot more work than actually was -- the main decode loop
was de-indented by dropping the loop as a step-once function.
Mike Frysinger [Sat, 28 Mar 2015 08:28:46 +0000 (04:28 -0400)]
sim: avr: start a basic testsuite
Just enough to know the sim isn't totally broken.
Jiri Gaisler [Tue, 17 Mar 2015 21:02:42 +0000 (22:02 +0100)]
sim/erc32: Fix a few compiler warnings
Jiri Gaisler [Tue, 17 Mar 2015 21:02:41 +0000 (22:02 +0100)]
sim/erc32: Use memory_iread() function for instruction fetching.
Use separate memory_iread() function for instruction fetching.
Speeds up execution and allows addition of an MMU at a later stage.
Mike Frysinger [Sat, 28 Mar 2015 06:46:48 +0000 (02:46 -0400)]
sim: erc32: strip paren from return statements
James Bowman [Mon, 23 Mar 2015 19:15:32 +0000 (19:15 +0000)]
gdb: ft32: new port
FT32 is a new high performance 32-bit RISC core developed by FTDI for
embedded applications.
James Bowman [Mon, 23 Mar 2015 19:20:59 +0000 (19:20 +0000)]
sim: ft32: new port
FT32 is a new high performance 32-bit RISC core developed by FTDI for
embedded applications.
GDB Administrator [Sat, 28 Mar 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 27 Mar 2015 21:39:39 +0000 (14:39 -0700)]
Don't run ld-x86-64/pr18160.d for x86_64-*-nacl*
* ld-x86-64/pr18160.d: Don't run for x86_64-*-nacl* target.
Jan Kratochvil [Fri, 27 Mar 2015 19:19:37 +0000 (20:19 +0100)]
Revert: Code cleanup: Move print_command_1 expr variable scope
Simon Marchi:
I think this patch is wrong. Starting with that commit (
f30d5c7),
some tests (e.g. mi-break.exp) started to fail for me, because
of gdb segfaulting.
The address of expr is passed to the cleanup. When the cleanup is ran,
expr is no longer in scope, so what is at that address is probably not
safe to use anymore. That's my guess.
gdb/ChangeLog
2015-03-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert:
2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* printcmd.c (print_command_1): Move expr variable scope.
H.J. Lu [Fri, 27 Mar 2015 16:29:05 +0000 (09:29 -0700)]
Remove the unused cpu_flags_set
* config/tc-i386.c (cpu_flags_set): Removed.
Joel Brobecker [Fri, 27 Mar 2015 13:37:34 +0000 (06:37 -0700)]
Initialize EXPR in dtrace-probe::dtrace_process_dof_probe
GCC 4.4.7 generates the following warning:
| cc1: warnings being treated as errors
| dtrace-probe.c: In function ‘dtrace_process_dof_probe’:
| dtrace-probe.c:416: error: ‘expr’ may be used uninitialized in this function
| make[2]: *** [dtrace-probe.o] Error 1
Later versions (GCC 5) do a better job and don't generate the warning,
but it does not hurt to pre-initialize "expr" to NULL.
gdb/ChangeLog:
* dtrace-probe.c (dtrace_process_dof_probe): Initialize expr to NULL.
Rafael Ávila de Espíndola [Fri, 27 Mar 2015 13:50:23 +0000 (09:50 -0400)]
Avoid looking up Input_merge_map multiple times.
Avoid looking up Input_merge_map multiple times when we know were are
processing items from the same input section.
Andrzej Kaczmarek [Fri, 27 Mar 2015 12:09:02 +0000 (12:09 +0000)]
Fix gdb_bfd_section_index for special sections
Indexes returned for special sections are off by one, i.e. with N+4
sections last one has index N+4 returned which is outside allocated
obstack (at the same time index N is not used at all).
In worst case, if sections obstack is allocated up to end of chunk,
writing last section data will cause buffer overrun and some data
corruption.
Here's output from Valgrind::
==14630== Invalid write of size 8
==14630== at 0x551B1A: add_to_objfile_sections_full (objfiles.c:225)
==14630== by 0x552768: allocate_objfile (objfiles.c:324)
==14630== by 0x4E8E2E: symbol_file_add_with_addrs (symfile.c:1171)
==14630== by 0x4E9453: symbol_file_add_from_bfd (symfile.c:1280)
==14630== by 0x4E9453: symbol_file_add (symfile.c:1295)
==14630== by 0x4E94B7: symbol_file_add_main_1 (symfile.c:1320)
==14630== by 0x514246: catch_command_errors_const (main.c:398)
==14630== by 0x5150AA: captured_main (main.c:1061)
==14630== by 0x51123C: catch_errors (exceptions.c:240)
==14630== by 0x51569A: gdb_main (main.c:1164)
==14630== by 0x408824: main (gdb.c:32)
==14630== Address 0x635f3b8 is 8 bytes after a block of size 4,064 alloc'd
==14630== at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14630== by 0x60F797: xmalloc (common-utils.c:41)
==14630== by 0x5E787FB: _obstack_begin (obstack.c:184)
==14630== by 0x552679: allocate_objfile (objfiles.c:294)
==14630== by 0x4E8E2E: symbol_file_add_with_addrs (symfile.c:1171)
==14630== by 0x4E9453: symbol_file_add_from_bfd (symfile.c:1280)
==14630== by 0x4E9453: symbol_file_add (symfile.c:1295)
==14630== by 0x4E94B7: symbol_file_add_main_1 (symfile.c:1320)
==14630== by 0x514246: catch_command_errors_const (main.c:398)
==14630== by 0x5150AA: captured_main (main.c:1061)
==14630== by 0x51123C: catch_errors (exceptions.c:240)
==14630== by 0x51569A: gdb_main (main.c:1164)
==14630== by 0x408824: main (gdb.c:32)
gdb/ChangeLog:
* gdb_bfd.c (gdb_bfd_section_index): Fix off-by-one for special
sections.
Renlin Li [Fri, 27 Mar 2015 10:22:46 +0000 (10:22 +0000)]
[Patch ]Fix bintest.s failure after previous AArch64 map symbol commit
2015-03-26 Renlin Li <renlin.li@arm.com>
binutils/testsuite/
* binutils-all/readelf.s-64: Support aarch64 case.
* binutils-all/readelf.ss-64: Likewise.
Alan Modra [Fri, 27 Mar 2015 05:11:05 +0000 (15:41 +1030)]
Relax PR 15228 protected visibility restriction
Allows .dynbss copy of shared library protected visibility variables
if they are read-only.
To recap: Copying a variable from a shared library into an executable's
.dynbss is an old hack invented for non-PIC executables, to avoid the
text relocations you'd otherwise need to access a shared library
variable. This works with ELF shared libraries because global
symbols can be overridden. The trouble is that protected visibility
symbols can't be overridden. A shared library will continue to access
it's own protected visibility variable while the executable accesses a
copy. If either the shared library or the executable updates the
value then the copy diverges from the original. This is wrong since
there is only one definition of the variable in the application.
So I made the linker report an error on attempting to copy protected
visibility variables into .dynbss. However, you'll notice the above
paragraph contains an "If". An application that does not modify the
variable value remains correct even though two copies of the variable
exist. The linker can detect this situation if the variable was
defined in a read-only section.
PR ld/15228
PR ld/18167
* elflink.c (elf_merge_st_other): Add "sec" parameter. Don't set
protected_def when symbol section is read-only. Adjust all calls.
* elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment.
GDB Administrator [Fri, 27 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Jon Turney [Thu, 26 Mar 2015 20:51:44 +0000 (20:51 +0000)]
testsuite: Don't set SYMBOL_PREFIX for x86_64_*_cygwin
Exactly like x86_64-*-mingw, SYMBOL_PREFIX should not be set to "_" for
x86_64_*_cygwin
gdb/testuite/ChangeLog:
* lib/gdb.exp (gdb_target_symbol_prefix_flags): Don't set
SYMBOL_PREFIX for x86_64-*-cygwin.
Joel Brobecker [Thu, 26 Mar 2015 18:14:03 +0000 (19:14 +0100)]
dtrace-probe: Handle error while parsing probe argument.
The debugger on Solaris has been broken since the introduction of
DTrace probe support:
(gdb) start
Temporary breakpoint 1 at 0x80593bc: file simple_main.adb, line 4.
Starting program: /[...]/simple_main
[Thread debugging using libthread_db enabled]
No definition of "mutex_t" in current context.
The problem occurs while trying to parse a probe's argument,
and the exception propagates all the way to the top. This patch
fixes the issue by containing the exception and falling back on
using the "long" builtin type if the argument's type could not
be determined.
Also, the parsing should be done using the C language parser.
gdb/ChangeLog:
* dtrace-probe.c (dtrace_process_dof_probe): Contain any
exception raised while parsing the probe arguments.
Force parsing to be done using the C language parser.
* expression.h (parse_expression_with_language): Declare.
* parse.c (parse_expression_with_language): New function.
Jon Turney [Thu, 26 Mar 2015 20:29:00 +0000 (20:29 +0000)]
Add myself as a write-after-approval GDB maintainer
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add "Jon Turney".
Simon Marchi [Thu, 26 Mar 2015 19:10:10 +0000 (15:10 -0400)]
Fix copy-paste typo in -data-write-memory-bytes doc
* gdb.texinfo (GDB/MI Data Manipulation): Fix copy-paste typo in
-data-write-memory-bytes.
Andy Wingo [Thu, 26 Mar 2015 18:41:15 +0000 (19:41 +0100)]
Properly intern constants into psymtab
Variables with a DW_AT_const_value but without a DW_AT_location were not
getting added to the partial symbol table. They are added to the full
symbol table, however, when the compilation unit's psymtabs are
expanded.
Before:
(gdb) p one
No symbol "one" in current context.
(gdb) mt flush-symbol-cache
(gdb) mt expand one.c
(gdb) p one
$1 = 1
After:
(gdb) p one
$1 = 1
To the user it's pretty strange, as depending on whether tab completion
has forced expansion of all CUs or not the lookup might succeed, or not
if the failure was already added to the symbol cache.
This commit simply makes sure to add constants to the partial symbol
tables.
gdb/testsuite/ChangeLog:
PR symtab/18148
* gdb.dwarf2/dw2-intercu.S (one, two): Add variables that have a
const_value but not a location.
* gdb.dwarf2/dw2-intercu.exp: Add tests that constants without
location defined in non-main CUs are visible.
gdb/ChangeLog:
PR symtab/18148
* dwarf2read.c (struct partial_die_info): Add has_const_value
member.
(add_partial_symbol): Don't punt on symbols that have const_value
attributes.
(read_partial_die): Detect DW_AT_const_value.
Jan Kratochvil [Thu, 26 Mar 2015 17:44:38 +0000 (18:44 +0100)]
Code cleanup: Move print_command_1 expr variable scope
gdb/ChangeLog
2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* printcmd.c (print_command_1): Move expr variable scope.
Jan Kratochvil [Thu, 26 Mar 2015 17:41:24 +0000 (18:41 +0100)]
Code cleanup: Make validate_format parameter const
gdb/ChangeLog
2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* printcmd.c (validate_format): Make the parameter cmdname const.
Don Breazeal [Thu, 26 Mar 2015 17:23:05 +0000 (10:23 -0700)]
Clarify comment on the purpose of the assertion loop in _initialize_remote.
gdb/ChangeLog:
2015-03-26 Don Breazeal <donb@codesourcery.com>
* remote.c (_initialize_remote): Update comment.
Tejas Belagod [Thu, 26 Mar 2015 16:20:38 +0000 (16:20 +0000)]
[AArch64] Fix branch stubs for BE
2015-03-26 Tejas Belagod <tejas.belagod@arm.com>
ld/testsuite
* ld-aarch64/farcall-back-be.d: New.
bfd/
* elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic
_bfd_final_link_relocate with aarch64_relocate.
H.J. Lu [Fri, 13 Mar 2015 15:14:29 +0000 (08:14 -0700)]
Add ELFOSABI_CLOUDABI and SHF_COMPRESSED
Update from gABI DRAFT - 10 June 2013.
* common.h (ELFOSABI_CLOUDABI): New.
(SHF_COMPRESSED): Likewise.
(ELFCOMPRESS_ZLIB): Likewise.
(ELFCOMPRESS_LOOS): Likewise.
(ELFCOMPRESS_HIOS): Likewise.
(ELFCOMPRESS_LOPROC): Likewise.
(ELFCOMPRESS_HIPROC): Likewise.
H.J. Lu [Fri, 13 Mar 2015 17:40:33 +0000 (10:40 -0700)]
Import zlib from GCC
H.J. Lu [Thu, 26 Mar 2015 15:22:08 +0000 (08:22 -0700)]
Skip gc-sections if relocation is incompatible
This patch skips gc-sections if input relocation is incompatible with
output.
bfd/
PR ld/18160
* elflink.c (elf_gc_sweep): Skip if relocation is incompatible.
(bfd_elf_gc_sections): Likewise.
ld/testsuite/
PR ld/18160
* ld-x86-64/pr18160.d: New file.
* ld-x86-64/pr18160.s: Likewise.
* ld-x86-64/pr18160.t: Likewise.
* ld-x86-64/x86-64.exp: Run pr18160.
Pedro Alves [Thu, 26 Mar 2015 10:21:07 +0000 (10:21 +0000)]
Don't set breakpoints on import stubs on Windows amd64
On Windows amd64, setting a breakpoint on a symbol imported from a
shared library after that library is loaded creates a breakpoint with
two locations, one on the import stub, and another in the shared
library, while on i386, the breakpoint is only set in the shared
library.
This is due to the minimal symbol for the import stub not being
correctly given the type mst_solib_trampoline on Windows amd64, unlike
Windows i386.
As currently written, coff_symfile_read is always skipping over the
character after the "__imp_" (amd64) or "_imp_" (i386) prefix,
assuming that it is '_'. However, while i386 is an underscored
target, amd64 is not.
On x86_64-pc-cygwin, it fixes:
- FAIL: gdb.base/solib-symbol.exp: foo in libmd
+ PASS: gdb.base/solib-symbol.exp: foo in libmd
Unfortunately, several other tests which passed now fail but that's
because this issue was masking other problems.
No change on i686-pc-cygwin.
gdb/ChangeLog:
2015-03-26 Pedro Alves <palves@redhat.com>
Jon TURNEY <jon.turney@dronecode.org.uk>
* coffread.c (coff_symfile_read): When constructing the name of an
import stub symbol from import symbol for amd64, only skip the
char after _imp_ if the target is underscored (like i386) and the
char is indeed the target's leading char.
Yao Qi [Thu, 26 Mar 2015 08:29:48 +0000 (08:29 +0000)]
Handle the effect of skipping prologue
break-asm-file.exp has some manually written dwarf to create some line
number entries like this,
[0x0000013d] Extended opcode 2: set Address to 0x40053f
[0x00000144] Advance Line by 4 to 7
[0x00000146] Copy
[0x00000147] Extended opcode 2: set Address to 0x400541
[0x0000014e] Advance Line by 1 to 8
[0x00000150] Copy
[0x00000151] Extended opcode 2: set Address to 0x400547
[0x00000158] Extended opcode 1: End of Sequence
0x40053f is the start address of function func, and is mapped to line
7. 0x400541 is within function func, and is mapped to line 8.
(gdb) disassemble /r 0x40053f,+8
Dump of assembler code from 0x40053f to 0x400547:
0x000000000040053f <func+0>: 00 00 add %al,(%rax)
0x0000000000400541 <func+2>: 00 00 add %al,(%rax)
0x0000000000400543 <func+4>: 00 00 add %al,(%rax)
0x0000000000400545 <func+6>: 00 00 add %al,(%rax)
in the following test,
(gdb) break a/break-asm-file0.s:func
Breakpoint 1 at 0x40053f: file a/break-asm-file0.s, line 7.
As we can see, breakpoint is set at the start address of function func
on x86, which means no prologue is skipped. On other targets, such as
arm and aarch64, breakpoint is set at the address *after* the start
address, which is mapped to line 8. Then test fails.
In fact, it is lucky this test doesn't fail on x86 and x86_64, whose
gdbarch method skip_prologue doesn't reply on skip_prologue_using_sal
if producer isn't clang.
if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
{
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
/* Clang always emits a line note before the prologue and another
one after. We trust clang to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
&& startswith (COMPUNIT_PRODUCER (cust), "clang ")))
return max (start_pc, post_prologue_pc);
}
so it doesn't return and go further to prologue analyser. Since ".int 0"
isn't an instruction of prologue, nothing is skipped, starting address
is used, and test passes.
however, on targets which don't have such producer checking, the first
line number entry is skipped, and skip_prologue_using_sal returns sal
represents the second line number entry.
The idea of this patch is to force GDB stop at somewhere which is stilled
mapped to line 7 after skipping prologue. I choose to add a new line
number entry for the following instruction but mapped to the same line (7),
because I see the comments in dwarf2read.c,
... fact that two consecutive
line number entries for the same line is a heuristic used by gcc
to denote the end of the prologue.
then the line table becomes:
[0x000000d4] Extended opcode 2: set Address to 0x400529
[0x000000db] Advance Line by 4 to 7
[0x000000dd] Copy
[0x000000de] Extended opcode 2: set Address to 0x40052a
[0x000000e5] Advance Line by 0 to 7
[0x000000e7] Copy
[0x000000e8] Extended opcode 2: set Address to 0x40052b
[0x000000ef] Advance Line by 1 to 8
[0x000000f1] Copy
[0x000000f2] Extended opcode 2: set Address to 0x40052c
[0x000000f9] Extended opcode 1: End of Sequence
gdb/testsuite:
2015-03-26 Yao Qi <yao.qi@linaro.org>
PR testsuite/18139
* gdb.linespec/break-asm-file0.s (func): New label .Lfunc_2.
Add a line number entry for the same line.
* gdb.linespec/break-asm-file1.s (func): New label .Lfunc_2.
Add a line number entry for the same line.
Yao Qi [Thu, 26 Mar 2015 08:29:48 +0000 (08:29 +0000)]
Remove some hard-coded stuff in tests
There are some hard-coded stuff in .s files, such as .int 0 and
address offset, which isn't portable. This patch is to replace
".int 0" with nop and address offset with labels.
gdb/testsuite:
2015-03-26 Yao Qi <yao.qi@linaro.org>
* gdb.linespec/break-asm-file0.s (func2): Use nop instead of
.int 0.
(func): Likewise. Add .Lfunc_1 label.
Use .Lfunc_1 label.
* gdb.linespec/break-asm-file1.s (func3): Use nop instead of
.int 0.
(func): Likewise.
Use .Lfunc_1 label.
Yao Qi [Thu, 26 Mar 2015 08:29:48 +0000 (08:29 +0000)]
Compile break-asm-file{0,1}.s without debug info
If I add some nop into break-asm-file1.s like this,
--- INDEX:/gdb/testsuite/gdb.linespec/break-asm-file1.s
+++ WORKDIR:/gdb/testsuite/gdb.linespec/break-asm-file1.s
@@ -31,8 +31,8 @@ _func:
.type func, %function
func:
.Lbegin_func:
- .int 0
- .int 0
+ nop
+ nop
.Lend_func:
.size func, .-func
.Lend_text1:
I get the following error:
Running gdb/testsuite/gdb.linespec/break-asm-file.exp ...
gdb/testsuite/gdb.linespec/break-asm-file1.s: Assembler messages:^M
gdb/testsuite/gdb.linespec/break-asm-file1.s: Fatal error: duplicate .debug_line sections
break-asm-file0.s and break-asm-file1.s have already had debug information
(written manually), so don't need to generate debug infor for them.
gdb/testsuite:
2015-03-26 Yao Qi <yao.qi@linaro.org>
* gdb.linespec/break-asm-file.exp: Don't call prepare_for_testing.
Call gdb_compile instead to compile each .s files without debug
information.
Yao Qi [Thu, 26 Mar 2015 08:16:20 +0000 (08:16 +0000)]
Relax pattern to match the output of "info frame" in gdb.base/savedregs.exp
Hi,
I see the following two fails in gdb.base/savedregs.exp on aarch64-linux,
info frame 2^M
Stack frame at 0x7ffffffa60:^M
pc = 0x40085c in thrower (/home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.base/savedregs.c:49); saved pc = 0x400898^M
called by frame at 0x7ffffffa70, caller of frame at 0x7fffffe800^M
source language c.^M
Arglist at 0x7ffffffa60, args: ^M
Locals at 0x7ffffffa60, Previous frame's sp is 0x7ffffffa60^M
(gdb) FAIL: gdb.base/savedregs.exp: Get thrower info frame
info frame 2^M
Stack frame at 0x7fffffe800:^M
pc = 0x400840 in catcher (/home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.base/savedregs.c:42); saved pc = 0x7fb7ffc350^M
called by frame at 0x7fffffe800, caller of frame at 0x7fffffe7e0^M
source language c.^M
Arglist at 0x7fffffe7f0, args: sig=11^M
Locals at 0x7fffffe7f0, Previous frame's sp is 0x7fffffe800
(gdb) FAIL: gdb.base/savedregs.exp: Get catcher info frame
looks the test expects to match "Saved registers:" from the output of
"info frame", but no registers are saved on these two frames, because
thrower and catcher are simple and leaf functions.
(gdb) disassemble thrower
Dump of assembler code for function thrower:
0x0000000000400858 <+0>: mov x0, #0x0 // #0
0x000000000040085c <+4>: strb wzr, [x0]
0x0000000000400860 <+8>: ret
End of assembler dump.
(gdb) disassemble catcher
Dump of assembler code for function catcher:
0x0000000000400838 <+0>: sub sp, sp, #0x10
0x000000000040083c <+4>: str w0, [sp,#12]
0x0000000000400840 <+8>: adrp x0, 0x410000
0x0000000000400844 <+12>: add x0, x0, #0xb9c
0x0000000000400848 <+16>: mov w1, #0x1 // #1
0x000000000040084c <+20>: str w1, [x0]
0x0000000000400850 <+24>: add sp, sp, #0x10
0x0000000000400854 <+28>: ret
There are two ways to fix these fails, one is to modify functions to
force some registers saved (for example, doing function call in them),
and the other one is to relax the pattern to optionally match
"Saved registers:". I did both, and feel that the latter is simple,
so here is it.
gdb/testsuite:
2015-03-26 Yao Qi <yao.qi@linaro.org>
* gdb.base/savedregs.exp (process_saved_regs): Make
"Saved registers:" optional in the pattern.
GDB Administrator [Thu, 26 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Anton Blanchard [Wed, 25 Mar 2015 02:44:28 +0000 (13:44 +1100)]
powerpc: Only initialise opcode indices once
The gdb TUI is calling gdb_print_insn() (which calls
disassemble_init_powerpc()) enough to show up high in profiles. As
suggested by Alan, only initialise if the indices are empty.
opcodes/ChangeLog:
2015-03-25 Anton Blanchard <anton@samba.org>
* ppc-dis.c (disassemble_init_powerpc): Only initialise
powerpc_opcd_indices and vle_opcd_indices once.
Anton Blanchard [Wed, 25 Mar 2015 02:43:18 +0000 (13:43 +1100)]
powerpc: Add slbfee. instruction
opcodes/ChangeLog:
2015-03-25 Anton Blanchard <anton@samba.org>
* ppc-opc.c (powerpc_opcodes): Add slbfee.
Marcus Shawcroft [Sun, 22 Mar 2015 08:31:18 +0000 (08:31 +0000)]
[AArch64] Implement branch over stub section.
Ensure that injection of a stub section does not break a link where
there is an xpectation that flow of control can pass from one input
section to another simply by linking the input sections in series.
The solution here is to allow stub sections to be inserted after any
input section (existing behaviour), but inject an additional branch at
the start of each stub section such that control flow falling into the
stub section will branch over the stub section.
Marcus Shawcroft [Sun, 22 Mar 2015 07:48:07 +0000 (07:48 +0000)]
[AArch64] Remove padding before stub sections.
Lower stub alignment from 8 to 4 bytes thus removing padding between
input section content and stub section content.
Marcus Shawcroft [Wed, 25 Mar 2015 14:39:14 +0000 (14:39 +0000)]
[AArch64] Adjust veneer count.
Markus Metzger [Tue, 3 Feb 2015 15:42:41 +0000 (16:42 +0100)]
btrace: fix tests for 32-bit
The x86-record_goto.S assembly source file does not build on 32-bit.
This breaks many tests that use this file.
Split it into x86_64-record_goto.S and i686-record_goto.S. Luckily, we
can use either one with the same test .exp file.
It further turned out that most tests do not really need a fixed binary;
they should work pretty well with a newly-compiled C program. The
one thing that breaks this is the heavy use of "record goto" to navigate
inside the recorded execution.
Combine step.exp, next,exp, and finish.exp into a single test step.exp
and use normal stepping and reverse-stepping commands for navigation.
testsuite/
* gdb.btrace/next.exp: Merged into step.exp.
* gdb.btrace/finish.exp: Merged into step.exp.
* gdb.btrace/nexti.exp: Merged into stepi.exp.
* gdb.btrace/step.exp: Use record_goto.c as test file. Avoid using
"record goto" and checking the exact replay position.
* gdb.btrace/stepi.exp: Choose test file based on target. Do not
check for "Recording format" in "info record" output.
* gdb.btrace/record_goto.exp: Choose test file based on target.
* gdb.btrace/x86-record_goto.S: Renamed into ...
* gdb.btrace/x86_64-record_goto.S: ... this.
* gdb.btrace/i686-record_goto.S: New.
* gdb.btrace/x86-tailcall.S: Renamed into ...
* gdb.btrace/x86_64-tailcall.S: ... this.
* gdb.btrace/i686-tailcall.S: New.
* gdb.btrace/x86-tailcall.c: Renamed into ...
* gdb.btrace/tailcall.c: ... this. Split "return ++answer" into two
separate statements. Update test.
* gdb.btrace/delta.exp: Use record_goto.c as test file.
* gdb.btrace/gcore.exp: Use record_goto.c as test file.
* gdb.btrace/nohist.exp: Use record_goto.c as test file.
* gdb.btrace/tailcall.exp: Choose test file based on target.
* gdb.btrace/Makefile.in: Remove next, finish, and nexti.
Markus Metzger [Fri, 23 Jan 2015 14:13:20 +0000 (15:13 +0100)]
btrace: increase buffer size for exception test
The trace for throwing and catching an exception can be quite big.
Increase the buffer size to avoid spurious fails.
testsuite/
* gdb.btrace/exception.exp: Increase BTS buffer size.
Renlin Li [Wed, 25 Mar 2015 12:33:07 +0000 (12:33 +0000)]
[AARCH64]Fix "align directive causes MAP_DATA symbol to be lost"
gas/ChangeLog:
2015-03-25 Renlin Li <renlin.li@arm.com>
* config/tc-aarch64.c (mapping_state): Remove first MAP_DATA emitting code.
(mapping_state_2): Emit first MAP_DATA symbol here.
Pedro Alves [Wed, 25 Mar 2015 11:28:31 +0000 (11:28 +0000)]
Simplify target_async hook interface
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
Gary Benson [Wed, 25 Mar 2015 11:26:43 +0000 (11:26 +0000)]
Associate target_ops with target_fileio file descriptors
Various target_fileio_* functions use integer file descriptors to
refer to open files. File operation functions are looked up from
the target stack as they are used, which causes problems if the
target stack changes after the file is opened.
For example, if a file is opened on a remote target and the remote
target disconnects or closes the remote target will be popped off
the stack. If target_fileio_close is then called on that file and
"set auto-connect-native-target" is "on" (the default) then the
native target's close method will be called. If the file opened
on the remote happens to share the same number with a file open in
GDB then that file will be closed by mistake.
This commit changes target_fileio_open to store newly opened file
descriptors in a table together with the target_ops used to open
them. The index into the table is returned and used as the file
descriptor argument to all target_fileio_* functions that accept
file descriptor arguments.
gdb/ChangeLog:
* target.c (fileio_ft_t): New typedef, define object vector.
(fileio_fhandles): New static variable.
(is_closed_fileio_fh): New macro.
(lowest_closed_fd): New static variable.
(acquire_fileio_fd): New function.
(release_fileio_fd): Likewise.
(fileio_fd_to_fh): New macro.
(target_fileio_open): Wrap the file descriptor on success.
(target_fileio_pwrite): Updated to use wrapped file descriptor.
(target_fileio_pread): Likewise.
(target_fileio_close): Likewise.
Senthil Kumar Selvaraj [Tue, 24 Mar 2015 13:48:04 +0000 (19:18 +0530)]
Garbage collecting debug sections
I noticed that _bfd_elf_gc_mark_extra_sections attempts to unmark
related debug sections when it finds an unmarked code section.
When it finds .text.foo is unmarked, for example, it removes
.debug_line.text.foo as well (using the section name as a suffix
match check.
However, it bails out after finding one such section.
bfd/
* elflink.c (_bfd_elf_gc_mark_extra_sections): Don't break on
first matching debug section.
ld/testsuite/
* ld-gc/all-debug-sections.d: New file.
* ld-gc/all-debug-sections.s: Likewise.
* ld-gc/gc.exp: Execute new testcase.
H.J. Lu [Wed, 25 Mar 2015 02:06:22 +0000 (19:06 -0700)]
Don't write the zlib header if not used
No need to write the zlib header if compression didn't make the section
smaller.
PR gas/18087
* write.c (compress_debug): Don't write the zlib header if
compression didn't make the section smaller.
GDB Administrator [Wed, 25 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Tue, 24 Mar 2015 21:01:29 +0000 (21:01 +0000)]
Fix "thread apply all" with exited threads
I noticed that "thread apply all" sometimes crashes.
The problem is that thread_apply_all_command doesn take exited threads
into account, and we qsort and then walk more elements than there
really ever were put in the array. Valgrind shows:
The current thread <Thread ID 3> has terminated. See `help thread'.
(gdb) thread apply all p 1
Thread 1 (Thread 0x7ffff7fc2740 (LWP 29579)):
$1 = 1
==29576== Use of uninitialised value of size 8
==29576== at 0x639CA8: set_thread_refcount (thread.c:1337)
==29576== by 0x5C2C7B: do_my_cleanups (cleanups.c:155)
==29576== by 0x5C2CE8: do_cleanups (cleanups.c:177)
==29576== by 0x63A191: thread_apply_all_command (thread.c:1477)
==29576== by 0x50374D: do_cfunc (cli-decode.c:105)
==29576== by 0x506865: cmd_func (cli-decode.c:1893)
==29576== by 0x7562CB: execute_command (top.c:476)
==29576== by 0x647DA4: command_handler (event-top.c:494)
==29576== by 0x648367: command_line_handler (event-top.c:692)
==29576== by 0x7BF7C9: rl_callback_read_char (callback.c:220)
==29576== by 0x64784C: rl_callback_read_char_wrapper (event-top.c:171)
==29576== by 0x647CB5: stdin_event_handler (event-top.c:432)
==29576==
...
This can happen easily today as linux-nat.c/linux-thread-db.c are
forgetting to purge non-current exited threads. But even with that
fixed, we can always do "thread apply all" with an exited thread
selected, which won't be deleted until the user switches to another
thread. That's what the test added by this commit exercises.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* thread.c (thread_apply_all_command): Take exited threads into
account.
gdb/testsuite/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.threads/no-unwaited-for-left.exp: Test "thread apply all".
H.J. Lu [Tue, 24 Mar 2015 20:27:52 +0000 (13:27 -0700)]
Don't write the zlib header if not used
No need to write the zlib header if compression didn't make the section
smaller.
PR binutils/18087
* compress.c (bfd_compress_section_contents): Don't write the
zlib header and set contents as well as compress_status if
compression didn't make the section smaller.
(bfd_init_section_compress_status): Don't check compression
size here.
Pedro Alves [Tue, 24 Mar 2015 14:24:54 +0000 (14:24 +0000)]
Fix switch_back_to_stepped_thread comment references
Whoops, switch_back_to_stepping doesn't exist...
gdb/
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (resume, proceed): Mention
switch_back_to_stepped_thread, not switch_back_to_stepping.
Pedro Alves [Tue, 24 Mar 2015 14:24:53 +0000 (14:24 +0000)]
Shuffle user_visible_resume_ptid
... and move comment to declaration.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (user_visible_resume_ptid): Rewrite going from
most-locked to unlocked instead of the opposite. Move comment ...
* infrun.h (user_visible_resume_ptid): ... here.
Pedro Alves [Tue, 24 Mar 2015 18:31:51 +0000 (18:31 +0000)]
Debug output tweaks in the Linux target backends
This adds/tweaks a few debug logs I found useful recently.
gdb/gdbserver/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* linux-low.c (check_stopped_by_breakpoint): Tweak debug log
output. Also dump TRAP_TRACE.
(linux_low_filter_event): In debug output, distinguish a
resume_stop SIGSTOP from a delayed SIGSTOP.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_nat_resume): Output debug logs before trying
to resume the event lwp. Use the lwp's ptid instead of the passed
in (maybe wildcard) ptid.
(stop_wait_callback): Tweak debug log output.
(check_stopped_by_breakpoint): Tweak debug log output. Also dump
TRAP_TRACE.
(linux_nat_filter_event): In debug output, distinguish a
resume_stop SIGSTOP from a delayed SIGSTOP. Output debug logs
before trying to resume the lwp.
Joel Brobecker [Tue, 24 Mar 2015 18:14:13 +0000 (11:14 -0700)]
Do not make "prop" field of struct dynamic_prop_list a pointer.
struct dynamic_prop_list is declared as follow:
struct dynamic_prop_list
{
[...]
/* The dynamic property itself. */
struct dynamic_prop *prop;
[...]
};
In this case, the pointer indirection is unnecessary and costing us,
for each dynamic property, the memory needed to store one pointer.
This patch removes this pointer indirection, savin us a tiny bit of
memory, as well as reduces a bit the complexity by removing the need
to allocate memory for the property, as the allocation is now part
of the struct itself.
gdb/ChangeLog:
* gdbtypes.h (struct dynamic_prop_list) <prop>: Remove
pointer indirection.
* gdbtypes.c (get_dyn_prop): Adjust, following change above.
(add_dyn_prop, copy_dynamic_prop_list): Likewise.
Tested on x86_64-linux.
Joel Brobecker [Tue, 24 Mar 2015 18:03:21 +0000 (11:03 -0700)]
GDB: rename DYN_ATTR_DATA_LOCATION into DYN_PROP_DATA_LOCATION.
The terminology we've been using is (dynamic) "property" rather than
"attribute", so this patch renames an enum to use the same terminology.
No behavior change.
gdb/ChangeLog:
* gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_DATA_LOCATION>:
Renames DYN_ATTR_DATA_LOCATION.
(TYPE_DATA_LOCATION): Use DYN_PROP_DATA_LOCATION instead of
DYN_ATTR_DATA_LOCATION.
* dwarf2read.c (set_die_type): Use DYN_PROP_DATA_LOCATION
instead of DYN_ATTR_DATA_LOCATION.
Tested on x86_64-linux.
Pedro Alves [Tue, 24 Mar 2015 17:50:31 +0000 (17:50 +0000)]
Remove 'step' parameters from 'proceed' and 'resume'
The "step" parameters of 'proceed' and 'resume' aren't really useful
as indication of whether run control wants to single-step the target,
as that information must already be retrievable from
currently_stepping. In fact, if currently_stepping disagrees with
whether we single-stepped the target, then things break. Thus instead
of having the same information in two places, this patch removes those
parameters.
Setting 'step_start_function' is the only user of proceed's 'step'
argument, other than passing the 'step' argument down to 'resume' and
debug log output. Move that instead to set_step_frame, where we
already set other related fields.
clear_proceed_status keeps its "step" parameter for now because it
needs to know which set of threads should have their state cleared,
and is called before the "stepping_command" flag is set.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* breakpoint.c (until_break_command): Adjust call to proceed.
* gdbthread.h (struct thread_control_state) <stepping_command>:
New field.
* infcall.c (run_inferior_call): Adjust call to proceed.
* infcmd.c (run_command_1, proceed_thread_callback, continue_1):
Adjust calls to proceed.
(set_step_frame): Set the current thread's step_start_function
here.
(step_once): Adjust calls to proceed.
(jump_command, signal_command, until_next_command)
(finish_backward, finish_forward, proceed_after_attach_callback)
(attach_command_post_wait): Adjust calls to proceed.
* infrun.c (proceed_after_vfork_done): Adjust call to proceed.
(do_target_resume): New function, factored out from ...
(resume): ... here. Remove 'step' parameter. Instead, check
currently_stepping to determine whether the thread should be
single-stepped.
(proceed): Remove 'step' parameter and don't set the thread's
step_start_function here. Adjust call to 'resume'.
(handle_inferior_event): Adjust calls to 'resume'.
(switch_back_to_stepped_thread): Use do_target_resume instead of
'resume'.
(keep_going): Adjust calls to 'resume'.
* infrun.h (proceed): Remove 'step' parameter.
(resume): Likewise.
* windows-nat.c (do_initial_windows_stuff): Adjust call to
'resume'.
* mi/mi-main.c (proceed_thread): Adjust call to 'proceed'.
Pedro Alves [Tue, 24 Mar 2015 17:50:31 +0000 (17:50 +0000)]
Make "set scheduler-locking step" depend on user intention, only
Currently, "set scheduler-locking step" is a bit odd. The manual
documents it as being optimized for stepping, so that focus of
debugging does not change unexpectedly, but then it says that
sometimes other threads may run, and thus focus may indeed change
unexpectedly... A user can then be excused to get confused and wonder
why does GDB behave like this.
I don't think a user should have to know about details of how "next"
or whatever other run control command is implemented internally to
understand when does the "scheduler-locking step" setting take effect.
This patch completes a transition that the code has been moving
towards for a while. It makes "set scheduler-locking step" hold
threads depending on whether the _command_ the user entered was a
stepping command [step/stepi/next/nexti], or not.
Before, GDB could end up locking threads even on "continue" if for
some reason run control decides a thread needs to be single stepped
(e.g., for a software watchpoint).
After, if a "continue" happens to need to single-step for some reason,
we won't lock threads (unless when stepping over a breakpoint,
naturally). And if a stepping command wants to continue a thread for
bit, like when skipping a function to a step-resume breakpoint, we'll
still lock threads, so focus of debugging doesn't change.
In order to make this work, we need to record in the thread structure
whether what set it running was a stepping command.
(A follow up patch will remove the "step" parameters of 'proceed' and 'resume')
FWIW, Fedora GDB, which defaults to "scheduler-locking step" (mainline
defaults to "off") carries a different patch that goes in this
direction as well.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_control_state) <stepping_command>:
New field.
* infcmd.c (step_once): Pass step=1 to clear_proceed_status. Set
the thread's stepping_command field.
* infrun.c (resume): Check the thread's stepping_command flag to
determine which threads should be resumed. Rename 'entry_step'
local to user_step.
(clear_proceed_status_thread): Clear 'stepping_command'.
(schedlock_applies): Change parameter type to struct thread_info
pointer. Adjust.
(find_thread_needs_step_over): Remove 'step' parameter. Adjust.
(switch_back_to_stepped_thread): Adjust calls to
'schedlock_applies'.
(_initialize_infrun): Adjust "set scheduler-locking step" help.
gdb/testsuite/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.threads/schedlock.exp (test_step): No longer expect that
"set scheduler-locking step" with "next" over a function call runs
threads unlocked.
gdb/doc/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* gdb.texinfo (test_step) <set scheduler-locking step>: No longer
mention that threads may sometimes run unlocked.
Pedro Alves [Tue, 24 Mar 2015 17:50:30 +0000 (17:50 +0000)]
Make step_start_function be per thread
I noticed that step_start_function is still a global, while it
obviously should be a per-thread field.
gdb/ChangeLog:
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (step_start_function): Delete and ...
* gdbthread.h (struct thread_control_state) <step_start_function>:
... now a field here.
* infrun.c (clear_proceed_status_thread): Clear the thread's
step_start_function.
(proceed, process_event_stop_test, print_stop_event): Adjust.
Pedro Alves [Tue, 24 Mar 2015 17:50:29 +0000 (17:50 +0000)]
No longer handle negative 'step' in 'proceed'
Nothing ever passes a negative 'step' to proceed.
Gets rid of one of the few remaining stop_after_trap references.
gdb/ChangeLog
2015-03-24 Pedro Alves <palves@redhat.com>
* infrun.c (proceed): No longer handle negative step.
Antoine Tremblay [Tue, 24 Mar 2015 17:28:42 +0000 (13:28 -0400)]
Fix mi-pending.exp test output to allow stable test diffing
gdb/testsuite/ChangeLog:
* gdb.mi/mi-pending.exp: Fix output of breakpoint test.
Nick Clifton [Tue, 24 Mar 2015 17:20:00 +0000 (17:20 +0000)]
Fixes a bug introduced by the new ranges checks on COFF symbol tables.
PR binutils/17512
* coffgen.c (coff_get_normalized_symtab): Fix test for out of
range auxillary sections.
Marcus Shawcroft [Mon, 2 Mar 2015 12:11:40 +0000 (12:11 +0000)]
[AArch64] Factor out _bfd_aarch64_get_stub_for_link_section.
Marcus Shawcroft [Sat, 28 Feb 2015 00:17:22 +0000 (00:17 +0000)]
[AArch64] Refactor section_group[] representation.
Change the behaviour of section_group[] such that .stub_sec points to
the stub section attached to the indexed section rather than the stub
section attached to the link_section pointed to be the index section.
This provides a mechanism to get to the stub section following any
input section. While still allowing the section grouping mechanism to
find the section group stub section associated with an input section
by first following the link_sec pointer.
Gary Benson [Tue, 24 Mar 2015 14:05:45 +0000 (14:05 +0000)]
Move duplicated Linux x86 code to nat/x86-linux.c
This commit moves two identical functions from gdb/x86-linux-nat.c and
gdb/gdbserver/linux-x86-low.c into the shared file gdb/nat/x86-linux.c.
gdb/ChangeLog:
* nat/x86-linux.h (x86_linux_new_thread): New declaration.
(x86_linux_prepare_to_resume): Likewise.
* x86-linux-nat.c (x86_linux_new_thread):
Moved to nat/x86-linux.c.
(x86_linux_prepare_to_resume): Likewise.
* nat/x86-linux.c (x86_linux_new_thread): New function.
(x86_linux_prepare_to_resume): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_new_thread): Moved to
nat/x86-linux.c.
(x86_linux_prepare_to_resume): Likewise.
Gary Benson [Tue, 24 Mar 2015 14:05:45 +0000 (14:05 +0000)]
Move low-level Linux x86 debug register code to a shared file
This commit moves the now-identical low-level Linux x86 debug register
code from gdb/x86-linux-nat.c and gdb/gdbserver/linux-x86-low.c into a
new shared file gdb/nat/x86-linux-dregs.c.
gdb/ChangeLog:
* nat/x86-linux-dregs.h: New file.
* nat/x86-linux-dregs.c: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux-dregs.h.
(x86-linux-dregs.o): New rule.
* config/i386/linux.mh (NATDEPFILES): Add x86-linux-dregs.o.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* x86-linux-nat.c: Include nat/x86-linux-dregs.h.
(u_debugreg_offset): Moved to nat/x86-linux-dregs.c.
(x86_linux_dr_get): Likewise.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_update_debug_registers): Likewise.
gdb/gdbserver/ChangeLog:
* Makefile.in (x86-linux-dregs.o): New rule.
* configure.srv: Add x86-linux-dregs.o to relevant targets.
* linux-x86-low.c: Include nat/x86-linux-dregs.h.
(u_debugreg_offset): Moved to nat/x86-linux-dregs.c.
(x86_linux_dr_get): Likewise.
(x86_linux_dr_set): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(x86_linux_update_debug_registers): Likewise.
Gary Benson [Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)]
Introduce x86_linux_update_debug_registers
This commit moves the entire body of both GDB's and gdbserver's
x86_linux_prepare_to_resume functions into new functions,
x86_linux_update_debug_registers. This reorganisation allows
all Linux x86 low-level debug register code to be placed in one
shared file, separate from general Linux x86 shared code.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.
Gary Benson [Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)]
Linux x86 low-level debug register comment synchronization
This commit updates comments in the low-level debug register code for
Linux x86, making GDB's and gdbserver's implementations identical.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_dr_get): Update comments.
(x86_linux_dr_set): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_prepare_to_resume): Likewise.
(x86_linux_new_thread): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_dr_get): Update comments.
(x86_linux_dr_set): Likewise.
(update_debug_registers_callback): Likewise.
(x86_linux_dr_set_addr): Likewise.
(x86_linux_dr_get_addr): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(x86_linux_prepare_to_resume): Likewise.
Gary Benson [Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)]
Linux x86 low-level debug register code synchronization
This commit makes several small changes to the low-level debug
register code for Linux x86, making the code in the GDB and
gdbserver implementations identical.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_dr_set_addr): Update assertion.
(x86_linux_new_thread): Rename argument.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_dr_get): Add assertion.
Use perror_with_name. Pass string through gettext.
(x86_linux_dr_set): Likewise.
Gary Benson [Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)]
Rename gdbserver's low-level Linux x86 debug register accessors
This commit renames gdbserver's low-level Linux x86 debug register
accessors to the same names used by GDB.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_dr_low_set_addr): Rename to...
(x86_linux_dr_set_addr): ...this.
(x86_dr_low_get_addr): Rename to...
(x86_linux_dr_get_addr): ...this.
(x86_dr_low_set_control): Rename to...
(x86_linux_dr_set_control): ...this.
(x86_dr_low_get_control): Rename to...
(x86_linux_dr_get_control): ...this.
(x86_dr_low_get_status): Rename to...
(x86_linux_dr_get_status): ...this.
(x86_dr_low): Update with new function names.