[debug] coroutine's stack frame locations pre-calculated on initialization
This commit is contained in:
committed by
Vladimir Ilmov
parent
4191d1d699
commit
c8c0f3383d
+6
-19
@@ -200,10 +200,8 @@ class CreationCoroutineStackFrameItem(
|
|||||||
frame: StackFrameProxyImpl,
|
frame: StackFrameProxyImpl,
|
||||||
val stackTraceElement: StackTraceElement,
|
val stackTraceElement: StackTraceElement,
|
||||||
stackFrame: XStackFrame,
|
stackFrame: XStackFrame,
|
||||||
val location: Location
|
location: Location
|
||||||
) : CoroutineStackFrameItem(frame, stackFrame) {
|
) : CoroutineStackFrameItem(frame, stackFrame, location) {
|
||||||
override fun location() = location
|
|
||||||
|
|
||||||
fun emptyDescriptor() =
|
fun emptyDescriptor() =
|
||||||
EmptyStackFrameDescriptor(stackTraceElement, frame)
|
EmptyStackFrameDescriptor(stackTraceElement, frame)
|
||||||
}
|
}
|
||||||
@@ -213,9 +211,7 @@ class SuspendCoroutineStackFrameItem(
|
|||||||
val stackTraceElement: StackTraceElement,
|
val stackTraceElement: StackTraceElement,
|
||||||
stackFrame: XStackFrame,
|
stackFrame: XStackFrame,
|
||||||
val lastObservedFrameFieldRef: ObjectReference
|
val lastObservedFrameFieldRef: ObjectReference
|
||||||
) : CoroutineStackFrameItem(frame, stackFrame) {
|
) : CoroutineStackFrameItem(frame, stackFrame, frame.location()) {
|
||||||
override fun location() = frame.location()
|
|
||||||
|
|
||||||
fun emptyDescriptor() =
|
fun emptyDescriptor() =
|
||||||
EmptyStackFrameDescriptor(stackTraceElement, frame)
|
EmptyStackFrameDescriptor(stackTraceElement, frame)
|
||||||
}
|
}
|
||||||
@@ -224,28 +220,19 @@ class AsyncCoroutineStackFrameItem(
|
|||||||
frame: StackFrameProxyImpl,
|
frame: StackFrameProxyImpl,
|
||||||
val frameItem: StackFrameItem,
|
val frameItem: StackFrameItem,
|
||||||
stackFrame: XStackFrame
|
stackFrame: XStackFrame
|
||||||
) : CoroutineStackFrameItem(frame, stackFrame) {
|
) : CoroutineStackFrameItem(frame, stackFrame, frame.location())
|
||||||
override fun location() : Location = frame.location()
|
|
||||||
}
|
|
||||||
|
|
||||||
class RunningCoroutineStackFrameItem(
|
class RunningCoroutineStackFrameItem(
|
||||||
frame: StackFrameProxyImpl,
|
frame: StackFrameProxyImpl,
|
||||||
stackFrame: XStackFrame
|
stackFrame: XStackFrame
|
||||||
) : CoroutineStackFrameItem(frame, stackFrame) {
|
) : CoroutineStackFrameItem(frame, stackFrame, frame.location())
|
||||||
val location = frame.location() // it should be invoked in manager thread
|
|
||||||
|
|
||||||
override fun location() = location
|
abstract class CoroutineStackFrameItem(val frame: StackFrameProxyImpl, val stackFrame: XStackFrame, val location: Location) {
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CoroutineStackFrameItem(val frame: StackFrameProxyImpl, val stackFrame: XStackFrame) {
|
|
||||||
val log by logger
|
val log by logger
|
||||||
|
|
||||||
fun sourcePosition() : XSourcePosition? = stackFrame.sourcePosition
|
fun sourcePosition() : XSourcePosition? = stackFrame.sourcePosition
|
||||||
|
|
||||||
abstract fun location(): Location
|
|
||||||
|
|
||||||
fun uniqueId(): String {
|
fun uniqueId(): String {
|
||||||
val location = location()
|
|
||||||
try {
|
try {
|
||||||
return location.safeSourceName() + ":" + location.safeMethod().toString() + ":" +
|
return location.safeSourceName() + ":" + location.safeMethod().toString() + ":" +
|
||||||
location.safeLineNumber() + ":" + location.safeSourceLineNumber()
|
location.safeLineNumber() + ":" + location.safeSourceLineNumber()
|
||||||
|
|||||||
+1
-1
@@ -237,7 +237,7 @@ class XCoroutineView(val project: Project, val session: XDebugSession) :
|
|||||||
inner class CoroutineFrameValue(val frame: CoroutineStackFrameItem
|
inner class CoroutineFrameValue(val frame: CoroutineStackFrameItem
|
||||||
) : XNamedValue(frame.uniqueId()) {
|
) : XNamedValue(frame.uniqueId()) {
|
||||||
override fun computePresentation(node: XValueNode, place: XValuePlace) =
|
override fun computePresentation(node: XValueNode, place: XValuePlace) =
|
||||||
applyRenderer(node, renderer.render(frame.location()))
|
applyRenderer(node, renderer.render(frame.location))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun applyRenderer(node: XValueNode, presentation: SimpleColoredTextIcon) =
|
private fun applyRenderer(node: XValueNode, presentation: SimpleColoredTextIcon) =
|
||||||
|
|||||||
Reference in New Issue
Block a user