diff options
author | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2024-08-23 13:09:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 13:09:31 -0700 |
commit | 8b4147d14c460f8886e882db48361d4c101917d7 (patch) | |
tree | ec1c185e806e9e32c7a07b47a1d3e83e13fc8341 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
parent | aa61925eace86602ce1da00bda4a993719061df2 (diff) | |
download | llvm-8b4147d14c460f8886e882db48361d4c101917d7.zip llvm-8b4147d14c460f8886e882db48361d4c101917d7.tar.gz llvm-8b4147d14c460f8886e882db48361d4c101917d7.tar.bz2 |
[GDBRemote] Fix processing of comma-separated memory region entries (#105873)
The existing algorithm was performing the following comparisons for an
`aaa,bbb,ccc,ddd`:
aaa\0bbb,ccc,ddd == "stack"
aaa\0bbb\0ccc,ddd == "stack"
aaa\0bbb\0ccc\0ddd == "stack"
Which wouldn't work. This commit just dispatches to a known algorithm
implementation.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 83ba277..d7a0baa 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1632,17 +1632,9 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( } } } else if (name == "type") { - std::string comma_sep_str = value.str(); - size_t comma_pos; - while ((comma_pos = comma_sep_str.find(',')) != std::string::npos) { - comma_sep_str[comma_pos] = '\0'; - if (comma_sep_str == "stack") { + for (llvm::StringRef entry : llvm::split(value, ',')) { + if (entry == "stack") region_info.SetIsStackMemory(MemoryRegionInfo::eYes); - } - } - // handle final (or only) type of "stack" - if (comma_sep_str == "stack") { - region_info.SetIsStackMemory(MemoryRegionInfo::eYes); } } else if (name == "error") { StringExtractorGDBRemote error_extractor(value); |