Skip to content

Commit 5add33b

Browse files
Copilotxusheng6
andcommitted
Fix parsing to skip anonymous mappings properly
Co-authored-by: xusheng6 <94503187+xusheng6@users.noreply.github.com>
1 parent be6c547 commit 5add33b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

core/adapters/gdbmiadapter.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,11 +841,20 @@ std::vector<DebugModule> GdbMiAdapter::GetModuleList()
841841
// Rest of the line is the objfile (path)
842842
std::getline(lineStream, objfile);
843843

844-
// Trim leading whitespace from objfile
844+
// Trim leading and trailing whitespace from objfile
845845
size_t firstNonSpace = objfile.find_first_not_of(" \t");
846-
if (firstNonSpace != std::string::npos)
846+
if (firstNonSpace == std::string::npos)
847847
{
848-
objfile = objfile.substr(firstNonSpace);
848+
// Line is all whitespace, skip it
849+
continue;
850+
}
851+
objfile = objfile.substr(firstNonSpace);
852+
853+
// Trim trailing whitespace
854+
size_t lastNonSpace = objfile.find_last_not_of(" \t");
855+
if (lastNonSpace != std::string::npos)
856+
{
857+
objfile = objfile.substr(0, lastNonSpace + 1);
849858
}
850859

851860
// Skip lines without valid addresses or without objfile

0 commit comments

Comments
 (0)