sketchup-ruby-debugger icon indicating copy to clipboard operation
sketchup-ruby-debugger copied to clipboard

SketchUp crashes when launched with debugger on Monterey 12.01 and Apple silicon

Open ruggieroguida opened this issue 4 years ago • 39 comments

I am trying to update my development environment to Apple Silicon (M1 Pro) with Monterey 12.0.1. Sketchup works fine, but when I launch Sketchup with the debugger it crashes immediately. The same debugger 1.3.0 works fine in BigSur with intel.

Bugsplat attached

bugsplat.txt

ruggieroguida avatar Dec 14 '21 21:12 ruggieroguida

There's yet to be a release of SketchUp that support Monterey, ditto for native M1 support. When that is released we'll be making another build of the debugger and make it available.

thomthom avatar Dec 15 '21 09:12 thomthom

Just seen the updated debugger. It still crashes. I have tested it on SU21 and SU22 (Monterey and Apple Silicon). I have just sent the crash report (Crash #185).

I am using vscode. In tasks.json I have:

{
  "label": "Debug SketchUp 2022",
  "type": "shell",
  "command": "open -a '/Applications/SketchUp 2022/SketchUp.app' --args -rdebug 'ide port=7000'",
  "windows": {
    "command": "&'C:/Program Files/SketchUp/SketchUp 2022/SketchUp.exe' -rdebug 'ide port=7000'"
  }
},

and in launch.json

{
  "name": "Sketchup 2022 Debug",
  "type": "Ruby",
  "request": "attach",
  "cwd": "${workspaceRoot}",
  "remoteHost": "127.0.0.1",
  "remotePort": "7000",
  "remoteWorkspaceRoot": "${workspaceRoot}"
}

Any change required?

ruggieroguida avatar Jan 26 '22 14:01 ruggieroguida

hm... I'm not sure what's going on.

Could you try building it yourself, that should give you debug symbols? And then lunching SU with a debugger attached? In the crash report we're getting it doesn't collect symbols for the debugger since it's a separate library.

Should be only a matter of opening the Xcode project and building. No external dependencies.

thomthom avatar Jan 26 '22 14:01 thomthom

I can try! :-) Never done it before and Xcode is quite intimidating.

Will let you know how it goes

ruggieroguida avatar Jan 26 '22 14:01 ruggieroguida

Xcode is quite intimidating.

I know, macOS is not within my comfort zone either. (I'm going to double check on my end here, though I don't have a Monterey machine)

thomthom avatar Jan 26 '22 14:01 thomthom

OK. I managed to compile it, but it still crashes. I have sent the two report (2021 and 2022) Crash #407529 Crash #189

I have used the file from the folder

/Users/xxx/Library/Developer/Xcode/DerivedData/SURubyDebugger-gigrtipdowtnfidsolwkhtppphzs/Build/Products/Debug/

ruggieroguida avatar Jan 26 '22 15:01 ruggieroguida

I'm not sure if you can load the Debug dylib in a Release app.

Refer to this page for how to use xcodebuild to build a Release build: https://github.com/SketchUp/sketchup-ruby-debugger/blob/main/Development.md (Sorry, I should have mentioned this.)

thomthom avatar Jan 26 '22 15:01 thomthom

Don't worry.

No luck unfortunately

SU2021 Crash #407556 SU2022 Crash #190

ruggieroguida avatar Jan 26 '22 15:01 ruggieroguida

Are you able to launch SU with the debugger attached, so you can break on the crash?

We won't get the debug symbols reported in our tracker, so you'd have to report here.

thomthom avatar Jan 26 '22 15:01 thomthom

Do you mean with this command?

open -a '/Applications/SketchUp 2022/SketchUp.app' --args -rdebug 'ide port=7000'

If so, yes.

ruggieroguida avatar Jan 26 '22 15:01 ruggieroguida

We won't get the debug symbols reported in our tracker, so you'd have to report here.

Do you want me to copy the content of the crash report here?

ruggieroguida avatar Jan 26 '22 15:01 ruggieroguida

I have the same problem here. M1 Monterey ... opening the Xcode project ... euh what Xcode project ? may I ask, full of embarrassment.

mariocha avatar Feb 05 '22 02:02 mariocha

You need to download the repository. It is in the Build directory.

Curious to see if works for you. It still doesn't for me

ruggieroguida avatar Feb 05 '22 16:02 ruggieroguida

Boy! this is a lot of work installing & configuring all the required apps. I found a good guide, up to date. https://mac.install.guide/ruby/index.html

mariocha avatar Feb 08 '22 13:02 mariocha

Opening the file SURubyDebugger.xcodeproj in XCode, 12 issues are indicated. all the same as the one on the image. issues

mariocha avatar Feb 08 '22 13:02 mariocha

@mariocha hava a look at @thomthom reply above

Refer to this page for how to use xcodebuild to build a Release build: https://github.com/SketchUp/sketchup-ruby-debugger/blob/main/Development.md

ruggieroguida avatar Feb 09 '22 06:02 ruggieroguida

@ruggieroguida Do you want me to copy the content of the crash report here?

Please, with such long files (like in the 1st post,) do not copy and paste them. Instead attach them as text file. If GitHub does not like the file extension, just wrap it up in a zip file.

DanRathbun avatar Feb 14 '22 14:02 DanRathbun

@DanRathbun Done. Much better. I had not realised you could attach files.

ruggieroguida avatar Feb 14 '22 14:02 ruggieroguida

Ok , I managed to build a dylb. But the 12 errors mentioned above are still indicated, so .... I am rather sceptic . Anyway here it is SURubyDebugger.dylib.zip

mariocha avatar Feb 16 '22 23:02 mariocha

I am also getting crashes when I launch SketchUp, whether directly from the Terminal or from VS Code. My system is a 2019 16" MacBook Pro running macOS Monterey 12.2.1. One example BugSplat #3412. The head of the crash report looks like this, which appears to indicate an exception from the code that tries to open a socket for the debug connection?

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7ff81ec61112 __pthread_kill + 10 1 libsystem_pthread.dylib 0x7ff81ec97214 pthread_kill + 263 2 libsystem_c.dylib 0x7ff81ebe3d10 abort + 123 3 CrashReporter 0x10522a0a9 uncaught_exception_handler.cold.1 + 24 4 CrashReporter 0x10520dcb2 uncaught_exception_handler + 39 5 ExceptionHandling 0x7ff922997cc0 NSExceptionHandlerUncaughtExceptionHandler + 34 6 BugsplatMac 0x104e39af8 uncaught_cxx_exception_handler + 70 7 BugsplatMac 0x104e469f2 BITCrashUncaughtCXXTerminateHandler() + 409 8 libc++abi.dylib 0x7ff81ec534d7 std::__terminate(void ()()) + 8 9 libc++abi.dylib 0x7ff81ec55d55 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception) + 27 10 libc++abi.dylib 0x7ff81ec55d1c __cxa_throw + 116 11 SURubyDebugger.dylib 0x113bb2d7e void boost::throw_exceptionboost::system::system_error(boost::system::system_error const&) + 56 12 SURubyDebugger.dylib 0x113bc3015 boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::execution::any_executor<boost::asio::execution::context_as_tboost::asio::execution_context&, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > > >::basic_socket_acceptorboost::asio::io_context(boost::asio::io_context&, boost::asio::ip::basic_endpointboost::asio::ip::tcp const&, bool, std::__1::enable_if<is_convertible<boost::asio::io_context&, boost::asio::execution_context&>::value, void>::type*) + 601 13 SURubyDebugger.dylib 0x113babd49 SketchUp::RubyDebugger::RDIP::Impl::Impl(SketchUp::RubyDebugger::IDebugServer*, int) + 179 14 SURubyDebugger.dylib 0x113bb20ce SketchUp::RubyDebugger::RDIP::Initialize(SketchUp::RubyDebugger::IDebugServer*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 968 15 SURubyDebugger.dylib 0x113ba21b7 SketchUp::RubyDebugger::Server::Start(std::__1::unique_ptr<SketchUp::RubyDebugger::IDebuggerUI, std::__1::default_deleteSketchUp::RubyDebugger::IDebuggerUI >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 173 16 SURubyDebugger.dylib 0x113bcb930 InitDebugger + 534 17 SketchUp 0x1045326a7 InitRubyDebugger(atlast::utils::atlast_ustring const&) + 217

slbaumgartner avatar Feb 23 '22 14:02 slbaumgartner

I tried building according to the directions. It still crashes. Attached is the full crash report

Debugger-crash.zip .

slbaumgartner avatar Feb 23 '22 14:02 slbaumgartner

I also tried local build of the 1.4.0.0 source. BugSplat Crash #3521

slbaumgartner avatar Feb 23 '22 15:02 slbaumgartner

My C++ is a bit rusty, but it looks to me as if the boost library is throwing an exception after failing to bind the socket for the ruby debugger to listen on.

slbaumgartner avatar Feb 23 '22 16:02 slbaumgartner

hm... yea, seems to be a boost error being thrown there... I need to get my hands on a machine with matching OS for this one I think....

thomthom avatar Feb 28 '22 14:02 thomthom

Having the same issue on MacOS 12.3 (Monterey) on Intell

zhukmj avatar Mar 27 '22 15:03 zhukmj

@thomthom I was wondering whether there was some progress on this. I did not see any update in the forum. Thanks!

mioruggieroguida avatar Sep 18 '22 09:09 mioruggieroguida

After upgrading to Monterey I'm seeing this on my own system as well.

thomthom avatar Nov 02 '22 13:11 thomthom

Turns out macOS Monterey is using port 7000. And RubyDebugger doesn't handle a failed connection - it just crashes. (https://developer.apple.com/forums/thread/682332)

Try with a different port and let me know.

thomthom avatar Nov 02 '22 15:11 thomthom

The good news is that it does not crash using port 7354. This port is not used according to lsof -i -P | grep -i "listen".

The bad news is that the breakpoints are not triggered. It has been a while, but from memory, SketchUp used to hang until the debugger was launched. Now it does not happen.

When you execute the script being debugged, vscode appears briefly, but then the focus goes back to SketchUp and nothing happens.

I have also tried with the wait option

open -a '/Applications/SketchUp 2021/SketchUp.app' --args -rdebug 'ide port=7354 wait' same thing...

ruggieroguida avatar Nov 02 '22 16:11 ruggieroguida

If you launch without using open, but open SU directly:

/Applications/SketchUp\ 2022/SketchUp.app/Contents/MacOS/SketchUp -rdebug "ide port=6123"

Does the terminal output say anything like Initializing ruby-debug-ide protocol?

thomthom avatar Nov 02 '22 16:11 thomthom