Page MenuHomePhabricator

Make TestHelloWorld.py to pass remotely on Linux.
AbandonedPublic

Authored by ovyalov on Feb 11 2015, 4:32 PM.

Details

Reviewers
vharron
clayborg
Summary

TestHelloWorld uses stack unwinding to get a thread's backtrace.
In case of remote run the test should use system libraries (like libc.so) from a target in order to lookup symbols correctly:

  • Added optional environment variable LLDB_IMAGE_SEARCH_PATH that represents root directory for custom search paths.
  • lldbtest.addImageSearchPaths registers custom target image search paths for directories that contain at least one file.

In total, the test uses for unwinding a downloaded version of libc.so instead of local one.

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 19794.Feb 11 2015, 4:32 PM
ovyalov retitled this revision from to Make TestHelloWorld.py to pass remotely on Linux..
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added reviewers: vharron, clayborg.
ovyalov added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Feb 11 2015, 4:50 PM
clayborg edited edge metadata.

looks good.

By the way: on MacOSX we have UUIDs in all of our binaries, so our IDE just gives us all of the files that it builds by adding them to our target. They first create a target, then they add all built modules using:

lldb::SBModule module = target.AddModule (const char *path, const char *triple, const char *uuid_cstr, const char *symfile);

Then when we run, we discover, via the dynamic loader, that we need some binary whose UUID is 1234. Since we were given the local copy of the binary already, we can just match it up and not worry about search paths. Any files that we weren't given binaries for, we expect them to be in the sys root of the platform (where all the /usr/lib binaries are cached, etc). So we expect any binaries that were locally built to be supplied to us (which can be done in the test suite for example) and all others to be in the SDK and the platform plug-in will locate them.

This revision is now accepted and ready to land.Feb 11 2015, 4:50 PM

looks good.

By the way: on MacOSX we have UUIDs in all of our binaries, so our IDE just gives us all of the files that it builds by adding them to our target. They first create a target, then they add all built modules using:

lldb::SBModule module = target.AddModule (const char *path, const char *triple, const char *uuid_cstr, const char *symfile);

Then when we run, we discover, via the dynamic loader, that we need some binary whose UUID is 1234. Since we were given the local copy of the binary already, we can just match it up and not worry about search paths. Any files that we weren't given binaries for, we expect them to be in the sys root of the platform (where all the /usr/lib binaries are cached, etc). So we expect any binaries that were locally built to be supplied to us (which can be done in the test suite for example) and all others to be in the SDK and the platform plug-in will locate them.

Thank you for context. UUID in some way does simplify correct symbols discovery.
Does it mean that every time you re-build a binary it gets a new UUID assigned (if it's a part of compilation or linker stage)?

It is part of the linker stage so each rebuild should produce an unique UUID. Note, the MacOS X linker actually makes the UUID by checksumming the binary - minus some obvious bits the linker knows to contain timestamps - so if you rebuild the same sources with the same compiler & compiler options, you will get the same UUID. This can cause some confusion, for instance changing just a comment and rebuilding will produce the same UUID... That is an implementation detail, however, and usually doesn't cause problems...

Jim

emaste added a subscriber: emaste.Feb 12 2015, 11:13 AM

Thank you for context. UUID in some way does simplify correct symbols discovery.
Does it mean that every time you re-build a binary it gets a new UUID assigned (if it's a part of compilation or linker stage)?

Note that GNU toolchains do the same, it's called build-ID. The actual algorithm is implementation-defined, but I think generally includes all content so unlike OS X changing debug info etc. will produce a new build-ID. When I last looked the gold linker just hashes the whole object.

ovyalov abandoned this revision.Feb 24 2015, 6:07 PM