[Lldb-commits] [PATCH] D95601: [lldb][AArch64] Add memory tag reading to lldb-server

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 13 05:56:03 PDT 2021

DavidSpickett marked 2 inline comments as done.
DavidSpickett added inline comments.

Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1464
+  // get all tags back.
+  while (num_tags > 0) {
+    tags_vec.iov_base = dest;
omjavaid wrote:
> this loop condition is is a little fishy.  num_tags is unsigned which means if by chance it doesnt end up going to zero we ll keep looping for ever.
I couldn't see another loop condition that made sense to use, so I've added an assert below:
assert(tags_read && (tags_read <= num_tags));
If num_tags was 0 we'd never enter the loop in the first place. Then we assert that if there was no error, the kernel returned at least 1 tag and no more tags than we asked for.

This should prevent num_tags wrapping around 0 and causing an infinite loop.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list