@@ -4,19 +4,28 @@ Debugging facilities for `kotlinx.coroutines` on JVM.
4
4
5
5
### Overview
6
6
7
- This module provides a debug JVM agent which allows to track and trace existing coroutines.
7
+ This module provides a debug JVM agent that allows to track and trace existing coroutines.
8
8
The main entry point to debug facilities is [ DebugProbes] API.
9
- Call to [ DebugProbes.install] installs debug agent via ByteBuddy and starts to spy on coroutines when they are created, suspended or resumed.
9
+ Call to [ DebugProbes.install] installs debug agent via ByteBuddy and starts spying on coroutines when they are created, suspended and resumed.
10
10
11
11
After that, you can use [ DebugProbes.dumpCoroutines] to print all active (suspended or running) coroutines, including their state, creation and
12
12
suspension stacktraces.
13
13
Additionally, it is possible to process the list of such coroutines via [ DebugProbes.dumpCoroutinesState] or dump isolated parts
14
- of coroutines hierarchy referenced by a [ Job] instance using [ DebugProbes.printScope] or [ DebugProbes.printJob] .
14
+ of coroutines hierarchy referenced by a [ Job] or [ CoroutineScope] instances using [ DebugProbes.printJob] and [ DebugProbes.printScope] respectively.
15
+
16
+ ### Using in your project
17
+
18
+ Add ` kotlinx-coroutines-debug ` to your project test dependencies:
19
+ ```
20
+ dependencies {
21
+ testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.1.0-alpha'
22
+ }
23
+ ```
15
24
16
25
### Using as JVM agent
17
26
18
27
It is possible to use this module as a standalone JVM agent to enable debug probes on the application startup.
19
- You can run your application with an additional argument: ` -javaagent:kotlinx-coroutines-debug-1.0.1 .jar ` .
28
+ You can run your application with an additional argument: ` -javaagent:kotlinx-coroutines-debug-1.1.0-alpha .jar ` .
20
29
Additionally, on Linux and Mac OS X you can use ` kill -5 $pid ` command in order to force your application to print all alive coroutines.
21
30
22
31
@@ -110,6 +119,7 @@ Do not use this module in production environment and do not rely on the format o
110
119
<!-- - MODULE kotlinx-coroutines-core -->
111
120
<!-- - INDEX kotlinx.coroutines -->
112
121
[ Job ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/index.html
122
+ [ CoroutineScope ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html
113
123
<!-- - MODULE kotlinx-coroutines-debug -->
114
124
<!-- - INDEX kotlinx.coroutines.debug -->
115
125
[ DebugProbes ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-debug/kotlinx.coroutines.debug/-debug-probes/index.html
0 commit comments