Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d00b4a92
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d00b4a92
编写于
5月 02, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug sessions model refactoring.
上级
b5b5333c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
94 addition
and
261 deletion
+94
-261
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
...g.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
+5
-172
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
...debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
+3
-50
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGSession.java
...er.debug.core/src/org/jkiss/dbeaver/debug/DBGSession.java
+16
-5
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
...g/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
+25
-26
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseStackFrame.java
...rg/jkiss/dbeaver/debug/core/model/DatabaseStackFrame.java
+2
-2
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseThread.java
...rc/org/jkiss/dbeaver/debug/core/model/DatabaseThread.java
+1
-1
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/IDatabaseDebugTarget.java
.../jkiss/dbeaver/debug/core/model/IDatabaseDebugTarget.java
+2
-1
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
...eaver/ext/postgresql/debug/internal/console/Debugger.java
+5
-3
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
...t/postgresql/debug/internal/impl/PostgreDebugSession.java
+35
-1
未找到文件。
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
浏览文件 @
d00b4a92
...
...
@@ -26,9 +26,9 @@ import org.jkiss.dbeaver.debug.internal.DebugMessages;
import
org.jkiss.dbeaver.debug.jdbc.DBGJDBCSession
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
DBGBaseController
implements
DBGController
{
...
...
@@ -37,7 +37,6 @@ public abstract class DBGBaseController implements DBGController {
private
final
DBPDataSourceContainer
dataSourceContainer
;
private
final
Map
<
String
,
Object
>
configuration
;
private
final
Map
<
Object
,
DBGJDBCSession
>
sessions
=
new
HashMap
<>(
1
);
private
ListenerList
<
DBGEventHandler
>
eventHandlers
=
new
ListenerList
<>();
...
...
@@ -57,7 +56,7 @@ public abstract class DBGBaseController implements DBGController {
}
@Override
public
Object
attach
(
DBRProgressMonitor
monitor
)
throws
DBGException
{
public
DBGSession
openSession
(
DBRProgressMonitor
monitor
)
throws
DBGException
{
if
(!
dataSourceContainer
.
isConnected
())
{
try
{
dataSourceContainer
.
connect
(
monitor
,
true
,
true
);
...
...
@@ -69,173 +68,25 @@ public abstract class DBGBaseController implements DBGController {
throw
new
DBGException
(
"Not connected to database"
);
}
try
{
DBGJDBCSession
debugSession
=
createSession
(
monitor
,
configuration
);
Object
targetId
=
debugSession
.
getSessionInfo
().
getID
();
sessions
.
put
(
targetId
,
debugSession
);
return
targetId
;
return
createSession
(
monitor
,
configuration
);
}
catch
(
DBException
e
)
{
String
message
=
NLS
.
bind
(
DebugMessages
.
DatabaseDebugController_e_opening_debug_context
,
dataSourceContainer
);
String
message
=
NLS
.
bind
(
DebugMessages
.
DatabaseDebugController_e_opening_debug_context
,
dataSourceContainer
);
log
.
error
(
message
,
e
);
throw
new
DBGException
(
message
,
e
);
}
}
@Override
public
boolean
canSuspend
(
Object
sessionKey
)
{
return
false
;
}
@Override
public
boolean
canResume
(
Object
sessionKey
)
{
return
isSessionAccessible
(
sessionKey
);
}
@Override
public
void
suspend
(
Object
sessionkey
)
throws
DBGException
{
// not supported by default
}
@Override
public
void
resume
(
Object
sessionKey
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
sessionKey
);
session
.
execContinue
();
}
@Override
public
void
detach
(
DBRProgressMonitor
monitor
,
Object
sessionkey
)
throws
DBGException
{
DBGSession
session
=
sessions
.
remove
(
sessionkey
);
if
(
session
!=
null
)
{
session
.
closeSession
(
monitor
);
}
}
@Override
public
void
dispose
()
{
Collection
<
DBGJDBCSession
>
values
=
sessions
.
values
();
for
(
DBGJDBCSession
session
:
values
)
{
try
{
session
.
closeSession
(
new
VoidProgressMonitor
());
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error while closing session {0}"
,
session
);
log
.
error
(
message
,
e
);
}
}
Object
[]
listeners
=
eventHandlers
.
getListeners
();
for
(
Object
listener
:
listeners
)
{
unregisterEventHandler
((
DBGEventHandler
)
listener
);
}
}
@Override
public
List
<?
extends
DBGBreakpointDescriptor
>
getBreakpoints
(
Object
sessionKey
)
throws
DBGException
{
DBGJDBCSession
session
=
ensureSessionAccessible
(
sessionKey
);
return
session
.
getBreakpoints
();
}
@Override
public
void
addBreakpoint
(
DBRProgressMonitor
monitor
,
Object
sessionKey
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
{
DBGJDBCSession
session
=
ensureSessionAccessible
(
sessionKey
);
session
.
addBreakpoint
(
monitor
,
descriptor
);
}
@Override
public
void
removeBreakpoint
(
DBRProgressMonitor
monitor
,
Object
sessionKey
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
{
DBGJDBCSession
session
=
ensureSessionAccessible
(
sessionKey
);
session
.
removeBreakpoint
(
monitor
,
descriptor
);
}
@Override
public
List
<?
extends
DBGStackFrame
>
getStack
(
Object
id
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
id
);
return
session
.
getStack
();
}
@Override
public
List
<?
extends
DBGVariable
<?>>
getVariables
(
Object
id
,
DBGStackFrame
stack
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
id
);
if
(
stack
!=
null
)
{
session
.
selectFrame
(
stack
.
getLevel
());
}
return
session
.
getVariables
();
}
@Override
public
String
getSource
(
Object
sessionKey
,
DBGStackFrame
stack
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
sessionKey
);
return
session
.
getSource
(
stack
);
}
public
abstract
DBGJDBCSession
createSession
(
DBRProgressMonitor
monitor
,
Map
<
String
,
Object
>
configuration
)
throws
DBGException
;
protected
DBGJDBCSession
findSession
(
Object
id
)
{
return
sessions
.
get
(
id
);
}
public
boolean
isSessionExists
(
Object
id
)
{
return
sessions
.
containsKey
(
id
);
}
public
List
<
DBGSession
>
getSessions
()
throws
DBGException
{
return
new
ArrayList
<>(
sessions
.
values
());
}
@Override
public
boolean
canStepInto
(
Object
sessionKey
)
{
return
isSessionAccessible
(
sessionKey
);
}
@Override
public
boolean
canStepOver
(
Object
sessionKey
)
{
return
isSessionAccessible
(
sessionKey
);
}
@Override
public
boolean
canStepReturn
(
Object
sessionKey
)
{
// hmm, not sure
return
false
;
}
@Override
public
void
stepInto
(
Object
sessionKey
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
sessionKey
);
session
.
execStepInto
();
}
@Override
public
void
stepOver
(
Object
sessionKey
)
throws
DBGException
{
DBGSession
session
=
ensureSessionAccessible
(
sessionKey
);
session
.
execStepOver
();
}
@Override
public
void
stepReturn
(
Object
sessionKey
)
throws
DBGException
{
// throw DBGException?
}
protected
DBGJDBCSession
ensureSessionAccessible
(
Object
sessionKey
)
throws
DBGException
{
DBGJDBCSession
session
=
findSession
(
sessionKey
);
if
(
session
==
null
)
{
String
message
=
NLS
.
bind
(
"Session for {0} is not available"
,
sessionKey
);
throw
new
DBGException
(
message
);
}
boolean
isAccessible
=
session
.
isAttached
()
&&
!
session
.
isWaiting
()
&&
session
.
isDone
();
if
(!
isAccessible
)
{
String
message
=
NLS
.
bind
(
"Session for {0} is not accessible"
,
sessionKey
);
throw
new
DBGException
(
message
);
}
return
session
;
}
protected
boolean
isSessionAccessible
(
Object
sessionKey
)
{
DBGJDBCSession
session
=
findSession
(
sessionKey
);
return
session
!=
null
&&
session
.
isAttached
()
&&
!
session
.
isWaiting
()
&&
session
.
isDone
();
}
@Override
public
void
registerEventHandler
(
DBGEventHandler
eventHandler
)
{
eventHandlers
.
add
(
eventHandler
);
...
...
@@ -252,22 +103,4 @@ public abstract class DBGBaseController implements DBGController {
}
}
/*
* protected void executeProcedure(DBPDataSource dataSource, Map<String,
* Object> configuration, DBRProgressMonitor monitor) throws DBException {
* String procedureName = String.valueOf(configuration.get(PROCEDURE_NAME));
* String call = String.valueOf(configuration.get(PROCEDURE_CALL)); String
* taskName = NLS.bind("Execute procedure {0}", procedureName); Job job =
* new Job(taskName) {
*
* @Override protected IStatus run(IProgressMonitor monitor) { try { try
* (final DBCSession execSession = DBUtils.openUtilSession(new
* VoidProgressMonitor(), dataSource, taskName)) { try (final DBCStatement
* dbStat = execSession.prepareStatement(DBCStatementType.EXEC, call, true,
* false, false)) { dbStat.executeStatement(); } } } catch (DBCException e)
* { log.error(taskName, e); return DebugCore.newErrorStatus(taskName, e);
*
* } return Status.OK_STATUS; } }; job.schedule(); }
*/
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
浏览文件 @
d00b4a92
...
...
@@ -41,64 +41,17 @@ public interface DBGController {
*
* @return key to use for <code>detach</code>
*/
Object
attach
(
DBRProgressMonitor
monitor
)
throws
DBGException
;
/**
*
* @param sessionKey
* the key obtained as a result of <code>attach</code>
*/
void
detach
(
DBRProgressMonitor
monitor
,
Object
sessionKey
)
throws
DBGException
;
void
dispose
();
DBGSession
openSession
(
DBRProgressMonitor
monitor
)
throws
DBGException
;
DBGBreakpointDescriptor
describeBreakpoint
(
Map
<
String
,
Object
>
attributes
);
List
<?
extends
DBGBreakpointDescriptor
>
getBreakpoints
(
Object
sessionKey
)
throws
DBGException
;
void
addBreakpoint
(
DBRProgressMonitor
monitor
,
Object
sessionKey
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
;
void
removeBreakpoint
(
DBRProgressMonitor
monitor
,
Object
sessionKey
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
;
List
<?
extends
DBGStackFrame
>
getStack
(
Object
sessionKey
)
throws
DBGException
;
List
<?
extends
DBGVariable
<?>>
getVariables
(
Object
sessionKey
,
DBGStackFrame
stack
)
throws
DBGException
;
String
getSource
(
Object
sessionKey
,
DBGStackFrame
stack
)
throws
DBGException
;
/*
* suspend/resume
*/
boolean
canSuspend
(
Object
sessionKey
);
boolean
canResume
(
Object
sessionKey
);
void
suspend
(
Object
sessionKey
)
throws
DBGException
;
void
resume
(
Object
sessionKey
)
throws
DBGException
;
/*
* Stepping
*/
boolean
canStepInto
(
Object
sessionKey
);
boolean
canStepOver
(
Object
sessionKey
);
boolean
canStepReturn
(
Object
sessionKey
);
void
stepInto
(
Object
sessionKey
)
throws
DBGException
;
void
stepOver
(
Object
sessionKey
)
throws
DBGException
;
void
stepReturn
(
Object
sessionKey
)
throws
DBGException
;
/*
* Events
*/
void
registerEventHandler
(
DBGEventHandler
eventHandler
);
void
unregisterEventHandler
(
DBGEventHandler
eventHandler
);
void
dispose
();
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGSession.java
浏览文件 @
d00b4a92
...
...
@@ -27,29 +27,40 @@ public interface DBGSession {
DBGSessionInfo
getSessionInfo
();
Object
getSessionId
();
List
<?
extends
DBGBreakpointDescriptor
>
getBreakpoints
();
void
addBreakpoint
(
DBRProgressMonitor
monitor
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
;
void
removeBreakpoint
(
DBRProgressMonitor
monitor
,
DBGBreakpointDescriptor
descriptor
)
throws
DBGException
;
boolean
canStepInto
();
boolean
canStepOver
();
boolean
canStepReturn
();
void
execContinue
()
throws
DBGException
;
void
execStepInto
()
throws
DBGException
;
void
execStepOver
()
throws
DBGException
;
void
closeSession
(
DBRProgressMonitor
monitor
)
throws
DBGException
;
void
execStepReturn
(
)
throws
DBGException
;
List
<?
extends
DBGVariable
<?>>
getVariables
()
throws
DBGException
;
void
resume
()
throws
DBGException
;
void
suspend
()
throws
DBGException
;
List
<?
extends
DBGVariable
<?>>
getVariables
(
DBGStackFrame
stack
)
throws
DBGException
;
void
setVariableVal
(
DBGVariable
<?>
variable
,
Object
value
)
throws
DBGException
;
List
<?
extends
DBGStackFrame
>
getStack
()
throws
DBGException
;
Object
getSessionId
()
;
String
getSource
(
DBGStackFrame
stack
)
throws
DBGException
;
void
selectFrame
(
int
frameNumbe
r
)
throws
DBGException
;
void
closeSession
(
DBRProgressMonitor
monito
r
)
throws
DBGException
;
String
getSource
(
DBGStackFrame
stack
)
throws
DBGException
;
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
浏览文件 @
d00b4a92
...
...
@@ -56,7 +56,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
private
boolean
suspended
=
false
;
private
boolean
terminated
=
false
;
private
Object
sessionKey
;
private
DBGSession
session
;
public
DatabaseDebugTarget
(
String
modelIdentifier
,
ILaunch
launch
,
IProcess
process
,
DBGController
controller
)
{
super
(
null
);
...
...
@@ -86,8 +86,8 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
}
@Override
public
Object
getSessionID
()
{
return
session
Key
;
public
DBGSession
getSession
()
{
return
session
;
}
protected
DatabaseThread
newThread
()
{
...
...
@@ -169,7 +169,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
@Override
public
void
connect
(
IProgressMonitor
monitor
)
throws
CoreException
{
try
{
session
Key
=
this
.
controller
.
attach
(
new
DefaultProgressMonitor
(
monitor
));
session
=
this
.
controller
.
openSession
(
new
DefaultProgressMonitor
(
monitor
));
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Failed to connect {0} to the target"
,
getName
());
IStatus
error
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -199,7 +199,10 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
terminated
=
true
;
suspended
=
false
;
try
{
controller
.
detach
(
getProgressMonitor
(),
sessionKey
);
if
(
session
!=
null
)
{
session
.
closeSession
(
new
VoidProgressMonitor
());
session
=
null
;
}
controller
.
unregisterEventHandler
(
this
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error terminating {0}"
,
getName
());
...
...
@@ -247,7 +250,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
public
void
resume
()
throws
DebugException
{
suspended
=
false
;
try
{
controller
.
resume
(
sessionKey
);
session
.
resume
(
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error resuming {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -262,7 +265,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
@Override
public
void
suspend
()
throws
DebugException
{
try
{
controller
.
suspend
(
sessionKey
);
session
.
suspend
(
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error suspending {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -270,10 +273,6 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
}
}
private
VoidProgressMonitor
getProgressMonitor
()
{
return
new
VoidProgressMonitor
();
}
public
void
suspended
(
int
detail
)
{
suspended
=
true
;
thread
.
setStepping
(
false
);
...
...
@@ -296,7 +295,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
return
;
}
try
{
controller
.
addBreakpoint
(
new
VoidProgressMonitor
(),
sessionKey
,
descriptor
);
session
.
addBreakpoint
(
new
VoidProgressMonitor
()
,
descriptor
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Unable to add breakpoint {0}"
,
breakpoint
);
Status
error
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -316,7 +315,7 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
return
;
}
try
{
controller
.
removeBreakpoint
(
new
VoidProgressMonitor
(),
sessionKey
,
descriptor
);
session
.
removeBreakpoint
(
new
VoidProgressMonitor
()
,
descriptor
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Unable to remove breakpoint {0}"
,
breakpoint
);
Status
error
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -374,7 +373,10 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
@Override
public
void
disconnect
()
throws
DebugException
{
try
{
controller
.
detach
(
getProgressMonitor
(),
sessionKey
);
if
(
session
!=
null
)
{
session
.
closeSession
(
new
VoidProgressMonitor
());
session
=
null
;
}
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error disconnecting {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -413,45 +415,42 @@ public class DatabaseDebugTarget extends DatabaseDebugElement implements IDataba
}
public
boolean
canStepInto
()
{
return
controller
.
canStepInto
(
sessionKey
);
return
session
!=
null
&&
session
.
canStepInto
(
);
}
public
boolean
canStepOver
()
{
return
controller
.
canStepOver
(
sessionKey
);
return
session
!=
null
&&
session
.
canStepOver
(
);
}
public
boolean
canStepReturn
()
{
return
controller
.
canStepReturn
(
sessionKey
);
return
session
!=
null
&&
session
.
canStepReturn
(
);
}
public
void
stepInto
()
throws
DebugException
{
DBGController
controller
=
getController
();
try
{
controller
.
stepInto
(
sessionKey
);
session
.
execStepInto
(
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Step into failed for session {0}"
,
session
Key
);
String
message
=
NLS
.
bind
(
"Step into failed for session {0}"
,
session
.
getSessionId
()
);
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
throw
new
DebugException
(
status
);
}
}
public
void
stepOver
()
throws
DebugException
{
DBGController
controller
=
getController
();
try
{
controller
.
stepOver
(
sessionKey
);
session
.
execStepOver
(
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Step over failed for session {0}"
,
session
Key
);
String
message
=
NLS
.
bind
(
"Step over failed for session {0}"
,
session
.
getSessionId
()
);
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
throw
new
DebugException
(
status
);
}
}
public
void
stepReturn
()
throws
DebugException
{
DBGController
controller
=
getController
();
try
{
controller
.
stepReturn
(
sessionKey
);
session
.
execStepReturn
(
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Step return failed for session {0}"
,
session
Key
);
String
message
=
NLS
.
bind
(
"Step return failed for session {0}"
,
session
.
getSessionId
()
);
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
throw
new
DebugException
(
status
);
}
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseStackFrame.java
浏览文件 @
d00b4a92
...
...
@@ -141,7 +141,7 @@ public class DatabaseStackFrame extends DatabaseDebugElement implements IStackFr
/*if (refreshVariables)*/
{
try
{
IDatabaseDebugTarget
debugTarget
=
getDatabaseDebugTarget
();
List
<?
extends
DBGVariable
<?>>
variables
=
debugTarget
.
get
Controller
().
getVariables
(
debugTarget
.
getSessionID
(),
dbgStackFrame
);
List
<?
extends
DBGVariable
<?>>
variables
=
debugTarget
.
get
Session
().
getVariables
(
dbgStackFrame
);
rebuildVariables
(
variables
);
}
catch
(
DBGException
e
)
{
log
.
error
(
e
);
...
...
@@ -232,7 +232,7 @@ public class DatabaseStackFrame extends DatabaseDebugElement implements IStackFr
String
source
;
try
{
IDatabaseDebugTarget
debugTarget
=
getDatabaseDebugTarget
();
source
=
debugTarget
.
get
Controller
().
getSource
(
debugTarget
.
getSessionID
(),
dbgStackFrame
);
source
=
debugTarget
.
get
Session
().
getSource
(
dbgStackFrame
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Unable to retrieve sources for stack {0}"
,
dbgStackFrame
);
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseThread.java
浏览文件 @
d00b4a92
...
...
@@ -158,7 +158,7 @@ public class DatabaseThread extends DatabaseDebugElement implements IThread {
protected
void
extractStackFrames
()
throws
DebugException
{
try
{
IDatabaseDebugTarget
debugTarget
=
getDatabaseDebugTarget
();
List
<?
extends
DBGStackFrame
>
stackFrames
=
debugTarget
.
get
Controller
().
getStack
(
debugTarget
.
getSessionID
()
);
List
<?
extends
DBGStackFrame
>
stackFrames
=
debugTarget
.
get
Session
().
getStack
(
);
rebuildStack
(
stackFrames
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error reading stack for {0}"
,
getName
());
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/IDatabaseDebugTarget.java
浏览文件 @
d00b4a92
...
...
@@ -25,12 +25,13 @@ 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.DBGSession
;
public
interface
IDatabaseDebugTarget
extends
IDebugTarget
,
IDebugEventSetListener
,
IBreakpointManagerListener
{
DBGController
getController
();
Object
getSessionID
();
DBGSession
getSession
();
void
connect
(
IProgressMonitor
monitor
)
throws
CoreException
;
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
浏览文件 @
d00b4a92
...
...
@@ -34,6 +34,7 @@ import java.util.Scanner;
@SuppressWarnings
(
"nls"
)
public
class
Debugger
{
/*
public static final String PROMPT = ">";
public static final String COMMAND_ATTACH = "A";
public static final String COMMAND_CLOSE = "X";
...
...
@@ -61,7 +62,7 @@ public class Debugger {
DBGVariable<?> v = null;
List
<?
extends
DBGVariable
<?>>
vars
=
session
.
getVariables
();
List<? extends DBGVariable<?>> vars = session.getVariables(
null
);
Scanner scArg;
...
...
@@ -332,7 +333,7 @@ public class Debugger {
break;
}
controller
.
detach
(
new
VoidProgressMonitor
(),
debugSessionC
.
getSessionId
());
debugSessionC.closeSession(new VoidProgressMonitor
());
System.out.println("Session closed");
...
...
@@ -380,7 +381,7 @@ public class Debugger {
break;
}
List
<?
extends
DBGVariable
<?>>
vars
=
debugSessionVL
.
getVariables
();
List<? extends DBGVariable<?>> vars = debugSessionVL.getVariables(
null
);
if (vars.size() == 0) {
System.out.println("No vars defined");
...
...
@@ -706,5 +707,6 @@ public class Debugger {
}
}
*/
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
浏览文件 @
d00b4a92
...
...
@@ -425,6 +425,21 @@ public class PostgreDebugSession extends DBGJDBCSession {
}
@Override
public
void
execStepReturn
()
throws
DBGException
{
throw
new
DBGException
(
"Exec return not implemented"
);
}
@Override
public
void
resume
()
throws
DBGException
{
throw
new
DBGException
(
"Resume not implemented"
);
}
@Override
public
void
suspend
()
throws
DBGException
{
throw
new
DBGException
(
"Suspend not implemented"
);
}
/**
* Execute step SQL command asynchronously, set debug session name to
* [sessionID] name [managerPID]
...
...
@@ -447,7 +462,11 @@ public class PostgreDebugSession extends DBGJDBCSession {
}
@Override
public
List
<
DBGVariable
<?>>
getVariables
()
throws
DBGException
{
public
List
<
DBGVariable
<?>>
getVariables
(
DBGStackFrame
stack
)
throws
DBGException
{
if
(
stack
!=
null
)
{
selectFrame
(
stack
.
getLevel
());
}
List
<
DBGVariable
<?>>
vars
=
new
ArrayList
<>();
String
sql
=
SQL_GET_VARS
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
));
...
...
@@ -616,6 +635,21 @@ public class PostgreDebugSession extends DBGJDBCSession {
return
sessionId
;
}
@Override
public
boolean
canStepInto
()
{
return
true
;
}
@Override
public
boolean
canStepOver
()
{
return
true
;
}
@Override
public
boolean
canStepReturn
()
{
return
true
;
}
/**
* Return true if debug session up and running on server
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录