Maciej W. Rozycki [Thu, 20 Mar 2014 21:41:56 +0000 (21:41 +0000)]
Avoid using the ISO C99 `z' formatted output modifier
* mi/mi-interp.c (mi_memory_changed): Avoid using the ISO C99
`z' formatted output modifier.
Richard Sandiford [Thu, 20 Mar 2014 21:18:43 +0000 (21:18 +0000)]
gas/
* config/tc-mips.h (DIFF_EXPR_OK, CFI_DIFF_EXPR_OK): Define.
* config/tc-mips.c (md_pcrel_from): Remove error message.
(md_apply_fix): Convert PC-relative BFD_RELOC_32s to
BFD_RELOC_32_PCREL. Report a specific error message for unhandled
PC-relative expressions. Handle BFD_RELOC_8.
gas/testsuite/
* gas/all/gas.exp: Remove XFAIL of forward.d for MIPS.
* gas/mips/pcrel-1.s, gas/mips/pcrel-1.d, gas/mips/pcrel-2.s,
gas/mips/pcrel-2.d, gas/mips/pcrel-3.s, gas/mips/pcrel-3.l,
gas/mips/pcrel-4.s, gas/mips/pcrel-4-32.d, gas/mips/pcrel-4-n32.d,
gas/mips/pcrel-4-64.d: New tests.
* gas/mips/mips.exp: Run them.
* gas/mips/lui-2.l: Tweak error message for line 7.
ld/testsuite/
* ld-elf/merge.d: Remove MIPS XFAIL.
Sergio Durigan Junior [Thu, 20 Mar 2014 21:08:31 +0000 (18:08 -0300)]
Fix probe-related internal error on AIX
-- Initial message by Tom Tromey:
While testing on AIX, I happened to notice an internal error coming
from parse_probes. This happens because there are no probes defined
on this platform. This patch fixes the problem by changing an assert
into an ordinary error, and then changing the relevant caller to cope.
This fixes a few tests on AIX; also regtested on x86-64 Fedora 18.
-- Followup by Sergio Durigan Junior:
By reading the patch (and the original code), I found it a little bit
obscure, so I took the liberty to try to improve it. Here's the patch.
Could you please take a look and see if it works on AIX (and also if you
like the approach)?
gdb/
2014-03-20 Tom Tromey <tromey@redhat.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* probe.c (parse_probes): Turn assert into an ordinary error.
* break-catch-throw.c (re_set_exception_catchpoint): Ignore
exceptions when parsing probes. Rearrange the code for clarity.
Tom Tromey [Tue, 4 Mar 2014 18:32:52 +0000 (11:32 -0700)]
Fix py-finish-breakpoint.exp with target async.
With target async enabled, py-finish-breakpoint.exp triggers an
assertion failure.
The failure occurs because execute_command re-enters the event loop in
some circumstances, and in this case resets the sync_execution flag.
Then later GDB reaches this assertion in normal_stop:
gdb_assert (sync_execution || !target_can_async_p ());
In detail:
#1 - A synchronous execution command is run. sync_execution is set.
#2 - A python breakpoint is hit (TARGET_WAITKIND_STOPPED), and the
corresponding Python breakpoint's stop method is executed. When
and while python commands are executed, interpreter_async is
forced to 0.
#3 - The Python stop method happens to execute a not-execution-related
gdb command. In this case, "where 1".
#4 - Seeing that sync_execution is set, execute_command nests a new
event loop (although that wasn't necessary; this is the problem).
#5 - The linux-nat target's pipe in the event loop happens to be
marked. That's normal, due to this in linux_nat_wait:
/* If we requested any event, and something came out, assume there
may be more. If we requested a specific lwp or process, also
assume there may be more. */
The nested event loop thus immediately wakes up and calls
target_wait. No thread is actually executing in the inferior, so
the target returns TARGET_WAITKIND_NO_RESUMED.
#6 - normal_stop is reached. GDB prints "No unwaited-for children
left.", and resets the sync_execution flag (IOW, there are no
resumed threads left, so the synchronous command is considered
completed.) This is already bogus. We were handling a
breakpoint!
#7 - the nested event loop unwinds/ends. GDB is now back to handling
the python stop method (TARGET_WAITKIND_STOPPED), which decides
the breakpoint should stop. normal_stop is called for this
event. However, normal_stop actually works with the _last_
reported target status:
void
normal_stop (void)
{
struct target_waitstatus last;
ptid_t last_ptid;
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
...
get_last_target_status (&last_ptid, &last);
...
if (last.kind == TARGET_WAITKIND_NO_RESUMED)
{
gdb_assert (sync_execution || !target_can_async_p ());
target_terminal_ours_for_output ();
printf_filtered (_("No unwaited-for children left.\n"));
}
And due to the nesting in execute command, the last event is now
TARGET_WAITKIND_NO_RESUMED, not the actual breakpoint event being
handled. This could be seen to be broken in itself, but we can
leave fixing that for another pass. The assertion is reached, and
fails.
execute_command has a comment explaining when it should synchronously
wait for events:
/* If the interpreter is in sync mode (we're running a user
command's list, running command hooks or similars), and we
just ran a synchronous command that started the target, wait
for that command to end. */
However, the code did not follow this comment -- it didn't check to
see if the command actually started the target, just whether the
target was executing a sync command at this point.
This patch fixes the problem by noting whether the target was
executing in sync_execution mode before running the command, and then
augmenting the condition to test this as well.
2014-03-20 Tom Tromey <tromey@redhat.com>
PR gdb/14135
* top.c (execute_command): Only dispatch events if the command
started the target.
Pedro Alves [Thu, 20 Mar 2014 17:03:43 +0000 (17:03 +0000)]
make dprintf.exp pass in target async mode
When target-async is enabled, dprintf.exp fails:
Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ...
FAIL: gdb.base/dprintf.exp: 1st dprintf, call
FAIL: gdb.base/dprintf.exp: 2nd dprintf, call
FAIL: gdb.base/dprintf.exp: Set dprintf function
FAIL: gdb.base/dprintf.exp: 1st dprintf, fprintf
FAIL: gdb.base/dprintf.exp: 2nd dprintf, fprintf
Breakpoint 2, main (argc=1, argv=0x7fffffffd3f8) at ../../../src/gdb/testsuite/gdb.base/dprintf.c:33
33 int loc = 1234;
(gdb) continue
Continuing.
kickoff 1234
also to stderr 1234
At foo entry
(gdb) FAIL: gdb.base/dprintf.exp: 1st dprintf, call
The problem is that GDB gave the prompt back to the user too early.
This happens when calling functions while handling an event that
doesn't cause a user visible stop. dprintf with "set dprintf-style
gdb" is one such case. This patch adds a test case that has a
breakpoint with a condition that calls a function that returns false,
so that regression testing isn't dependent on the implementation of
dprintf.
The problem happens because run_inferior_call causes GDB to forget
that it is running in sync_execution mode, so any event that runs an
inferior call causes fetch_inferior_event to display the prompt, even
if the event should not result in a user visible stop (that is, gdb
resumes the inferior and waits for the next event).
This patch fixes the issue by noticing when GDB was in sync_execution
mode in run_inferior_call, and taking care to restore this state
afterward.
gdb/
2014-03-20 Tom Tromey <tromey@redhat.com>
PR cli/15718
* infcall.c: Include event-top.h.
(run_inferior_call): Call async_disable_stdin if needed.
gdb/testsuite/
2014-03-20 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
PR cli/15718
* gdb.base/condbreak-call-false.c: New file.
* gdb.base/condbreak-call-false.exp: New file.
Ilya Tocar [Thu, 20 Mar 2014 09:12:16 +0000 (13:12 +0400)]
Fix memory size for gather/scatter instructions
For gathers with indices larger than elements (e. g.)
vpgatherqd ymm6{k1}, ZMMWORD PTR [ebp+zmm7*8-123]
We currently treat memory size as a size of index register, while it is
actually should be size of destination register:
vpgatherqd ymm6{k1}, YMMWORD PTR [ebp+zmm7*8-123]
This patch fixes it.
opcodes/
* i386-opc.tbl: Change memory size for vgatherpf0qps, vgatherpf1qps,
vscatterpf0qps, vscatterpf1qps, vgatherqps, vpgatherqd, vpscatterqd,
vscatterqps.
* i386-tbl.h: Regenerate.
gas/testsuite/
* gas/i386/avx512pf-intel.d: Change memory size for vgatherpf0qps,
vgatherpf1qps, vscatterpf0qps, vscatterpf1qps.
* gas/i386/avx512pf.s: Ditto.
* gas/i386/x86-64-avx512pf-intel.d: Ditto.
* gas/i386/x86-64-avx512pf.s: Ditto.
* gas/i386/avx512f-intel.d: Change memory size for vgatherqps,
vpgatherqd, vpscatterqd, vscatterqps.
* gas/i386/avx512f.s: Ditto.
* gas/i386/x86-64-avx512f-intel.d: Ditto.
* gas/i386/x86-64-avx512f.s: Ditto.
Pedro Alves [Thu, 20 Mar 2014 14:09:53 +0000 (14:09 +0000)]
Further cleanup of signal-while-stepping-over-bp-other-thread.c.
This test now uses pthread_kill instead of the host's kill command, so
no longer need to block signals, or store the the inferior's PID.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-while-stepping-over-bp-other-thread.c (pid):
Delete.
(block_signals, unblock_signals): Delete.
(child_function_2, main): Remove references to deleted variable
and functions.
Pedro Alves [Thu, 20 Mar 2014 13:26:33 +0000 (13:26 +0000)]
Make signal-while-stepping-over-bp-other-thread.exp run against remote targets too.
Use pthread_kill instead of the host's "kill". The reason the test
wasn't written that way to begin with, is that done this way, before
the previous fixes to make GDB step-over all other threads before the
stepping thread, the test would fail...
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-while-stepping-over-bp-other-thread.c (main):
Use pthread_kill to signal thread 2.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust to make the test send itself a signal rather than using the
host's "kill" command.
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)]
Handle multiple step-overs.
This test fails with current mainline.
If the program stopped for a breakpoint in thread 1, and then the user
switches to thread 2, and resumes the program, GDB first switches back
to thread 1 to step it over the breakpoint, in order to make progress.
However, that logic only considers the last reported event, assuming
only one thread needs that stepping over dance.
That's actually not true when we play with scheduler-locking. The
patch adds an example to the testsuite of multiple threads needing a
step-over before the stepping thread can be resumed. With current
mainline, the program re-traps the same breakpoint it had already
trapped before.
E.g.:
Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
99 wait_threads (); /* set wait-threads breakpoint here */
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint
info threads
Id Target Id Frame
3 Thread 0x7ffff77c9700 (LWP 4310) "multiple-step-o" 0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43
2 Thread 0x7ffff7fca700 (LWP 4309) "multiple-step-o" 0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60
* 1 Thread 0x7ffff7fcb740 (LWP 4305) "multiple-step-o" main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: info threads shows all threads
set scheduler-locking on
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking on
break 44
Breakpoint 3 at 0x4007d3: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 44.
(gdb) break 61
Breakpoint 4 at 0x40082d: file ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 61.
(gdb) thread 3
[Switching to thread 3 (Thread 0x7ffff77c9700 (LWP 4310))]
#0 0x00000000004007ca in child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:43
43 (*myp) ++;
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 3
continue
Continuing.
Breakpoint 3, child_function_3 (arg=0x1) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:44
44 callme (); /* set breakpoint thread 3 here */
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 3
p *myp = 0
$1 = 0
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 3
thread 2
[Switching to thread 2 (Thread 0x7ffff7fca700 (LWP 4309))]
#0 0x0000000000400827 in child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:60
60 (*myp) ++;
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 2
continue
Continuing.
Breakpoint 4, child_function_2 (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:61
61 callme (); /* set breakpoint thread 2 here */
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: continue to breakpoint: run to breakpoint in thread 2
p *myp = 0
$2 = 0
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: unbreak loop in thread 2
thread 1
[Switching to thread 1 (Thread 0x7ffff7fcb740 (LWP 4305))]
#0 main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
99 wait_threads (); /* set wait-threads breakpoint here */
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: thread 1
set scheduler-locking off
(gdb) PASS: gdb.threads/multiple-step-overs.exp: step: set scheduler-locking off
At this point all thread are stopped for a breakpoint that needs stepping over.
(gdb) step
Breakpoint 2, main () at ../../../src/gdb/testsuite/gdb.threads/multiple-step-overs.c:99
99 wait_threads (); /* set wait-threads breakpoint here */
(gdb) FAIL: gdb.threads/multiple-step-overs.exp: step
But that "step" retriggers the same breakpoint instead of making
progress.
The patch teaches GDB to step over all breakpoints of all threads
before resuming the stepping thread.
Tested on x86_64 Fedora 17, against pristine mainline, and also my
branch that implements software single-stepping on x86.
gdb/
2014-03-20 Pedro Alves <palves@redhat.com>
* infrun.c (prepare_to_proceed): Delete.
(thread_still_needs_step_over): New function.
(find_thread_needs_step_over): New function.
(proceed): If the current thread needs a step-over, set its
steping_over_breakpoint flag. Adjust to use
find_thread_needs_step_over instead of prepare_to_proceed.
(process_event_stop_test): For BPSTAT_WHAT_STOP_NOISY and
BPSTAT_WHAT_STOP_SILENT, assume the thread stopped for a
breakpoint.
(switch_back_to_stepped_thread): Step over breakpoints of all
threads not the stepping thread, before switching back to the
stepping thread.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/multiple-step-overs.c: New file.
* gdb.threads/multiple-step-overs.exp: New file.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Adjust expected infrun debug output.
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)]
Fix for even more missed events; eliminate thread-hop code.
Even with deferred_step_ptid out of the way, GDB can still lose
watchpoints.
If a watchpoint triggers and the PC points to an address where a
thread-specific breakpoint for another thread is set, the thread-hop
code triggers, and we lose the watchpoint:
if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
{
int thread_hop_needed = 0;
struct address_space *aspace =
get_regcache_aspace (get_thread_regcache (ecs->ptid));
/* Check if a regular breakpoint has been hit before checking
for a potential single step breakpoint. Otherwise, GDB will
not see this breakpoint hit when stepping onto breakpoints. */
if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
{
if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid))
thread_hop_needed = 1;
^^^^^^^^^^^^^^^^^^^^^
}
And on software single-step targets, even without a thread-specific
breakpoint in the way, here in the thread-hop code:
else if (singlestep_breakpoints_inserted_p)
{
...
if (!ptid_equal (singlestep_ptid, ecs->ptid)
&& in_thread_list (singlestep_ptid))
{
/* If the PC of the thread we were trying to single-step
has changed, discard this event (which we were going
to ignore anyway), and pretend we saw that thread
trap. This prevents us continuously moving the
single-step breakpoint forward, one instruction at a
time. If the PC has changed, then the thread we were
trying to single-step has trapped or been signalled,
but the event has not been reported to GDB yet.
There might be some cases where this loses signal
information, if a signal has arrived at exactly the
same time that the PC changed, but this is the best
we can do with the information available. Perhaps we
should arrange to report all events for all threads
when they stop, or to re-poll the remote looking for
this particular thread (i.e. temporarily enable
schedlock). */
CORE_ADDR new_singlestep_pc
= regcache_read_pc (get_thread_regcache (singlestep_ptid));
if (new_singlestep_pc != singlestep_pc)
{
enum gdb_signal stop_signal;
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: unexpected thread,"
" but expected thread advanced also\n");
/* The current context still belongs to
singlestep_ptid. Don't swap here, since that's
the context we want to use. Just fudge our
state and continue. */
stop_signal = ecs->event_thread->suspend.stop_signal;
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
ecs->ptid = singlestep_ptid;
ecs->event_thread = find_thread_ptid (ecs->ptid);
ecs->event_thread->suspend.stop_signal = stop_signal;
stop_pc = new_singlestep_pc;
}
else
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: unexpected thread\n");
thread_hop_needed = 1;
stepping_past_singlestep_breakpoint = 1;
saved_singlestep_ptid = singlestep_ptid;
}
}
}
we either end up with thread_hop_needed, ignoring the watchpoint
SIGTRAP, or switch to the stepping thread, again ignoring that the
SIGTRAP could be for some other event.
The new test added by this patch exercises both paths.
So the fix is similar to the deferred_step_ptid fix -- defer the
thread hop to _after_ the SIGTRAP had a change of passing through the
regular bpstat handling. If the wrong thread hits a breakpoint, we'll
just end up with BPSTAT_WHAT_SINGLE, and if nothing causes a stop,
keep_going starts a step-over.
Most of the stepping_past_singlestep_breakpoint mechanism is really
not necessary -- setting the thread to step over a breakpoint with
thread->trap_expected is sufficient to keep all other threads locked.
It's best to still keep the flag in some form though, because when we
get to keep_going, the software single-step breakpoint we need to step
over is already gone -- an optimization done by a follow up patch will
check whether a step-over is still be necessary by looking to see
whether the breakpoint is still there, and would find the thread no
longer needs a step-over, while we still want it.
Special care is still needed to handle the case of PC of the thread we
were trying to single-step having changed, like in the old code. We
can't just keep_going and re-step it, as in that case we can over-step
the thread (if it was already done with the step, but hasn't reported
it yet, we'd ask it to step even further). That's now handled in
switch_back_to_stepped_thread. As bonus, we're now using a technique
that doesn't lose signals, unlike the old code -- we now insert a
breakpoint at PC, and resume, which either reports the breakpoint
immediately, or any pending signal.
Tested on x86_64 Fedora 17, against pristine mainline, and against a
branch that implements software single-step on x86.
gdb/
2014-03-20 Pedro Alves <palves@redhat.com>
* breakpoint.c (single_step_breakpoint_inserted_here_p): Make
extern.
* breakpoint.h (single_step_breakpoint_inserted_here_p): Declare.
* infrun.c (saved_singlestep_ptid)
(stepping_past_singlestep_breakpoint): Delete.
(resume): Remove stepping_past_singlestep_breakpoint handling.
(proceed): Store the prev_pc of the stepping thread too.
(init_wait_for_inferior): Adjust. Clear singlestep_ptid and
singlestep_pc.
(enum infwait_states): Delete infwait_thread_hop_state.
(struct execution_control_state) <hit_singlestep_breakpoint>: New
field.
(handle_inferior_event): Adjust.
(handle_signal_stop): Delete stepping_past_singlestep_breakpoint
handling and the thread-hop code. Before removing single-step
breakpoints, check whether the thread hit a single-step breakpoint
of another thread. If it did, the trap is not a random signal.
(switch_back_to_stepped_thread): If the event thread hit a
single-step breakpoint, unblock it before switching to the
stepping thread. Handle the case of the stepped thread having
advanced already.
(keep_going): Handle the case of the current thread moving past a
single-step breakpoint.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/step-over-trips-on-watchpoint.c: New file.
* gdb.threads/step-over-trips-on-watchpoint.exp: New file.
Pedro Alves [Thu, 20 Mar 2014 13:26:32 +0000 (13:26 +0000)]
PR breakpoints/7143 - Watchpoint does not trigger when first set
Say the program is stopped at a breakpoint, and the user sets a
watchpoint. When the program is next resumed, GDB will first step
over the breakpoint, as explained in the manual:
@value {GDBN} normally ignores breakpoints when it resumes
execution, until at least one instruction has been executed. If it
it did not do this, you would be unable to proceed past a breakpoint
without first disabling the breakpoint. This rule applies whether
or not the breakpoint already existed when your program stopped.
However, GDB currently also removes watchpoints, catchpoints, etc.,
and that means that the first instruction off the breakpoint does not
trigger the watchpoint, catchpoint, etc.
testsuite/gdb.base/watchpoint.exp has a kfail for this.
The PR proposes installing watchpoints only when stepping over a
breakpoint, but that misses catchpoints, etc.
A better fix would instead work from the opposite direction -- remove
only real breakpoints, leaving all other kinds of breakpoints
inserted.
But, going further, it's really a waste to constantly remove/insert
all breakpoints when stepping over a single breakpoint (generating a
pair of RSP z/Z packets for each breakpoint), so the fix goes a step
further and makes GDB remove _only_ the breakpoint being stepped over,
leaving all others installed. This then has the added benefit of
reducing breakpoint-related RSP traffic substancialy when there are
many breakpoints set.
gdb/
2014-03-20 Pedro Alves <palves@redhat.com>
PR breakpoints/7143
* breakpoint.c (should_be_inserted): Don't insert breakpoints that
are being stepped over.
(breakpoint_address_match): Make extern.
* breakpoint.h (breakpoint_address_match): New declaration.
* inferior.h (stepping_past_instruction_at): New declaration.
* infrun.c (struct step_over_info): New type.
(step_over_info): New global.
(set_step_over_info, clear_step_over_info)
(stepping_past_instruction_at): New functions.
(handle_inferior_event): Clear the step-over info when
trap_expected is cleared.
(resume): Remove now stale comment.
(clear_proceed_status): Clear step-over info.
(proceed): Adjust step-over handling to set or clear the step-over
info instead of removing all breakpoints.
(handle_signal_stop): When setting up a thread-hop, don't remove
breakpoints here.
(stop_stepping): Clear step-over info.
(keep_going): Adjust step-over handling to set or clear step-over
info and then always inserting breakpoints, instead of removing
all breakpoints when stepping over one.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
PR breakpoints/7143
* gdb.base/watchpoint.exp: Mention bugzilla bug number instead of
old gnats gdb/38. Remove kfail. Adjust to use gdb_test instead
of gdb_test_multiple.
* gdb.cp/annota2.exp: Remove kfail for gdb/38.
* gdb.cp/annota3.exp: Remove kfail for gdb/38.
Pedro Alves [Thu, 20 Mar 2014 13:26:31 +0000 (13:26 +0000)]
Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid.
Consider the case of the user doing "step" in thread 2, while thread 1
had previously stopped for a breakpoint. In order to make progress,
GDB makes thread 1 step over its breakpoint first (with all other
threads stopped), and once that is over, thread 2 then starts stepping
(with thread 1 and all others running free, by default). If GDB
didn't do that, thread 1 would just trip on the same breakpoint
immediately again. This is what the prepare_to_proceed /
deferred_step_ptid code is all about.
However, deferred_step_ptid code resumes the target with:
resume (1, GDB_SIGNAL_0);
prepare_to_wait (ecs);
return;
Recall we were just stepping over a breakpoint when we get here. That
means that _nothing_ had installed breakpoints yet! If there's
another breakpoint just after the breakpoint that was just stepped,
we'll miss it. The fix for that would be to use keep_going instead.
However, there are more problems. What if the instruction that was
just single-stepped triggers a watchpoint? Currently, GDB just
happily resumes the thread, losing that too...
Missed watchpoints will need yet further fixes, but we should keep
those in mind.
So the fix must be to let the trap fall through the regular bpstat
handling, and only if no breakpoint, watchpoint, etc. claims the trap,
shall we switch back to the stepped thread.
Now, nowadays, we have code at the tail end of trap handling that does
exactly that -- switch back to the stepped thread
(switch_back_to_the_stepped_thread).
So the deferred_step_ptid code is just standing in the way, and can
simply be eliminated, fixing bugs in the process. Sweet.
The comment about spurious "Switching to ..." made me pause, but is
actually stale nowadays. That isn't needed anymore.
previous_inferior_ptid used to be re-set at each (internal) event, but
now it's only touched in proceed and normal stop.
The two tests added by this patch fail without the fix.
Tested on x86_64 Fedora 17 (also against my software single-stepping
on x86 branch).
gdb/
2014-03-20 Pedro Alves <palves@redhat.com>
* infrun.c (previous_inferior_ptid): Adjust comment.
(deferred_step_ptid): Delete.
(infrun_thread_ptid_changed, prepare_to_proceed)
(init_wait_for_inferior): Adjust.
(handle_signal_stop): Delete deferred_step_ptid handling.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
* gdb.threads/step-over-lands-on-breakpoint.c: New file.
* gdb.threads/step-over-lands-on-breakpoint.exp: New file.
Nick Clifton [Thu, 20 Mar 2014 13:15:12 +0000 (13:15 +0000)]
An off-by-one error in the code to catch bogus vn_next fields meant that
linker testsuite failures were showing up for the cris target. Fixed by
this patch.
* readelf.c (process_version_sections): Fix off-by-one error in
previous delta.
Will Newton [Fri, 10 Jan 2014 14:38:58 +0000 (14:38 +0000)]
bfd/elf32-arm.c: Set st_value to zero for undefined symbols
Unless pointer_equality_needed is set then set st_value to be zero
for undefined symbols.
bfd/ChangeLog:
2014-03-20 Will Newton <will.newton@linaro.org>
PR ld/16715
* elf32-arm.c (elf32_arm_check_relocs): Set
pointer_equality_needed for absolute references within
executable links.
(elf32_arm_finish_dynamic_symbol): Set st_value to zero
unless pointer_equality_needed is set.
ld/testsuite/ChangeLog:
2014-03-20 Will Newton <will.newton@linaro.org>
* ld-arm/ifunc-14.rd: Update symbol values.
Alan Modra [Wed, 19 Mar 2014 23:02:15 +0000 (09:32 +1030)]
daily update
Nick Clifton [Wed, 19 Mar 2014 16:48:02 +0000 (16:48 +0000)]
This is a fix for PR binutils/16723, where a corrupt .gnu.version_r section could
send readelf into an infinite loop.
* readelf.c (process_version_sections): Prevent an infinite loop
when the vn_next field is zero but there are still entries to be
processed.
Jose E. Marchesi [Wed, 19 Mar 2014 16:43:41 +0000 (16:43 +0000)]
This patch adds support for the hyperprivileged registers %hstick_offset
and %hstick_enable to the Sparc assembler.
* config/tc-sparc.c (hpriv_reg_table): Added entries for
%hstick_offset and %hstick_enable.
* doc/c-sparc.texi (Sparc-Regs): Document the %hstick_offset and
%hstick_enable hyperprivileged registers.
* sparc-dis.c (v9_hpriv_reg_names): Names for %hstick_offset and
%hstick_enable added.
* gas/sparc/rdhpr.s: Test rd %hstick_offset and %hstick_enable.
* gas/sparc/rdhpr.d: Likewise.
* gas/sparc/wrhpr.s: Test wr %hstick_offset and %hstick_enable.
* gas/sparc/wrhpr.d: Likewise.
Jose E. Marchesi [Wed, 19 Mar 2014 16:22:31 +0000 (16:22 +0000)]
Fix Sparc test which was failing in the presence of new v9 opcodes.
* gas/sparc/ldd_std.d: Fix objdump invocation in order to get
the old opcodes for the ldtw, ldtwa, stw and stwa instructions.
Pedro Alves [Wed, 19 Mar 2014 13:05:43 +0000 (13:05 +0000)]
gdb.base/async.exp: Enable it.
There's no reason not to enable this test anymore.
Even if the current output isn't ideal (we mess up the prompt), it's what
we have today. We can adjust the test if the output improves.
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Remove early return.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)]
gdb.base/async.exp: Make test messages unique.
$ cat gdb.sum| grep PASS| sort | uniq -c |sort -n
1 PASS: gdb.base/async.exp: finish&
1 PASS: gdb.base/async.exp: jump&
1 PASS: gdb.base/async.exp: next&
1 PASS: gdb.base/async.exp: nexti&
1 PASS: gdb.base/async.exp: set exec-done-display off
1 PASS: gdb.base/async.exp: set exec-done-display on
1 PASS: gdb.base/async.exp: set target-async on
1 PASS: gdb.base/async.exp: stepi&
1 PASS: gdb.base/async.exp: until&
2 PASS: gdb.base/async.exp: step&
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (step& tests): Pass explicit test messages.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)]
gdb.base/async.exp: Fix races.
This test is currently racy:
PASS: gdb.base/async.exp: step&
stepi&
(gdb) 0x0000000000400547 14 x = 5; x = 5;
completed.
PASS: gdb.base/async.exp: stepi&
nexti&
(gdb) 15 y = 3;
completed.FAIL: gdb.base/async.exp: nexti&
The problem is here:
-re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
pass "$command"
}
-re "$gdb_prompt.*completed\.$" {
fail "$command"
}
Note how the fail pattern is a subset of the pass pattern. If the
expect buffer happens to end up with:
"^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\."
that is, the final "\r\n" has't reached the expect buffer yet, but
"completed." has, then the fail pattern matches...
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (test_background): Expect \r\n after
"completed." in the fail pattern.
Pedro Alves [Wed, 19 Mar 2014 15:22:45 +0000 (15:22 +0000)]
gdb.base/async.exp: Factor out test pattern to a procedure.
All the tests here follow the same pattern (and they all have the same
problem, not fixed here yet). Add a new procedure, factoring out the
pattern to a simple place.
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (test_background): New procedure.
Use it for all background execution command tests.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)]
gdb.base/async.exp: Use prepare_for_testing.
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Use prepare_for_testing.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)]
gdb.base/async.exp: Fix stepi& test.
Currently the test assumes that "stepi" over:
13 x = 5;
end up somewhere midline. But, (at least) on x86, that assignment
ends up compiled as just one movl instruction, so a stepi stops at the
next line already:
completed.
PASS: gdb.base/async.exp: step &
step&
(gdb) foo () at ../../../src/gdb/testsuite/gdb.base/async.c:13
13 x = 5;
completed.
PASS: gdb.base/async.exp: step &
stepi&
(gdb) 14 y = 3;
completed.
FAIL: gdb.base/async.exp: (timeout) stepi &
nexti&
(gdb) 16 return x + y;
completed.
FAIL: gdb.base/async.exp: (timeout) nexti &
finish&
Run till exit from #0 foo () at ../../../src/gdb/testsuite/gdb.base/async.c:16
This patch fixes it, by making sure there's more than one instruction
in that line.
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.c (foo): Make 'x' volatile. Write to it twice in
the same line.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)]
gdb.base/async.exp: Don't hardcode line numbers.
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.c (main): Add "jump here" and "until here" line
marker comments.
* gdb.base/async.exp (jump_here): New global.
(jump& test): Use it.
(until_here): New global.
(until& test): Use it.
Pedro Alves [Wed, 19 Mar 2014 15:22:44 +0000 (15:22 +0000)]
gdb.base/async.exp: Leave gdb_protocol alone.
Many eons ago, async was only implemented in the remote target, and
you'd activate it by doing "target async" rather than "target remote".
That's long gone now, replaced by "set target-async on".
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp: Don't frob gdb_protocol.
Nick Clifton [Wed, 19 Mar 2014 14:46:15 +0000 (14:46 +0000)]
Improve .rsrc section merging again. This time with an algorithm that
should work for all types of input .rsrc section.
* peXXigen.c (rsrc_process_section): Add code to scan input
sections and record their lengths. Use these lengths to find the
start of each merged .rsrc section.
* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
(.rsrc): Add SUBALIGN(4). Remove SORT.
* scripttempl/pep.sc: Likewise.
Nick Clifton [Wed, 19 Mar 2014 14:43:00 +0000 (14:43 +0000)]
Remove spurious character.
Daniel Gutson [Wed, 19 Mar 2014 14:31:25 +0000 (14:31 +0000)]
Add support for ARM assembler produced by CodeCompositor Studio.
* config/tc-arm.c (codecomposer_syntax): New flag that states whether the
CCS syntax compatibility mode is on or off.
(asmfunc_states): New enum to represent the asmfunc directive state.
(asmfunc_state): New variable holding the asmfunc directive state.
(comment_chars): Rename to arm_comment_chars.
(line_separator_chars): Rename to arm_line_separator_chars.
(s_ccs_ref): New function that handles the .ref directive.
(asmfunc_debug): New function.
(s_ccs_asmfunc): New function that handles the .asmfunc directive.
(s_ccs_endasmfunc): New function that handles the .endasmfunc directive.
(s_ccs_def): New function that handles the .def directive.
(tc_start_label_without_colon): New function.
(md_pseudo_table): Added new CCS directives.
(arm_ccs_mode): New function that handles the -mccs command line option.
(arm_long_opts): Added new -mccs command line option.
* config/tc-arm.h (LABELS_WITHOUT_COLONS): New macro.
(TC_START_LABEL_WITHOUT_COLON): New macro.
(tc_start_label_without_colon): Added extern function declaration.
(tc_comment_chars): Define.
(tc_line_separator_chars): Define.
* app.c (do_scrub_begin): Use tc_line_separator_chars, if defined.
* read.c (read_begin): Likewise.
* doc/as.texinfo: Add documentation for the -mccs command line
option.
* doc/c-arm.texi: Likewise.
* doc/internals.texi: Document tc_line_separator_chars.
* NEWS: Mention the new feature.
* gas/arm/ccs.s: New test case.
* gas/arm/ccs.d: New expected disassembly.
Nick Clifton [Wed, 19 Mar 2014 12:21:39 +0000 (12:21 +0000)]
Fix RX linker testsuite failures by making the assembler use conventional section names.
* config/default.exp (ASFLAGS): For the RX target add:
-muse-conventional-section-names.
Nick Clifton [Wed, 19 Mar 2014 09:40:21 +0000 (09:40 +0000)]
Fix typo in changelog entry.
Nick Clifton [Wed, 19 Mar 2014 09:38:25 +0000 (09:38 +0000)]
Fix RX gas testsuite failures by accounting for new variations in the disassembler's output.
* rx-decode.opc (bwl): Allow for bogus instructions with a size
field of 3.
(sbwl, ubwl, SCALE): Likewise.
* rx-decode.c: Regenerate.
* gas/rx/mov.d: Update expected disassembly.
Nick Clifton [Wed, 19 Mar 2014 08:51:20 +0000 (08:51 +0000)]
Improve .rsrc section merging with better handling of the alignment adjustments
made between merged .rsrc sections.
* peXXigen.c (rsrc_align): New function. Attempts to cope with
alignment variances when .rsrc sections are merged.
(rsrc_process_section): Use rsrc_align.
* Makefile.am (default-manifest.o): Use WINDRES_FOR_TARGET.
* Makefile.in: Regenerate.
* emultempl/default-manifest.rc: Fix typo.
* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
(.rsrc): Add SUBALIGN(4).
* scripttempl/pep.sc: Likewise.
Doug Evans [Tue, 18 Mar 2014 23:19:51 +0000 (19:19 -0400)]
* gdb.base/async.exp: Whitespace fixes. Turn on target-async.
Fix spelling of exec-done-display.
Alan Modra [Tue, 18 Mar 2014 23:00:42 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Tue, 18 Mar 2014 21:48:06 +0000 (22:48 +0100)]
Fix SIGTERM signal safety (PR gdb/15358).
gdb/
2014-03-18 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/15358
* defs.h (sync_quit_force_run): New declaration.
(QUIT): Check also SYNC_QUIT_FORCE_RUN.
* event-top.c (async_sigterm_handler): New declaration.
(async_sigterm_token): New variable.
(async_init_signals): Create also async_sigterm_token.
(async_sigterm_handler): New function.
(sync_quit_force_run): New variable.
(handle_sigterm): Replace quit_force call by other calls.
* utils.c (quit): Call quit_force if SYNC_QUIT_FORCE_RUN.
gdb/testsuite/
2014-03-18 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/15358
* gdb.base/gdb-sigterm.c: New file.
* gdb.base/gdb-sigterm.exp: New file.
Message-ID: <
20140316135334.GA30698@host2.jankratochvil.net>
Maciej W. Rozycki [Tue, 18 Mar 2014 19:39:41 +0000 (19:39 +0000)]
Power: Correct little-endian e500v2 GPR frame offsets
This change corrects GPR frame offset calculation for the e500v2
processor. On this target, featuring the SPE APU, GPRs are 64-bit and
are held in stack frames whole with the use of `evstdd' and `evldd'
instructions. Their integer 32-bit part occupies the low-order word and
therefore its offset varies between the two endiannesses possible.
* rs6000-tdep.c (rs6000_frame_cache): Correct little-endian GPR
offset into SPE pseudo registers.
Pedro Alves [Tue, 18 Mar 2014 17:50:28 +0000 (17:50 +0000)]
PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output.
Part of PR gdb/13860 is about the mi-solib.exp test's output being
different in sync vs async modes.
sync:
>./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
~"done.\n"
(gdb)
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="17724"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
(gdb)
async:
>./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async on" -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
~"done.\n"
(gdb)
start
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="17729"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
(gdb)
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1"
For now, let's focus only on the *stopped event. We see that the
async output is missing frame info. And this causes a test failure in
async mode, as "mi_expect_stop solib-event" wants to see the frame
info.
However, if we compare the event output when a real MI execution
command is used, compared to a CLI command (e.g., run vs -exec-run,
next vs -exec-next, etc.), we see:
>./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..."
~"done.\n"
(gdb)
r
&"r\n"
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="17751"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
(gdb)
-exec-run
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
=library-unloaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",thread-group="i1"
=thread-group-started,id="i1",pid="17754"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1"
=thread-selected,id="1"
(gdb)
As seen above, with MI commands, the *stopped event _doesn't_ have
frame info. This is because normal_stop, as commanded by the result
of bpstat_print, skips printing frame info in this case (it's an
"event", not a "breakpoint"), and when the interpreter is MI,
mi_on_normal_stop skips calling print_stack_frame, as the normal_stop
call was already done with the MI uiout. This explains why the async
output is different even with a CLI command. Its because in async
mode, the mi_on_normal_stop path is always taken; it is always reached
with the MI uiout, because the stop is handled from the event loop,
instead of from within `proceed -> wait_for_inferior -> normal_stop'
with the interpreter overridden, as in sync mode.
This patch fixes the issue by making all cases output the same
*stopped event, by factoring out the print code from normal_stop, and
using it from mi_on_normal_stop as well. I chose the *stopped output
without a frame, mainly because that is what you already get if you
use MI execution commands, the commands frontends are supposed to use
(except when implementing a console). This patch makes it simpler to
tweak the MI output differently if desired, as we only have to change
the centralized print_stop_event (taking into account whether the
uiout is MI-like), and all different modes will change accordingly.
Tested on x86_64 Fedora 17, no regressions. The mi-solib.exp test no
longer fails in async mode with this patch, so the patch removes the
kfail.
2014-03-18 Pedro Alves <palves@redhat.com>
PR gdb/13860
* inferior.h (print_stop_event): Declare.
* infrun.c (print_stop_event): New, factored out from ...
(normal_stop): ... this.
* mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead
of bpstat_print/print_stack_frame.
2014-03-18 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-solib.exp: Remove gdb/13860 kfail.
* lib/mi-support.exp (mi_expect_stop): Add special handling for
solib-event.
Yufeng Zhang [Tue, 18 Mar 2014 17:41:43 +0000 (17:41 +0000)]
Enable verbose error messages by default for AArch64 gas.
gas/
* config/tc-aarch64.c (aarch64_opts): Add new option
"mno-verbose-error".
(verbose_error_p): Initialize to 1.
* doc/c-aarch64.texi (AArch64 Options): Document -mverbose-error
and -mno-verbose-error.
gas/testsuite/
* gas/aarch64/illegal.d: Pass -mno-verbose-error.
* gas/aarch64/verbose-error.s: Add more verbose message testcases.
* gas/aarch64/verbose-error.l: Ditto.
Nick Clifton [Tue, 18 Mar 2014 14:16:54 +0000 (14:16 +0000)]
Convert function declarations to ISO C format. Remove redundant code.
* wrapper.c: Convert function declarations to ISO C format.
(sim_open): Delete code for handling t,d and z command line
options.
Alan Modra [Mon, 17 Mar 2014 23:00:50 +0000 (09:30 +1030)]
daily update
Tom Tromey [Mon, 17 Mar 2014 19:02:13 +0000 (19:02 +0000)]
fix latent bugs in ui-out.c
The destructor code in ui-out.c has a latent bug, which is hidden by
the fact that nothing uses this right now. This patch fixes the
problem. The bug is that we don't always clear a pointer in the
ui-out object, leading to a bad free.
2014-03-17 Tom Tromey <tromey@redhat.com>
* ui-out.c (clear_table, ui_out_new): Clear uiout->table.id.
Chris Faylor [Mon, 17 Mar 2014 17:09:15 +0000 (13:09 -0400)]
2014-03-17 Christopher Faylor <me.cygwin2014@cgf.cx>
* Makefile.am: Use host version of windres.
* Makefile.in: Regenerate.
Nick Clifton [Mon, 17 Mar 2014 16:30:30 +0000 (16:30 +0000)]
Add support for parsing VFP register names in .cfi_offset directives.
PR gas/16694
* config/tc-arm.c (tc_arm_regname_to_dw2regnum): Parse VFP
registers as well.
* gas/cfi/cfi-arm-1.s: Add checks of VFP registers.
* gas/cfi/cfi-arm-1.d: Update expected output.
Joel Brobecker [Mon, 17 Mar 2014 15:41:48 +0000 (08:41 -0700)]
[testsuite/Ada] New testcase for packed array renaming.
gdb/testsuite/ChangeLog:
* gdb.ada/pckd_arr_ren: New testcase.
Pierre-Marie de Rodat [Fri, 14 Mar 2014 13:55:42 +0000 (14:55 +0100)]
[Ada] Crash with references to GNAT packed arrays handling
Consider the following declarations:
type Packed_Array is array (Natural range <>) of Boolean;
pragma Pack (Packed_Array);
function Make (H, L : Natural) return Packed_Array is
begin
return (H .. L => False);
end Make;
A1 : Packed_Array := Make (1, 2);
A2 : Packed_Array renames A1;
One possible DWARF translation for A2 is:
<3><1e4>: Abbrev Number: 21 (DW_TAG_variable)
<1e5> DW_AT_name : a2
<1ea> DW_AT_type : <0x1d9>
<3><1d9>: Abbrev Number: 22 (DW_TAG_const_type)
<1da> DW_AT_type : <0x1de>
<3><1de>: Abbrev Number: 23 (DW_TAG_reference_type)
<1e0> DW_AT_type : <0x1a3>
<3><1a3>: Abbrev Number: 17 (DW_TAG_array_type)
<1a4> DW_AT_name : foo__Ta1S___XP1
<1a8> DW_AT_GNAT_descriptive_type: <0x16b>
<3><16b>: Abbrev Number: 6 (DW_TAG_typedef)
<16c> DW_AT_name : foo__Ta1S
<172> DW_AT_type : <0x176>
<3><176>: Abbrev Number: 17 (DW_TAG_array_type)
<177> DW_AT_name : foo__Ta1S
<17b> DW_AT_GNAT_descriptive_type: <0x223>
Here, foo__Ta1S___XP1 is the type used for the code generation while
foo__Ta1S is the source-level type. Both form a valid GNAT encoding for
a packed array type.
Trying to print A2 (1) can make GDB crash. This is because A2 is defined
as a reference to a GNAT encoding for a packed array. When decoding
constrained packed arrays, the ada_coerce_ref subprogram follows
references and returns a fixed type from the target type, peeling
the GNAT encoding for packed arrays. The remaining code assumes that
the resulting type is still such an encoding while we only have
a standard GDB array type, hence the crash:
arr = ada_coerce_ref (arr);
[...]
type = decode_constrained_packed_array_type (value_type (arr));
decode_constrained_packed_array_type assumes that its argument is
such an encoding. From its front comment:
/* The array type encoded by TYPE, where
ada_is_constrained_packed_array_type (TYPE). */
This patch simply replaces the call to ada_coerce_ref with a call
to coerce_ref in order to avoid prematurely transforming
the packed array type as a side-effect. This way, the remaining code
will always work with a GNAT encoding.
gdb/ChangeLog:
* ada-lang.c (decode_constrained_packed_array): Perform a
minimal coercion for reference with coerce_ref instead of
ada_coerce_ref.
Tristan Gingold [Mon, 17 Mar 2014 13:01:02 +0000 (14:01 +0100)]
darwin: handle recent version of dyld
gdb/
* solib-darwin.c (DYLD_VERSION_MAX): Increase value.
(darwin_solib_create_inferior_hook): Emit a warning if version
is unhandled.
Nick Clifton [Mon, 17 Mar 2014 11:00:32 +0000 (11:00 +0000)]
readelf -s test: Skip extra symbols produced by MSP430 assembler.
* binutils-all/readelf.ss: Add skip of MSP430 defined symbols.
Tristan Gingold [Mon, 17 Mar 2014 08:46:36 +0000 (09:46 +0100)]
od-macho: dump compact unwind info.
binutils/
* od-macho.c (dump_section_header): Renames of dump_section.
(dump_segment): Adjust after renaming.
(OPT_COMPACT_UNWIND): Define.
(options): Add compact unwind.
(mach_o_help): Document compact_unwind.
(unwind_x86_64_regs, unwind_x86_regs): New arrays.
(dump_unwind_encoding_x86, dump_unwind_encoding)
(dump_obj_compact_unwind, dump_exe_compact_unwind)
(dump_section_content): New functions.
(mach_o_dump): Handle compact unwind.
include/mach-o/
* unwind.h: New file.
Tristan Gingold [Mon, 17 Mar 2014 08:46:07 +0000 (09:46 +0100)]
mach-o: handle lasz load dylib command.
bfd/
* mach-o.c (bfd_mach_o_read_dylib): Handle lazy load dylib.
(bfd_mach_o_read_command): Ditto.
binutils/
* od-macho.c (dump_load_command): Handle lazy load dylib.
Alan Modra [Sun, 16 Mar 2014 23:00:41 +0000 (09:30 +1030)]
daily update
Ulrich Weigand [Sun, 16 Mar 2014 14:01:24 +0000 (15:01 +0100)]
Fix Python 2.4 build break
This fixes a build failure against Python 2.4 by casting away "const"
on the second argument to PyObject_GetAttrString. Similar casts to
support Python 2.4 were already present in a number of other places.
gdb/
2014-03-16 Ulrich Weigand <uweigand@de.ibm.com>
* python/py-value.c (get_field_flag): Cast flag_name argument to
PyObject_GetAttrString to support Python 2.4.
Alan Modra [Sat, 15 Mar 2014 23:00:42 +0000 (09:30 +1030)]
daily update
Alan Modra [Fri, 14 Mar 2014 23:00:57 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Fri, 14 Mar 2014 18:54:08 +0000 (19:54 +0100)]
Step down from being global maintainer.
gdb/
2014-03-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* MAINTAINERS (The Official FSF-appointed GDB Maintainers)
(Global Maintainers): Remove Jan Kratochvil.
Anthony Green [Fri, 14 Mar 2014 16:56:12 +0000 (12:56 -0400)]
Check fwrite return code
Nick Clifton [Fri, 14 Mar 2014 15:21:23 +0000 (15:21 +0000)]
Add support for instruction level tracing to the ARM simulator.
* wrapper.c (op_print): New function.
(sim_dis_read): New function.
(print_insn): New function - disassembles the given instruction.
(sim_trace): Note that tracing is now allowed.
(sim_create_inferior): Default to emulating v6.
Initialise the disassembler machinery.
(sim_target_parse_command_line): Add support for -t -d and -z
options.
(sim_target_display_usage): Note existence of -d and -z options.
(sim_open): Parse -t -d and -z options.
* armemu.h: Add exports of trace, disas and trace_funcs.
Add prototype for print_insn.
* armemu.c (ARMul_Emulate26): Add tracing code.
Delete unused variables.
* thumbemu (handle_v6_thumb_insn): Delete unused variable Rd.
Move Rm variable into switch cases.
Add tracing code.
* armcopro.c (XScale_cp15_init): Add a return value.
(XScale_cp13_init): Likewise.
(XScale_cp14_init): Likewise.
(XScale_cp15_LDC): Delete unused function.
(XScale_cp15_STC): Likewise.
* maverick.c: Delete comment inside comment.
(DSPInit): Delete unused function.
(DSPMCR4): Fix compile time warning about missing parenthesis.
(DSPMCR5): Likewise.
(DSPCDP6): Delete unused variable opcode2.
David McQuillan [Fri, 14 Mar 2014 14:03:29 +0000 (14:03 +0000)]
Prevent writes to R15 via LDR or LDM from changing the ARM/Thumb state in pre-v5 architectures.
PR sim/8388
* armemu.c (WriteR15Load): New function. Determines if the state
can be changed upon a write to R15.
(LoadMult): Use WriteR15Load.
* armemu.h (WRITEDESTB): Use WriteR15Load.
Alan Modra [Fri, 14 Mar 2014 13:40:14 +0000 (00:10 +1030)]
Correct ld-powerpc/vle-reloc-2 test
* ld-powerpc/vle-reloc-3.d: Remove addresses.
Nick Clifton [Fri, 14 Mar 2014 11:21:00 +0000 (11:21 +0000)]
Fix build time problem with MingGW hosts, which do not have a strnlen() function.
2014-03-13 Meador Inge <meadori@codesourcery.com>
* configure.in: Add strnlen to AC_CHECK_DECLS.
* config.in: Regenerate.
* configure: Regenerate.
* sysdep.h (strnlen): Add prototype.
* dwarf.c (strnlen): Move prototype ...
* sysdep.h (strnlen): ... to here.
Joel Brobecker [Fri, 14 Mar 2014 07:55:26 +0000 (08:55 +0100)]
Fix guit.texi CL entry.
Alan Modra [Fri, 14 Mar 2014 04:31:53 +0000 (15:01 +1030)]
Fix overflow handling of VLE_SDA21
bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Correct overflow
handling for VLE_SDA21 relocs.
ld/testsuite/
* ld-powerpc/vle.ld: Place .PPC.EMB.sdata0 within 32k of 0.
* ld-powerpc/vle-reloc-3.d: Update.
Alan Modra [Fri, 14 Mar 2014 00:55:59 +0000 (11:25 +1030)]
Remove search path from -l:namespec DT_NEEDED
For libraries without a soname, -l:libfoo.so set DT_NEEDED to the search
dir plus filename, while gold and -lfoo just use the filename. This
patch fixes the inconsistency.
* ldlang.h (full_name_provided): New input flag.
* ldlang.c (new_afile): Don't use lang_input_file_is_search_file_enum
for -l:namespec. Instead use lang_input_file_is_l_enum with
full_name_provided flag.
* ldlfile.c (ldfile_open_file_search): Don't complete lib name if
full_name_provided flag is set.
* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
Handle full_name_provided libraries. Tidy EXTRA_SHLIB_EXTENSION
support. Set DT_NEEDED for -l:namespec as namespec.
* emultempl/aix.em (ppc_after_open_output): Handle full_name_provided.
* emultempl/linux.em (gld${EMULATION_NAME}_open_dynamic_archive):
Don't handle full_name_provided libraries.
* emultempl/pe.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
* emultempl/pep.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
* emultempl/vms.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
Pedro Alves [Fri, 14 Mar 2014 00:06:45 +0000 (00:06 +0000)]
Rename native-only terminal related functions.
Looking at target_terminal_inferior etc. in async mode, I realized
that the naming of the terminal_inferior, terminal_ours,
etc. functions doesn't really give a clue that they're meant for the
native target only. This patch renames them. There's already
child_terminal_info using the child_ prefix, and, they're most
prominently installed by inf-child.c, so I went with the child_
prefix. I dropped "inferior" from a couple to make the name match the
corresponding target method.
Tested on x86_64 Fedora 17, and cross built for mingw. I didn't test
gnu-nat.c, but I think the change is as obvious as it gets. I grepped
the tree looking for other potential spots that would need adjustment
but this is all I found. If something breaks, it should be trivial to
fix.
gdb/
2014-03-14 Pedro Alves <palves@redhat.com>
* inferior.h (terminal_ours_for_output): Rename to ...
(child_terminal_ours_for_output): ... this.
(terminal_save_ours): Rename to ...
(child_terminal_save_ours): ... this.
(terminal_ours): Rename to ...
(child_terminal_ours): ... this.
(terminal_inferior): Rename to ...
(child_terminal_inferior): ... this.
(terminal_init_inferior): Rename to ...
(child_terminal_init_inferior): ... this.
(terminal_init_inferior_with_pgrp): Rename to ...
(child_terminal_init_inferior_with_pgrp): ... this.
* inflow.c (terminal_init_inferior_with_pgrp): Rename to ...
(child_terminal_init_with_pgrp): ... this.
(terminal_save_ours): Rename to ...
(child_terminal_save_ours): ... this.
(terminal_init_inferior): Rename to ...
(child_terminal_init): ... this. Adjust.
(terminal_inferior): Rename to ...
(child_terminal_inferior): ... this.
(terminal_ours_for_output): Rename to ...
(child_terminal_ours_for_output): ... this. Adjust.
(terminal_ours): Rename to ...
(child_terminal_ours): ... this.
(terminal_ours_1): Rename to ...
(child_terminal_ours_1): ... this. Adjust.
* linux-nat.c (linux_nat_terminal_inferior): Adjust.
* windows-nat.c (do_initial_windows_stuff): Adjust.
* gnu-nat.c (gnu_terminal_init_inferior): Rename to ...
(gnu_terminal_init): ... this. Adjust.
(gnu_target): Adjust.
* inf-child.c (inf_child_target): Adjust.
Alan Modra [Thu, 13 Mar 2014 23:01:24 +0000 (09:31 +1030)]
daily update
Richard Earnshaw [Thu, 13 Mar 2014 17:10:04 +0000 (17:10 +0000)]
AArch64: Clean up docs and document -mcpu and -march.
2014-03-13 Richard Earnshaw <rearnsha@arm.com>
Jiong Wang <Jiong.Wang@arm.com>
* doc/c-aarch64.texi: Clean up some formatting issues.
(AArch64 Options): Document -mcpu and -march.
(AArch64 Extensions): New node.
Doug Evans [Thu, 13 Mar 2014 16:55:12 +0000 (09:55 -0700)]
Fix pr 16612.
* guile/scm-type.c (tyscm_copy_type_recursive): Move type to its
new eq?-hashtab.
testsuite/
* gdb.guile/scm-value.ep (test_value_after_death): Do a garbage
collect after discarding symbols.
Doug Evans [Thu, 13 Mar 2014 16:24:19 +0000 (09:24 -0700)]
Fix segv when referencing a value added to history after a Guile garbage collect.
* value.c (record_latest_value): Call release_value_or_incref
instead of release_value.
testsuite/
* gdb.guile/scm-value.exp (test_value_in_inferior): Verify value added
to history survives a gc.
Nick Clifton [Thu, 13 Mar 2014 12:47:05 +0000 (12:47 +0000)]
Make the new aarch64 bignum test endian agnostic.
* gas/aarch64/litpool.s: Make the test endian agnostic.
* gas/aarch64/litpool.d: Update expected disassembly.
Pedro Alves [Wed, 12 Mar 2014 12:40:40 +0000 (12:40 +0000)]
Rename Solaris's target to "target child" like most other ports.
Note that "target procfs" is used by QNX, but the test must be failing
there, as nto-procfs.c overrides to_open with a method that doesn't
throw the error being tested. So I'm just removing the test
completely.
gdb/
2014-03-13 Pedro Alves <palves@redhat.com>
* procfs.c (procfs_target): Don't override to_shortname,
to_longname or to_doc.
gdb/testsuite/
2014-03-13 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Don't test "target procfs".
Pedro Alves [Thu, 13 Mar 2014 12:02:24 +0000 (12:02 +0000)]
Don't mention "Unix" in native target name.
I find the mention of "Unix" unnecessary (and really slightly a lie)
on GNU/Linux in a couple of places:
(gdb) maint print target-stack
The current target stack is:
- multi-thread (multi-threaded child process.)
- child (Unix child process)
- exec (Local exec file)
- None (None)
(gdb) help target child
Unix child process (started by the "run" command).
(gdb) target child
Use the "run" command to start a Unix child process.
It's also odd that e.g., the Windows port says "Unix" in reaction to
"target child" (it was already that way before Windows used
inf-child.c):
(gdb) target child
Use the "run" command to start a Unix child process.
(gdb)
So drop "Unix", going in the direction of saying mostly the same on
all native targets:
(gdb) maint print target-stack
The current target stack is:
- multi-thread (multi-threaded child process.)
- - child (Unix child process)
+ - child (Child process)
- exec (Local exec file)
- None (None)
(gdb) help target child
- Unix child process (started by the "run" command).
+ Child process (started by the "run" command).
(gdb) target child
-Use the "run" command to start a Unix child process.
+Use the "run" command to start a child process.
gdb/
2014-03-13 Pedro Alves <palves@redhat.com>
* inf-child.c (inf_child_open, inf_child_target): Don't mention
Unix in user visible strings.
gdb/testsuite/
2014-03-13 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Update "target child" and "target procfs"
tests to not expect "Unix".
Tristan Gingold [Mon, 2 Dec 2013 13:30:32 +0000 (14:30 +0100)]
Add pe/x86_64 bigobj file format.
bfd/
* peicode.h (pe_ILF_object_p): Adjust, as the version number
has been read.
(pe_bfd_object_p): Also read version number to detect ILF.
* pe-x86_64.c (COFF_WITH_PE_BIGOBJ): Define.
(x86_64pe_bigobj_vec): Define
* coffcode.h (bfd_coff_backend_data): Add _bfd_coff_max_nscns field.
(bfd_coff_max_nscns): New macro.
(coff_compute_section_file_positions): Use unsigned int for
target_index. Compare with bfd_coff_max_nscns.
(bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table):
Set a value for _bfd_coff_max_nscns.
(header_bigobj_classid): New constant.
(coff_bigobj_swap_filehdr_in, coff_bigobj_swap_filehdr_out)
(coff_bigobj_swap_sym_in, coff_bigobj_swap_sym_out)
(coff_bigobj_swap_aux_in, coff_bigobj_swap_aux_out): New
functions.
(bigobj_swap_table): New table.
* libcoff.h: Regenerate.
* coff-sh.c (bfd_coff_small_swap_table): Likewise.
* coff-alpha.c (alpha_ecoff_backend_data): Add value for
_bfd_coff_max_nscns.
* coff-mips.c (mips_ecoff_backend_data): Likewise.
* coff-rs6000.c (bfd_xcoff_backend_data)
(bfd_pmac_xcoff_backend_data): Likewise.
* coff64-rs6000.c (bfd_xcoff_backend_data)
(bfd_xcoff_aix5_backend_data): Likewise.
* targets.c (x86_64pe_bigobj_vec): Declare.
* configure.in (x86_64pe_bigobj_vec): New vector.
* configure: Regenerate.
* config.bfd: Add bigobj object format for Windows targets.
gas/
* config/tc-i386.c (use_big_obj): Declare.
(OPTION_MBIG_OBJ): Define.
(md_longopts): Add -mbig-obj option.
(md_parse_option): Handle it.
(md_show_usage): Display help for this option.
(i386_target_format): Use bigobj for x86-64 if -mbig-obj.
* doc/c-i386.texi: Document the option.
gas/testsuite/
* gas/pe/big-obj.d, gas/pe/big-obj.s: Add test.
* gas/pe/pe.exp: Add test.
include/coff/
* pe.h (struct external_ANON_OBJECT_HEADER_BIGOBJ): Declare.
(FILHSZ_BIGOBJ): Define.
(struct external_SYMBOL_EX): Declare.
(SYMENT_BIGOBJ, SYMESZ_BIGOBJ): Define.
(union external_AUX_SYMBOL_EX): Declare.
(AUXENT_BIGOBJ, AUXESZ_BIGOBJ): Define.
* internal.h (struct internal_filehdr): Change type
of f_nscns.
Stan Shebs [Thu, 13 Mar 2014 02:36:45 +0000 (19:36 -0700)]
Doxygenate gdbtypes.h
Alan Modra [Wed, 12 Mar 2014 23:01:14 +0000 (09:31 +1030)]
daily update
Pedro Alves [Wed, 12 Mar 2014 20:32:53 +0000 (20:32 +0000)]
Factor out foreground/background execution command preparation.
All execution commands currently have this pattern:
/* If we must run in the background, but the target can't do it,
error out. */
if (async_exec && !target_can_async_p ())
error (_("Asynchronous execution not supported on this target."));
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution. */
async_disable_stdin ();
}
This patch factors that into a shared function.
attach_command installs a cleanup to re-enable stdin, but that's not
necessary, as per the comment in prepare_execution_command. In any
case, if someday it turns out necessary, we have a single place to
install it now.
Tested on x86_64 Fedora 17, sync and async modes.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* infcmd.c (prepare_execution_command): New function, factored out
from several execution commands.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Use prepare_execution_command.
Omair Javaid [Wed, 12 Mar 2014 20:23:55 +0000 (01:23 +0500)]
Support for HWbreak/watchpoint across fork/vfork on arm-native
This patch updates arm native support for hwbreak-/watchpoints to enable
support for hwbreak-/watchpoints across fork/vfork. This involves changes to
hwbreak-/watchpoint insertion mechanism to the modern way, by marking debug
registers as needing update, but only really updating them on resume, which is
necessary for supporting watchpoints in non-stop mode. This also updates a
previously maintained per thread hwbreak-/watchpoint cache to a per process
cache which allows target specific code to come in sync with gdb-linux calls to
threads create/destroy and process fork/exit hooks.
Pedro Alves [Wed, 12 Mar 2014 19:40:52 +0000 (19:40 +0000)]
Make 'make check TESTS="..."' work from GDB's build dir.
I noticed 'make check TESTS="..."' works when ran from gdb/testsuite/,
but TESTS is ignored when "make check" is ran from gdb/.
The issue is that TESTS isn't being passed to the testsuite subdir
make invocation.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* Makefile.in (TARGET_FLAGS_TO_PASS): Add TESTS.
Tom Tromey [Fri, 28 Feb 2014 16:47:34 +0000 (09:47 -0700)]
fix regressions with target-async
A patch in the target cleanup series caused a regression when using
record with target-async. Version 4 of the patch is here:
https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html
The immediate problem is that record supplies to_can_async_p and
to_is_async_p methods, but does not supply a to_async method. So,
when target-async is set, record claims to support async -- but if the
underlying target does not support async, then the to_async method
call will end up in that method's default implementation, namely
tcomplain.
This worked previously because the record target used to provide a
to_async method; one that (erroneously, only at push time) checked the
other members of the target stack, and then simply dropped to_async
calls in the "does not implement async" case.
My first thought was to simply drop tcomplain as the default for
to_async. This works, but Pedro pointed out that the only reason
record has to supply to_can_async_p and to_is_async_p is that these
default to using the find_default_run_target machinery -- and these
defaults are only needed by "run" and "attach".
So, a nicer solution presents itself: change run and attach to
explicitly call into the default run target when needed; and change
to_is_async_p and to_can_async_p to default to "return 0". This makes
the target stack simpler to use and lets us remove the method
implementations from record. This is also in harmony with other plans
for the target stack; namely trying to reduce the impact of
find_default_run_target. This approach makes it clear that
find_default_is_async_p is not needed -- it is asking whether a target
that may not even be pushed is actually async, which seems like a
nonsensical question.
While an improvement, this approach proved to introduce the same bug
when using the core target. Looking a bit deeper, the issue is that
code in "attach" and "run" may need to use either the current target
stack or the default run target -- but different calls into the target
API in those functions could wind up querying different targets.
This new patch makes the target to use more explicit in "run" and
"attach". Then these commands explicitly make the needed calls
against that target. This ensures that a single target is used for
all relevant operations. This lets us remove a couple find_default_*
functions from various targets, including the dummy target. I think
this is a decent understandability improvement.
One issue I see with this patch is that the new calls in "run" and
"attach" are not very much like the rest of the target API. I think
fundamentally this is due to bad factoring in the target API, which
may need to be fixed for multi-target. Tackling that seemed ambitious
for a regression fix.
While working on this I noticed that there don't seem to be any test
cases that involve both target-async and record, so this patch changes
break-precsave.exp to add some. It also changes corefile.exp to add
some target-async tests; these pass with current trunk and with this
patch applied, but fail with the v1 patch.
This patch differs from v4 in that it moves initialization of
to_can_async_p and to_supports_non_stop into inf-child, adds some
assertions to complete_target_initialization, and adds some comments
to target.h.
Built and regtested on x86-64 Fedora 20.
2014-03-12 Tom Tromey <tromey@redhat.com>
* inf-child.c (return_zero): New function.
(inf_child_target): Set to_can_async_p, to_supports_non_stop.
* aix-thread.c (aix_thread_inferior_created): New function.
(aix_thread_attach): Remove.
(init_aix_thread_ops): Don't set to_attach.
(_initialize_aix_thread): Register inferior_created observer.
* corelow.c (init_core_ops): Don't set to_attach or
to_create_inferior.
* exec.c (init_exec_ops): Don't set to_attach or
to_create_inferior.
* infcmd.c (run_command_1): Use find_run_target. Make direct
target calls.
(attach_command): Use find_attach_target. Make direct target
calls.
* record-btrace.c (init_record_btrace_ops): Don't set
to_create_inferior.
* record-full.c (record_full_can_async_p, record_full_is_async_p):
Remove.
(init_record_full_ops, init_record_full_core_ops): Update. Don't
set to_create_inferior.
* target.c (complete_target_initialization): Add assertion.
(target_create_inferior): Remove.
(find_default_attach, find_default_create_inferior): Remove.
(find_attach_target, find_run_target): New functions.
(find_default_is_async_p, find_default_can_async_p)
(target_supports_non_stop, target_attach): Remove.
(init_dummy_target): Don't set to_create_inferior or
to_supports_non_stop.
* target.h (struct target_ops) <to_attach>: Add comment. Remove
TARGET_DEFAULT_FUNC.
<to_create_inferior>: Add comment.
<to_can_async_p, to_is_async_p, to_supports_non_stop>: Use
TARGET_DEFAULT_RETURN.
<to_can_async_p, to_supports_non_stop, to_can_run>: Add comments.
(find_attach_target, find_run_target): Declare.
(target_create_inferior): Remove.
(target_has_execution_1): Update comment.
(target_supports_non_stop): Remove.
* target-delegates.c: Rebuild.
2014-03-12 Tom Tromey <tromey@redhat.com>
* gdb.base/corefile.exp (corefile_test_run, corefile_test_attach):
New procs. Add target-async tests.
* gdb.reverse/break-precsave.exp (precsave_tests): New proc.
Add target-async tests.
Nick Clifton [Wed, 12 Mar 2014 15:44:09 +0000 (15:44 +0000)]
The value of a bignum expression is held in a single global array. This means
that if multiple bignum values are encountered only the most recent is valid.
If such expressions are cached, eg to be emitted into a literal pool later on
in the assembly, then only one expression - the last - will be correct. This
patch fixes the problem for the AArch64 target by caching each bignum value
locally.
PR gas/16688
* config/tc-aarch64.c (literal_expression): New structure.
(literal_pool): Replace exp array with literal_expression array.
(add_to_lit_pool): When adding a bignum cache the big value.
(s_ltorg): When emitting a bignum initialise the global bignum
array from the cached value.
* gas/aarch64/litpool.s: New test case.
* gas/aarch64/litpool.d: Expected disassembly.
Andreas Arnez [Fri, 7 Mar 2014 12:23:47 +0000 (12:23 +0000)]
Fix dw2-ifort-parameter.exp on PPC64
On PPC64, 'func' and 'main' are function descriptors and don't point
to the actual code. Thus the usage of these symbols in the DWARF
assembler source was broken. The patch introduces new labels
func_start and func_end for this purpose.
Andreas Arnez [Fri, 7 Mar 2014 11:52:54 +0000 (11:52 +0000)]
Migrate dw2-ifort-parameter.exp to Dwarf::assemble
A "side effect" of the migration to Dwarf::assemble is that the DWARF
address size is now automatically adjusted to the target architecture.
The original assembler source hard-coded the DWARF address size to 4,
even on 64-bit architectures. This address size mismatch caused a
test case failure on s390x due to a wrong result from DW_OP_deref.
Andreas Arnez [Fri, 7 Mar 2014 11:45:49 +0000 (11:45 +0000)]
Exploit 'prepare_for_testing' etc. for 'Dwarf::assemble'-generated files
Now that prepare_for_testing etc. can cope with absolute path names,
this can be exploited for test cases with generated source files.
This is just to simplify the code and shouldn't cause any functional
change.
Andreas Arnez [Fri, 7 Mar 2014 10:23:42 +0000 (10:23 +0000)]
gdb.exp: Support absolute path name args in 'prepare_for_testing' etc.
Test cases that produce source files in the build directory have not
been able to use prepare_for_testing and friends. This was because
build_executable_from_specs unconditionally prepended the source
directory path name to its arguments.
Nick Clifton [Wed, 12 Mar 2014 13:12:37 +0000 (13:12 +0000)]
Prevent the linker from generaing a seg-fault when the user attempts to link
an ARM ELF binary into an AARCH64 ELF executable.
PR ld/16671
* elf32-arm.c (elf32_arm_add_symbol_hook): Check for ARM format
before testing for vxworks.
Nick Clifton [Wed, 12 Mar 2014 12:00:27 +0000 (12:00 +0000)]
Update the documentation for the AR command so that it shows the --plugin
option coming *after* the command option not before it.
PR binutils/16652
* doc/binutils.texi (ar cmdline): Move --plugin command line
option to after the command option.
Pedro Alves [Wed, 12 Mar 2014 11:55:02 +0000 (11:55 +0000)]
inf-child.h: Update comment.
Like inf-child.c, this file is no longer used exclusively by Unix
targets anymore.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* inf-child.h: Update comment to not mention Unix.
Pedro Alves [Wed, 12 Mar 2014 11:33:59 +0000 (11:33 +0000)]
inf-child.c: Update comments.
This file is no longer used exclusively by Unix targets anymore.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* inf-child.c: Update top comment to not mention Unix. Add
generic comment describing how this target is meant to be used.
(inf_child_post_attach, inf_child_post_startup_inferior)
(inf_child_follow_fork, inf_child_pid_to_exec_file): Don't mention
Unix in comment.
Pedro Alves [Wed, 12 Mar 2014 11:21:36 +0000 (11:21 +0000)]
Make the nto-procfs.c target inherit inf-child.c.
So that all native targets inherit a single "superclass".
Target methods that are set to or do the same as inf-child.c's are
removed.
Not tested.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* nto-procfs.c: Include inf-child.h.
(procfs_ops): Delete global.
(procfs_can_run): Delete method.
(procfs_detach, procfs_mourn_inferior): Unpush the passed in
target pointer instead of referencing procfs_ops.
(procfs_prepare_to_store): Delete.
(init_procfs_ops): Delete function.
(procfs_target): New function, based on init_procfs_ops, but
inherit inf_child_target.
(_initialize_procfs): Use procfs_target.
Pedro Alves [Wed, 12 Mar 2014 11:21:36 +0000 (11:21 +0000)]
Make the windows-nat.c target inherit inf-child.c.
So that all native targets inherit a single "superclass".
Target methods that are set to or do the same as inf-child.c's are
removed.
Tested by cross building on Fedora 17, and then confirming that
./gdb.exe ./gdb.exe -ex "set pagination off" -ex "start"
under Wine still works.
Also, Joel tested this with Adacore's internal testsuite.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* windows-nat.c: Include inf-child.h.
(windows_ops): Delete global.
(windows_open, windows_prepare_to_store, windows_can_run): Delete
methods.
(init_windows_ops): Delete function.
(windows_target): New function, based on init_windows_ops, but
inherit inf_child_target.
(_initialize_windows_nat): Use windows_target. Install x86
specific target methods here.
Pedro Alves [Wed, 12 Mar 2014 11:07:37 +0000 (11:07 +0000)]
Mention PR gdb/16696 in corresponding ChangeLog entry.
Nick Clifton [Wed, 12 Mar 2014 11:02:57 +0000 (11:02 +0000)]
Add myself as the maintainer for the MSP430 sim.
Dmitry Gorbachev [Wed, 12 Mar 2014 10:56:17 +0000 (10:56 +0000)]
Fix compile time warnings about unused variables 'yyinput' and 'input'.
PR binutils/16567
* deflex.l: Add noinput and nounput options.
Alan Modra [Wed, 12 Mar 2014 04:32:00 +0000 (15:02 +1030)]
autoreconf
Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes.
Regenerate gas/config.in.
Alan Modra [Wed, 12 Mar 2014 00:03:26 +0000 (10:33 +1030)]
objcopy/strip ELF program header p_vaddr confusion
copy_elf_program_header has logic to reject non-alloc sections when
calculating p_vaddr offset for padding, but blithely assumed the
first section in a segment was allocated.
PR 16690
* elf.c (copy_elf_program_header): Ignore first section lma if
non-alloc.
Alan Modra [Tue, 11 Mar 2014 23:01:13 +0000 (09:31 +1030)]
daily update
Alan Modra [Tue, 11 Mar 2014 05:12:46 +0000 (15:42 +1030)]
intptr_t type definition needed
coffcode.h uses an intptr_t cast inside an #ifdef RS6000COFF_C, so
ensure that intptr_t is defined. We don't see this when
cross-compiling from linux due to intptr_t being provided by
unistd.h.
PR 16686
* coff-rs6000.c: Include stdint.h.
* coff64-rs6000.c: Likewise.
Doug Evans [Tue, 11 Mar 2014 04:02:19 +0000 (00:02 -0400)]
* guile/guile.c (call_initialize_gdb_module): New function.
(initialize_guile): Replace call to scm_init_guile with call to
scm_with_guile.
Mike Frysinger [Sat, 8 Mar 2014 05:21:13 +0000 (00:21 -0500)]
sim: msp430: start a test framework
The current sim lacks any sort of tests. Start a basic framework and
add a simple one to test the add insn.
Mike Frysinger [Sat, 8 Mar 2014 05:20:11 +0000 (00:20 -0500)]
sim: msp430: set initial PC to ELF entry if available
If we want to run a simple ELF, the reset vector isn't set up, so starting
at address 0 doesn't make sense. Use the ELF's entry point instead.
Mike Frysinger [Fri, 7 Mar 2014 04:29:37 +0000 (23:29 -0500)]
sim: msp430: fix build time warnings
This fix is simple:
msp430-sim.c: In function 'maybe_perform_syscall':
msp430-sim.c:898:10: warning: format '%d' expects argument of type 'int',
but argument 5 has type 'long int' [-Wformat]
This one we change to use casts like everyone else does in the code base:
msp430-sim.c: In function 'msp430_step_once':
msp430-sim.c:985:7: warning: passing argument 3 of 'init_disassemble_info'
from incompatible pointer type [enabled by default]
include/dis-asm.h:368:13: note: expected 'fprintf_ftype' but argument is
of type 'int (*)(struct FILE * __restrict__, const char * __restrict__)'