This is an archive of the discontinued LLVM Phabricator instance.

[lldb/API] Make Launch(Simple) use args and env from target properties
ClosedPublic

Authored by friss on Mar 11 2020, 10:17 PM.

Details

Summary

When no arguments or environment is provided to SBTarget::LaunchSimple,
make it use the values surrently set in the target properties. You can
get the current behavior back by passing an empty array instead.

It seems like using the target defaults is a much more intuitive
behavior for those APIs. It's unllikely that anyone passed NULL/None to
this API after having set properties in order to explicitely ignore them.

One direct application of this change is within the testsuite. We have
plenty of tests calling LaunchSimple and passing None as environment.
If you passed --inferior-env to dotest.py to, for example, set
(DY)LD_LIBRARY_PATH, it wouldn't be taken into account.

Diff Detail

Event Timeline

friss created this revision.Mar 11 2020, 10:17 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 11 2020, 10:17 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
friss updated this revision to Diff 249834.Mar 11 2020, 10:19 PM

Remove unrelated change commited by accident

friss removed a reviewer: Restricted Project.Mar 11 2020, 10:20 PM
friss removed a project: Restricted Project.
friss removed a subscriber: libcxx-commits.
labath accepted this revision.Mar 12 2020, 4:59 AM

sounds reasonable.

lldb/include/lldb/API/SBTarget.h
130–133

Make it explicit that "isn't provided" means nullptr. And maybe mention that one can get an empty environment by passing an empty array. And do the same for the argv array. :)

This revision is now accepted and ready to land.Mar 12 2020, 4:59 AM
friss added a comment.Mar 12 2020, 3:48 PM

This is somewhat useless without D76009 because the default LaunchInfo doesn't get populated with the environment without it. I'll wait for a resolution there before landing this.

This revision was automatically updated to reflect the committed changes.