This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix ^C handling in IOHandlerProcessSTDIO
ClosedPublic

Authored by labath on Mar 17 2022, 7:13 AM.

Details

Summary

D120762 accidentally moved the interrupt check into the block which was
reading stdio. This meant that a ^C only took effect after a regular
character has been pressed.

This patch fixes that and adds a (pexpect) test.

Diff Detail

Event Timeline

labath created this revision.Mar 17 2022, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 7:13 AM
labath requested review of this revision.Mar 17 2022, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 7:13 AM

I also found this in the process of looking at https://github.com/llvm/llvm-project/issues/53673 (different issue same area).

Bisected it to the same change you got, and this fixes things for me too.

Do you know if the pexpect test will cleanup the debugee process if some part of the test fails? Or will we have that hanging around in its infinite loop?

This revision is now accepted and ready to land.Mar 17 2022, 8:20 AM
This revision was landed with ongoing or failed builds.Mar 17 2022, 11:52 AM
This revision was automatically updated to reflect the committed changes.

Do you know if the pexpect test will cleanup the debugee process if some part of the test fails? Or will we have that hanging around in its infinite loop?

It won't, but the debuggee is not doing an infinite loop. The while (std::getline(std::cin, str)) thingy will terminate when it reaches EOF, which will happen when lldb gets killed at the latest (if lldb is still somewhat functioning, it will kill the inferior first, when *it* detects the EOF).