Bug 3540

Summary: Determine why getIsa is called so often
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Nurdin Premji <npremji>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on: 3628    
Bug Blocks: 1593    

Description Andrew Cagney 2006-11-17 21:30:54 UTC
Proc.getIsa should be evaluated lazy style.

Clearly it isn't or something is pulling that value when it isn't needed.
Comment 1 Andrew Cagney 2006-11-24 16:11:44 UTC
Any updates or results?

Suggest creating a test case that demonstrates the getIsa criteria:

- when a process is detached the isa is invalid
- when a process is attached the isa is valid

by transitioning a process through attached and detached events checking that it
gets its state changed
Comment 2 Nurdin Premji 2006-11-24 19:49:36 UTC
Added TestCase to check memory is null when not attached and not null when attached.

November 24, 2006
frysk-core/frysk/proc/CL
        * TestMemory.java: Added.	
	* TaskState.java (Attached.transitionToRunningState): Changed to notify static
Task observable.
	(detaching.handleStoppedEvent): Ditto.
	* Task.java (ObservableXXX): Made static.
	(taskStateAttached.update): Ditto.
	(taskStateDetached.update): Ditto.
	(Task): Removed add observer from here and made static so any task that
attaches gets data filled.
Comment 3 Nurdin Premji 2006-11-24 20:25:13 UTC
More test cases that should be looked at:

Test that isa is a singleton. (Unless switching between 32 and 64 bit execs)
Test switching between 32 and 64 bit execs.
Test Attach, Detach, Attach agan, (Detach again), etc.
Test Attach, create attached child process.
Comment 4 Nurdin Premji 2006-12-04 16:02:39 UTC
(In reply to comment #3)
> More test cases that should be looked at:
> 
> Test that isa is a singleton. (Unless switching between 32 and 64 bit execs)
Done: TestIsa.testIsaSingleton

> Test switching between 32 and 64 bit execs.
TestIsa.test64To32Isa() and test64To32To64().

> Test Attach, Detach, Attach agan, (Detach again), etc.
TestIsa.testAttachDetachAttachAgainDetachAgainAtachAgainAgain().

> Test Attach, create attached child process.
TestIsa.testAttachedCreateAttachedChild(), testAttachedCreateAttachedClone() and
testAttachedCreateChild().
Comment 5 Nurdin Premji 2006-12-12 16:08:09 UTC
Fixed
December 5, 2006
        frysk-core/frysk/proc/CL
        * LinuxTask.java (fillRegisterBank): Added.
        (fillMemory): Added.
        (LinuxTask): Removed calls to setupMapsXXX/fill memory and register banks.
        * DummyTask.java (fillRegisterBank): Added.
        (fillMemory): Added.
        * TestIsa.java (AttachedObserver.updateAttached): Added call to try to
detect isa. (For "on-demand" access of isa).
        (testAttachDetachAttachAgainDetachAgainAttachAgainAgain): Enabled.
        (testIsa): Enabled.
        * TaskState.java (detaching.handleStoppedEvent): notify Task that the
given task has detached.
        * Task.java (TaskStateObservable): Added.
        (TaskStateObservable.notify): Added.
        (taskStateDetached): Added.
        (getRegisterBank): Added. Fills register bank if null.
        (clearIsa): Added.
        (static.update): When a task detaches, clear it's Isa information.
        (getMemory): Fill memory if null.