[llvm] [RISCV][Disassemble] Ensure the comment stream of the disassembler is set. (PR #125962)

Francesco Petrogalli via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 14:28:00 PST 2025


fpetrogalli wrote:

> @fpetrogalli not all disassemblers set CommentStream. This causes disassemblers to assert, including in lldb. I don't think there should be asserts in MCDisassembler.cpp

Maybe all disassembler should set CommentStream for their target? Both functions are dereferencing `CommentStream`, I think it is better to leave the assertion, or alternatively to modify `Symbolizer->tryAddingSymbolicOperand` to handle the nullptr case.

```cpp
    assert(CommentStream && "CommentStream is not set.");
    return Symbolizer->tryAddingSymbolicOperand(Inst, *CommentStream, Value,
                                                Address, IsBranch, Offset,
                                                OpSize, InstSize);
  }
```


https://github.com/llvm/llvm-project/pull/125962


More information about the llvm-commits mailing list