With your help i was able to run mksnapshot through the debugger. Here's my vsCode launch.json file for anyone who comes along after me.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch mksnapshot",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/out/x64.debug/mksnapshot",
"args": [
"${workspaceFolder}/snapshot.js",
"--turbo_instruction_scheduling",
"--target_os=mac",
"--target_arch=x64",
"--embedded_src",
"${workspaceFolder}/out/x64.debug/gen/embedded.S",
"--turbo-profiling-input",
"${workspaceFolder}/tools/builtins-pgo/x64.profile",
"--embedded_variant",
"Default",
"--random-seed",
"314159265",
"--startup_blob",
"snapshot_blob.bin",
"--no-native-code-counters",
"--verify-heap"
],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"sourceFileMap": { "../../": "${workspaceFolder}" }
}
]
}
```
I was able to get a callstack at the crash, I'm not sure if it helps, but i'm poking further into it.
[Unknown/Just-In-Time compiled code] (Unknown Source:0)
mksnapshot!v8::internal::GeneratedCode<unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, long, unsigned long**>::Call(unsigned long, unsigned long, unsigned long, unsigned long, long, unsigned long**) (/Users/matthenkes/Source/v8-build/v8/src/execution/simulator.h:157)
mksnapshot!v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) (/Users/matthenkes/Source/v8-build/v8/src/execution/execution.cc:426)
mksnapshot!v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) (/Users/matthenkes/Source/v8-build/v8/src/execution/execution.cc:537)
mksnapshot!v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) (/Users/matthenkes/Source/v8-build/v8/src/api/api.cc:2112)
mksnapshot!v8::Script::Run(v8::Local<v8::Context>) (/Users/matthenkes/Source/v8-build/v8/src/api/api.cc:2040)
mksnapshot!v8::internal::(anonymous namespace)::RunExtraCode(v8::Isolate*, v8::Local<v8::Context>, char const*, char const*) (/Users/matthenkes/Source/v8-build/v8/src/snapshot/snapshot.cc:736)
mksnapshot!v8::internal::CreateSnapshotDataBlobInternal(v8::SnapshotCreator::FunctionCodeHandling, char const*, v8::Isolate*) (/Users/matthenkes/Source/v8-build/v8/src/snapshot/snapshot.cc:755)
mksnapshot!(anonymous namespace)::CreateSnapshotDataBlob(v8::Isolate*, char const*) (/Users/matthenkes/Source/v8-build/v8/src/snapshot/mksnapshot.cc:160)
mksnapshot!main (/Users/matthenkes/Source/v8-build/v8/src/snapshot/mksnapshot.cc:286)
dyld!start (Unknown Source:0)
In the debugger i am using, lldb, the variables at the time of the crash aren't very useful. They just numbers and addresses when i'd expect them to be an array. (I'm currently a JS dev and haven't looked at C++ in 20 years, so my expectations might be off lol). Anyone know if variables would be more readable if i used GDB instead of LLDB?