llvm / llvm/llvm-project

Importing a python command that runs a non-existent function happens without error

Open
#211,789 4 comments 0 reactions 1 assignee Claimed by @medismailben View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

In this script file I have deliberately registered the wrong function name:

`$ cat test_cmd.py`

```python
import lldb

def test_command(debugger, command, result, internal_dict):
result.AppendMessage("No one will see this!")

def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand(
"command script add "
"-f test_cmd.test_cmd "
"test_cmd"
)
print("Installed command: test_cmd")
```

When I import this lldb says nothing and I can execute this empty command but nothing happens:

```
$ ./bin/lldb
(lldb) command script import test_cmd
Installed command: test_cmd
(lldb) test_cmd
(lldb)
```

The only sign that something is wrong is a message in the help:

```
(lldb) help test_cmd
For more information run 'help test_cmd' Expects 'raw' input (see 'help raw-input'.)

Syntax: test_cmd
Function test_cmd.test_cmd was not found. Containing module might be missing.
```

I expect there's some reason why we don't error early here but it's not a great user experience.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.