Implements the required functions on gdb-remote so the '--include-existing' flag of process attach works correctly on Linux.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | ||
---|---|---|
372 | Is there an easier way to format a StringRef such that if I have a StringRef "foo" I get a new StringRef "/foo"? | |
377 | 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? | |
3314 | 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. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | ||
---|---|---|
372 | 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. | |
377 | 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. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | ||
---|---|---|
377 | Oh I see. I just assumed that it could potentially return the full path, my bad. I believe simply comparing info_name != process_name will be sufficient then. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | ||
---|---|---|
359–366 | Reverse this logic and switch the if/else contents? | |
371 | Do we need to get the correct directory delimiter for the current platform here? This will work for everything except windows. Just wanted to bring this up in case we do. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | ||
---|---|---|
371 | Turns out that was unnecessary since match_infos are compared by file name and not full path. |
@labath sorry for the repeated messages. I believe this is ready to be merged, right?
clang-format not found in user's PATH; not linting file.