From 7c504b483aefda95da9a956a5dda6360eef23682 Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Mon, 4 Sep 2023 15:29:37 +0300 Subject: [PATCH 1/7] fixed the additional args for sys images --- docs/src/userguide/debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index 06c2a8e..e36e52c 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -137,7 +137,7 @@ Custom julia sys images can also be used when debugging. Go to julia-vscode exte Once in the settings, use "-J" option followed by your path to the custom sys image. Note this "Additional Args" settings are currently used only when debugging in the REPL mode, see the `@run` macron in the example bellow. ``` "julia.additionalArgs": [ - "-JC:\\temp\\sys_custom.so", + "-J", "C:\\temp\\sys_custom.so", ], ``` ### Example for fast(er) debugging From b67cac621f084bad590cae11a4c94222979e1341 Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Mon, 4 Sep 2023 22:17:45 +0300 Subject: [PATCH 2/7] document external tools for debugging: --- docs/src/userguide/debugging.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index e36e52c..f5ca3ac 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -148,3 +148,33 @@ In the following code we use the packages GLMakie and Statistics. GLMakie is a p As the debugger hits the desired line of code we can step inside the `mean` function (Statistics) and debug there. ![Debugger](../assets/debugger/19.png) + +## Debugging using external tools +You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, see bellow. Both packages can be used in combination with a custom system image via [julia.additionalArgs](https://www.julia-vscode.org/docs/dev/userguide/debugging/#Use-a-custom-sys-image). + +Note: the documentation for externall tools is currently minimal. Visual examples have to de added. + +### Debugger.jl +[Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) + +In order to debug _Main_ and also _SomePackage_ while having all the other packages as compiled, we can use the following code in REPL, before debugging using the @run or @enter. +``` +using SomePackage +union!(JuliaInterpreter.compiled_modules, setdiff(Base.loaded_modules_array(), [Main, SomePackage])) +``` + +Another use-case is to set all modules and submodules in _Base_ as compiled: +``` +using JuliaInterpreter, MethodAnalysis; +push!(JuliaInterpreter.compiled_modules, Base) +union!(JuliaInterpreter.compiled_modules, child_modules(Base)); +``` + +### Infiltrator.jl +[Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl) + +**@infiltrate** +It compiles all code, adding only user specified breakpoints (@infiltrate). Compile times and run times are good, but the user can only inspect the local state when a break point is reached. It is not possible to move around the call stack. + +**@exfiltrate** +Simply exports all local variables at the point of call to Main. The idea is that the entire local environment can be inspected at really no runtime or compilation cost. Simple and effective, but one cannot manipulate objects in the context of the calling module. \ No newline at end of file From df7fd6ed398799534cf0194984217632ade56f63 Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Mon, 4 Sep 2023 22:35:30 +0300 Subject: [PATCH 3/7] add documentation for externall tools --- docs/src/userguide/debugging.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index f5ca3ac..8e8b387 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -155,7 +155,7 @@ You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, Note: the documentation for externall tools is currently minimal. Visual examples have to de added. ### Debugger.jl -[Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) +[Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) requires the debugged code to be interpreted. Of course, interpretting the code is a lot slower compared to the compiled mode, so we want to make sure we interpret only the code we are interested in. In order to debug _Main_ and also _SomePackage_ while having all the other packages as compiled, we can use the following code in REPL, before debugging using the @run or @enter. ``` @@ -171,10 +171,5 @@ union!(JuliaInterpreter.compiled_modules, child_modules(Base)); ``` ### Infiltrator.jl -[Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl) - -**@infiltrate** -It compiles all code, adding only user specified breakpoints (@infiltrate). Compile times and run times are good, but the user can only inspect the local state when a break point is reached. It is not possible to move around the call stack. - -**@exfiltrate** -Simply exports all local variables at the point of call to Main. The idea is that the entire local environment can be inspected at really no runtime or compilation cost. Simple and effective, but one cannot manipulate objects in the context of the calling module. \ No newline at end of file +The _@infiltrate_ macro sets an infiltration point in the code. The advantage of Infiltrator over Debugger is that Infiltrator has neglijible performance overhead. You can inspect the local variables in the current call-stack. The disadvantage is that you cannot step-in or step-over instructions. Instead you can jump to the next infiltration point. +The full description is here: [Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl) \ No newline at end of file From 4028efbe39829547f0975e4570bb1b7aac2547b6 Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Tue, 5 Sep 2023 08:19:22 +0300 Subject: [PATCH 4/7] remove the note in debugging with external tools --- docs/src/userguide/debugging.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index 8e8b387..a68949c 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -152,8 +152,6 @@ As the debugger hits the desired line of code we can step inside the `mean` func ## Debugging using external tools You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, see bellow. Both packages can be used in combination with a custom system image via [julia.additionalArgs](https://www.julia-vscode.org/docs/dev/userguide/debugging/#Use-a-custom-sys-image). -Note: the documentation for externall tools is currently minimal. Visual examples have to de added. - ### Debugger.jl [Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) requires the debugged code to be interpreted. Of course, interpretting the code is a lot slower compared to the compiled mode, so we want to make sure we interpret only the code we are interested in. From f469661ef385a6ea8c8635e90179b6d1f1e9d46f Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Tue, 5 Sep 2023 08:44:23 +0300 Subject: [PATCH 5/7] removed commas in sample code --- docs/src/userguide/debugging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index a68949c..393c062 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -163,9 +163,9 @@ union!(JuliaInterpreter.compiled_modules, setdiff(Base.loaded_modules_array(), [ Another use-case is to set all modules and submodules in _Base_ as compiled: ``` -using JuliaInterpreter, MethodAnalysis; +using JuliaInterpreter, MethodAnalysis push!(JuliaInterpreter.compiled_modules, Base) -union!(JuliaInterpreter.compiled_modules, child_modules(Base)); +union!(JuliaInterpreter.compiled_modules, child_modules(Base)) ``` ### Infiltrator.jl From dc9b9c0ab2c8428b8221ccf711d87a26440fa94a Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Tue, 5 Sep 2023 10:37:35 +0300 Subject: [PATCH 6/7] update the comment related to custom sys images --- docs/src/userguide/debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index 393c062..f58a0f0 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -150,7 +150,7 @@ As the debugger hits the desired line of code we can step inside the `mean` func ![Debugger](../assets/debugger/19.png) ## Debugging using external tools -You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, see bellow. Both packages can be used in combination with a custom system image via [julia.additionalArgs](https://www.julia-vscode.org/docs/dev/userguide/debugging/#Use-a-custom-sys-image). +You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, see bellow. Both packages can be used in combination with a custom system image. ### Debugger.jl [Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) requires the debugged code to be interpreted. Of course, interpretting the code is a lot slower compared to the compiled mode, so we want to make sure we interpret only the code we are interested in. From 0d8000435bfaeb2d6f7bdc0a09dafd1550e4a103 Mon Sep 17 00:00:00 2001 From: MariusDrulea Date: Tue, 5 Sep 2023 22:55:03 +0300 Subject: [PATCH 7/7] only brief description on other debugging tools --- docs/src/userguide/debugging.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/docs/src/userguide/debugging.md b/docs/src/userguide/debugging.md index f58a0f0..daa5411 100644 --- a/docs/src/userguide/debugging.md +++ b/docs/src/userguide/debugging.md @@ -149,24 +149,11 @@ As the debugger hits the desired line of code we can step inside the `mean` func ![Debugger](../assets/debugger/19.png) -## Debugging using external tools -You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging, see bellow. Both packages can be used in combination with a custom system image. +## Other tools for debugging +You can also use the packages _Debugger.jl_ and _Infiltrator.jl_ for debugging. These packages offer debugging in REPL and are not connected to the vscode-julia extension. Both packages can be used in combination with a custom system image. They are briefly described bellow. Use the provided links for more information. ### Debugger.jl -[Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) requires the debugged code to be interpreted. Of course, interpretting the code is a lot slower compared to the compiled mode, so we want to make sure we interpret only the code we are interested in. - -In order to debug _Main_ and also _SomePackage_ while having all the other packages as compiled, we can use the following code in REPL, before debugging using the @run or @enter. -``` -using SomePackage -union!(JuliaInterpreter.compiled_modules, setdiff(Base.loaded_modules_array(), [Main, SomePackage])) -``` - -Another use-case is to set all modules and submodules in _Base_ as compiled: -``` -using JuliaInterpreter, MethodAnalysis -push!(JuliaInterpreter.compiled_modules, Base) -union!(JuliaInterpreter.compiled_modules, child_modules(Base)) -``` +[Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) uses [JuliaInterpreter.jl](https://github.com/JuliaDebug/JuliaInterpreter.jl) in order to debug the code in REPL. Note that vscode-julia extension also uses JuliaInterpreter, but offers UI based debugging. JuliaInterpreter allows the users to specify which modules will get compiled and which will get interpretted. You can achieve the same behavior as in [`ALL_MODULES_EXCEPT_MAIN`](https://www.julia-vscode.org/docs/dev/userguide/debugging/#ALL_MODULES_EXCEPT_MAIN), but using the REPL. ### Infiltrator.jl The _@infiltrate_ macro sets an infiltration point in the code. The advantage of Infiltrator over Debugger is that Infiltrator has neglijible performance overhead. You can inspect the local variables in the current call-stack. The disadvantage is that you cannot step-in or step-over instructions. Instead you can jump to the next infiltration point.