llvm / llvm/llvm-project

[lldb] Misleading error message when re-importing command script

Open
#206,508 2 comments 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```
(lldb) command script import /tmp/script.py
error: cannot add command: user command "foo" already exists and force replace was not set by --overwrite or 'settings set interpreter.require-overwrite false'
```

The `command script import` subcommand doesn't seem to have an `--overwrite` option:
```
(lldb) help command script import
Import a scripting module in LLDB.

Syntax: command script import [ [...]]

Command Options Usage:
command script import [-crs] [ [...]]

-c ( --relative-to-command-file )
-r ( --allow-reload )
-s ( --silent )
```

The `interpreter.require-overwrite` help text suggests this should be specific to `command script add`:
```
(lldb) apropos overwrite
No commands found pertaining to 'overwrite'. Try 'help' to see a complete list of debugger commands.

The following settings variables may relate to 'overwrite':
interpreter.require-overwrite -- If true, require --overwrite in 'command
script add' before overwriting existing user
commands.
```

Am I holding this wrong or is this just a discrepancy in the help text?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the command script import error and reading the help and option definitions for `command script import`, `command script add`, and `interpreter.require-overwrite`. Trace the existing LLDB tests for these commands. Done means the overwrite guidance accurately matches the supported options and the relevant behavior is covered by a focused test.

Written by the indexing model from the issue text.

Assessment

Domain
devtools, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.