This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [gdb-remote client] Support switching PID along with TID
ClosedPublic

Authored by mgorny on Apr 11 2021, 5:04 AM.

Details

Summary

Extend the SetCurrentThread() method to support specifying an alternate
PID to switch to. This makes it possible to issue requests to forked
processes.

Diff Detail

Event Timeline

mgorny requested review of this revision.Apr 11 2021, 5:04 AM
mgorny created this revision.
mgorny updated this revision to Diff 337403.Apr 14 2021, 4:25 AM

Rebase on top of the refactor. Remove m_override_pid in favor of controlling m_curr_pid and m_curr_pid_run.

JDevlieghere added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
345–346

I generally prefer a struct with named fields over an unnamed pair. Do you think that would help readability here?

587–589

Maybe a comment how these two are different?

mgorny added inline comments.Jul 1 2021, 2:16 PM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
345–346

While I was typing that I'm fine either way, I've noticed that the function takes tid+pid but returns pid+tid, so I suppose it could be confusing. I'll switch over to structs.

mgorny updated this revision to Diff 356199.Jul 2 2021, 9:48 AM
mgorny marked 2 inline comments as done.

Rebase. Use a struct for the PID+TID return value.

JDevlieghere accepted this revision.Jul 2 2021, 9:59 AM

Thanks! LGTM

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
589–590

Can we please make these doxygen comments /// and put them above the variable? The trailing comments really don't work well with the 80-col limit.

This revision is now accepted and ready to land.Jul 2 2021, 9:59 AM
mgorny marked an inline comment as done.Jul 2 2021, 12:10 PM

I'll do one more test run and push, thanks!

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
589–590

Sure, done.

This revision was landed with ongoing or failed builds.Jul 2 2021, 12:34 PM
This revision was automatically updated to reflect the committed changes.
mgorny marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2021, 12:34 PM