未验证 提交 fc2b6725 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #2831 from dbeaver/2556-debug-view

2556 debug view
......@@ -135,25 +135,26 @@ public abstract class DBGBaseController implements DBGController {
@Override
public List<? extends DBGStackFrame> getStack(Object id) throws DBGException {
DBGSession session = findSession(id);
if (session == null) {
String message = NLS.bind("Session for {0} is not available", id);
throw new DBGException(message);
}
DBGSession session = findAccessibleSession(id);
return session.getStack();
}
@Override
public List<? extends DBGVariable<?>> getVariables(Object id) throws DBGException {
DBGSession session = findAccessibleSession(id);
return session.getVariables();
}
public abstract DBGSession createSession(DBGSessionInfo targetInfo, DBCExecutionContext connection) throws DBGException;
public DBGSession findSession(Object id) throws DBGException {
return sessions.get(id);
}
@Override
public boolean isSessionExists(Object id) {
return sessions.containsKey(id);
}
@Override
public List<DBGSession> getSessions() throws DBGException {
return new ArrayList<DBGSession>(sessions.values());
}
......@@ -176,21 +177,13 @@ public abstract class DBGBaseController implements DBGController {
@Override
public void stepInto(Object sessionKey) throws DBGException {
DBGSession session = findSession(sessionKey);
if (session == null) {
String message = NLS.bind("Session for {0} is not available", sessionKey);
throw new DBGException(message);
}
DBGSession session = findAccessibleSession(sessionKey);
session.execStepInto();
}
@Override
public void stepOver(Object sessionKey) throws DBGException {
DBGSession session = findSession(sessionKey);
if (session == null) {
String message = NLS.bind("Session for {0} is not available", sessionKey);
throw new DBGException(message);
}
DBGSession session = findAccessibleSession(sessionKey);
session.execStepOver();
}
......@@ -198,7 +191,17 @@ public abstract class DBGBaseController implements DBGController {
public void stepReturn(Object sessionKey) throws DBGException {
//throw DBGException?
}
protected DBGSession findAccessibleSession(Object sessionKey) throws DBGException {
DBGSession session = findSession(sessionKey);
if (session == null) {
String message = NLS.bind("Session for {0} is not available", sessionKey);
throw new DBGException(message);
}
//FIXME:AF: check for accessible state here
return session;
}
@Override
public void registerEventHandler(DBGEventHandler eventHandler) {
eventHandlers.add(eventHandler);
......
......@@ -39,7 +39,7 @@ public abstract class DBGBaseSession implements DBGSession {
private final DBGBaseController controller;
private FutureTask<DBGEvent> task;
private FutureTask<Void> task;
private Thread workerThread = null;
......@@ -47,7 +47,7 @@ public abstract class DBGBaseSession implements DBGSession {
private final List<DBGBreakpointDescriptor> breakpoints = new ArrayList<>(1);
public DBGBaseSession(DBGBaseController controller) {
protected DBGBaseSession(DBGBaseController controller) {
this.controller = controller;
}
......@@ -71,7 +71,7 @@ public abstract class DBGBaseSession implements DBGSession {
this.connection = connection;
}
public DBGBaseController getController() {
protected DBGBaseController getController() {
return controller;
}
......@@ -105,8 +105,7 @@ public abstract class DBGBaseSession implements DBGSession {
}
if (task.isDone()) {
try {
DBGEvent dbgEvent = task.get();
getController().fireEvent(dbgEvent);
task.get();
} catch (InterruptedException e) {
log.error("DEBUG INTERRUPT ERROR ", e);
return false;
......@@ -126,18 +125,18 @@ public abstract class DBGBaseSession implements DBGSession {
* @param name
* @throws DBGException
*/
protected void runAsync(String commandSQL, String name, DBGEvent event) throws DBGException {
protected void runAsync(String commandSQL, String name, DBGEvent begin, DBGEvent end) throws DBGException {
Connection connection = getConnection();
try (Statement stmt = connection.createStatement()) {
connection.setAutoCommit(false);
DBGWorker worker = new DBGWorker(connection, commandSQL, event);
task = new FutureTask<DBGEvent>(worker);
workerThread = new Thread(task);
workerThread.setName(name);
workerThread.start();
} catch (SQLException e) {
throw new DBGException("SQL error", e);
}
DBGWorker worker = new DBGWorker(this, commandSQL, begin, end);
task = new FutureTask<Void>(worker);
workerThread = new Thread(task);
workerThread.setName(name);
workerThread.start();
}
public void close() {
......@@ -235,7 +234,7 @@ public abstract class DBGBaseSession implements DBGSession {
}
}
/**
* Try to acquire exclusive lock
*
......@@ -261,4 +260,8 @@ public abstract class DBGBaseSession implements DBGSession {
}
}
protected void fireEvent(DBGEvent event) {
controller.fireEvent(event);
}
}
......@@ -71,12 +71,8 @@ public interface DBGController {
DBGSessionInfo getSessionDescriptor(DBCExecutionContext connection) throws DBGException;
List<? extends DBGSessionInfo> getSessionDescriptors() throws DBGException;
DBGSession findSession(Object id) throws DBGException;
List<DBGSession> getSessions() throws DBGException;
DBGSession createSession(DBGSessionInfo targetInfo, DBCExecutionContext connection) throws DBGException;
boolean isSessionExists(Object id);
List<? extends DBGStackFrame> getStack(Object id) throws DBGException;
List<? extends DBGVariable<?>> getVariables(Object id) throws DBGException;
List<? extends DBGObjectDescriptor> getObjects(String ownerCtx, String nameCtx) throws DBGException;
/*
......
......@@ -24,16 +24,25 @@ public class DBGEvent extends EventObject {
private static final long serialVersionUID = 1L;
public static final int ATTACH = 0x0001;
public static final int SUSPEND = 0x0002;
public static final int RESUME = 0x0004;
public static final int DETACH = 0x0008;
/*
* The event kind constants
*/
public static final int RESUME= 0x0001;
public static final int SUSPEND= 0x0002;
public static final int CREATE= 0x0004;
public static final int TERMINATE= 0x0008;
public static final int CHANGE= 0x0010;
public static final int MODEL_SPECIFIC= 0x0020;
/*
* The event detail constants
*/
public static final int UNSPECIFIED = 0;
public static final int STEP_INTO = 0x0001;
public static final int STEP_OVER = 0x0002;
public static final int STEP_RETURN = 0x0004;
public static final int STEP_END = 0x0008;
public static final int BREAKPOINT= 0x0010;
private int kind;
......
......@@ -19,31 +19,34 @@
package org.jkiss.dbeaver.debug;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.concurrent.Callable;
public class DBGWorker implements Callable<DBGEvent> {
public class DBGWorker implements Callable<Void> {
private final Connection conn;
private final DBGBaseSession session;
private final String sql;
private final DBGEvent event;
private final DBGEvent before;
private final DBGEvent after;
public DBGWorker(Connection conn, String sqlCommand, DBGEvent event)
public DBGWorker(DBGBaseSession session, String sqlCommand, DBGEvent begin, DBGEvent end)
{
this.conn = conn;
this.session = session;
this.sql = sqlCommand;
this.event = event;
this.before = begin;
this.after = end;
}
@Override
public DBGEvent call() throws Exception
public Void call() throws Exception
{
try (Statement stmt = conn.createStatement()) {
try (Statement stmt = session.getConnection().createStatement()) {
session.fireEvent(before);
stmt.executeQuery(sql);
return event;
session.fireEvent(after);
return null;
} catch (SQLException e) {
String message = String.format("Failed to execute %s", sql);
throw new Exception(message, e);
......
......@@ -26,8 +26,8 @@ public class DatabaseDebugElement extends DebugElement {
super(target);
}
public IDatabaseDebugTarget getDatabaseDebugTarget() {
return (IDatabaseDebugTarget) getDebugTarget();
public DatabaseDebugTarget getDatabaseDebugTarget() {
return (DatabaseDebugTarget) getDebugTarget();
}
public DBGController getController() {
......
......@@ -38,8 +38,9 @@ import org.jkiss.dbeaver.debug.DBGController;
import org.jkiss.dbeaver.debug.DBGEvent;
import org.jkiss.dbeaver.debug.DBGEventHandler;
import org.jkiss.dbeaver.debug.DBGException;
import org.jkiss.dbeaver.debug.DBGStackFrame;
import org.jkiss.dbeaver.debug.DBGVariable;
import org.jkiss.dbeaver.debug.core.DebugCore;
import org.jkiss.dbeaver.debug.core.DebugEvents;
import org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
......@@ -287,11 +288,6 @@ public abstract class DatabaseDebugTarget extends DatabaseDebugElement implement
return false;
}
@Override
public DebugEvent toDebugEvent(DBGEvent event) {
return new DebugEvent(event.getSource(), event.getKind(), event.getDetails());
}
@Override
public boolean supportsStorageRetrieval() {
return false;
......@@ -304,9 +300,67 @@ public abstract class DatabaseDebugTarget extends DatabaseDebugElement implement
@Override
public void handleDebugEvent(DBGEvent event) {
DebugEvent debugEvent = toDebugEvent(event);
DebugEvents.fireEvent(debugEvent);
// DebugEvents.fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, DebugEvent.BREAKPOINT));
int kind = event.getKind();
if (DBGEvent.SUSPEND == kind) {
suspended(event.getDetails());
}
}
public boolean canStepInto() {
return controller.canStepInto(sessionKey);
}
public boolean canStepOver() {
return controller.canStepOver(sessionKey);
}
public boolean canStepReturn() {
return controller.canStepReturn(sessionKey);
}
public void stepInto() throws DebugException {
DBGController controller = getController();
try {
controller.stepInto(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step into failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
}
public void stepOver() throws DebugException {
DBGController controller = getController();
try {
controller.stepOver(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step over failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
}
public void stepReturn() throws DebugException {
DBGController controller = getController();
try {
controller.stepReturn(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step return failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
}
protected List<? extends DBGStackFrame> requestStackFrames() throws DBGException {
DBGController controller = getController();
List<? extends DBGStackFrame> stack = controller.getStack(sessionKey);
return stack;
}
protected List<? extends DBGVariable<?>> requestVariables() throws DBGException {
DBGController controller = getController();
List<? extends DBGVariable<?>> variables = controller.getVariables(sessionKey);
return variables;
}
}
......@@ -10,7 +10,6 @@ import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.osgi.util.NLS;
import org.jkiss.dbeaver.debug.DBGException;
import org.jkiss.dbeaver.debug.DBGSession;
import org.jkiss.dbeaver.debug.DBGStackFrame;
import org.jkiss.dbeaver.debug.DBGVariable;
......@@ -18,90 +17,93 @@ public class DatabaseStackFrame extends DatabaseDebugElement implements IStackFr
private static final IRegisterGroup[] NO_REGISTER_GROUPS = new IRegisterGroup[0];
private static final IVariable[] NO_VARIABLES = new IVariable[0];
private final DBGStackFrame dbgStackFrame;
private final List<DatabaseVariable> variables = new ArrayList<DatabaseVariable>();
private final DatabaseThread thread;
private final Object sessionKey;
private final DBGStackFrame dbgStackFrame;
public DatabaseStackFrame(DatabaseThread thread, DBGStackFrame dbgStackFrame, Object sessionKey) {
private boolean refreshVariables = true;
public DatabaseStackFrame(DatabaseThread thread, DBGStackFrame dbgStackFrame) {
super(thread.getDatabaseDebugTarget());
this.thread = thread;
this.dbgStackFrame = dbgStackFrame;
this.sessionKey = sessionKey;
}
@Override
public boolean canStepInto() {
return thread.canStepInto();
return getThread().canStepInto();
}
@Override
public boolean canStepOver() {
return thread.canStepOver();
return getThread().canStepOver();
}
@Override
public boolean canStepReturn() {
return thread.canStepReturn();
return getThread().canStepReturn();
}
@Override
public boolean isStepping() {
return thread.isStepping();
return getThread().isStepping();
}
@Override
public void stepInto() throws DebugException {
thread.stepInto();
getThread().stepInto();
}
@Override
public void stepOver() throws DebugException {
thread.stepOver();
getThread().stepOver();
}
@Override
public void stepReturn() throws DebugException {
thread.canStepReturn();
getThread().canStepReturn();
}
@Override
public boolean canResume() {
return thread.canResume();
return getThread().canResume();
}
@Override
public boolean canSuspend() {
return thread.canSuspend();
return getThread().canSuspend();
}
@Override
public boolean isSuspended() {
return thread.isSuspended();
return getThread().isSuspended();
}
@Override
public void resume() throws DebugException {
thread.resume();
getThread().resume();
}
@Override
public void suspend() throws DebugException {
thread.suspend();
getThread().suspend();
}
@Override
public boolean canTerminate() {
return thread.canTerminate();
return getThread().canTerminate();
}
@Override
public boolean isTerminated() {
return thread.isTerminated();
return getThread().isTerminated();
}
@Override
public void terminate() throws DebugException {
thread.terminate();
getThread().terminate();
}
@Override
......@@ -111,28 +113,40 @@ public class DatabaseStackFrame extends DatabaseDebugElement implements IStackFr
@Override
public IVariable[] getVariables() throws DebugException {
try {
DBGSession debugSession = getController().findSession(sessionKey);
List<? extends DBGVariable<?>> dbgVariables = debugSession.getVariables();
if (dbgVariables.size() == 0) {
return NO_VARIABLES;
if (refreshVariables) {
try {
List<? extends DBGVariable<?>> variables = getDatabaseDebugTarget().requestVariables();
rebuildVariables(variables);
} catch (DBGException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<DatabaseVariable> variables = new ArrayList<DatabaseVariable>();
}
if (variables.isEmpty()) {
return NO_VARIABLES;
}
return (IVariable[]) variables.toArray(new IVariable[variables.size()]);
}
protected void invalidateVariables() {
refreshVariables = true;
}
protected void rebuildVariables(List<? extends DBGVariable<?>> dbgVariables) {
try {
variables.clear();
for (DBGVariable<?> dbgVariable : dbgVariables) {
DatabaseVariable e = new DatabaseVariable(getDatabaseDebugTarget(), dbgVariable);
variables.add(e);
DatabaseVariable variable = new DatabaseVariable(getDatabaseDebugTarget(), dbgVariable);
variables.add(variable);
}
return (DatabaseVariable[]) variables.toArray(new DatabaseVariable[variables.size()]);
} catch (DBGException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
refreshVariables = false;
}
return NO_VARIABLES;
}
@Override
public boolean hasVariables() throws DebugException {
return true;
return isSuspended();
}
@Override
......
......@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IStackFrame;
......@@ -29,6 +30,7 @@ import org.eclipse.osgi.util.NLS;
import org.jkiss.dbeaver.debug.DBGController;
import org.jkiss.dbeaver.debug.DBGException;
import org.jkiss.dbeaver.debug.DBGStackFrame;
import org.jkiss.dbeaver.debug.DBGVariable;
import org.jkiss.dbeaver.debug.core.DebugCore;
/**
......@@ -39,7 +41,11 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
private final Object sessionKey;
public DatabaseThread(IDatabaseDebugTarget target, Object sessionKey) {
private boolean stepping = false;
private List<DatabaseStackFrame> frames = new ArrayList<>(1);
public DatabaseThread(DatabaseDebugTarget target, Object sessionKey) {
super(target);
this.sessionKey = sessionKey;
}
......@@ -61,14 +67,13 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
@Override
public void resume() throws DebugException {
// TODO Auto-generated method stub
aboutToResume(DebugEvent.CLIENT_REQUEST, false);
getDebugTarget().resume();
}
@Override
public void suspend() throws DebugException {
// TODO Auto-generated method stub
getDebugTarget().suspend();
}
@Override
......@@ -91,44 +96,32 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
@Override
public boolean isStepping() {
// TODO Auto-generated method stub
return false;
return stepping;
}
@Override
public void stepInto() throws DebugException {
DBGController controller = getController();
try {
controller.stepInto(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step into failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
aboutToResume(DebugEvent.STEP_INTO, true);
getDatabaseDebugTarget().stepInto();
}
@Override
public void stepOver() throws DebugException {
DBGController controller = getController();
try {
controller.stepOver(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step over failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
aboutToResume(DebugEvent.STEP_OVER, true);
getDatabaseDebugTarget().stepOver();
}
@Override
public void stepReturn() throws DebugException {
DBGController controller = getController();
try {
controller.stepReturn(sessionKey);
} catch (DBGException e) {
String message = NLS.bind("Step return failed for session {0}", sessionKey);
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
aboutToResume(DebugEvent.STEP_RETURN, true);
getDatabaseDebugTarget().stepReturn();
}
private void aboutToResume(int detail, boolean stepping) {
frames.clear();
setStepping(stepping);
// setBreakpoints(null);
fireResumeEvent(detail);
}
@Override
......@@ -143,24 +136,30 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
@Override
public void terminate() throws DebugException {
frames.clear();
getDebugTarget().terminate();
}
@Override
public IStackFrame[] getStackFrames() throws DebugException {
List<DatabaseStackFrame> frames = new ArrayList<DatabaseStackFrame>();
DBGController controller = getController();
try {
List<? extends DBGStackFrame> stack = controller.getStack(sessionKey);
for (DBGStackFrame dbgStackFrame : stack) {
DatabaseStackFrame frame = new DatabaseStackFrame(this, dbgStackFrame, sessionKey);
frames.add(frame);
if (isSuspended()) {
if (frames.size() == 0) {
extractStackFrames();
}
}
return frames.toArray(new IStackFrame[frames.size()]);
}
protected void extractStackFrames() throws DebugException {
List<? extends DBGStackFrame> stackFrames;
try {
stackFrames = getDatabaseDebugTarget().requestStackFrames();
rebuildStack(stackFrames);
} catch (DBGException e) {
// TODO Auto-generated catch block
e.printStackTrace();
String message = NLS.bind("Error reading stack for {0}", getName());
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
return (IStackFrame[]) frames.toArray(new IStackFrame[frames.size()]);
}
@Override
......@@ -168,6 +167,17 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
return true;
}
public void rebuildStack(List<? extends DBGStackFrame> stackFrames) {
for (DBGStackFrame dbgStackFrame : stackFrames) {
addFrame(dbgStackFrame, sessionKey);
}
}
private void addFrame(DBGStackFrame stackFrameId , Object sessionKey) {
DatabaseStackFrame frame = new DatabaseStackFrame(this, stackFrameId);
frames.add(frame);
}
@Override
public int getPriority() throws DebugException {
// no idea for now
......@@ -176,7 +186,14 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
@Override
public IStackFrame getTopStackFrame() throws DebugException {
// TODO Auto-generated method stub
if (isSuspended()) {
if (frames.size() == 0) {
extractStackFrames();
}
if (frames.size() > 0) {
return frames.get(0);
}
}
return null;
}
......@@ -187,13 +204,23 @@ public abstract class DatabaseThread extends DatabaseDebugElement implements ITh
}
public void resumedByTarget() {
// TODO Auto-generated method stub
aboutToResume(DebugEvent.CLIENT_REQUEST, false);
}
public void setStepping(boolean b) {
// TODO Auto-generated method stub
public void setStepping(boolean stepping) {
this.stepping = stepping;
}
protected List<? extends DBGVariable<?>> requestVariables() throws DebugException {
List<DBGVariable<?>> variables = new ArrayList<DBGVariable<?>>();
try {
variables.addAll(getDatabaseDebugTarget().requestVariables());
} catch (DBGException e) {
String message = NLS.bind("Error reading variables for {0}", getName());
IStatus status = DebugCore.newErrorStatus(message, e);
throw new DebugException(status);
}
return variables;
}
}
......@@ -19,17 +19,13 @@ package org.jkiss.dbeaver.debug.core.model;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.IBreakpointManagerListener;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.IDebugTarget;
import org.jkiss.dbeaver.debug.DBGController;
import org.jkiss.dbeaver.debug.DBGEvent;
public interface IDatabaseDebugTarget extends IDebugTarget, IDebugEventSetListener, IBreakpointManagerListener {
DebugEvent toDebugEvent(DBGEvent event);
DBGController getController();
void connect(IProgressMonitor monitor) throws CoreException;
......
......@@ -22,7 +22,7 @@ import org.jkiss.dbeaver.debug.internal.core.DebugCoreMessages;
public class ProcedureThread extends DatabaseThread {
public ProcedureThread(IDatabaseDebugTarget target, Object sessionKey) {
public ProcedureThread(DatabaseDebugTarget target, Object sessionKey) {
super(target, sessionKey);
}
......
......@@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.util.List;
import java.util.Scanner;
import org.jkiss.dbeaver.debug.DBGBaseController;
import org.jkiss.dbeaver.debug.DBGBreakpointDescriptor;
import org.jkiss.dbeaver.debug.DBGController;
import org.jkiss.dbeaver.debug.DBGException;
......@@ -210,7 +211,7 @@ public class Debugger {
}
public static DBGSession chooseSession(Scanner sc, DBGController controller)
public static DBGSession chooseSession(Scanner sc, DBGBaseController controller)
throws DBGException {
DBGSession debugSession = null;
......@@ -288,7 +289,7 @@ public class Debugger {
DBPDataSourceContainer dataSource = null;
Connection conn;
DBGController controller;
DBGBaseController controller;
try {
conn = DriverManager.getConnection(url);
......
......@@ -89,7 +89,7 @@ public class PostgreDebugSession extends DBGBaseSession {
* @param sessionDebugInfo - session (debugger client connection) description
* @throws DBGException
*/
public PostgreDebugSession(DBGBaseController controller, PostgreDebugSessionInfo sessionInfo, Object targetId) throws DBGException {
PostgreDebugSession(DBGBaseController controller, PostgreDebugSessionInfo sessionInfo, Object targetId) throws DBGException {
super(controller);
this.sessionInfo = sessionInfo;
this.targetId = targetId;
......@@ -133,7 +133,10 @@ public class PostgreDebugSession extends DBGBaseSession {
String sessionParam = String.valueOf(getSessionId());
String taskName = sessionParam + " global attached to " + String.valueOf(targetId);
runAsync(SQL_ATTACH.replaceAll("\\?sessionid", sessionParam), taskName, new DBGEvent(this, DBGEvent.ATTACH));
String sql = SQL_ATTACH.replaceAll("\\?sessionid", sessionParam);
DBGEvent begin = new DBGEvent(this, DBGEvent.RESUME, DBGEvent.MODEL_SPECIFIC);
DBGEvent end = new DBGEvent(this, DBGEvent.SUSPEND, DBGEvent.BREAKPOINT);
runAsync(sql, taskName, begin, end);
/*if (breakpoint) {
runAsync(SQL_ATTACH_BREAKPOINT.replaceAll("\\?sessionid", String.valueOf(sessionId)),
......@@ -198,20 +201,20 @@ public class PostgreDebugSession extends DBGBaseSession {
* Execute step SQL command asynchronously, set debug session name to
* [sessionID] name [managerPID]
*
* @param commandSQL - SQL command for execute step
* @param name - session 'name' part
* @param commandPattern - SQL command for execute step
* @param nameParameter - session 'name' part
* @throws DBGException
*/
public void execStep(String commandSQL, String name, int eventDetail) throws DBGException {
public void execStep(String commandPattern, String nameParameter, int eventDetail) throws DBGException {
acquireWriteLock();
try {
DBGEvent event = new DBGEvent(this, DBGEvent.RESUME, eventDetail);
runAsync(commandSQL.replaceAll("\\?sessionid", String.valueOf(sessionId)),
String.valueOf(sessionId) + name + String.valueOf(targetId), event);
String sql = commandPattern.replaceAll("\\?sessionid", String.valueOf(sessionId));
String taskName = String.valueOf(sessionId) + nameParameter + String.valueOf(targetId);
DBGEvent begin = new DBGEvent(this, DBGEvent.RESUME, eventDetail);
DBGEvent end = new DBGEvent(this, DBGEvent.SUSPEND, eventDetail);
runAsync(sql, taskName, begin, end);
} finally {
lock.writeLock().unlock();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册