labath added inline comments.
================ 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(); + ---------------- augusto2112 wrote: > Is there an easier way to format a StringRef such that if I have a StringRef > "foo" I get a new StringRef "/foo"? Not exactly, since StringRef always needs a persistent materialized string to refer to. But in the cases you don't have one handy, you can use a std::string. You could create it as `("/" + foo).str()`, but per the comment below, I don't think this is the right solution. ================ 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]( ---------------- augusto2112 wrote: > 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? That is odd, because `GetNameAsStringRef` should already strip the path: ``` llvm::StringRef ProcessInfo::GetNameAsStringRef() const { return m_executable.GetFilename().GetStringRef(); } ``` If that's not working for you, then I guess you need to figure out why is that function failing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D94672/new/ https://reviews.llvm.org/D94672 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits