utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
585 stars 38 forks source link

[Proposal] Print JVM stack trace when the error is being thrown inside a cpp file. #186

Open Humberd opened 3 years ago

Humberd commented 3 years ago

It would be cool to have it, so that we would know what went wrong

piiertho commented 3 years ago

Exception should appear in classic console or terminal. We can't do much about this, the stream to where JVM prints is handled by JVM implementation. When calling void ExceptionDescribe() JVM will output it to sdterr. There is no easy way for us to retreive the message.

@chippmann if you're ok, I think we can close this one.

chippmann commented 3 years ago

@piiertho I don't think this is what the issue describes. As I understand it; the problem is when a crash happens inside cpp land and not the jvm. Then no java stacktrace is printed. Only a dump from cpp land is printed. What this issue requests (as far as i understand it) is that when a cpp crash happens, the jvm stacktrace should be printed as well, if a call was coming from jvm land. This would enable easier debugging.

Humberd commented 3 years ago

What @chippmann said was exactly my problem. I wrote a bunch of code, executed it and then the cpp part crashed and I didn't know which JVM call caused that, which resulted in me putting logs in every line.

CedNaru commented 4 months ago

To close after #627 is merged

chippmann commented 4 months ago

@piiertho I don't think this is what the issue describes. As I understand it; the problem is when a crash happens inside cpp land and not the jvm. Then no java stacktrace is printed. Only a dump from cpp land is printed. What this issue requests (as far as i understand it) is that when a cpp crash happens, the jvm stacktrace should be printed as well, if a call was coming from jvm land. This would enable easier debugging.

@CedNaru i don't think that my PR solves this issue. It still only handles a jvm exception but not a print of the jvm stacktrace if no error has happened in jvm but one in cpp (like cannot find node by path as node is not in scene tree)

CedNaru commented 4 months ago

I see. Then 4.3 will solve the issue, there is a new API call that makes a language print its current stacktrace, we will just have to implement it by calling a dummy Jvm method that will only throw an exception.

https://github.com/godotengine/godot/pull/91006

chippmann commented 4 months ago

Nice!