In a continuation of a topic started by mrbkap, I present you this gem of a gdb
command I needed to use today:
cond 8 \ (*$9 && \ ((*$9)->id&7) == 4 && \ (*(jschar**)((uintptr_t) (*$9)->id + 4))[0] == 'o' && \ (*(jschar**)((uintptr_t) (*$9)->id + 4))[1] == 'f' && \ (*(jschar**)((uintptr_t) (*$9)->id + 4))[2] == 'f')
For minimal background, breakpoint 8 was the result of watch *$9
, and of course $9 = (JSScopeProperty **) 0x7ffff2f08038
.
By the way, did you know the gdb
command line supports line continuations? I didn’t, before I had to think about how the above command would display without any. 🙂 This is the above command as I originally wrote it:
cond 8 (*$9 && ((*$9)->id&7) == 4 && (*(jschar**)((uintptr_t) (*$9)->id + 4))[0] == 'o' && (*(jschar**)((uintptr_t) (*$9)->id + 4))[1] == 'f' && (*(jschar**)((uintptr_t) (*$9)->id + 4))[2] == 'f')