Crystal: Execute dsymutil on build with --debug on macOS

Created on 24 Mar 2017  路  9Comments  路  Source: crystal-lang/crystal

ATM to get a backtrace on macOS you'd need manually run dsymutil --flat <path to bin>.

I'd suggest running it as a part of the Crystal build process - only on macOS, and only for debug builds.

feature discussion topicdebugger

Most helpful comment

I believe the option to not generate the .dwarf file is --no-debug since we didn't push any debug info in the first place, and the developer specifically stated she didn't want any.

All 9 comments

Agreed. This should be done automatically, but won't having a .dwarf file appear next to the executable feel weird? I thought of generating them in crystal's cache, thought it means the executable needs to know where to find where the file.

yep, I was thinking the same... one solution that seemed sensible was placing it behind a command-line flag non-activated from default.

Or maybe a compile message: Gathering debug info as foo.dwarf?

@ysbaddaden personally I'd go for both, cli flag (enabled from default) + compile message for clarity what's goin' on.

Some solution along these lines would be really cool. I've answered the "I'm on Mac. Why am I not seeing line numbers in my backtraces?" question quite a few times :P

We can at least execute dsymutil when you do crystal run file.cr or just crystal file.cr. The compiler generates an executable in the cache directory, so having it there too won't bother users.

Then there's the issue of having a .dwarf file next to the executable. I think that's a bit weird but it's acceptable. If you imagine a project or application with a single binary as an entry, having one extra file that provides really useful debug information is OK.

Maybe people will start asking what's that dwarf file, but we can answer it and they'll find out by a Google search. We can add an option not to generate that dwarf file, though, in case it's bothersome.

I believe the option to not generate the .dwarf file is --no-debug since we didn't push any debug info in the first place, and the developer specifically stated she didn't want any.

Maybe people will start asking what's that dwarf file, but we can answer it and they'll find out by a Google search. We can add an option not to generate that dwarf file, though, in case it's bothersome.

Googling crystal and .dwarf is how I found this GitHub issue. Still not quite sure how to use it. But I have figured out --release or --no-debug gets rid of it.

@Juice10 it's neccesary for line numbers in backtraces on macos

Was this page helpful?
0 / 5 - 0 ratings

Related issues

asterite picture asterite  路  3Comments

nabeelomer picture nabeelomer  路  3Comments

relonger picture relonger  路  3Comments

grosser picture grosser  路  3Comments

jhass picture jhass  路  3Comments