# Attach debugger to running process

**URL:** <https://discourse.julialang.org/t/attach-debugger-to-running-process/136890>\
**Category:** VS Code\
**Tags:** debugging, debugger\
**Created:** [April 26, 2026, 6:57pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890 "2026-04-26T18:57:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zuckerruebe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zuckerruebe/32/49121_2.png) [@zuckerruebe](https://discourse.julialang.org/u/zuckerruebe)\
**Post date:** [April 26, 2026, 6:57pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/1 "2026-04-26T18:57:40Z")

</div>

Hi all

Glancing at `DebugAdapter.jl` it seemed to me that you could debug a program “after the fact”, i.e. attach a debugger to it once it has started. Is that correct? Can `DebugAdapter.jl` do this? If so, can this functionality be used from the `vscode` plugin? I’m fine with running my code through a special function if need be.

Thanks,  
Damian

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 26, 2026, 7:59pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/2 "2026-04-26T19:59:11Z")

</div>

Yes, check out the docs at

> **[Debugging code from the REPL - Debugging · Julia in VS Code](https://www.julia-vscode.org/docs/stable/userguide/debugging/#Debugging-code-from-the-REPL)**
>
> The Julia extension supports debugging of all types of Julia programs and applications. | Documentation for Julia in VS Code.

---

<div class="post-metadata">

**Author:** ![zuckerruebe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zuckerruebe/32/49121_2.png) [@zuckerruebe](https://discourse.julialang.org/u/zuckerruebe)\
**Post date:** [April 27, 2026, 7:27am UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/3 "2026-04-27T07:27:31Z")

</div>

Nice! Does the REPL have to be launched from vscode? How does vscode know which REPL to connect to? By port number? Can I launch a REPL outside of vscode and then connect to it?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 27, 2026, 8:12am UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/4 "2026-04-27T08:12:56Z")

</div>

> [@zuckerruebe](#):
>
> Does the REPL have to be launched from vscode?

No, not necessarily.

> [@zuckerruebe](#):
>
> How, does vscode know which REPL to connect to? By port number?

A socket path gets passed at startup.

> [@zuckerruebe](#):
>
> Can I launch a REPL outside of vscode and then connect to it?

Yes, use the `Julia: Connect external REPL` command for that. You’ll need to have a REPL available in the process you’re trying to connect to (though technically that requirement could be relaxed).

---

<div class="post-metadata">

**Author:** ![zuckerruebe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zuckerruebe/32/49121_2.png) [@zuckerruebe](https://discourse.julialang.org/u/zuckerruebe)\
**Post date:** [May 4, 2026, 4:14pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/5 "2026-05-04T16:14:39Z")

</div>

Is it an actual REPL I need to attach to? A Debugger.jl “session” (if such a thing exists) isn’t enough? I believe debugging in the REPL relies on Debugger.jl under the hood? I’m asking because I’m embedding Julia using `jlrs` and I don’t have a running REPL there, nor do I know of an official way to start one “after-the-fact”, programmatially, from inside Julia.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [May 4, 2026, 4:18pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/6 "2026-05-04T16:18:36Z")

</div>

something like [py-spy](https://github.com/benfred/py-spy) for Julia would be quite cool. I have something vibe coded locally that provides similar features

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [May 4, 2026, 4:43pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/7 "2026-05-04T16:43:12Z")

</div>

`Julia: Connect external REPL` requires an actual REPL, yes. DebugAdapter.jl doesn’t, but it’s easiest to use from one and we don’t currently officially support attaching to random Julia processes.

> [@zuckerruebe](#):
>
> I believe debugging in the REPL relies on [Debugger.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/Debugger) under the hood?

Yes, but Debugger.jl and DebugAdapter.jl both are debugger frontends built on top of the JuliaInterpreter.jl infrastructure. The VS Code integration only works with the latter.

---

<div class="post-metadata">

**Author:** ![zuckerruebe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zuckerruebe/32/49121_2.png) [@zuckerruebe](https://discourse.julialang.org/u/zuckerruebe)\
**Post date:** [May 5, 2026, 7:32am UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/8 "2026-05-05T07:32:43Z")

</div>

Thanks for your reply. My current workflow is

1. Start a Julia REPL outside of `vscode`
2. `Connect external REPL` (get the “external REPL connected” message)
3. `include` my script there after having set a breakpoint in it in `vscode`

However, my breakpoint isn’t hit. Any idea what I’m doing wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [May 5, 2026, 10:07am UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/9 "2026-05-05T10:07:01Z")

</div>

Check out the instructions at

> **[Debugging code from the REPL - Debugging · Julia in VS Code](https://www.julia-vscode.org/docs/stable/userguide/debugging/#Debugging-code-from-the-REPL)**
>
> The Julia extension supports debugging of all types of Julia programs and applications. | Documentation for Julia in VS Code.

and also this thread:

> [@Debugger no longer hits breakpoints in VSC?](https://discourse.julialang.org/t/debugger-no-longer-hits-breakpoints-in-vsc/136161/20):
>
> Try with this debugger configuration: Here, the debugger is interpreting everything. Also make sure to set your breakpoints before starting a debugging session – applying them while debugging can sometimes fail. If none of that works, set ENV["JULIA\_DEBUG"] = "DebugAdapter,DebugEngines" and try again – if you can paste the output into a gist and post a MWE, I can take a look at what’s going on.

---

<div class="post-metadata">

**Author:** ![zuckerruebe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zuckerruebe/32/49121_2.png) [@zuckerruebe](https://discourse.julialang.org/u/zuckerruebe)\
**Post date:** [May 18, 2026, 8:52am UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/10 "2026-05-18T08:52:22Z")

</div>

Hi

Thanks for getting back. Hmm, I know it’s a bit of a cop-out but a MWE is not trivial, our setup is quite complex… What I can say is that can start

1. A REPL outside of vscode
2. Successfully connect vscode to the REPL
3. Kick off my code in the REPL
4. Have `Debugger.jl` stop in the REPL at a manually inserted `@bp` in the code.

But what I fail to do is for vscode to stop at a breakpoint added in the editor. Note that the code on which I set the breakpoint in vscode is “dynamically” `include`d, outside of the normal module definitions (does that make sense, not sure if I explained it well).

P.S.: I’ve set the Julia debug options and I can see that the breakpoints are set:

```julia-auto
┌ Debug: Setting breakpoint at c:\Users\damian.birchler\src\private\julia4trnsys\julia4trnsys.rs\julia\types\ConstantEffectivenessHeatExchanger.jl:73 (condition nothing)

```

This file is `include`d “dynamically” some time along the run of the program, so I wonder how the breakpoint is “matched”. Does each (interpreted) instructed know what file it came from?

Actually, the workflow is Julia REPL → Native module (jlrs/Rust) → calls back into Julia via C API → Julia code I want to debug. I guess the debugging infrastructure is just not made for something so convoluted?

Cheers,  
Damian

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [May 20, 2026, 3:50pm UTC](https://discourse.julialang.org/t/attach-debugger-to-running-process/136890/11 "2026-05-20T15:50:46Z")

</div>

The main complication I see here is that you still need to enter “debug mode” with `@run` or `@enter` somehow, but that doesn’t survive any FFI boundaries. You also can’t use the VSCodeServer variants in local scopes or anything like that.

So yes, I don’t think this is going to work with your setup at this point. It _may_ be possible to hack around some of these issues by manually sprinkling `VSCodeServer.DebugAdapter.JuliaInterpreter.@interpret`s into whatever functions you want to debug (at the rust → julia interface) and hope the correct breakpoints are set at the right time…
