Jun 30
Working on the JS engine
Especially working on old branches without some of the nice debugging helpers that jorendorff has implemented, sometimes I look at my gdb session and just know that I’m working on the JS engine:
(gdb) p $.atom $11 = (JSAtom *) 0xb194f984 (gdb) p/x *(JSString *)((int)$ & ~7) $12 = {length = 0x20000004, u = {chars = 0xaf434970, base = 0xaf434970}} (gdb) x/4ch $.u.chars 0xaf434970: 97 'a' 98 'b' 99 'c' 100 'd'1 comment
1 Comment so far
Dude, it’s so much more intelligible when you spit it out on one line:
(gdb) p ((JSString*)((uintptr_t)$.atom&~7))->mLength&~(1<<29)
$11 = 4
(gdb) x/4ch ((JSString*)((uintptr_t)$.atom&~7))->mChars
0xaf434970: 97 ‘a’ 98 ‘b’ 99 ‘c’ 100 ‘d’
(there may be typos above, I didn’t bother firing up a debugger to record a real such sequence, but I think those are all the right field names and bitmasks 🙂 )