erlang / erlide_eclipse

Eclipse IDE for Erlang
http://erlide.org
202 stars 70 forks source link

breakpoints fail to stop code running #331

Open MPC-BlackBox opened 4 years ago

MPC-BlackBox commented 4 years ago

Hi, I am trying to setup a erlang ide using eclipse. I have followed all the setup information with success.

I can run the following test code: start() -> Bin1 = <<10,20>>, X = binary_to_list(Bin1), io:fwrite("~w",[X]).

Trying to manually setup debug configuration does not work but debug as erlang application fills in all the boxes and it does work.

Only issue is break points do not work. They are ignored.

Debug config settings are attached below.

erlide - Erlang language tools 0.56.0.201909301105

config1 Config2 config3

Any ideas greatly appreciated.

Thanks MPC.

_Originally posted by @MPC-BlackBox in https://github.com/erlang/erlide_eclipse/issues/316#issuecomment-573751433_

MPC-BlackBox commented 4 years ago

From the erlide.log file I noticed:

17:33:12,439 W: (ErlideDebug.java:139) : timeout in erlide_debug:interpret/4

erlide.log

Thanks.

MPC-BlackBox commented 4 years ago

The problem seems to be with the directory C:\eclipse_java\plugins\org.erlide.kernel.debugger_0.115.3.201806041948 It seems that erlide can not find the .beams. I guess its just no compatable with the latest OTP.

I have downloaded OTP19.3 and forced eclipse to use this version. Breakpoints now work!

Will there be an update for the latest OTP?

Cheers MPC.

vladdu commented 4 years ago

Thank you for the report and analysis!

The trouble with updating the debugger is that we use a patched veriosn of the OTP debugger and it's not very easy to apply the changes. It may be possible to just recompile the latest patched version with the current compiler, but then any bugfixes or new features will not be available.

If I remember correctly, I tried to get these patches into the main debugger, but it wasn't approved. I'll try to find details about that.

I don't know when I'll have time to build a new version, this week I am very busy. Feel free to ask if nothing happens for a while.

sputnik-1 commented 3 years ago

I'm trying to step through some erlang code to test out the debugger, but I can't seem to get this to work. Am I not doing something right?

erlide.log Eclipse-IDE_Screenshot_20211019_220015

vladdu commented 3 years ago

You don't do anything wrong, but the debugger is not really working on Erlang 21+. It may work sometimes, but the problem is as mentioned in a comment above, I would need to patch and recompile it for every supported version, and unfortunately I don't have the time for it anymore. If there would be a large number of people requesting it, I could be convinced. I'm sorry about that.

sputnik-1 commented 3 years ago

@vladdu

I've had to go with the JetBrains IntelliJ CE IDE and that appears to work OK on Linux Mint 20.1

It's free to download from here and use for commercial projects:

https://www.jetbrains.com/idea/download/#section=linux

Once the IDE is running you can install the Erlang plugin directly from the IntelliJ CE IDE.

https://plugins.jetbrains.com/plugin/7083-erlang

JetBrains-CE-IDE_screenshot_20211020_115746

sputnik-1 commented 3 years ago

The trouble with updating the debugger is that we use a patched version of the OTP debugger and it's not very easy to apply the changes. It may be possible to just recompile the latest patched version with the current compiler, but then any bugfixes or new features will not be available.

Is this something I could try doing on Linux?

What needs to be re-compiled to make this work again?

vladdu commented 3 years ago

The debugger needs to be patched so that it talks with the Eclipse client instead of the regular dbg_something (can't remember exactly). The code is in the erlide_kernel project, that also has a setup that allows compiling for several OTP versions (each with its own copy of the debugger). Actually, it requires these OTP versions, so one needs to install them in a special place. It's kind of a mess...

Tomorrow I have a meeting where I maybe can get some time to add the OTP 23+ support 🤞🏼 Let's see what happens and we can go from there.

sputnik-1 commented 3 years ago

That sounds promising, as I do prefer to debug in the Eclipse IDE rather than the IntelliJ IDE - which is all new to me.

sputnik-1 commented 3 years ago

I've been following the installation instructions from:

https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md

and have installed the packages that configure says are missing.

I have now got as far as running the smoke tests - which all passed OK.

The debugger needs to be patched so that it talks with the Eclipse client instead of the regular dbg_something (can't remember exactly).

What part of the code needs to be looked at to set the correct path to the beam files please?

Is this not something that can be set as an external entity that can be configured by the user, like an env variable $BEAM_PATH or possibly in a text configuration file the Erlang/OTP kernel can read at start up, or set the path in the Erl-IDE debug configuration from inside Eclipse? Erl-OTP_smoke_tests

Screenshot_20211021_083425

sputnik-1 commented 3 years ago

I had to run 'make install' as root user, as normal user could not write to

/usr/bin/install: cannot change permissions of ‘/usr/local/lib/erlang’: No such file or directory
make: *** [Makefile:1161: install.dirs] Error 1
spock@hp-compaq-a:~/workspace/erlang-otp/otp-master$
cd /usr/local/bin
rm -f erl
rm -f erlc
rm -f epmd
rm -f run_erl
rm -f to_erl
rm -f dialyzer
rm -f typer
rm -f escript
rm -f ct_run
ln -s ../lib/erlang/bin/erl erl
ln -s ../lib/erlang/bin/erlc erlc
ln -s ../lib/erlang/bin/epmd epmd
ln -s ../lib/erlang/bin/run_erl run_erl
ln -s ../lib/erlang/bin/to_erl to_erl
ln -s ../lib/erlang/bin/dialyzer dialyzer
ln -s ../lib/erlang/bin/typer typer
ln -s ../lib/erlang/bin/escript escript
ln -s ../lib/erlang/bin/ct_run ct_run
root@hp-compaq-a:/home/spock/workspace/erlang-otp/otp-master# 

I now have a working Erlang/OTP installed under: /usr/local/lib/erlang/

So if I can modify the kernel and tell Eclipse to use this patched version the ERL-IDE debugger might work OK then.

Screenshot_20211021_113530