[Lldb-commits] [PATCH] D94672: Implement vAttachOrWait

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 14 04:44:10 PST 2021


augusto2112 added inline comments.
Herald added a subscriber: JDevlieghere.


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:372
+  name_with_slash_stream.Format("/{0}", process_name);
+  auto name_with_slash = name_with_slash_stream.GetString();
+
----------------
Is there an easier way to format a StringRef such that if I have a StringRef "foo" I get a new StringRef "/foo"?


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:377
+  // by the desired name.
+  auto should_exclude_process = [&exclusion_list, &process_name,
+                                 &name_with_slash](
----------------
There was an oversight on my last patch, where we could attach to a different process if it ended with the name of the process we want to attach to. For example if we want to attach to "bar", it could also attach to "foobar". I changed it so we exclude processes whose names aren't a perfect match ("bar") or end with a slash + process name ("path/to/bar"). Is this enough, or could there be other false positives?


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:3314
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait(
+    StringExtractorGDBRemote &packet) {
----------------
`Handle_vAttachOrWait` and `Handle_vAttachWait` are pretty much the same. The only differences are the argument we pass to `packet.SetFilePos` and to `AttachWaitProcess`. Since they're so small I decided to keep them as separate functions, but I could make one common function for both.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94672/new/

https://reviews.llvm.org/D94672



More information about the lldb-commits mailing list