2015-03-17 22:51:21 +00:00
|
|
|
add_lldb_unittest(UtilityTests
|
2017-11-13 16:16:33 +00:00
|
|
|
ArchSpecTest.cpp
|
2018-02-23 22:08:38 +00:00
|
|
|
CleanUpTest.cpp
|
2017-02-05 00:44:54 +00:00
|
|
|
ConstStringTest.cpp
|
Add Utility/Environment class for handling... environments
Summary:
There was some confusion in the code about how to represent process
environment. Most of the code (ab)used the Args class for this purpose,
but some of it used a more basic StringList class instead. In either
case, the fact that the underlying abstraction did not provide primitive
operations for the typical environment operations meant that even a
simple operation like checking for an environment variable value was
several lines of code.
This patch adds a separate Environment class, which is essentialy a
llvm::StringMap<std::string> in disguise. To standard StringMap
functionality, it adds a couple of new functions, which are specific to
the environment use case:
- (most important) envp conversion for passing into execve() and likes.
Instead of trying to maintain a constantly up-to-date envp view, it
provides a function which creates a envp view on demand, with the
expectation that this will be called as the very last thing before
handing the value to the system function.
- insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value)
pair and inserts it into the environment map.
- compose(value_type KeyValue) - takes a map entry and converts in back
into "KEY=VALUE" representation.
With this interface most of the environment-manipulating code becomes
one-liners. The only tricky part was maintaining compatibility in
SBLaunchInfo, which expects that the environment entries are accessible
by index and that the returned const char* is backed by the launch info
object (random access into maps is hard and the map stores the entry in
a deconstructed form, so we cannot just return a .c_str() value). To
solve this, I have the SBLaunchInfo convert the environment into the
"envp" form, and use it to answer the environment queries. Extra code is
added to make sure the envp version is always in sync.
(This also improves the layering situation as Args was in the Interpreter module
whereas Environment is in Utility.)
Reviewers: zturner, davide, jingham, clayborg
Subscribers: emaste, lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D41359
llvm-svn: 322174
2018-01-10 11:57:31 +00:00
|
|
|
EnvironmentTest.cpp
|
2017-08-22 18:36:12 +00:00
|
|
|
JSONTest.cpp
|
2017-03-03 20:56:28 +00:00
|
|
|
LogTest.cpp
|
2017-02-20 11:35:33 +00:00
|
|
|
NameMatchesTest.cpp
|
2017-05-12 04:51:55 +00:00
|
|
|
StatusTest.cpp
|
2015-03-17 22:51:21 +00:00
|
|
|
StringExtractorTest.cpp
|
2017-06-27 10:45:31 +00:00
|
|
|
StructuredDataTest.cpp
|
2017-03-22 17:33:23 +00:00
|
|
|
TildeExpressionResolverTest.cpp
|
2016-11-25 11:58:44 +00:00
|
|
|
TimeoutTest.cpp
|
2017-06-29 14:32:17 +00:00
|
|
|
TimerTest.cpp
|
2015-03-17 22:51:21 +00:00
|
|
|
UriParserTest.cpp
|
2017-02-16 19:38:21 +00:00
|
|
|
VASprintfTest.cpp
|
2017-02-01 22:17:00 +00:00
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
lldbUtility
|
2017-06-29 13:02:11 +00:00
|
|
|
lldbUtilityHelpers
|
2017-02-17 10:19:46 +00:00
|
|
|
LINK_COMPONENTS
|
|
|
|
Support
|
2015-03-17 22:51:21 +00:00
|
|
|
)
|
2017-06-27 10:45:31 +00:00
|
|
|
|
|
|
|
add_unittest_inputs(UtilityTests
|
|
|
|
StructuredData-basic.json
|
|
|
|
)
|