R: dump-class-layout script not working

# Frank Jaeger (a day ago)

thanks for your help. I am running the script on macOS Mojave 10.14 and I'm pretty sure I have the lldb python bindings installed. Or otherwise it should fail when importing them at the beginning of the script, right? From what I understood by reading the script's code, it is directly calling into the lldb binding to dump the class layout, and it's failing inside.

As I've said before, the error it gives me implies that the provided framework/class pair has not been found in the image, even though I am sure that the pair is valid and found in the image (e.g. JSC::JSString).

Contact us to advertise here
# Frank Jaeger (5 hours ago)

I finally managed to fix it. I was running the script on a VM with development tools installed and running it on a WebKit built from my host machine. The reason I was using this intricate setup was because the script broke completely on my host machine when I tried to run it, giving this error:

Fatal Python error: PyThreadState_Get: no current thread

This actually crashed Python. I couldn't figure out why this was happening so I tried to run it on a semi-clean VM with only dev tools installed, and it was working (i.e. not crashing) but failed for some reason to find the symbols.

At this point I did some more researching on the original crash, and managed to fix it. This is probably caused by having multiple Python versions on your machine, particularly with brew, which messes up your $PATH and the script ends up using some wrong Python dynamic library, which leads to the crash. I fixed this by giving the correct $PATH to the script when launching it:

PATH=/usr/bin ./Tools/Scripts/dump-class-layout --architecture=x86_64 -c Debug JavaScriptCore JSString

This lets me run the script correctly on my host machine, and it works perfectly fine. I really don't know why it was failing in the VM, since I had developer tools installed.

Want more features?

Request early access to our private beta of readable email premium.