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

Pedro Tammela via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 24 06:59:34 PST 2020


tammela marked an inline comment as done.
tammela added a comment.

In D91508#2413582 <https://reviews.llvm.org/D91508#2413582>, @labath wrote:

> 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...

I thought that too, but internally it's a naked call to `lua_newuserdata()` which might throw in case of a memory error.

> 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.

Fair enough. Will remove those.
Since this seems to be a fact of life for LLVM, perhaps wrapping potential memory errors turns out to be just bloat. If that's the case, then the wrapping in `PushSBClass` is not needed and the `abort()` call that Lua does is honest.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91508/new/

https://reviews.llvm.org/D91508



More information about the lldb-commits mailing list