diff options
| author | yonghong-song <yhs@fb.com> | 2025-07-02 18:28:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 18:28:05 -0700 |
| commit | 13fddeaf2c494e2f88ef4e7063ae2ee3278e4f1e (patch) | |
| tree | 6a4a22ecd3604cce0e785cb8e4d35d49650372b1 /lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp | |
| parent | 220a00239696257a02fe625a4819fcd038e9dd07 (diff) | |
[BPF] Emit proper error message for insns with tied operands (#146778)
Jonathan Cottrill reported a crash in [1] with the following command
line:
```
$ echo 'r0 = atomic_fetch_add((u64*)(r2 + 0), r1)' | llvm-mc --arch bpf --filetype null
```
Note that in the above command, the insn specification requires that r0
and r1 must be the same register. Otherwise, the crash will happen.
Let us add a case Match_InvalidTiedOperand to handle such invalid insns.
With this patch, the error message looks like below:
```
<stdin>:1:39: error: operand is not the same as the dst register
r0 = atomic_fetch_add((u64*)(r2 + 0), r1)
^
```
The error message is much better than the crash. Some other insns are
also covered by this patch.
```
$ echo 'w0 = xchg32_32(r2 + 0, w1)' | llvm-mc --arch bpf --filetype null
<stdin>:1:24: error: operand is not the same as the dst register
w0 = xchg32_32(r2 + 0, w1)
^
```
[1] https://github.com/llvm/llvm-project/issues/145180
Co-authored-by: Yonghong Song <yonghong.song@linux.dev>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp')
0 files changed, 0 insertions, 0 deletions
