[Lldb-commits] [PATCH] D91508: [LLDB/Lua] add support for one-liner breakpoint callback

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 24 05:45:27 PST 2020

labath added a comment.

In D91508#2412510 <https://reviews.llvm.org/D91508#2412510>, @tammela wrote:

>> I'm not sure what you mean by that. Can you elaborate?
> Sure, it's was just a nod to your previous comment about that running callbacks (C++ lambdas) inside a `pcall` is a dangerous API. Although possible, it requires that the developer be very cautious about implicit throws.

Right. That's why I'd like to have good wrappers, which make it easy to do the right thing, and hard to do the wrong one.

I don't think we're quite there yet, but before I comment on the API, I want to understand one other thing.

I am puzzled by all the wrapping that's happening inside the `PushSBClass` functions. What is that protecting us from? I would hope that pushing a swig wrapper on the stack is a safe operation...

> The Lua implementation guarantees at least 20 stack slots when the `lua_State` is created so I've added the stack checks for sanity rather than necessity.

So, IIUC, this can only fail if we are running out of memory? If that's the case, then I would remove these checks, as (for better or worse) llvm is not robust against memory allocation errors, and they add a fair amount of cruft to the code.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list