Chapter 7: block literal not printing

I’m running into an issue in Chapter 7 in the Hunting for Code section. When I set up the breakpoint for the Objective-C block and execute frame variable I don’t see the object referencing the block itself. Here’s is what my console looks like:

(int) sig = 23

(siginfo_t *) siginfo = 0x00007ffee9dc1c48

(UnixSignalHandler *) self = 0x0000600000c281c0

(UnixSignal *) unixSignal = 0x0000000106c2a6b9

Any idea on why I’m not able to see the block, or if there is another way to find out the address of the block so I can continue with the remaining steps of the chapter?

@lolgrep Can you please help with this when you get a chance? Thank you - much appreciated! :]

Yea, I’m not sure why we are not seeing the block_literal.

if we print the $rdi:

<__NSMallocBlock__: some address>

Which is the same as what we should see on the instruction on the next page using the _block_literal_5

(lldb) po ((__block_literal_5 *)0x0000618000070200)

(Page 97). 

I’m not sure why it’s not showing on LLDB. But if you want the block address to work with and continue the examples, you can obtain it from the $rdi.

(lldb) po $rdi
<__NSMallocBlock__: 0x000061800007020A>
//Your address might change so I just wrote a random number

And now you can use that Address and continue:

(lldb) po ((__block_literal_5 *)0x000061800007020A)
(lldb) p/x ((__block_literal_5 *)0x000061800007020A)->__FuncPtr

I would also like to know why the __block_literal_5 is not showing, but in the mean time I used that to continue the lesson.

I hope it helps.

1 Like

@rderik Thank you for sharing your solution - much appreciated!

This topic was automatically closed after 166 days. New replies are no longer allowed.