Java 类org.eclipse.debug.core.model.IMemoryBlock 实例源码

项目:brainfuck    文件:InstructionPointerAnnotationHover.java   
@Override
public String getHoverText(Annotation annotation, ITextViewer textViewer, IRegion hoverRegion) {
    if (!BfDebugModelPresentation.INSTRUCTION_POINTER_ANNOTATION_TYPE.equals(annotation.getType())) {
        return null;
    }
    IAdaptable adaptable = DebugUITools.getDebugContext();
    if (adaptable instanceof BfStackFrame) {
        BfStackFrame stackFrame = (BfStackFrame) adaptable;
        try {
            int instructionPointer = stackFrame.getCharStart();
            String text = "Instruction Pointer: [<b>" + instructionPointer + "</b>]";
            int memoryPointer = stackFrame.getMemoryPointer();
            IMemoryBlock memoryBlock = stackFrame.getDebugTarget().getMemoryBlock(memoryPointer, 1);
            byte value = memoryBlock.getBytes()[0];
            text = text + "<br>Memory Value: [<b>0x" + Integer.toHexString(memoryPointer).toUpperCase() + "</b>]=<b>0x" + Integer.toHexString((value & 0xFF)) + "</b>";
            return text;
        } 
        catch (DebugException ex) {
            DbgActivator.getDefault().logError("Memory Block could not be evaluated", ex);
        }
    }
    return null;
}
项目:brainfuck    文件:BfDebugTarget.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length)
        throws DebugException {
    if (this.process.getProcessListener().getSuspendedState() != null) {
        return new BfMemoryBlock(this, this.process.getProcessListener().getSuspendedState(), startAddress, length);
    }
    else {
        return null;
    }
}
项目:jive    文件:OfflineDebugTarget.java   
@Override
public IMemoryBlock getMemoryBlock(final long startAddress, final long length)
    throws DebugException
{
  // synthetic targets do not support memory block retrieval
  return null;
}
项目:dsp4e    文件:DSPDebugTarget.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
    return null;
}
项目:google-cloud-eclipse    文件:LocalAppEngineServerLaunchConfigurationDelegate.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
  return null;
}
项目:statecharts    文件:SCTDebugTarget.java   
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
    return null;
}
项目:monto-eclipse    文件:MontoDebugTarget.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
  notSupported("MontoDebugTarget does not support memory block retrieval", null);
  return null;
}
项目:brainfuck    文件:BfUIListenerContributor.java   
@Override
public void memoryBlocksRemoved(IMemoryBlock[] memory) {
}
项目:brainfuck    文件:BfUIListenerContributor.java   
@Override
public void memoryBlocksAdded(final IMemoryBlock[] memory) {

    WorkbenchJob job = new WorkbenchJob("Update Memory View") {
        private static final long RESCHEDULE_TIME = 200;
        private static final int MAX_ATTEMPTS = 5;
        private volatile int attempts = 0;

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            if (page == null) {
                return Status.OK_STATUS;
            }
            try {
                IMemoryRenderingSite memoryView = null;
                for (IViewReference ref : page.getViewReferences()) {
                    if (ref.getId().equals(IDebugUIConstants.ID_MEMORY_VIEW)) {
                        memoryView = (IMemoryRenderingSite) ref.getView(true);
                        break;
                    }
                }
                if (memoryView == null) {
                    if (attempts < MAX_ATTEMPTS) { //Memory view may still not been opened, try 5 times
                        attempts++;
                        this.schedule(RESCHEDULE_TIME);
                    }
                    else {
                        attempts = 0;
                    }
                    return Status.OK_STATUS;
                }

                for (IMemoryBlock mb : memory) {
                    if (mb instanceof BfMemoryBlock && !((BfMemoryBlock) mb).isUserCreated()) {
                        IMemoryRenderingType renderingType = DebugUITools.getMemoryRenderingManager().getPrimaryRenderingType(mb);
                        IMemoryRendering rendering = renderingType.createRendering();
                        IMemoryRenderingContainer container = memoryView.getContainer(IDebugUIConstants.PLUGIN_ID + ".MemoryView.RenderingViewPane.1");
                        rendering.init(container, mb);
                        container.addMemoryRendering(rendering);
                    }
                }
            }
            catch (CoreException e) {
                DbgActivator.getDefault().logError("Updating Memory View failed", e);
            }
            this.attempts = 0;
            return Status.OK_STATUS;
        }
    };
    job.setUser(false);
    job.schedule();
}
项目:brainfuck    文件:BfThread.java   
@Override
    public void fireSuspendEvent(int detail) {
        this.stackFrame = new BfStackFrame(getDebugTarget(), this, "Brainfuck Stack Frame");
        if (detail == DebugEvent.STEP_END) {
            this.isStepping = false;
            this.fireChangeEvent(DebugEvent.CONTENT | DebugEvent.STATE);
        }
        else if (detail == DebugEvent.BREAKPOINT) {
            try {
            IBreakpointManager bpManager = DebugPlugin.getDefault().getBreakpointManager();
                int location = this.getDebugTarget().getProcess().getProcessListener().getInstructionPointer();
                List<IBreakpoint> breakpoints = new ArrayList<>();
                for (IBreakpoint bp : bpManager.getBreakpoints(getModelIdentifier())) {
                    if (bp instanceof  BfBreakpoint && ((BfBreakpoint) bp).getCharStart() == location) {
                        breakpoints.add(bp);
                    }
                }
                this.suspendedBreakpoints = breakpoints.toArray(new IBreakpoint[breakpoints.size()]);
//              this.fireChangeEvent(DebugEvent.CONTENT | DebugEvent.STATE);
            }
            catch (CoreException ex) {
                DbgActivator.getDefault().logError("Breakpoints cannot be found", ex);
            }
        }
        try {
            IMemoryBlockManager mbManager = DebugPlugin.getDefault().getMemoryBlockManager();
            List<IMemoryBlock> memoryBlocks = Arrays.asList(mbManager.getMemoryBlocks(getDebugTarget()));
            boolean found = false;
            int length = this.getDebugTarget().getProcess().getProcessListener().getSuspendedState().getDataSize();
            for (IMemoryBlock block : memoryBlocks) {
                if (block.getStartAddress() == 0 && block.getLength() == length) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                BfMemoryBlock mb = (BfMemoryBlock) this.getDebugTarget().getMemoryBlock(0, length);
                mb.setUserCreated(false);
                mb.fireCreationEvent();     
                mbManager.addMemoryBlocks(new IMemoryBlock[]{mb});
            }
        } 
        catch (DebugException e) {
            DbgActivator.getDefault().logError("Memory block could not be created", e);
        } 
        super.fireSuspendEvent(detail);
    }
项目:chromedevtools    文件:DebugTargetImpl.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
  return null;
}
项目:birt    文件:ScriptDebugTarget.java   
public IMemoryBlock getMemoryBlock( long startAddress, long length )
        throws DebugException
{
    return null;
}
项目:Pydev    文件:AbstractDebugTarget.java   
@Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
    return null;
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapter.java   
/**
 * {@inheritDoc} Unused method.
 *
 * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
 */
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
    return null;
}
项目:ModelDebugging    文件:DSLDebugTargetAdapter.java   
/**
 * {@inheritDoc} Unused method.
 *
 * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
 */
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
    return null;
}