Page MenuHomePhabricator

[LLDB/API] Expose args and env from SBProcessInfo.
AcceptedPublic

Authored by brucem on Fri, Jun 4, 1:34 AM.

Details

Reviewers
mib
Group Reviewers
Restricted Project
Commits
rG8d33437d030a: [LLDB/API] Expose args and env from SBProcessInfo.
Summary

This is another step towards implementing the equivalent of
platform process list and related functionality.

uint32_t is used for the argument count and index despite the
underlying value being size_t to be consistent with other
index-based access to arguments.

Diff Detail

Event Timeline

brucem requested review of this revision.Fri, Jun 4, 1:34 AM
brucem created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFri, Jun 4, 1:34 AM
teemperor added a reviewer: Restricted Project.Fri, Jun 4, 2:01 AM
mib accepted this revision as: mib.Fri, Jun 4, 2:02 AM
mib added a subscriber: mib.

LGTM!

This revision is now accepted and ready to land.Fri, Jun 4, 2:02 AM
teemperor added inline comments.
lldb/bindings/interface/SBProcessInfo.i
78

Can you add this line here?

%feature("autodoc", "GetArgumentAtIndex(int index) -> string") GetArgumentAtIndex;

Otherwise the Python docs will mention that this returns const char * which is always kinda weird for users to see.

brucem updated this revision to Diff 349895.Fri, Jun 4, 9:28 AM

Rebase and address feedback.

brucem marked an inline comment as done.Fri, Jun 4, 9:31 AM
brucem added inline comments.
lldb/bindings/interface/SBProcessInfo.i
78

I changed this to have the whole thing be an autodoc rather than both an autodoc and a docstring. This isn't consistently done throughout the code though and in this case, the resulting syntax help is a bit different.

This revision was landed with ongoing or failed builds.Fri, Jun 4, 11:43 PM
This revision was automatically updated to reflect the committed changes.
brucem marked an inline comment as done.
brucem reopened this revision.Sat, Jun 5, 1:54 AM

Not sure why this failed. Is it perhaps a difference where some processes have args including the executable and some do not?

This revision is now accepted and ready to land.Sat, Jun 5, 1:54 AM

Not sure why this failed. Is it perhaps a difference where some processes have args including the executable and some do not?

Do you have the bot failures around for that? (Or, the platform at least so I could reproduce it locally?)

lldb/bindings/interface/SBProcessInfo.i
78

Sure, let's see how it looks on the website and then we can decide what works.

It failed because on macOS, the underlying args contains argv0 while on Linux it does not. So my test that checked that GetNumArguments is 1 fails on macOS, since there are 2.

Ideally, each platform would agree on whether or not the argv0 was included in the args ... or I can modify the test to check that the last argument is --abc.

(I've just been busy this week, so I hadn't gotten back to this.)