Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug support in fiddle? #93

Open
rubyFeedback opened this issue Sep 23, 2021 · 2 comments
Open

Debug support in fiddle? #93

rubyFeedback opened this issue Sep 23, 2021 · 2 comments

Comments

@rubyFeedback
Copy link

kojix2 provides the fiddle-bindings for libui here:

https://github.com/kojix2/LibUI

Libui is very easy to use; I ported many of my ruby-gtk3 widgets already,
even though libui is quite limited compared to ruby-gtk3. Anyway, in my own
project i modify Fiddle::Pointer to fake-"simulate" OOP.

My biggest problem with fiddle so far is the debug-support. Due to doing
tons of mistakes I get lots of segfaults, and while it is fun to find out why,
in the long run I'd love to be able to more easily and quickly find the error
I did. But when things segfault, I don't seem to get good quality information.

If segfaults happen in ruby, then I often get the exact name, stack tracke
and call stack; and I can use caller(). With fiddle I do not seem to get the
same information or at the least not as much as I think may be useful.

Would it be possible to improve the debug support in fiddle in general?
Perhaps a better stack trace showing where errors happened, a bit
like how ruby does. Or perhaps I just don't know how to debug this,
in which case it would be nice if the main README could provide a
few helpful pointers. Please feel free to close this issue at any moment
in time - I understand that this may not be a trivial change but if anyone
finds some time in the future, keeping better debug-support would be
super-useful. Right now I seem to do random changes and hope for
the best. :D (See also kojix2' comment in regards to having to assign
to variables to avoid the GC terminate the program. Would be nice
if this could all become more transparent when working via ruby.)

@kou
Copy link
Member

kou commented Sep 23, 2021

If segfaults happen in ruby, then I often get the exact name, stack tracke
and call stack; and I can use caller(). With fiddle I do not seem to get the
same information or at the least not as much as I think may be useful.

Could you show a sample output when a Ruby script that uses Fiddle is segfault-ed?

See also kojix2' comment

Could you show URL for it?

@kojix2
Copy link

kojix2 commented Oct 12, 2021

To be honest, I don't really understand how to use Fiddle.
For example, I didn't even know about Fiddle::RUBY_FREE until recently.

They say that an OSS that is incomplete, flawed and full of things to fix will attract more people, and I think LibUI is such a case.
Various people find bugs in LibUI (which is relatively easy), make DSLs and teach me how to use ocra correctly. It's amazing. I am very grateful.

As for this issue, I think it's a question of what ordinary Ruby users should do when a segregation fault appears.
In my case, I simply copy it to an issue and ask kou to take a look at it.
However, I think many people don't know what to do the moment a segregation fault occurs.

So I think what you really need to do is to read the Segmentation fault error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants