Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Sources/GDBRemote/Mixins/FileOperationsMixin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,23 @@ ErrorCode FileOperationsMixin<T>::onQueryModuleInfo(Session &session,
std::string &triple,
ModuleInfo &info) const {
ByteVector buildId;
if (!Platform::GetExecutableFileBuildID(path, buildId))
return kErrorUnknown;
if (Platform::GetExecutableFileBuildID(path, buildId)) {
// format the uuid as an upper-case string with two hex chars per byte
std::ostringstream ss;
for(const auto b : buildId)
ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << int(b);

info.uuid = ss.str();
}

// TODO(andrurogerz): Not all executable files contain an embedded build ID.
// If GetExecutableFileBuildID fails, calculate an md5 hash of the file
// contents and return that as an "md5" field instead of the "uuid" field.

// send the uuid as a hex-encoded, upper-case string
std::ostringstream ss;
for(const auto b : buildId)
ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << int(b);

auto error = File::fileSize(path, info.file_size);
if (error != kSuccess)
return error;

info.uuid = ss.str();
info.triple = triple;
info.file_path = path;
info.file_offset = 0;
Expand Down
3 changes: 2 additions & 1 deletion Sources/GDBRemote/Structures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ std::string ProgramResult::encode() const {

std::string ModuleInfo::encode() const {
std::ostringstream ss;
ss << "uuid:" << ToHex(uuid) << ";";
if (!uuid.empty())
ss << "uuid:" << ToHex(uuid) << ";";
ss << "triple:" << ToHex(triple) << ";";
ss << "file_path:" << ToHex(file_path) << ";";
ss << "file_offset:" << HEX(16) << file_offset << ";";
Expand Down
Loading