Subject: Re: bug#56495: 29.0.50; Support for debugging Emacs with LLDB

From: Gerd Möllmann <[email-masked]>
Date: Mon, 11 Jul 2022 13:27:22 +0200

> On 2022-07-11,, at 12:56 , Robert Pluim <[email-masked]> wrote:
> 
> But if I 'command script import emacs_lldb' in my llvm lldb, I get no
> errors. Maybe itʼs a version 14 thing.

Looks like it is.

> I donʼt think itʼs a big deal, and lldb version dependent checks will
> invariably be out of date. Maybe just stick in a comment?

This seems to work for me with Apple's LLDB and the one from LLVM:

def define_command (debugger, function):
    lldb_command = function.__name__
    python_function = __name__ + "." + function.__name__
    interpreter = debugger.GetCommandInterpreter()
    def define(overwrite):
        res = lldb.SBCommandReturnObject()
        interpreter.HandleCommand(f"command script add "
                                  f"{overwrite} "
                                  f"--function {python_function} "
                                  f"{lldb_command}",
                                  res)
        return res.Succeeded()
    if not define("--overwrite"):
        define("")

Could you please try it with your LLDBs?

It relies on runtime-availability of the '--overwrite', only.