* step-by-step
@ 2006-10-12 22:12 Mark Wielaard
2006-10-12 23:12 ` step-by-step Mark Wielaard
0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2006-10-12 22:12 UTC (permalink / raw)
To: frysk
[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]
Hi,
This adds a first pass at the stepping Instruction observer. There
aren't any new testcases yet (but a little demo program will follow
right after this email). All existing tests of course PASS. More tests,
to see how the new observer interacts with the other observers will be
added tomorrow.
I am posting this now so people can start looking at it and maybe try it
out to see if it fits in their use cases. I also thought it might be
useful as a simple way to have a blocking observer for a Task (although
it might not be ideal, I'll reply to Nurdins post).
This uses the needsSuspendedAction support in TaskObservation. No actual
action is really needed for a stepping Instruction observer, but the
Task must be suspended when this observer is added so it can start
stepping from then on. Every place where we used to check for a 'normal'
or a 'syscall' ptrace continue we now have a new check whether we need a
'stepping' ptrace continue for the Task.
2006-10-12 Mark Wielaard <mark@klomp.org>
* Proc.java (InstructionAction): New static inner class.
(requestAddInstructionObserver): New method.
(requestDeleteInstructionObserver): New method.
* Task.java (instructionObservers): New field.
(requestAddInstructionObserver): New method.
(requestDeleteInstructionObserver): New method.
(notifyInstruction): New method.
* TaskObserver.java (Instruction): Update documentation.
* TaskState.java: Check whether instruction observers are installed
and do a sendStepInstruction() instead of a sendContinue() or
sendSyscallContinue().
(Running.handleTrappedEvent): Also check for instruction observer
steps.
Committed. Comments welcome.
Cheers,
Mark
[-- Attachment #2: step.patch --]
[-- Type: text/x-patch, Size: 11135 bytes --]
Index: frysk-core/frysk/proc/Proc.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/Proc.java,v
retrieving revision 1.83
diff -u -r1.83 Proc.java
--- frysk-core/frysk/proc/Proc.java 11 Oct 2006 16:04:37 -0000 1.83
+++ frysk-core/frysk/proc/Proc.java 12 Oct 2006 21:22:22 -0000
@@ -598,6 +598,80 @@
Manager.eventLoop.add(to);
}
+
+ /**
+ * Class describing the action to take on the suspended Task
+ * before adding or deleting an Instruction observer. No
+ * particular actions are needed, but we must make sure the Task
+ * is suspended.
+ */
+ final static class InstructionAction implements Runnable
+ {
+ public void run()
+ {
+ // There is nothing in particular we need to do. We just want
+ // to make sure the Task is stopped so we can send it a step
+ // instruction or, when deleted, start resuming the process
+ // normally.
+ }
+ }
+
+ /**
+ * (Internal) Tell the process to add the specified Instruction
+ * Observation, attaching and/or suspending the process if
+ * necessary. As soon as the observation is added and the task
+ * isn't blocked it will inform the Instruction observer of every
+ * step of the task.
+ */
+ void requestAddInstructionObserver (final Task task,
+ TaskObservable observable,
+ TaskObserver.Instruction observer)
+ {
+ logger.log (Level.FINE, "{0} requestAddInstructionObserver\n", this);
+ TaskObservation to;
+ InstructionAction ia = new InstructionAction();
+ to = new TaskObservation(task, observable, observer, ia, true)
+ {
+ public void execute ()
+ {
+ handleAddObservation (this);
+ }
+
+ public boolean needsSuspendedAction()
+ {
+ return task.instructionObservers.numberOfObservers() == 0;
+ }
+ };
+ Manager.eventLoop.add(to);
+ }
+
+ /**
+ * (Internal) Tell the process to delete the specified Instruction
+ * Observation, detaching and/or suspending from the process if
+ * necessary.
+ */
+ void requestDeleteInstructionObserver (final Task task,
+ TaskObservable observable,
+ TaskObserver.Instruction observer)
+ {
+ logger.log (Level.FINE, "{0} requestDeleteInstructionObserver\n", this);
+ TaskObservation to;
+ InstructionAction ia = new InstructionAction();
+ to = new TaskObservation(task, observable, observer, ia, false)
+ {
+ public void execute ()
+ {
+ handleAddObservation (this);
+ }
+
+ public boolean needsSuspendedAction()
+ {
+ return task.instructionObservers.numberOfObservers() == 1;
+ }
+ };
+ Manager.eventLoop.add(to);
+ }
+
/**
* Table of this processes child processes.
*/
Index: frysk-core/frysk/proc/Task.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/Task.java,v
retrieving revision 1.103
diff -u -r1.103 Task.java
--- frysk-core/frysk/proc/Task.java 11 Oct 2006 16:04:37 -0000 1.103
+++ frysk-core/frysk/proc/Task.java 12 Oct 2006 21:22:22 -0000
@@ -917,6 +917,52 @@
return blockers.size();
}
+ /**
+ * Set of Instruction observers.
+ */
+ TaskObservable instructionObservers = new TaskObservable(this);
+
+ /**
+ * Request the addition of a Instruction observer that will be
+ * notified as soon as the task executes an instruction.
+ * <code>o.updateExecuted</code> is called as soon as the Task
+ * starts running again (is not blocked or stopped) and executes the
+ * next instruction.
+ */
+ public void requestAddInstructionObserver(TaskObserver.Instruction o)
+ {
+ logger.log(Level.FINE, "{0} requestAddInstructionObserver\n", this);
+ proc.requestAddInstructionObserver(this, instructionObservers, o);
+ }
+
+ /**
+ * Delete TaskObserver.Instruction from the TaskObserver pool.
+ */
+ public void requestDeleteInstructionObserver (TaskObserver.Instruction o)
+ {
+ logger.log(Level.FINE, "{0} requestDeleteInstructionObserver\n", this);
+ proc.requestDeleteInstructionObserver(this, instructionObservers, o);
+ }
+
+ /**
+ * Notify all Instruction observers. Returns the total number of
+ * blocking observers.
+ */
+ int notifyInstruction()
+ {
+ logger.log(Level.FINE, "{0} notifyInstruction()\n", this);
+
+ Iterator i = instructionObservers.iterator();
+ while (i.hasNext())
+ {
+ TaskObserver.Instruction observer;
+ observer = (TaskObserver.Instruction) i.next();
+ if (observer.updateExecuted(this) == Action.BLOCK)
+ blockers.add(observer);
+ }
+ return blockers.size();
+ }
+
// List containing the TaskObservations that are pending addition
// or deletion (in order that they were requested). Will be dealt with
// as soon as a stop event is received during one of the running states.
Index: frysk-core/frysk/proc/TaskObserver.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/TaskObserver.java,v
retrieving revision 1.17
diff -u -r1.17 TaskObserver.java
--- frysk-core/frysk/proc/TaskObserver.java 21 Sep 2006 16:45:01 -0000 1.17
+++ frysk-core/frysk/proc/TaskObserver.java 12 Oct 2006 21:22:22 -0000
@@ -177,7 +177,9 @@
/**
* Interface used to notify that a Task has executed a single
- * instruction.
+ * instruction. <code>updateExecuted</code> is called as soon after
+ * the Instruction observer is added to the Task and the Task starts
+ * running again (isn't blocked or suspended).
*/
public interface Instruction
extends TaskObserver
Index: frysk-core/frysk/proc/TaskState.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/TaskState.java,v
retrieving revision 1.121
diff -u -r1.121 TaskState.java
--- frysk-core/frysk/proc/TaskState.java 11 Oct 2006 16:04:37 -0000 1.121
+++ frysk-core/frysk/proc/TaskState.java 12 Oct 2006 21:22:22 -0000
@@ -296,7 +296,12 @@
task.sendSetOptions();
if (task.notifyAttached () > 0)
return new BlockedSignal(signal, false);
- if (task.syscallObservers.numberOfObservers() > 0)
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ task.sendStepInstruction(signal);
+ return running;
+ }
+ else if (task.syscallObservers.numberOfObservers() > 0)
{
task.sendSyscallContinue(signal);
return syscallRunning;
@@ -606,6 +611,7 @@
// XXX: Really notify attached here?
if (task.notifyAttached () > 0)
return blockedContinue;
+ // XXX - What about syscall or instruction observers?
task.sendContinue (0);
return running;
}
@@ -663,7 +669,12 @@
{
return blockedContinue;
}
- if (task.syscallObservers.numberOfObservers() > 0)
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ task.sendStepInstruction(0);
+ return running;
+ }
+ else if (task.syscallObservers.numberOfObservers() > 0)
{
task.sendSyscallContinue (0);
return syscallRunning;
@@ -702,7 +713,9 @@
*/
private void sendContinue(Task task, int sig)
{
- if (syscalltracing)
+ if (task.instructionObservers.numberOfObservers() > 0)
+ task.sendStepInstruction(sig);
+ else if (syscalltracing)
task.sendSyscallContinue(sig);
else
task.sendContinue(sig);
@@ -733,8 +746,10 @@
TaskState handleStoppedEvent (Task task)
{
Collection pendingObservations = task.pendingObservations;
+ // XXX Real stop event! - Do we want observers here?
+ // What state should the task be after being stopped?
if (pendingObservations.isEmpty())
- throw new RuntimeException("Whoa!");
+ throw new RuntimeException("Unhandled real stop event");
Iterator it = pendingObservations.iterator();
while (it.hasNext())
@@ -747,7 +762,13 @@
it.remove();
}
- if (task.syscallObservers.numberOfObservers() > 0)
+ // See how to continue depending on the kind of observers.
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ task.sendStepInstruction(0);
+ return insyscall ? inSyscallRunning : running;
+ }
+ else if (task.syscallObservers.numberOfObservers() > 0)
{
task.sendSyscallContinue(0);
return insyscall ? inSyscallRunningTraced : syscallRunning;
@@ -814,6 +835,11 @@
}
else
{
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ task.sendStepInstruction(0);
+ return inSyscallRunning;
+ }
if (syscalltracing)
{
task.sendSyscallContinue(0);
@@ -861,12 +887,15 @@
}
/**
- * Handles traps caused by breakpoints. If there are any Code
- * observers at the address of the trap they get notified. If
- * none of the Code observers blocks we continue over the
- * breakpoint (breakpoint stepping state), otherwise we block
- * till all blocking observers are happy (breakpoint stopped
- * state).
+ * Handles traps caused by breakpoints or instruction
+ * stepping. If there are any Code observers at the address of
+ * the trap they get notified. If none of the Code observers
+ * blocks we continue over the breakpoint (breakpoint stepping
+ * state), otherwise we block till all blocking observers are
+ * happy (breakpoint stopped state). If there are no Code observers
+ * installed at the address, but we are stepping then all instruction
+ * observers are notified. Otherwise it is a real trap event and we
+ * pass it on to the task itself.
*/
TaskState handleTrappedEvent (Task task)
{
@@ -899,8 +928,22 @@
int blockers = task.notifyCodeBreakpoint(address);
if (blockers == -1)
{
- // This is not a trap event generated by us.
- return handleSignaledEvent (task, Sig.TRAP_);
+ // Maybe we were stepping this Task
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ if (task.notifyInstruction() > 0)
+ return blockedContinue();
+ else
+ {
+ sendContinue(task, 0);
+ return this;
+ }
+ }
+ else
+ {
+ // This is not a trap event generated by us.
+ return handleSignaledEvent (task, Sig.TRAP_);
+ }
}
else if (blockers == 0)
{
@@ -971,12 +1014,12 @@
if (insyscall && task.notifySyscallExit() > 0)
return blockedContinue;
- task.sendSyscallContinue(0);
+ sendContinue(task, 0);
return insyscall ? syscallRunning : inSyscallRunningTraced;
}
else
{
- task.sendContinue(0);
+ sendContinue(task, 0);
return this;
}
}
@@ -1127,6 +1170,11 @@
task.blockers.remove (observer);
if (task.blockers.size () > 0)
return this; // Still blocked.
+ if (task.instructionObservers.numberOfObservers() > 0)
+ {
+ task.sendStepInstruction(sig);
+ return running;
+ }
if (task.syscallObservers.numberOfObservers() > 0)
{
task.sendSyscallContinue(sig);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-12 22:12 step-by-step Mark Wielaard
@ 2006-10-12 23:12 ` Mark Wielaard
2006-10-13 14:17 ` step-by-step Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2006-10-12 23:12 UTC (permalink / raw)
To: frysk
[-- Attachment #1: Type: text/plain, Size: 2454 bytes --]
Hi,
On Fri, 2006-10-13 at 00:12 +0200, Mark Wielaard wrote:
> This adds a first pass at the stepping Instruction observer. There
> aren't any new testcases yet (but a little demo program will follow
> right after this email).
Here is a little toy fstep that uses it.
Hope it is a simple example of how you would use a step Instruction
observer. Please let me know if the interface is wrong or inconvenient.
Just drop fstep.java in frysk-core/frysk/bindir, reautogen, build
and ...
$ frysk-core/frysk/bindir/fstep /bin/true
0x3375dff167 (steps: 10000)
0x3375dff167 jbe 0x3375dff1d8
0x3375dff169 movzbl 0x4(%rcx),%edx
0x3375dff16d mov %edx,%eax
0x3375dff16f shr $0x4,%al
0x3375dff172 sub $0x1,%eax
0x3375dff169 (steps: 20000)
0x3375dff169 movzbl 0x4(%rcx),%edx
0x3375dff16d mov %edx,%eax
0x3375dff16f shr $0x4,%al
0x3375dff172 sub $0x1,%eax
0x3375dff175 cmp $0x1,%al
0x3375dff172 (steps: 30000)
0x3375dff172 sub $0x1,%eax
0x3375dff175 cmp $0x1,%al
0x3375dff177 ja 0x3375dff160
0x3375dff179 mov %edx,%eax
0x3375dff17b and $0xf,%eax
0x3375dff16d (steps: 40000)
0x3375dff16d mov %edx,%eax
0x3375dff16f shr $0x4,%al
0x3375dff172 sub $0x1,%eax
0x3375dff175 cmp $0x1,%al
0x3375dff177 ja 0x3375dff160
0x3375dff17b (steps: 50000)
0x3375dff17b and $0xf,%eax
0x3375dff17e cmp $0x6,%eax
0x3375dff181 je 0x3375dff160
0x3375dff183 movzwl 0x6(%rcx),%edx
0x3375dff187 test %dx,%dx
0x3375d26bc4 (steps: 60000)
0x3375d26bc4 mov %eax,0x40(%rsi,%rdx,8)
0x3375d26bc8 jmpq 0x3375d26b43
0x3375d26bcd data16
0x3375d26bce data16
0x3375d26bcf nop
0x3375d25e8e (steps: 70000)
0x3375d25e8e mov 0xffffffffffffffc8(%rbp),%rdi
0x3375d25e92 mov %r12d,%edx
0x3375d25e95 lea (%rax,%r13,8),%rcx
0x3375d25e99 callq 0x3375d26430
0x3375d25e9e test %rax,%rax
0x3375d264a1 (steps: 80000)
0x3375d264a1 test %eax,%eax
0x3375d264a3 je 0x3375d26586
0x3375d264a9 test %r13,%r13
0x3375d264ac jne 0x3375d265b1
0x3375d264b2 mov %r12,%rsi
Total steps: 84582
[-- Attachment #2: fstep.java --]
[-- Type: text/x-java, Size: 3927 bytes --]
// This file is part of the program FRYSK.
//
// Copyright 2006, Red Hat Inc.
//
// FRYSK is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// FRYSK is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FRYSK; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// In addition, as a special exception, Red Hat, Inc. gives You the
// additional right to link the code of FRYSK with code not covered
// under the GNU General Public License ("Non-GPL Code") and to
// distribute linked combinations including the two, subject to the
// limitations in this paragraph. Non-GPL Code permitted under this
// exception must only link to the code of FRYSK through those well
// defined interfaces identified in the file named EXCEPTION found in
// the source code files (the "Approved Interfaces"). The files of
// Non-GPL Code may instantiate templates or use macros or inline
// functions from the Approved Interfaces without causing the
// resulting work to be covered by the GNU General Public
// License. Only Red Hat, Inc. may make changes or additions to the
// list of Approved Interfaces. You must obey the GNU General Public
// License in all respects for all of the FRYSK code and other code
// used in conjunction with FRYSK except the Non-GPL Code covered by
// this exception. If you modify this file, you may extend this
// exception to your version of the file, but you are not obligated to
// do so. If you do not wish to provide this exception without
// modification, you must delete this exception statement from your
// version and license this file solely under the GPL without
// exception.
import frysk.proc.*;
import lib.opcodes.*;
import java.util.*;
public class fstep
implements TaskObserver.Attached,
TaskObserver.Instruction,
TaskObserver.Terminated
{
Disassembler disassembler;
long steps;
public static void main(String[] command)
{
fstep step = new fstep();
Manager.host.requestCreateAttachedProc(command, step);
Manager.eventLoop.start();
}
// TaskObserver.Attached interface
public Action updateAttached(Task task)
{
disassembler = new Disassembler(task.getMemory());
task.requestAddTerminatedObserver(this);
task.requestAddInstructionObserver(this);
return Action.CONTINUE;
}
// TaskObserver.Terminated interface
public Action updateTerminated(Task task, boolean signal, int exit)
{
System.err.println("Total steps: " + steps);
Manager.eventLoop.requestStop();
return Action.CONTINUE;
}
// TaskObserver.Instruction interface
public Action updateExecuted(Task task)
{
steps++;
try
{
if (steps % 10000 == 0)
{
long pc = task.getIsa().pc(task);
System.out.println("0x" + Long.toHexString(pc)
+ " (steps: " + steps + ")");
Iterator it;
it = disassembler.disassembleInstructions(pc, 5).iterator();
while (it.hasNext())
System.out.println("\t" + it.next());
}
}
catch(TaskException te)
{
// Task disappeared?
te.printStackTrace();
System.exit(-1);
}
catch(OpcodesException oe)
{
// Bad location?
oe.printStackTrace();
System.exit(-1);
}
return Action.CONTINUE;
}
// Common interface methods
public void addedTo (Object observable)
{
// Unused
}
public void addFailed (Object observable, Throwable w)
{
w.printStackTrace();
System.exit(-1);
}
public void deletedFrom (Object observable)
{
// Unused
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-12 23:12 ` step-by-step Mark Wielaard
@ 2006-10-13 14:17 ` Andrew Cagney
2006-10-18 1:01 ` step-by-step Yong Zheng
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2006-10-13 14:17 UTC (permalink / raw)
To: Mark Wielaard; +Cc: frysk
Mark Wielaard wrote:
> Hi,
>
> On Fri, 2006-10-13 at 00:12 +0200, Mark Wielaard wrote:
>
>> This adds a first pass at the stepping Instruction observer. There
>> aren't any new testcases yet (but a little demo program will follow
>> right after this email).
>>
>
> Here is a little toy fstep that uses it.
>
Mark,
fstep is more than a toy. Having been reduced to using an instruction
tracing simulator to track down an SMP races, this forms the foundation
of an extremely wicked tool!
I created http://sourceware.org/bugzilla/show_bug.cgi?id=3364
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-13 14:17 ` step-by-step Andrew Cagney
@ 2006-10-18 1:01 ` Yong Zheng
2006-10-18 1:28 ` step-by-step Roland McGrath
2006-10-18 14:26 ` step-by-step Andrew Cagney
0 siblings, 2 replies; 7+ messages in thread
From: Yong Zheng @ 2006-10-18 1:01 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Mark Wielaard, frysk
On Fri, 2006-10-13 at 10:18 -0400, Andrew Cagney wrote:
>
> fstep is more than a toy. Having been reduced to using an instruction
> tracing simulator to track down an SMP races, this forms the foundation
> of an extremely wicked tool!
>
Unfortunately, fstep doesnot work well for both 64-bit and 32-bit
applications on our PPC64 box(with 4 processors). When we use fstep to
step one applications, the application will run into never-ending loop
like the following:
0xfe78cb8 (steps: 60000)
0xfe78cb8 lwarx r9,0,r31
0xfe78cbc cmpw r9,r11
0xfe78cc0 bne- 0xfe78ccc
0xfe78cc4 stwcx. r0,0,r31
0xfe78cc8 bne- 0xfe78cb8
0xfe78cb8 (steps: 70000)
0xfe78cb8 lwarx r9,0,r31
0xfe78cbc cmpw r9,r11
0xfe78cc0 bne- 0xfe78ccc
0xfe78cc4 stwcx. r0,0,r31
0xfe78cc8 bne- 0xfe78cb8
0xfe78cb8 (steps: 80000)
0xfe78cb8 lwarx r9,0,r31
0xfe78cbc cmpw r9,r11
0xfe78cc0 bne- 0xfe78ccc
0xfe78cc4 stwcx. r0,0,r31
0xfe78cc8 bne- 0xfe78cb8
The instruction at 0xfe78cb8 is located in libc-2.4.so. The process of
fstep may break down the lwarx/stwcx operations on PPC64.
> I created http://sourceware.org/bugzilla/show_bug.cgi?id=3364
Fstep works well on our X86/X86_64 box(of course only with one
processor). So I add our mail addresses in CC list.
Best regards
Yong Zheng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-18 1:01 ` step-by-step Yong Zheng
@ 2006-10-18 1:28 ` Roland McGrath
2006-10-18 14:26 ` step-by-step Andrew Cagney
1 sibling, 0 replies; 7+ messages in thread
From: Roland McGrath @ 2006-10-18 1:28 UTC (permalink / raw)
To: Yong Zheng; +Cc: Andrew Cagney, Mark Wielaard, frysk
I don't think you can ever expect to step through locking sequences on some
machines, ppc included. There are magic pairs of instructions.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-18 1:01 ` step-by-step Yong Zheng
2006-10-18 1:28 ` step-by-step Roland McGrath
@ 2006-10-18 14:26 ` Andrew Cagney
2006-10-19 0:51 ` step-by-step Yong Zheng
1 sibling, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2006-10-18 14:26 UTC (permalink / raw)
To: Yong Zheng; +Cc: Mark Wielaard, frysk
Yong,
I've been waiting for you to notice this ;-) As Roland points out this
is the PPC sequence:
load word and reserve
modify
store word conditional on still being reserved
that is used to implement locking. It isn't possible to single step
this sequence since the step-instruction trap will clear the reservation
resulting in the store-word-conditional always failing.
Something more complicated is needed - a step object implemented using
frysk.proc's instruction-step and breakpoint primitives, switching
between each as needed. This more complicated object could also be
expanded to implement operations such as step-until-branch-or-out-of-range.
Andrew
Yong Zheng wrote:
> On Fri, 2006-10-13 at 10:18 -0400, Andrew Cagney wrote:
>
>> fstep is more than a toy. Having been reduced to using an instruction
>> tracing simulator to track down an SMP races, this forms the foundation
>> of an extremely wicked tool!
>>
>>
>
> Unfortunately, fstep doesnot work well for both 64-bit and 32-bit
> applications on our PPC64 box(with 4 processors). When we use fstep to
> step one applications, the application will run into never-ending loop
> like the following:
>
> 0xfe78cb8 (steps: 60000)
> 0xfe78cb8 lwarx r9,0,r31
> 0xfe78cbc cmpw r9,r11
> 0xfe78cc0 bne- 0xfe78ccc
> 0xfe78cc4 stwcx. r0,0,r31
> 0xfe78cc8 bne- 0xfe78cb8
> 0xfe78cb8 (steps: 70000)
> 0xfe78cb8 lwarx r9,0,r31
> 0xfe78cbc cmpw r9,r11
> 0xfe78cc0 bne- 0xfe78ccc
> 0xfe78cc4 stwcx. r0,0,r31
> 0xfe78cc8 bne- 0xfe78cb8
> 0xfe78cb8 (steps: 80000)
> 0xfe78cb8 lwarx r9,0,r31
> 0xfe78cbc cmpw r9,r11
> 0xfe78cc0 bne- 0xfe78ccc
> 0xfe78cc4 stwcx. r0,0,r31
> 0xfe78cc8 bne- 0xfe78cb8
>
> The instruction at 0xfe78cb8 is located in libc-2.4.so. The process of
> fstep may break down the lwarx/stwcx operations on PPC64.
>
>
>> I created http://sourceware.org/bugzilla/show_bug.cgi?id=3364
>>
> Fstep works well on our X86/X86_64 box(of course only with one
> processor). So I add our mail addresses in CC list.
>
> Best regards
> Yong Zheng
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: step-by-step
2006-10-18 14:26 ` step-by-step Andrew Cagney
@ 2006-10-19 0:51 ` Yong Zheng
0 siblings, 0 replies; 7+ messages in thread
From: Yong Zheng @ 2006-10-19 0:51 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Mark Wielaard, frysk
On Wed, 2006-10-18 at 10:26 -0400, Andrew Cagney wrote:
> Yong,
>
> I've been waiting for you to notice this ;-)
I noticed that but forget to send email to maillist as soon as
possible! :-)
> As Roland points out this
> is the PPC sequence:
>
> load word and reserve
> modify
> store word conditional on still being reserved
>
> that is used to implement locking. It isn't possible to single step
> this sequence since the step-instruction trap will clear the reservation
> resulting in the store-word-conditional always failing.
>
> Something more complicated is needed - a step object implemented using
> frysk.proc's instruction-step and breakpoint primitives, switching
> between each as needed. This more complicated object could also be
> expanded to implement operations such as step-until-branch-or-out-of-range.
>
Yes, we could implement fstep by using instruction-observer and
breakpoint observer together!(Yesterday, Wu also proposed this.) we will
do this soon.
Best regards
Yong Zheng
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-10-19 0:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-12 22:12 step-by-step Mark Wielaard
2006-10-12 23:12 ` step-by-step Mark Wielaard
2006-10-13 14:17 ` step-by-step Andrew Cagney
2006-10-18 1:01 ` step-by-step Yong Zheng
2006-10-18 1:28 ` step-by-step Roland McGrath
2006-10-18 14:26 ` step-by-step Andrew Cagney
2006-10-19 0:51 ` step-by-step Yong Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).