================
@@ -164,12 +164,17 @@ void lldb_private::ParseLinuxSMapRegions(llvm::StringRef 
linux_smap,
     if (!name.contains(' ')) {
       if (region) {
         if (name == "VmFlags") {
-          if (value.contains("mt"))
-            region->SetMemoryTagged(MemoryRegionInfo::eYes);
-          else
-            region->SetMemoryTagged(MemoryRegionInfo::eNo);
+          region->SetMemoryTagged(MemoryRegionInfo::eNo);
+          region->SetIsShadowStack(MemoryRegionInfo::eNo);
+
+          llvm::SmallVector<llvm::StringRef> flags;
+          value.split(flags, ' ', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
+          for (llvm::StringRef flag : flags)
----------------
DavidSpickett wrote:

The line we are parsing looks like:
```
VmFlags: rd ex mr mw me de sd
```
And I wouldn't want to see "amtb" and assume that memory tagging is set. We 
could do `contains(" mt ")` buy relying on that trailing space being there is 
risky.

It would be nice to be lazy and only tokenise as much as we need from the 
string though. I'll see if there's an iterator version I can use.

You made me realise I don't actually have a test case to check we don't match 
on substrings though, so I will add that.

https://github.com/llvm/llvm-project/pull/117861
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to