[Lldb-commits] [lldb] Complete the Implementation of DAP modules explorer. (PR #139934)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed May 14 10:33:54 PDT 2025
================
@@ -416,8 +416,11 @@ llvm::json::Value CreateModule(lldb::SBTarget &target, lldb::SBModule &module,
} else {
object.try_emplace("symbolStatus", "Symbols not found.");
}
- std::string loaded_addr = std::to_string(
- module.GetObjectFileHeaderAddress().GetLoadAddress(target));
+ std::string loaded_addr;
+ llvm::raw_string_ostream os_hex(loaded_addr);
+ os_hex << llvm::format_hex(
+ module.GetObjectFileHeaderAddress().GetLoadAddress(target),
+ sizeof(lldb::addr_t));
----------------
JDevlieghere wrote:
I assumed the load address was a "number" but the [spec](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Module) says it's a "string" in which case I agree it makes more sense to the hex conversion here.
You can simplify this something like this:
```
object.try_emplace("addressRange", llvm::format({0:x}, module.GetObjectFileHeaderAddress().GetLoadAddress(target)).str());
```
https://github.com/llvm/llvm-project/pull/139934
More information about the lldb-commits
mailing list