Pedro Alves [Wed, 21 May 2014 17:30:43 +0000 (18:30 +0100)]
Rename "target djgpp" -> "target native"
To be like other native targets.
Leave to_shortname, to_longname, to_doc as inf-child.c sets them:
t->to_shortname = "native";
t->to_longname = "Native process";
t->to_doc = "Native process (started by the \"run\" command).";
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_target): Don't override to_shortname,
to_longname or to_doc.
Pedro Alves [Wed, 21 May 2014 17:30:43 +0000 (18:30 +0100)]
Rename "target child" to "target native".
I had been pondering renaming "target child" to something else.
"child" is a little lie in case of "attach", and not exactly very
clear to users, IMO. By best suggestion is "target native". If I
were to explain what "target child" is, I'd just start out with "it's
the native target" anyway. I was worrying a little that "native"
might be a lie too if some port comes up with a default target that
can run but is not really native, but I think that's a very minor
issue - we can consider that "native" really means the default built
in target that GDB supports, instead of saying that's the target that
debugs host native processes, if it turns out necessary.
This change doesn't affect users much, because "target child" results
in error today:
(gdb) target child
Use the "run" command to start a child process.
Other places "child" is visible:
(gdb) help target
...
List of target subcommands:
target child -- Child process (started by the "run" command)
target core -- Use a core file as a target
target exec -- Use an executable file as a target
...
(gdb) info target
Symbols from "/home/pedro/gdb/mygit/build/gdb/gdb".
Child process:
Using the running image of child Thread 0x7ffff7fc9740 (LWP 4818).
While running this, GDB does not access memory from...
...
These places will say "native" instead. I think that's a good thing.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* inf-child.c (inf_child_open): Remove mention of "child".
(inf_child_target): Rename target to "native" instead of "child".
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Test "target native" instead of "target
child".
Andreas Arnez [Fri, 22 Nov 2013 18:49:51 +0000 (18:49 +0000)]
Drop regset_alloc().
Now that all invocations of regset_alloc() have been removed, the
function is dropped. Since regset_alloc() was the only function
provided by regset.c, this source file is removed as well.
Andreas Arnez [Mon, 24 Feb 2014 10:58:15 +0000 (10:58 +0000)]
SPARC: Replace regset_alloc() invocations by static regset structures.
Andreas Arnez [Fri, 28 Mar 2014 17:34:19 +0000 (17:34 +0000)]
SPARC: Rename register maps from "*regset" to "*regmap"
Clear the naming confusion about "regset" versus "sparc*regset". The
latter was used to represent the *map* of a register set, not the
register set itself, and is thus renamed accordingly.
The following identifiers are renamed:
sparc32_bsd_fpregset => sparc32_bsd_fpregmap
sparc32_linux_core_gregset => sparc32_linux_core_gregmap
sparc32_sol2_fpregset => sparc32_sol2_fpregmap
sparc32_sol2_gregset => sparc32_sol2_gregmap
sparc32_sunos4_fpregset => sparc32_sunos4_fpregmap
sparc32_sunos4_gregset => sparc32_sunos4_gregmap
sparc32nbsd_gregset => sparc32nbsd_gregmap
sparc64_bsd_fpregset => sparc64_bsd_fpregmap
sparc64_linux_core_gregset => sparc64_linux_core_gregmap
sparc64_linux_ptrace_gregset => sparc64_linux_ptrace_gregmap
sparc64_sol2_fpregset => sparc64_sol2_fpregmap
sparc64_sol2_gregset => sparc64_sol2_gregmap
sparc64fbsd_gregset => sparc64fbsd_gregmap
sparc64nbsd_gregset => sparc64nbsd_gregmap
sparc64obsd_core_gregset => sparc64obsd_core_gregmap
sparc64obsd_gregset => sparc64obsd_gregmap
sparc_fpregset => sparc_fpregmap
sparc_gregset => sparc_gregmap
sparc_sol2_fpregset => sparc_sol2_fpregmap
sparc_sol2_gregset => sparc_sol2_gregmap
Also, all local variables 'gregset' and 'fpregset' are renamed to
'gregmap' and 'fpregmap', respectively.
Andreas Arnez [Mon, 31 Mar 2014 09:07:42 +0000 (09:07 +0000)]
SCORE: Replace regset_alloc() invocation by a static regset structure.
Since this changes makes the only member of the tdep structure
obsolete, the tdep structure is removed.
Andreas Arnez [Fri, 22 Nov 2013 18:43:00 +0000 (18:43 +0000)]
MN10300: Replace regset_alloc() invocations by static regset structures.
On this architecture the change may fix a small memory leak.
Andreas Arnez [Fri, 22 Nov 2013 18:40:06 +0000 (18:40 +0000)]
MIPS: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Mon, 5 May 2014 12:58:11 +0000 (12:58 +0000)]
X86: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Fri, 28 Mar 2014 17:21:39 +0000 (17:21 +0000)]
ARM: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Fri, 22 Nov 2013 18:29:26 +0000 (18:29 +0000)]
AARCH64: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the tdep fields
'gregset' and 'fpregset' become obsolete and are thus removed.
Andreas Arnez [Tue, 13 May 2014 11:05:57 +0000 (11:05 +0000)]
Remove 'arch' field from regset structure.
Removes the 'arch' field from the regset structure, since it
represents the only "dynamic" data in a regset. It was referenced in
some regset supply- and collect routines, to get access to the gdbarch
associated with the regset. Naturally, the affected routines always
have access to the regcache to be supplied to or collected from. Thus
the gdbarch associated with that regcache can be used instead.
Andreas Arnez [Mon, 3 Mar 2014 09:31:21 +0000 (09:31 +0000)]
Constify regset structures.
Mark Wielaard [Wed, 21 May 2014 14:00:05 +0000 (16:00 +0200)]
gdb/testsuite: Handle underlying type in gdb.cp/var-tag.exp.
* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
Jan Kratochvil [Wed, 21 May 2014 14:25:53 +0000 (16:25 +0200)]
Fix TLS access for -static -pthread
I have posted:
TLS variables access for -static -lpthread executables
https://sourceware.org/ml/libc-help/2014-03/msg00024.html
and the GDB patch below has been confirmed as OK for current glibcs.
Further work should be done for newer glibcs:
Improve TLS variables glibc compatibility
https://sourceware.org/bugzilla/show_bug.cgi?id=16954
Still the patch below implements the feature in a fully functional way backward
compatible with current glibcs, it depends on the following glibc source line:
csu/libc-tls.c
main_map->l_tls_modid = 1;
gdb/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p.
(try_thread_db_load_1): Initialize it.
(thread_db_get_thread_local_address): Call it if LM is zero.
* target.c (target_translate_tls_address): Remove LM_ADDR zero check.
* target.h (struct target_ops) (to_get_thread_local_address): Add
load_module_addr comment.
gdb/gdbserver/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p.
(thread_db_get_tls_address): Call it if LOAD_MODULE is zero.
(thread_db_load_search, try_thread_db_load_1): Initialize it.
gdb/testsuite/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
<HAVE_TLS> (thread_function, main): Initialize it.
* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
Add clean_restart.
<$have_tls != "">: Check TLSVAR.
Message-ID: <
20140410115204.GB16411@host2.jankratochvil.net>
Pedro Alves [Wed, 21 May 2014 12:58:16 +0000 (13:58 +0100)]
Make the dcache (code/stack cache) handle line reading errors better
The dcache (code/stack cache) is supposed to be transparent, but it's
actually not in one case. dcache tries to read chunks (cache lines)
at a time off of the target. This may end up trying to read
unaccessible or unavailable memory. Currently the caller gets an xfer
error in this case. But if the specific bits of memory the caller
actually wanted are available and accessible, then the caller should
get the memory it wanted, not an error.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* dcache.c (dcache_read_memory_partial): If reading the cache line
fails, fallback to reading just the memory the caller wanted.
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/dcache-line-read-error.c: New.
* gdb.base/dcache-line-read-error.exp: New.
Alan Modra [Wed, 21 May 2014 00:01:09 +0000 (09:31 +0930)]
daily update
mfortune [Tue, 20 May 2014 22:50:21 +0000 (23:50 +0100)]
Add ChangeLog from previous MIPS .module commit
mfortune [Tue, 20 May 2014 12:28:20 +0000 (13:28 +0100)]
Add MIPS .module directive
gas/
* config/tc-mips.c (file_mips_opts_checked): New static global.
(s_module): New static function.
(file_ase): Remove.
(mips_pseudo_table): Add .module handler.
(mips_set_ase): Add opts argument and use instead of mips_opts.
(md_assemble): Use file_mips_check_options.
(md_parse_option): Update to use file_mips_opts instead of mips_opts.
(mips_set_architecture): Delete function. Moved to...
(mips_after_parse_args): Here. All logic now applies to
file_mips_opts first and then copies the final state to mips_opts.
Move error checking and defaults inference to mips_check_options and
file_mips_check_options.
(mips_check_options): New static function. Common option checking for
command line, .module and .set. Use .module values in error messages
instead of refering to command line options.
(file_mips_check_options): New static function. A wrapper for
mips_check_options with file_mips_opts. Updates BFD arch based on
final options.
(s_mipsset): Split into s_mipsset and parse_code_option. Settings
supported by both .set and .module are moved to parse_code_option.
Warnings and errors are kept in s_mipsset because when
parse_code_option is used with s_module the warnings are deferred
until code is generated. Any setting supporting 'default' value is
kept in s_mipsset as it is not applicable to s_module. Inferred
settings are also kept in s_mipsset as s_module does not infer any
settings. Use mips_check_options.
(parse_code_option): New static function derived from s_mipsset.
(s_module): New static function that implements .module. Allows file
level settings to be changed until code is generated.
(s_cpload, s_cpsetup, s_cplocal): Use file_mips_check_options.
(s_cprestore, s_cpreturn, s_cpadd, mips_address_bytes): Likewise.
(mips_elf_final_processing): Update file_ase to file_mips_opts.ase.
(md_mips_end): Use file_mips_check_options.
* doc/c-mips.texi: Document .module.
gas/testsuite
* gas/mips/mips.exp: Add new tests. Use 64-bit ABI for relax-bc1any.
Fix micromips arch definition to use mips64r2 consistently.
* gas/mips/module-defer-warn1.s: New.
* gas/mips/module-defer-warn1.d: New.
* gas/mips/module-defer-warn2.s: New.
* gas/mips/module-defer-warn2.l: New.
* gas/mips/module-override.d: New.
* gas/mips/module-override.s: New.
* gas/mips/mips-gp32-fp64.l: Update expected output.
* gas/mips/mips-gp64-fp32-pic.l: Update expected output.
* gas/mips/mips-gp64-fp32.l: Update expected output.
mfortune [Tue, 20 May 2014 22:34:19 +0000 (23:34 +0100)]
Remove newly introduced whitespace from warnings.
* messages.c (as_warn_internal): Remove extra whitespace from
warning messages.
mfortune [Tue, 20 May 2014 11:45:47 +0000 (12:45 +0100)]
Mark MSA as requiring FP64
gas/
* config/tc-mips.c (FP64_ASES): Add ASE_MSA.
(mips_after_parse_args): Do not select ASE_MSA without -mfp64.
gas/testsuite/
* gas/mips/micromips@msa-branch.d: Rework expected output for fp64.
* gas/mips/msa-branch.d: Likewise.
Hans-Peter Nilsson [Tue, 20 May 2014 21:13:08 +0000 (23:13 +0200)]
ld: Add missing eelf32mbel_linux.c to ALL_EMULATION_SOURCES.
ld:
* Makefile.am (ALL_EMULATION_SOURCES): Add missing eelf32mbel_linux.c.
* Makefile.in: Regenerate.
Doug Evans [Tue, 20 May 2014 20:06:26 +0000 (13:06 -0700)]
Fix gdb.multi/base.exp failures.
UNRESOLVED: gdb.multi/base.exp: remove-inferiors 2-3
UNRESOLVED: gdb.multi/base.exp: check remove-inferiors
gdb is crashing because it's accessing/freeing already freed memory.
==16368== Invalid read of size 4
==16368== at 0x660A9D: find_pc_section (binutils-gdb/gdb/objfiles.c:1349)
==16368== by 0x663ECB: lookup_minimal_symbol_by_pc_section (binutils-gdb/gdb/minsyms.c:734)
==16368== by 0x5D987A: find_pc_sect_symtab (binutils-gdb/gdb/symtab.c:2153)
==16368== by 0x5D4D77: blockvector_for_pc_sect (binutils-gdb/gdb/block.c:168)
==16368== by 0x5D4F59: block_for_pc_sect (binutils-gdb/gdb/block.c:246)
==16368== by 0x5D4F9B: block_for_pc (binutils-gdb/gdb/block.c:258)
==16368== by 0x734C5D: inline_frame_sniffer (binutils-gdb/gdb/inline-frame.c:218)
==16368== by 0x732104: frame_unwind_try_unwinder (binutils-gdb/gdb/frame-unwind.c:108)
==16368== by 0x73223F: frame_unwind_find_by_frame (binutils-gdb/gdb/frame-unwind.c:159)
==16368== by 0x72D5AA: compute_frame_id (binutils-gdb/gdb/frame.c:453)
==16368== by 0x7300EC: get_prev_frame_if_no_cycle (binutils-gdb/gdb/frame.c:1758)
==16368== by 0x73079A: get_prev_frame_always (binutils-gdb/gdb/frame.c:1931)
==16368== Address 0x5b13500 is 16 bytes inside a block of size 24 free'd
==16368== at 0x403072E: free (valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:445)
==16368== by 0x762134: xfree (binutils-gdb/gdb/common/common-utils.c:108)
==16368== by 0x65DACF: objfiles_pspace_data_cleanup (binutils-gdb/gdb/objfiles.c:91)
==16368== by 0x75E546: program_spaceregistry_callback_adaptor (binutils-gdb/gdb/progspace.c:45)
==16368== by 0x7644F6: registry_clear_data (binutils-gdb/gdb/registry.c:82)
==16368== by 0x7645AB: registry_container_free_data (binutils-gdb/gdb/registry.c:95)
==16368== by 0x75E5B4: program_space_free_data (binutils-gdb/gdb/progspace.c:45)
==16368== by 0x75E9BA: release_program_space (binutils-gdb/gdb/progspace.c:167)
==16368== by 0x75EB9B: prune_program_spaces (binutils-gdb/gdb/progspace.c:269)
==16368== by 0x75303D: remove_inferior_command (binutils-gdb/gdb/inferior.c:792)
==16368== by 0x50B5FD: do_cfunc (binutils-gdb/gdb/cli/cli-decode.c:107)
==16368== by 0x50E6F2: cmd_func (binutils-gdb/gdb/cli/cli-decode.c:1886)
The problem originates from the get_current_arch call in
py-progspace.c:py_free_pspace. The inferior associated with the
pspace is gone, and the current inferior is a different one and is running.
Therefore get_current_arch tries to read the current frame which
causes reads of data in the current program space which we've just deleted.
* python/py-progspace.c (py_free_pspace): Call target_gdbarch
instead of get_current_arch.
Mike Stump [Tue, 20 May 2014 19:45:30 +0000 (12:45 -0700)]
* messages.c (as_warn_internal): Ensure we don't interleave output
within a single line when make -j is used.
(as_bad_internal): Likewise.
DJ Delorie [Tue, 20 May 2014 19:42:23 +0000 (15:42 -0400)]
* elf32-msp430.c (msp430_elf_relax_adjust_locals): Avoid overflow.
Pedro Alves [Tue, 20 May 2014 18:11:39 +0000 (19:11 +0100)]
Make compare-sections work against all targets; add compare-sections [-r] tests.
This does two things:
1. Adds a test.
Recently compare-sections got a new "-r" switch, but given no test
existed for compare-sections, the patch was allowed in with no
testsuite addition. This now adds a test for both compare-sections
and compare-sections -r.
2. Makes the compare-sections command work against all targets.
Currently, compare-sections only works with remote targets, and only
those that support the qCRC packet. The patch makes it so that if the
target doesn't support accelerating memory verification, then GDB
falls back to comparing memory itself. This is of course slower, but
it's better than nothing, IMO. While testing against extended-remote
GDBserver I noticed that we send the qCRC request to the target if
we're connected, but not yet running a program. That can't work of
course -- the patch fixes that. This all also goes in the direction
of bridging the local/remote parity gap.
I didn't decouple 1. from 2., because that would mean that the test
would need to handle the case of the target not supporting the
command.
Tested on x86_64 Fedora 17, native, remote GDBserver, and
extended-remote GDBserver. I also hack-disabled qCRC support to make
sure the fallback paths in remote.c work.
gdb/doc/
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Memory) <compare-sections>: Generalize comments to
not be remote specific. Add cross reference to the qCRC packet.
(Separate Debug Files): Update cross reference to the qCRC packet.
(General Query Packets) <qCRC packet>: Add anchor.
gdb/
2014-05-20 Pedro Alves <palves@redhat.com>
* NEWS: Mention that compare-sections now works with all targets.
* remote.c (PACKET_qCRC): New enum value.
(remote_verify_memory): Don't send qCRC if the target has no
execution. Use packet_support/packet_ok. If the target doesn't
support the qCRC packet, fallback to a deep memory copy.
(compare_sections_command): Say "target image" instead of "remote
executable".
(_initialize_remote): Add PACKET_qCRC to the list of config
packets that have no associated command. Extend comment.
* target.c (simple_verify_memory, default_verify_memory): New
function.
* target.h (struct target_ops) <to_verify_memory>: Default to
default_verify_memory.
(simple_verify_memory): New declaration.
* target-delegates.c: Regenerate.
gdb/testsuite/
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/compare-sections.c: New file.
* gdb.base/compare-sections.exp: New file.
Richard Sandiford [Tue, 20 May 2014 18:02:41 +0000 (19:02 +0100)]
gas/
* config/obj-elf.h (obj_elf_seen_attribute): Declare.
* config/obj-elf.c (recorded_attribute_info): New structure.
(recorded_attributes): New variable.
(record_attribute, obj_elf_seen_attribute): New functions.
(obj_elf_vendor_attribute): Record which attributes have been seen.
Pedro Alves [Tue, 20 May 2014 17:24:28 +0000 (18:24 +0100)]
[GDBserver] Make Zx/zx packet handling idempotent.
This patch fixes hardware breakpoint regressions exposed by my fix for
"PR breakpoints/7143 - Watchpoint does not trigger when first set", at
https://sourceware.org/ml/gdb-patches/2014-03/msg00167.html
The testsuite caught them on Linux/x86_64, at least. gdb.sum:
gdb.sum:
FAIL: gdb.base/hbreak2.exp: next over recursive call
FAIL: gdb.base/hbreak2.exp: backtrace from factorial(5.1)
FAIL: gdb.base/hbreak2.exp: continue until exit at recursive next test
gdb.log:
(gdb) next
Program received signal SIGTRAP, Trace/breakpoint trap.
factorial (value=4) at ../../../src/gdb/testsuite/gdb.base/break.c:113
113 if (value > 1) { /* set breakpoint 7 here */
(gdb) FAIL: gdb.base/hbreak2.exp: next over recursive call
Actually, that patch just exposed a latent issue to "breakpoints
always-inserted off" mode, not really caused it. After that patch,
GDB no longer removes breakpoints at each internal event, thus making
some scenarios behave like breakpoint always-inserted on. The bug is
easy to trigger with always-inserted on.
The issue is that since the target-side breakpoint conditions support,
if the stub/server supports evaluating breakpoint conditions on the
target side, then GDB is sending duplicate Zx packets to the target
without removing them before, and GDBserver is not really expecting
that for Z packets other than Z0/z0. E.g., with "set breakpoint
always-inserted on" and "set debug remote 1":
(gdb) b main
Sending packet: $m410943,1#ff...Packet received: 48
Breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z0,410943,1#48...Packet received: OK
^^^^^^^^^^^^
(gdb) b main
Note: breakpoint 4 also set at pc 0x410943.
Sending packet: $m410943,1#ff...Packet received: 48
Breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z0,410943,1#48...Packet received: OK
^^^^^^^^^^^^
(gdb) b main
Note: breakpoints 4 and 5 also set at pc 0x410943.
Sending packet: $m410943,1#ff...Packet received: 48
Breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z0,410943,1#48...Packet received: OK
^^^^^^^^^^^^
(gdb) del
Delete all breakpoints? (y or n) y
Sending packet: $Z0,410943,1#48...Packet received: OK
Sending packet: $Z0,410943,1#48...Packet received: OK
Sending packet: $z0,410943,1#68...Packet received: OK
And for Z1, similarly:
(gdb) hbreak main
Sending packet: $m410943,1#ff...Packet received: 48
Hardware assisted breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z1,410943,1#49...Packet received: OK
^^^^^^^^^^^^
Packet Z1 (hardware-breakpoint) is supported
(gdb) hbreak main
Note: breakpoint 4 also set at pc 0x410943.
Sending packet: $m410943,1#ff...Packet received: 48
Hardware assisted breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z1,410943,1#49...Packet received: OK
^^^^^^^^^^^^
(gdb) hbreak main
Note: breakpoints 4 and 5 also set at pc 0x410943.
Sending packet: $m410943,1#ff...Packet received: 48
Hardware assisted breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
Sending packet: $Z1,410943,1#49...Packet received: OK
^^^^^^^^^^^^
(gdb) del
Delete all breakpoints? (y or n) y
Sending packet: $Z1,410943,1#49...Packet received: OK
^^^^^^^^^^^^
Sending packet: $Z1,410943,1#49...Packet received: OK
^^^^^^^^^^^^
Sending packet: $z1,410943,1#69...Packet received: OK
^^^^^^^^^^^^
So GDB sent a bunch of Z1 packets, and then when finally removing the
breakpoint, only one z1 packet was sent. On the GDBserver side (with
monitor set debug-hw-points 1), in the Z1 case, we see:
$ ./gdbserver :9999 ./gdbserver
Process ./gdbserver created; pid = 8629
Listening on port 9999
Remote debugging from host 127.0.0.1
insert_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=1 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
insert_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=2 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
insert_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=3 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
insert_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
insert_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=5 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
remove_watchpoint (addr=410943, len=1, type=instruction-execute):
CONTROL (DR7):
00000101 STATUS (DR6):
00000000
DR0: addr=0x410943, ref.count=4 DR1: addr=0x0, ref.count=0
DR2: addr=0x0, ref.count=0 DR3: addr=0x0, ref.count=0
That's one insert_watchpoint call for each Z1 packet, and then one
remove_watchpoint call for the z1 packet. Notice how ref.count
increased for each insert_watchpoint call, and then in the end, after
GDB told GDBserver to forget about the hardware breakpoint, GDBserver
ends with the the first debug register still with ref.count=4! IOW,
the hardware breakpoint is left armed on the target, while on the GDB
end it's gone. If the program happens to execute 0x410943 afterwards,
then the CPU traps, GDBserver reports the trap to GDB, and GDB not
having a breakpoint set at that address anymore, reports to the user a
spurious SIGTRAP.
This is exactly what is happening in the hbreak2.exp test, though in
that case, it's a shared library event that triggers a
breakpoint_re_set, when breakpoints are still inserted (because
nowadays GDB doesn't remove breakpoints while handling internal
events), and that recreates breakpoint locations, which likewise
forces breakpoint reinsertion and Zx packet resends...
That is a lot of bogus Zx duplication that should possibly be
addressed on the GDB side. GDB resends Zx packets because the way to
change the target-side condition, is to resend the breakpoint to the
server with the new condition. (That's an option in the packet: e.g.,
"Z1,410943,1;X3,220027" for "hbreak main if 0". The packets in the
examples above are shorter because the breakpoints don't have
conditions attached). GDB doesn't remove the breakpoint first before
reinserting it because that'd be bad for non-stop, as it'd open a
window where the inferior could miss the breakpoint. The conditions
actually haven't changed between the resends, but GDB isn't smart
enough to realize that.
(TBC, if the target doesn't support target-side conditions, then GDB
doesn't trigger these resends (init_bp_location calls
mark_breakpoint_location_modified, and that does nothing if condition
evaluation is on the host side. The resends are caused by the
'loc->condition_changed = condition_modified.' line.)
But, even if GDB was made smarter, GDBserver should really still
handle the resends anyway. So target-side conditions also aren't
really to blame. The documentation of the Z/z packets says:
"To avoid potential problems with duplicate packets, the operations
should be implemented in an idempotent way."
As such, we may want to fix GDB, but we should definitely fix
GDBserver. The fix is a prerequisite for target-side conditions on
hardware breakpoints anyway (and while at it, on watchpoints too).
GDBserver indeed already treats duplicate Z0 packets in an idempotent
way. mem-break.c has the concept of high-level and low-level
breakpoints, somewhat similar to GDB's split of breakpoints vs
breakpoint locations, and keeps track of multiple breakpoints
referencing the same address/location, for the case of an internal
GDBserver breakpoint or a tracepoint being set at the same address as
a GDB breakpoint. But, it only allows GDB to ever contribute one
reference to a software breakpoint location. IOW, if gdbserver sees a
Z0 packet for the same address where it already had a GDB breakpoint
set, then GDBserver won't create another high-level GDB breakpoint.
However, mem-break.c only tracks GDB Z0 breakpoints. The same logic
should apply to all kinds of Zx packets. Currently, gdbserver passes
down each duplicate Zx (other than Z0) request directly to the
target->insert_point routine. The x86 watchpoint support itself
refcounts watchpoint / hw breakpoint requests, to handle overlapping
watchpoints, and save debug registers. But that code doesn't (and
really shouldn't) handle the duplicate requests, assuming that for
each insert there will be a corresponding remove.
So the fix is to generalize mem-break.c to track all kinds of Zx
breakpoints, and filter out duplicates. As mentioned, this ends up
adding support for target-side conditions on hardware breakpoints and
watchpoints too (though GDB itself doesn't support the latter yet).
Probably the least obvious change in the patch is that it kind of
turns the breakpoint insert/remove APIs inside out. Before, the
target methods were only called for GDB breakpoints. The internal
breakpoint set/delete methods inserted memory breakpoints directly
bypassing the insert/remove target methods. That's not good when the
target should use a debug API to set software breakpoints, instead of
relying on GDBserver patching memory with breakpoint instructions, as
is the case of NTO.
Now removal/insertion of all kinds of breakpoints/watchpoints, either
internal, or from GDB, always go through the target methods. The
insert_point/remove_point methods no longer get passed a Z packet
type, but an internal/raw breakpoint type. They're also passed a
pointer to the raw breakpoint itself (note that's still opaque outside
mem-break.c), so that insert_memory_breakpoint /
remove_memory_breakpoint have access to the breakpoint's shadow
buffer. I first tried passing down a new structure based on GDB's
"struct bp_target_info" (actually with that name exactly), but then
decided against it as unnecessary complication.
As software/memory breakpoints work by poking at memory, when setting
a GDB Z0 breakpoint (but not internal breakpoints, as those can assume
the conditions are already right), we need to tell the target to
prepare to access memory (which on Linux means stop threads). If that
operation fails, we need to return error to GDB. Seeing an error, if
this is the first breakpoint of that type that GDB tries to insert,
GDB would then assume the breakpoint type is supported, but it may
actually not be. So we need to check whether the type is supported at
all before preparing to access memory. And to solve that, the patch
adds a new target->supports_z_point_type method that is called before
actually trying to insert the breakpoint.
Other than that, hopefully the change is more or less obvious.
New test added that exercises the hbreak2.exp regression in a more
direct way, without relying on a breakpoint re-set happening before
main is reached.
Tested by building GDBserver for:
aarch64-linux-gnu
arm-linux-gnueabihf
i686-pc-linux-gnu
i686-w64-mingw32
m68k-linux-gnu
mips-linux-gnu
mips-uclinux
nios2-linux-gnu
powerpc-linux-gnu
sh-linux-gnu
tilegx-unknown-linux-gnu
x86_64-redhat-linux
x86_64-w64-mingw32
And also regression tested on x86_64 Fedora 20.
gdb/gdbserver/
2014-05-20 Pedro Alves <palves@redhat.com>
* linux-aarch64-low.c (aarch64_insert_point)
(aarch64_remove_point): No longer check whether the type is
supported here. Adjust to new interface.
(the_low_target): Install aarch64_supports_z_point_type as
supports_z_point_type method.
* linux-arm-low.c (raw_bkpt_type_to_arm_hwbp_type): New function.
(arm_linux_hw_point_initialize): Take an enum raw_bkpt_type
instead of a Z packet char. Adjust.
(arm_supports_z_point_type): New function.
(arm_insert_point, arm_remove_point): Adjust to new interface.
(the_low_target): Install arm_supports_z_point_type.
* linux-crisv32-low.c (cris_supports_z_point_type): New function.
(cris_insert_point, cris_remove_point): Adjust to new interface.
Don't check whether the type is supported here.
(the_low_target): Install cris_supports_z_point_type.
* linux-low.c (linux_supports_z_point_type): New function.
(linux_insert_point, linux_remove_point): Adjust to new interface.
* linux-low.h (struct linux_target_ops) <insert_point,
remove_point>: Take an enum raw_bkpt_type instead of a char. Add
raw_breakpoint pointer parameter.
<supports_z_point_type>: New method.
* linux-mips-low.c (mips_supports_z_point_type): New function.
(mips_insert_point, mips_remove_point): Adjust to new interface.
Use mips_supports_z_point_type.
(the_low_target): Install mips_supports_z_point_type.
* linux-ppc-low.c (the_low_target): Install NULL as
supports_z_point_type method.
* linux-s390-low.c (the_low_target): Install NULL as
supports_z_point_type method.
* linux-sparc-low.c (the_low_target): Install NULL as
supports_z_point_type method.
* linux-x86-low.c (x86_supports_z_point_type): New function.
(x86_insert_point): Adjust to new insert_point interface. Use
insert_memory_breakpoint. Adjust to new
i386_low_insert_watchpoint interface.
(x86_remove_point): Adjust to remove_point interface. Use
remove_memory_breakpoint. Adjust to new
i386_low_remove_watchpoint interface.
(the_low_target): Install x86_supports_z_point_type.
* lynx-low.c (lynx_target_ops): Install NULL as
supports_z_point_type callback.
* nto-low.c (nto_supports_z_point_type): New.
(nto_insert_point, nto_remove_point): Adjust to new interface.
(nto_target_ops): Install nto_supports_z_point_type.
* mem-break.c: Adjust intro comment.
(struct raw_breakpoint) <raw_type, size>: New fields.
<inserted>: Update comment.
<shlib_disabled>: Delete field.
(enum bkpt_type) <gdb_breakpoint>: Delete value.
<gdb_breakpoint_Z0, gdb_breakpoint_Z1, gdb_breakpoint_Z2,
gdb_breakpoint_Z3, gdb_breakpoint_Z4>: New values.
(raw_bkpt_type_to_target_hw_bp_type): New function.
(find_enabled_raw_code_breakpoint_at): New function.
(find_raw_breakpoint_at): New type and size parameters. Use them.
(insert_memory_breakpoint): New function, based off
set_raw_breakpoint_at.
(remove_memory_breakpoint): New function.
(set_raw_breakpoint_at): Reimplement.
(set_breakpoint): New, based on set_breakpoint_at.
(set_breakpoint_at): Reimplement.
(delete_raw_breakpoint): Go through the_target->remove_point
instead of assuming memory breakpoints.
(find_gdb_breakpoint_at): Delete.
(Z_packet_to_bkpt_type, Z_packet_to_raw_bkpt_type): New functions.
(find_gdb_breakpoint): New function.
(set_gdb_breakpoint_at): Delete.
(z_type_supported): New function.
(set_gdb_breakpoint_1): New function, loosely based off
set_gdb_breakpoint_at.
(check_gdb_bp_preconditions, set_gdb_breakpoint): New functions.
(delete_gdb_breakpoint_at): Delete.
(delete_gdb_breakpoint_1): New function, loosely based off
delete_gdb_breakpoint_at.
(delete_gdb_breakpoint): New function.
(clear_gdb_breakpoint_conditions): Rename to ...
(clear_breakpoint_conditions): ... this. Don't handle a NULL
breakpoint.
(add_condition_to_breakpoint): Make static.
(add_breakpoint_condition): Take a struct breakpoint pointer
instead of an address. Adjust.
(gdb_condition_true_at_breakpoint): Rename to ...
(gdb_condition_true_at_breakpoint_z_type): ... this, and add
z_type parameter.
(gdb_condition_true_at_breakpoint): Reimplement.
(add_breakpoint_commands): Take a struct breakpoint pointer
instead of an address. Adjust.
(gdb_no_commands_at_breakpoint): Rename to ...
(gdb_no_commands_at_breakpoint_z_type): ... this. Add z_type
parameter. Return true if no breakpoint was found. Change debug
output.
(gdb_no_commands_at_breakpoint): Reimplement.
(run_breakpoint_commands): Rename to ...
(run_breakpoint_commands_z_type): ... this. Add z_type parameter,
and change return type to boolean.
(run_breakpoint_commands): New function.
(gdb_breakpoint_here): Also check for Z1 breakpoints.
(uninsert_raw_breakpoint): Don't try to reinsert a disabled
breakpoint. Go through the_target->remove_point instead of
assuming memory breakpoint.
(uninsert_breakpoints_at, uninsert_all_breakpoints): Uninsert
software and hardware breakpoints.
(reinsert_raw_breakpoint): Go through the_target->insert_point
instead of assuming memory breakpoint.
(reinsert_breakpoints_at, reinsert_all_breakpoints): Reinsert
software and hardware breakpoints.
(check_breakpoints, breakpoint_here, breakpoint_inserted_here):
Check both software and hardware breakpoints.
(validate_inserted_breakpoint): Assert the breakpoint is a
software breakpoint. Set the inserted flag to -1 instead of
setting shlib_disabled.
(delete_disabled_breakpoints): Adjust.
(validate_breakpoints): Only validate software breakpoints.
Adjust to inserted flag change.
(check_mem_read, check_mem_write): Skip breakpoint types other
than software breakpoints. Adjust to inserted flag change.
* mem-break.h (enum raw_bkpt_type): New enum.
(raw_breakpoint, struct process_info): Forward declare.
(Z_packet_to_target_hw_bp_type): Delete declaration.
(raw_bkpt_type_to_target_hw_bp_type, Z_packet_to_raw_bkpt_type)
(set_gdb_breakpoint, delete_gdb_breakpoint)
(clear_breakpoint_conditions): New declarations.
(set_gdb_breakpoint_at, clear_gdb_breakpoint_conditions): Delete.
(breakpoint_inserted_here): Update comment.
(add_breakpoint_condition, add_breakpoint_commands): Replace
address parameter with a breakpoint pointer parameter.
(gdb_breakpoint_here): Update comment.
(delete_gdb_breakpoint_at): Delete.
(insert_memory_breakpoint, remove_memory_breakpoint): Declare.
* server.c (process_point_options): Take a struct breakpoint
pointer instead of an address. Adjust.
(process_serial_event) <Z/z packets>: Use set_gdb_breakpoint and
delete_gdb_breakpoint.
* spu-low.c (spu_target_ops): Install NULL as
supports_z_point_type method.
* target.h: Include mem-break.h.
(struct target_ops) <prepare_to_access_memory>: Update comment.
<supports_z_point_type>: New field.
<insert_point, remove_point>: Take an enum raw_bkpt_type argument
instead of a char. Also take a raw breakpoint pointer.
* win32-arm-low.c (the_low_target): Install NULL as
supports_z_point_type.
* win32-i386-low.c (i386_supports_z_point_type): New function.
(i386_insert_point, i386_remove_point): Adjust to new interface.
(the_low_target): Install i386_supports_z_point_type.
* win32-low.c (win32_supports_z_point_type): New function.
(win32_insert_point, win32_remove_point): Adjust to new interface.
(win32_target_ops): Install win32_supports_z_point_type.
* win32-low.h (struct win32_target_ops):
<supports_z_point_type>: New method.
<insert_point, remove_point>: Take an enum raw_bkpt_type argument
instead of a char. Also take a raw breakpoint pointer.
gdb/testsuite/
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/break-idempotent.c: New file.
* gdb.base/break-idempotent.exp: New file.
Pedro Alves [Tue, 20 May 2014 17:24:27 +0000 (18:24 +0100)]
[GDBserver] Move Z packet defines and type convertion routines to shared code.
The Aarch64, MIPS and x86 Linux backends all have Z packet number
defines and corresponding protocol number to internal type convertion
routines. Factor them all out to gdbserver's core code, so we only
have one shared copy.
Tested on x86_64 Fedora 20, and also cross built for aarch64-linux-gnu
and mips-linux-gnu.
gdb/gdbserver/
2014-05-20 Pedro Alves <palves@redhat.com>
* mem-break.h: Include break-common.h.
(Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP)
(Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): New defines.
(Z_packet_to_target_hw_bp_type): New declaration.
* mem-break.c (Z_packet_to_target_hw_bp_type): New function.
* i386-low.c (Z_PACKET_HW_BP, Z_PACKET_WRITE_WP, Z_PACKET_READ_WP)
(Z_PACKET_ACCESS_WP): Delete macros.
(Z_packet_to_hw_type): Delete function.
* i386-low.h: Don't include break-common.h here.
(Z_packet_to_hw_type): Delete declaration.
* linux-x86-low.c (x86_insert_point, x86_insert_point): Call
Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type.
* win32-i386-low.c (i386_insert_point, i386_remove_point): Call
Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type.
* linux-aarch64-low.c: Don't include break-common.h here.
(Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP)
(Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): Delete macros.
(Z_packet_to_target_hw_bp_type): Delete function.
* linux-mips-low.c (rsp_bp_type_to_target_hw_bp_type): Delete
function.
(mips_insert_point, mips_remove_point): Use
Z_packet_to_target_hw_bp_type.
Pedro Alves [Tue, 20 May 2014 17:24:27 +0000 (18:24 +0100)]
[GDBserver][AArch64] Make watchpoint support use target_hw_bp_type.
This makes linux-aarch64-low.c use target_hw_bp_type, like gdb's
aarch64-linux-nat.c. The original motivation is decoupling
insert_point/remove_point from Z packet numbers, but I think making
the files a little bit more similar is a good thing on its own right.
Ideally we'd merge these files even... The
aarch64_point_encode_ctrl_reg change is taken straight from GDB's
copy.
I confirmed with a cross compiler that this builds, but it's otherwise
untested.
gdb/gdbserver/
2014-05-20 Pedro Alves <palves@redhat.com>
* linux-aarch64-low.c: Include break-common.h.
(enum target_point_type): Delete.
(Z_packet_to_point_type): Rename to ...
(Z_packet_to_target_hw_bp_type): ... this, and return a
target_hw_bp_type instead.
(aarch64_show_debug_reg_state): Take an enum target_hw_bp_type
instead of an enum target_point_type.
(aarch64_point_encode_ctrl_reg): Likewise. Compute type mask from
breakpoint type.
(aarch64_dr_state_insert_one_point)
(aarch64_dr_state_remove_one_point, aarch64_handle_breakpoint)
(aarch64_handle_aligned_watchpoint)
(aarch64_handle_unaligned_watchpoint, aarch64_handle_watchpoint):
Take an enum target_hw_bp_type instead of an enum
target_point_type.
(aarch64_supports_z_point_type): New function.
(aarch64_insert_point, aarch64_remove_point): Use it. Adjust to
use Z_packet_to_target_hw_bp_type.
Joel Brobecker [Mon, 19 May 2014 21:16:24 +0000 (14:16 -0700)]
Do not build gdbserver with -Werror by default if development=false
On GDB release branches, we change $development in gdb/development.sh
to false, in order to build the GDB release without -Werror by default,
thus avoiding harmless compiler warnings from breaking the build of
someone who's only interested in building GDB rather than working
on it.
This patch implements the same strategy for gdbserver, using the exact
same method.
gdb/gdbserver/ChangeLog:
* configure.ac: Only use -Werror by default when DEVELOPMENT
is true.
* configure: Regenerate.
Tested on x86_64-linux, by rebuilding GDBserver first with development
set to true, and then doing it again with development set to false.
Werror was used in the first case, but not in the second.
Markus Metzger [Thu, 15 May 2014 08:57:36 +0000 (10:57 +0200)]
btrace: no replay without history
When using a reverse execution command without execution history, GDB
might end up in a state where replaying has been started but remains
at the current instruction. This state is illegal.
Do not step if there is no execution history to avoid this.
2014-05-20 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_step_thread): Check for empty history.
testsuite/
* gdb.btrace/nohist.exp: New.
Nick Clifton [Tue, 20 May 2014 09:28:42 +0000 (10:28 +0100)]
Fix MSP430 assembler to support #hi(<symbol>).
* config/tc-msp430.c (CHECK_RELOC_MSP430): Add OP parameter.
Generate BFD_RELOC_MSP430_ABS_HI16 if vshift is 1.
(msp430_srcoperand): Store vshift value in operand.
* msp430.h (struct msp430_operand_s): Add vshift field.
* gas/elf/struct.d: Expect extra output from some toolchains.
* gas/symver/symver0.d: Likewise.
* gas/symver/symver1.d: Likewise.
Will Newton [Fri, 16 May 2014 14:22:58 +0000 (15:22 +0100)]
ld/aarch64: xfail non-PIC shared object tests on aarch64
aarch64 does not support building non-PIC shared objects, so mark
tests for these as xfail.
ld/testsuite/ChangeLog:
2014-05-20 Will Newton <will.newton@linaro.org>
* ld-shared/shared.exp: Mark non-PIC shared object tests
as xfail on aarch64.
Yao Qi [Fri, 9 May 2014 07:06:12 +0000 (15:06 +0800)]
Set timeout for gdb.reverse/*.exp test cases
Hi,
This patch is to add a new board setting gdb_reverse_timeout, which is
used to set timeout for all gdb.reverse test cases, which are usually
very slow and cause some TIMEOUT failures, for example, on some arm
boards. We have some alternatives to this approach, but I am not
satisfied with them:
- Increase the timeout value. This is the global change, and it may
cause some delay where actual failures happen.
- Set timeout by gdb_reverse_timeout in every gdb.reverse/*.exp.
Then, we have to touch every file under gdb.reverse.
In this patch, we choose a central place to set timeout for all tests
in gdb.reverse, which is convenient.
gdb/testsuite:
2014-05-20 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (gdb_init): Set timeout if test file is under
gdb.reverse directory and gdb_reverse_timeout exists in board
setting.
* README: Document gdb_reverse_timeout.
Yao Qi [Fri, 9 May 2014 03:01:07 +0000 (11:01 +0800)]
gdb_init argument ARGS is a string rather than a list
The argument ARGS of gdb_init is passed from dejagnu is a string, the
test file name. In dejagnu/runtest.exp:
proc runtest { test_file_name } {
....
....
if [info exists tool] {
if { [info procs "${tool}_init"] != "" } {
${tool}_init $test_file_name;
}
}
....
}
but inn default_gdb_init (callee of gdb_init), we have
set gdb_test_file_name [file rootname [file tail [lindex $args 0]]]
In tcl, all actual arguments are combined to a list and assigned to
args. This code here isn't wrong, but unnecessary, because its caller
(proc runtest) only passes one string to it, and IMO, we don't need
such tricky tcl "args".
I doubt that "[lindex $args 0]" is to be backward compatible with old
dejagnu, but dejagnu-1.4 release started to pass $test_file_name to
${too}_init, as I showed above. dejagnu-1.4 was released in 2001, and
it should be old enough. I also tried to check whether gdb testusite
works with dejagnu-1.3 or not, but failed to build dejagnu-1.3 on my
machine. Supposing GDB testsuite requires at least dejagnu-1.4, this
change should be safe.
This patch is update default_gdb_init to treat ARGS as a string instead
of a list. Then, 'args' sounds like a list, and this patch also renames
it by 'test_file_name', to align with dejagnu.
gdb/testsuite:
2014-05-20 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (default_gdb_init): Rename argument 'args' by
'test_file_name'. Treat args as a string instead of a list.
(gdb_init): Rename argument 'args' by 'test_file_name'.
Hui Zhu [Tue, 20 May 2014 05:19:06 +0000 (13:19 +0800)]
Fix issue #15778: GDB Aarch64 signal frame unwinder issue
The root cause of this issue is unwinder of "#3 <signal handler called>"
doesn't supply right values of registers.
When GDB want to get the previous frame of "#3 <signal handler called>",
it will call cache init function of unwinder "aarch64_linux_sigframe_init".
The address or the value of the registers is get from this function.
So the bug is inside thie function.
I check the asm code of "#3 <signal handler called>":
(gdb) frame 3
(gdb) p $pc
$1 = (void (*)()) 0x7f931fa4d0
(gdb) disassemble $pc, +10
Dump of assembler code from 0x7f931fa4d0 to 0x7f931fa4da:
=> 0x0000007f931fa4d0: mov x8, #0x8b // #139
0x0000007f931fa4d4: svc #0x0
0x0000007f931fa4d8: nop
This is the syscall sys_rt_sigreturn, Linux kernel function "restore_sigframe"
will set the frame:
for (i = 0; i < 31; i++)
__get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i],
err);
__get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err);
__get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err);
The struct of uc_mcontext is:
struct sigcontext {
__u64 fault_address;
/* AArch64 registers */
__u64 regs[31];
__u64 sp;
__u64 pc;
__u64 pstate;
/* 4K reserved for FP/SIMD state and future expansion */
__u8 __reserved[4096] __attribute__((__aligned__(16)));
};
But in GDB function "aarch64_linux_sigframe_init", the code the get address
of registers is:
for (i = 0; i < 31; i++)
{
trad_frame_set_reg_addr (this_cache,
AARCH64_X0_REGNUM + i,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ i * AARCH64_SIGCONTEXT_REG_SIZE);
}
trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp);
trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8);
trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8);
The code that get pc and sp is not right, so I change the code according
to Linux kernel code:
trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ 31 * AARCH64_SIGCONTEXT_REG_SIZE);
trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ 32 * AARCH64_SIGCONTEXT_REG_SIZE);
The issue was fixed by this change, and I did the regression test. It
also fixed a lot of other XFAIL and FAIL.
2014-05-20 Hui Zhu <hui@codesourcery.com>
Yao Qi <yao@codesourcery.com>
PR backtrace/16558
* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments
and change address of sp and pc.
Alan Modra [Tue, 20 May 2014 03:45:18 +0000 (13:15 +0930)]
Remove unnecessary header from m68k-dis.c
* m68k-dis.c: Don't include setjmp.h.
Alan Modra [Tue, 20 May 2014 02:12:42 +0000 (11:42 +0930)]
Rewrite ppc32 backend .sdata and .sdata2 handling
1) _SDA_BASE_ and _SDA2_BASE_ and defined automatically, in a similar
manner to the way _GLOBAL_OFFSET_TABLE_ is handled. It's a little
more complicated to remove the symbols because _SDA_BASE_ needs to
be there if either .sdata or .sbss is present, and similarly for
_SDA2_BASE.
2) The linker created .sdata and .sdata2 sections used for
R_PPC_EMB_SDAI16 and R_PPC_EMB_SDA2I16 pointers are created early.
Nowadays we strip unneeded sections from the output, so it isn't
necessary to delay creating the sections.
3) The output section for targets of various SDA relocs is now checked
as per the ABI(s). We previously allowed .sdata.foo and similar,
most likely because at some stage we were checking input sections.
Also, the patch fixes a long-standing bug in size_input_sections
that affects the values of symbols defined in stripped input
sections.
PR 16952
bfd/
* elf32-ppc.c (ppc_elf_create_linker_section): Move earlier.
Remove redundant setting of htab->elf.dynobj. Don't align.
Define .sdata symbols using _bfd_elf_define_linkage_sym.
(ppc_elf_create_glink): Call ppc_elf_create_linker_section.
(create_sdata_sym): Delete.
(elf_allocate_pointer_linker_section): Rename from
elf_create_pointer_linker_section. Align section.
(ppc_elf_check_relocs): Don't call ppc_elf_creat_linker_section
directly here, or create_sdata_sym. Set ref_regular on _SDA_BASE_
and _SDA2_BASE_.
(ppc_elf_size_dynamic_sections): Remove ATTRIBUTE_UNUSED on param.
Remove unnecessary tests on _SDA_BASE_ sym.
(maybe_strip_sdasym, ppc_elf_maybe_strip_sdata_syms): New functions.
(ppc_elf_relocate_section): Tighten SDA reloc symbol section checks.
* elf32-ppc.h (ppc_elf_set_sdata_syms): Delete.
(ppc_elf_maybe_strip_sdata_syms): Declare.
ld/
* emulparams/elf32ppccommon.sh (_SDA_BASE_, _SDA2_BASE_): Delete.
* emultempl/ppc32elf.em (ppc_before_allocation): Call
ppc_elf_maybe_strip_sdata_syms.
* ldlang.c (size_input_section): Correct output_offset value
for excluded input sections.
Alan Modra [Tue, 20 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Doug Evans [Mon, 19 May 2014 23:05:01 +0000 (16:05 -0700)]
build_type_unit_groups and moved closer to only caller and renamed
* dwarf2read.c (build_type_psymtabs_1): Renamed from
build_type_unit_groups and moved closer to only caller. Remove
arguments. All references updated. Remove outdated .gdb_index
comment.
(struct tu_abbrev_offset, sort_tu_by_abbrev_offset): Move with
build_type_psymtabs_1.
Tom Tromey [Mon, 19 May 2014 19:10:21 +0000 (13:10 -0600)]
fix two latent type errors
I'm checking this in as obvious.
I was looking at instances of "alloc.*sizeof" and noticed a couple
where the types in question are incorrect.
In gdbtypes, the code allocates sizeof(int) to represent a struct rank.
In mi-cmds, the code uses "struct mi_cmd **" -- one "*" too many.
In both cases the problems are latent because in practice the sizes
are the same as the sizes of the correct types. Still, it's better to
be correct.
I think gdb would be improved by a wholesale change from explicit
sizeofs to using the libiberty.h allocation macros. In most cases
they are both shorter and have better type safety. However, the
resulting patch is rather large.
Built and regtested on x86-64 Fedora 20.
2014-05-19 Tom Tromey <tromey@redhat.com>
* gdbtypes.c (rank_function): Use XNEWVEC.
* mi/mi-cmds.c (build_table): Use XCNEWVEC.
Doug Evans [Mon, 19 May 2014 19:50:44 +0000 (12:50 -0700)]
Remove all_type_unit_groups, unused.
* dwarf2read.c (struct dwarf2_per_objfile): Delete unused members
n_type_unit_groups, all_type_unit_groups. All uses removed.
(get_type_unit_group, build_type_unit_groups): Delete forward decls.
(dw2_get_cutu): Renamed from dw2_get_cu. All callers updated.
(dw2_get_cu): Renamed from dw2_get_primary_cu. All callers updated.
(add_type_unit_group_to_table): Delete.
Jan Kratochvil [Mon, 19 May 2014 18:20:27 +0000 (20:20 +0200)]
Fix gdbserver qGetTLSAddr for x86_64 -m32
gdbserver makes libthread_db to access uninitialized memory. Surprisingly it
does not harm normally, even -fsanitize=address works with current gdbserver.
I have found just valgrind detects it as a very first warning for gdbserver:
Syscall param ptrace(addr) contains uninitialised byte(s)
at 0x3721EECEBE: ptrace (ptrace.c:45)
by 0x436EE5: ps_get_thread_area (linux-x86-low.c:252)
by 0x5559D02: __td_ta_lookup_th_unique (td_ta_map_lwp2thr.c:157)
by 0x5559EC3: td_ta_map_lwp2thr (td_ta_map_lwp2thr.c:207)
by 0x43F87D: find_one_thread (thread-db.c:281)
by 0x440038: thread_db_get_tls_address (thread-db.c:505)
by 0x40F6D0: handle_query (server.c:2004)
by 0x4124CF: process_serial_event (server.c:3445)
by 0x4136B6: handle_serial_event (server.c:3889)
by 0x419571: handle_file_event (event-loop.c:434)
by 0x418D38: process_event (event-loop.c:189)
by 0x419AB7: start_event_loop (event-loop.c:552)
Reproducible with:
cd gdb/testsuite
g++ -o gdb.threads/tls gdb.threads/tls{,2}.c -m32 -pthread
../gdbserver/gdbserver :1234 gdb.threads/tls
../gdb -batch gdb.threads/tls -ex 'target remote :1234' -ex 'b spin' -ex c -ex 'p a_thread_local'
It is more easily reproducible even without valgrind using s/0x00/0xff/ in the
attached patch. It will then turn the output of reproducer above:
$1 = 0
->
Cannot find thread-local storage for Thread 29044, executable file .../gdb/testsuite/gdb.threads/tls:
Remote target failed to process qGetTLSAddr request
gdb/gdbserver/
2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gdbserver qGetTLSAddr for x86_64 -m32.
* linux-x86-low.c (X86_64_USER_REGS): New.
(x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case.
Message-ID: <
20140410114901.GA16411@host2.jankratochvil.net>
Doug Evans [Mon, 19 May 2014 17:51:08 +0000 (10:51 -0700)]
* eval.c (evaluate_subexp_standard): Add some comments.
Jan Kratochvil [Mon, 19 May 2014 13:39:24 +0000 (15:39 +0200)]
[testsuite patch] Test power{5,6,7} disassembly
Power5, Power6 and Power7 disassembly testing.
gdb/testsuite/
2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/powerpc-power.exp: New file.
* gdb.arch/powerpc-power.s: New file.
Message-ID: <
20140514205425.GA15398@host2.jankratochvil.net>
Nick Clifton [Mon, 19 May 2014 13:29:31 +0000 (14:29 +0100)]
Extend the fix already created for PR 16858 so that it works with x86 PE targets as well.
PR gas/16858
* config/tc-i386.c (md_apply_fix): Improve the detection of code
symbols for 32-bit PE targets.
Andreas Tobler [Mon, 19 May 2014 06:49:55 +0000 (08:49 +0200)]
Don't link FreeBSD tests with -ldl.
* ld-elf/shared.exp: Introduce the extralibs variable to control
the libraries to be linked. Don't link -ldl on *-*-freebsd*.
* ld-bootstrap/bootstrap.exp: Do not add -ldl to the extralibs on
*-*-freebsd*.
Alan Modra [Mon, 19 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Richard Sandiford [Sun, 18 May 2014 19:28:04 +0000 (20:28 +0100)]
gas/
* config/tc-mips.c (md_obj_begin): Delete.
(md_obj_end): Fold into...
(md_mips_end): ...here. Move to end of file.
Alan Modra [Sun, 18 May 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Doug Evans [Sat, 17 May 2014 19:18:26 +0000 (12:18 -0700)]
* progspace.c (remove_program_space): Delete, unused.
* progspace.h (remove_program_space): Ditto.
Doug Evans [Sat, 17 May 2014 18:59:34 +0000 (11:59 -0700)]
* inferior.c (prune_inferiors): Fix comment.
(remove_inferior_command): Call prune_program_spaces.
Nick Clifton [Sat, 17 May 2014 16:45:18 +0000 (17:45 +0100)]
Prevent the V850 assembler from generating an internal error if it is asked to
handle a ctoff() pseudo-op when running in RH850 ABI mode.
PR gas/16946
* config/tc-v850.c (handle_ctoff): Generate an error if called
when using the RH850 ABI.
Ryan Mansfield [Fri, 16 May 2014 14:49:46 +0000 (15:49 +0100)]
* config.bfd: Move QNX target_cflags from arm-*-netbsd* to arm-*-nto*.
Doug Evans [Sat, 17 May 2014 16:13:00 +0000 (09:13 -0700)]
Copy over changes from guile.texi.
* python.texi (Basic Python) <gdb.execute>: Add text.
(Basic Python) <gdb.post_event>: Remove "main" from "main GDB thread".
(Values From Inferior) <Python string>: Add text.
(Values From Inferior) <Value.string>: Clarify string length handling.
(Pretty Printing API): Add cindex.
(Types In Python) <TYPE_CODE_*>: Use vtable instead of table.
Remove unnecessary index of gdb.TYPE_CODE_*. Replace @findex with
@vindex.
(Commands In Python) <COMPLETE_*>: Similarly.
(Symbols In Python) <SYMBOL_*>: Similarly.
(Breakpoints In Python) <WP_*>: Similarly.
(Breakpoints In Python) <BP_*>: Similarly.
David Taylor [Sat, 17 May 2014 07:29:57 +0000 (10:29 +0300)]
Improve docs of qfThreadInfo packet.
gdb/doc/gdb.texinfo (General Query Packets): Add a note about thread IDs
mentioned in the qfThreadInfo reply.
Alan Modra [Sat, 17 May 2014 00:00:39 +0000 (09:30 +0930)]
daily update
Doug Evans [Fri, 16 May 2014 19:46:24 +0000 (12:46 -0700)]
* gdb.base/completion.exp: Check that all expected files exist
before doing file completion.
Doug Evans [Fri, 16 May 2014 19:34:05 +0000 (12:34 -0700)]
* gdb.base/Makefile.in (EXECUTABLES): Add completion.
Doug Evans [Fri, 16 May 2014 19:15:10 +0000 (12:15 -0700)]
New command line option -D.
* NEWS: Mention it.
* main.c (set_gdb_data_directory): New function.
(captured_main): Recognize -D. Flag error for --data-directory "".
Call set_gdb_data_directory.
(print_gdb_help): Print --data-directory, -D.
* main.h (set_gdb_data_directory): Declare.
* top.c (staged_gdb_datadir): New static global.
(set_gdb_datadir): Call set_gdb_data_directory
(show_gdb_datadir): New function.
(init_main): Update init of data-directory parameter.
testsuite/
* gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir):
Update.
(do_syscall_tests_without_xml): Update.
doc/
* gdb.texinfo (Mode Options): Add -D.
Gregory Fong [Fri, 16 May 2014 18:26:33 +0000 (12:26 -0600)]
Import the "dirfd" gnulib module.
2014-05-16 Gregory Fong <gregory.0xf0@gmail.com>
Import the "dirfd" gnulib module.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add dirfd.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/dirfd.c: New.
* gnulib/import/m4/dirfd.m4: New.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
John Marino [Fri, 16 May 2014 14:39:47 +0000 (15:39 +0100)]
* configure.tgt: Add /lib to dragonfly NATIVE_LIB_DIRS.
Jon Turney [Fri, 16 May 2014 14:34:13 +0000 (15:34 +0100)]
This fixes a few issues with pe/coff build-ids that were discovered since the
original patches were posted:
pe/coff: Display GUID build-id in the conventional way
pe/coff: Don't interpret debug directory in section with no contents
pe/coff: Keep .build-id with --only-keep-debug
pe/coff: Don't break .build-id with objcopy/strip
* peXXigen.c (pe_print_debugdata): Don't interpret debug directory
in a section with no contents.
(is_vma_in_section, find_section_by_vma): New functions.
(_bfd_XX_bfd_copy_private_bfd_data_common): Recalculate file
offsets in the debug directory.
(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
Byte-swap GUID from little-endian to big-endian order for
consistent and conventional display.
* objcopy.c (is_nondebug_keep_contents_section): New function.
(setup_section): Use it.
Kaushik Phata [Fri, 16 May 2014 13:57:10 +0000 (14:57 +0100)]
This adds support for marking RL78 binaries as either supporting 32-bit
or 64-bit doubles. It also makes the linker complain if the user attempts
to link together binaries with different sized doubles.
* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if
64-bit doubles objects mix with 32-bit doubles objects.
(rl78_elf_print_private_bfd_data): Describe 64-bit doubles flag.
* readelf.c (get_machine_flags): Handle RL78 64-bit doubles flag.
* config/tc-rl78.c (enum options): Add OPTION_32BIT_DOUBLES
and OPTION_64BIT_DOUBLES.
(md_longopts): Add -m32bit-doubles and -m64bit-doubles.
(md_parse_option): Parse -m32bit-doubles and -m64bit-doubles.
(md_show_usage): Show all of the RL78 options.
(rl78_float_cons): New static functions.
(md_pseudo_table): Update handler for "double".
Pedro Alves [Fri, 16 May 2014 13:43:47 +0000 (14:43 +0100)]
mi-support.exp: Fix some pastos.
gdb/testsuite/
2014-05-16 Pedro Alves <palves@redhat.com>
* lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout"
instead of "unknown output after running".
Yao Qi [Tue, 13 May 2014 03:41:03 +0000 (11:41 +0800)]
Copy file1.txt to remote host in dw2-filename.exp and dw2-anonymous-func.exp
Some gdb.dwarf2/*.exp tests copy file1.txt to host via gdb_remote_download
but dw2-filename.exp and dw2-anonymous-func.exp don't do that. Looks like
an oversight in this patch
https://sourceware.org/ml/gdb-patches/2013-08/msg00365.html
There are some fails in remote host testing.
FAIL: gdb.dwarf2/dw2-anonymous-func.exp: list file1.txt
FAIL: gdb.dwarf2/dw2-filename.exp: interpreter-exec mi -file-list-exec-source-files
FAIL: gdb.dwarf2/dw2-filename.exp: info sources
This patch is to invoke gdb_remote_download to copy file1.txt to host
and remote it at the end. This patch fixes these fails above.
gdb/testsuite:
2014-05-16 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-filename.exp: Copy file1.txt to host. Remove
file1.txt from host at the end.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
Yao Qi [Tue, 22 Apr 2014 04:56:08 +0000 (12:56 +0800)]
Fix display of tabulation character for mingw hosts.
Pierre proposed this patch
https://sourceware.org/ml/gdb-patches/2013-10/msg00011.html and
Tom gave a suggestion that it's better to do check \t in print_wchar
<https://sourceware.org/ml/gdb-patches/2013-11/msg00148.html>
However, I don't see the follow-up to this discussion.
We encounter two fails in printcmds.exp on mingw host, and Pierre's
patch fixes them. I pick it up, update a little per Tom's
comments, and post it here for review. This patch fixes these fails
below on mingw32 host.
FAIL: gdb.base/charset.exp: print string in ASCII
FAIL: gdb.base/charset.exp: try printing '\t' in ASCII
FAIL: gdb.base/charset.exp: print string in ISO-8859-1
FAIL: gdb.base/charset.exp: try printing '\t' in ISO-8859-1
FAIL: gdb.base/charset.exp: print string in UTF-32
FAIL: gdb.base/charset.exp: try printing '\t' in UTF-32
FAIL: gdb.base/printcmds.exp: p ctable1[9]
FAIL: gdb.base/printcmds.exp: p &ctable1[1*8]
Also regression tested on x86_64-linux. Is it OK?
gdb:
2014-05-16 Pierre Muller <muller@sourceware.org>
Yao Qi <yao@codesourcery.com>
* valprint.c (print_wchar): Move the code on checking whether
W is a printable wide char to the default branch of switch
statement below. Call wchar_printable instead of gdb_iswprint.
Yao Qi [Fri, 16 May 2014 12:10:38 +0000 (20:10 +0800)]
Fix changelong entry.
Each changelog entry should be tab-prefixed.
Taimoor Mirza [Fri, 16 May 2014 06:39:05 +0000 (11:39 +0500)]
Fix prologue analysis for ldr.w and ldrd instruction
Prologue analysis for ldr.w and ldrd instruction obtains offset from
first two bytes that contains opcode of instruction. It should obtain
offset from next two bytes that actually contain operands.
* arm-tdep.c (thumb_analyze_prologue): Fix offset calculation for
ldr.w and ldrd instructions.
Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
Alan Modra [Fri, 16 May 2014 00:00:36 +0000 (09:30 +0930)]
daily update
Doug Evans [Thu, 15 May 2014 22:50:34 +0000 (15:50 -0700)]
Make more robust when run in parallel mode.
Since we're not compiling with gcc, we don't know where the
DWO file will ultimately be built. It could be built in
testsuite/gdb.dwarf2/foo (non-parallel mode) or
testsuite/outputs/gdb.dwarf2/foo (parallel mode).
* gdb.dwarf2/fission-reread.S: Remove directory from .dwo file path.
* gdb.dwarf2/fission-reread.exp: Set debug-file-directory before
loading file. Add test for TU lookup.
Doug Evans [Thu, 15 May 2014 22:45:05 +0000 (15:45 -0700)]
* dwarf2read.c (read_structure_type): Delete outdated comments.
Simon Marchi [Tue, 13 May 2014 21:37:44 +0000 (17:37 -0400)]
Fix argument passing in mi_run_cmd_full
Passing arguments did not work when use_mi_command was set.
gdb/testsuite/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling
"-exec-arguments" or "set args" before running the inferior.
Simon Marchi [Tue, 13 May 2014 21:07:33 +0000 (17:07 -0400)]
Fix mi_expect_stop for non-zero exit codes
The message displayed by gdb is different when the inferior exits with
zero and non-zero values, this fix takes that into account.
gdb/testsuite/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_expect_stop): Expect message for
inferiors that exit with non-zero exit code.
Alan Modra [Thu, 15 May 2014 09:07:43 +0000 (18:37 +0930)]
Fix "overflow in PLT unwind data" warning
When linking statically, it's possible to hit this warning with IFUNC
or very large executables, due to .glink being unused.
* powerpc.cc (do_plt_fde_location): Handle zero length .glink.
Compare FDE contents with DW_CFA_nop rather than 0.
Alan Modra [Thu, 15 May 2014 00:00:45 +0000 (09:30 +0930)]
daily update
Sandra Loosemore [Wed, 14 May 2014 23:27:14 +0000 (16:27 -0700)]
Sync nios2 configure changes from GCC mainline.
2014-05-14 Sandra Loosemore <sandra@codesourcery.com>
* configure.ac (target_makefile_frag): Set for nios2-*-elf*.
* configure: Regenerated.
config/
* mt-nios2-elf: New file.
Tom Tromey [Wed, 14 May 2014 19:31:10 +0000 (13:31 -0600)]
reindent print_macro_definition
I happened to notice that print_macro_definition is indented
improperly. All the lines were a few extra spaces to the right.
This patch fixes the indentation.
Tested by rebuilding, committed.
2014-05-14 Tom Tromey <tromey@redhat.com>
* macrocmd.c (print_macro_definition): Reindent.
Yao Qi [Tue, 13 May 2014 06:40:22 +0000 (14:40 +0800)]
Fix mi-file.exp fails on remote host
This patch fixes mi-file.exp fails on remote host. First, we can't
assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host,
so this patch changes it to match ${srcfile} only on remote host.
Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path.
The file name is "basics.c" in my test env and can't match the pattern
due to "/" in it. Remove "/" from the pattern.
gdb/testsuite:
2014-05-14 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't
match absolute path on remote host.
(test_file_list_exec_source_files): Remove "/" from the
pattern.
Yao Qi [Tue, 13 May 2014 01:37:54 +0000 (09:37 +0800)]
Overwrite ${board}_file in local-remote-host
After I run test like this,
$ make check RUNTESTFLAGS='--host_board=local-remote-host dw2-basic.exp'
gdb.dwarf2/file1.txt in source tree was removed. In some gdb.dwarf2/*.exp,
file1.txt is copied to host and then removed at the end. However, in
local-remote-host-notty.exp, ${board}_download doesn't copy the file but
return the absolute path of the src file. 'remote_file host delete' at
the end will remove the file in source tree.
This patch is to overwrite ${board}_file, and specially make "delete"
option do nothing. This approach is used in gdbserver-base.exp and
remote-stdio-gdbserver.exp too.
gdb/testsuite:
2014-05-14 Yao Qi <yao@codesourcery.com>
* boards/local-remote-host-notty.exp (${board}_file): New
proc.
Doug Evans [Wed, 14 May 2014 02:44:51 +0000 (19:44 -0700)]
* python/py-cmd.c (cmdpy_completer): Add comment.
(completers): Make const.
Alan Modra [Wed, 14 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Simon Marchi [Mon, 21 Apr 2014 15:49:59 +0000 (11:49 -0400)]
Remove unused variable
should_resume is set to 1 at the beginning and never changed.
gdb/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* infrun.c (resume): Remove should_resume (unused). Move up
declaration of resume_ptid.
Sriraman Tallam [Tue, 13 May 2014 17:51:48 +0000 (10:51 -0700)]
With -pie and x86, the linker complains if it sees a PC-relative relocation
to access a global as it expects a GOTPCREL relocation. This is really not
necessary as the linker could use a copy relocation to get around it. This
patch enables copy relocations with pie.
Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable. By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access. It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead. Gold can then create a copy reloc for only the undefined globals.
gold/
* symtab.h (may_need_copy_reloc): Remove check for position independent
code.
* x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
position independence before pc absolute may_need_copy_reloc call.
Add check for executable output befor pc relative may_need_copy_reloc
call.
* i386.cc: Ditto.
* arm.cc: Ditto.
* sparc.cc: Ditto.
* tilegx.cc: Ditto.
* powerpc.cc: Add check for no position independence before
may_need_copy_reloc calls.
* testsuite/pie_copyrelocs_test.cc: New file.
* testsuite/pie_copyrelocs_shared_test.cc: New file.
* Makefile.am (pie_copyrelocs_test): New test.
* Makefile.in: Regenerate.
Tom Tromey [Tue, 13 May 2014 17:35:18 +0000 (11:35 -0600)]
remove an unused macro and an unused declaration
This patch removes an unused macro from language.h. It also removes
the declaration of a function which is not defined.
I'm checking this in as obvious.
Tested by rebuilding.
2014-05-13 Tom Tromey <tromey@redhat.com>
* language.h (unop_type_check): Remove.
(binop_type_check): Don't declare.
Sriraman Tallam [Tue, 13 May 2014 17:33:59 +0000 (10:33 -0700)]
Optimizing accesses to Globals with -fpie -pie:
With -pie and x86, the linker complains if it sees a PC-relative relocation
to access a global as it expects a GOTPCREL relocation. This is really not
necessary as the linker could use a copy relocation to get around it. This
patch enables copy relocations with pie.
Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable. By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access. It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead. Gold can then create a copy reloc for only the undefined globals.
Andreas Arnez [Tue, 13 May 2014 12:55:53 +0000 (14:55 +0200)]
S390: Fix erroneous offset in fill_gregset.
This fixes a bug that leads to various failures when debugging a
31-bit inferior with a 64-bit gdb on s390x.
mfortune [Tue, 13 May 2014 10:55:08 +0000 (11:55 +0100)]
Re-work register size macros for MIPS.
gas/
* config/tc-mips.c (mips_set_options): Rename gp32 to gp throughout.
(HAVE_32BIT_GPRS, HAVE_64BIT_GPRS): Remove. Re-implement via GPR_SIZE.
(HAVE_32BIT_FPRS, HAVE_64BIT_FPRS): Remove. Re-implement via FPR_SIZE.
(GPR_SIZE, FPR_SIZE): New macros. Use throughout.
Alan Modra [Tue, 13 May 2014 00:00:39 +0000 (09:30 +0930)]
daily update
DJ Delorie [Mon, 12 May 2014 23:05:19 +0000 (19:05 -0400)]
Support 32->64 sign extension in msp430's sign_ext
* msp43-sim.c (sign_ext): Change to "long long" to support
sign-extending 32-bit values.
Doug Evans [Mon, 12 May 2014 22:16:13 +0000 (15:16 -0700)]
Add link to older changes in ChangeLog-1993-2013.
Doug Evans [Mon, 12 May 2014 22:13:49 +0000 (15:13 -0700)]
Split out older testsuite/ChangeLog entries (prior to 2014)
into separate file: ChangeLog-1993-2013.
Simon Marchi [Sat, 26 Apr 2014 22:10:40 +0000 (18:10 -0400)]
mi: Use the value in mi_console_file->quote as the quoting character
In mi_interpreter_init, multiple MI consoles/channels are created and a quoting
character is given. In mi_console_raw_packet, we check if the value is not 0
to decide if we should quote the string, but we don't use the value. It is
hardcoded to ". We might never use another quoting character than an actual
quote, but I suggest we change it, for correctness. There is not visible
behavior change.
I changed the latest fputs_unfiltered changed to fputc_unfiltered just to stay
consistent.
gdb/ChangeLog:
2014-05-12 Simon Marchi <simon.marchi@ericsson.com>
* mi/mi-console.c (mi_console_raw_packet): Use the value from
mi_console->quote as the quoting character.
Simon Marchi [Mon, 12 May 2014 17:06:11 +0000 (13:06 -0400)]
Add myself as write after approval maintainer
2014-05-12 Simon Marchi <simon.marchi@ericsson.com>
* MAINTAINERS (Write After Approval): Add "Simon Marchi".
Alan Modra [Mon, 12 May 2014 00:00:37 +0000 (09:30 +0930)]
daily update
Chung-Lin Tang [Sun, 11 May 2014 17:04:45 +0000 (10:04 -0700)]
2014-05-11 Chung-Lin Tang <cltang@codesourcery.com>
* emulparams/nios2linux.sh (OTHER_GOT_SYMBOLS): Wrap _gp in HIDDEN(),
and gp in PROVIDE_HIDDEN.
Alan Modra [Sun, 11 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Samuel Bronson [Sat, 10 May 2014 01:07:43 +0000 (21:07 -0400)]
Add obviously forgotten "PACKAGE = @PACKAGE@" to gdb/doc/Makefile.in
* gdb/doc/Makefile.in (PACKAGE): Copy from ../Makefile.in in case of
"make -C".
Hans-Peter Nilsson [Sat, 10 May 2014 00:50:01 +0000 (02:50 +0200)]
Fix freeing of link_info.hash
ld:
* ldlang.c (lang_finish): Don't call bfd_link_hash_table_free here.
(output_bfd_hash_table_free_fn): New variable.
(open_output): Save the _bfd_link_hash_table_free function for the
output_bfd into output_bfd_hash_table_free_fn.
* ldmain.c (ld_cleanup): If set, call output_bfd_hash_table_free_fn
on link_info.hash.
* ldlang.h (output_bfd_hash_table_free_fn): Declare.
ld/testsuite:
* ld-mmix/wrap1.d, ld-mmix/wrap1a.s, ld-mmix/wrap1b.s,
ld-mmix/wrap1c.s, ld-mmix/wrap2.d, ld-mmix/wrap3.d,
ld-mmix/wrap3a.s, ld-mmix/wrap3b.s, ld-mmix/wrap4.d: New
tests.