This is an archive of the discontinued LLVM Phabricator instance.

LLGS: fix tracking execve on linux
ClosedPublic

Authored by labath on Jul 24 2019, 6:25 AM.

Details

Summary

Due to a logic error, lldb-server ended up asserting/crashing every time
the debugged process attempted an execve(). This fixes the error, and
extends TestExec to work on other platforms too. The "extension"
consists of avoiding non-standard posix_spawn extensions and using the
classic execve() call, which should be available on any platform that
actually supports re-execing. I change the test decorator from
@skipUnlessDarwin to @skipIfWindows.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jul 24 2019, 6:25 AM
clayborg accepted this revision.Jul 24 2019, 10:49 AM
This revision is now accepted and ready to land.Jul 24 2019, 10:49 AM

Is this not going to be racy on other platforms? Or do all platforms stop at entry point once a program has been exec'ed? I am worried we might miss the breakpoint.

jasonmolenda accepted this revision.Jul 24 2019, 7:12 PM

LGTM. I don't think the use of the posix_spawn API are important for the test case to exercise. If posix_spawn had a problem on darwin systems, lldb/debugserver's process launching would turn it up pretty quick.

Is this not going to be racy on other platforms? Or do all platforms stop at entry point once a program has been exec'ed? I am worried we might miss the breakpoint.

stopping on exec is a pretty standard feature of all ptrace-ish implementations, so I think all platforms should be able to implement that. Whether they actually implement it is a different question, and I wouldn't be surprised if this test ends up failing on some BSDs for example.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2019, 11:38 PM