This is an archive of the discontinued LLVM Phabricator instance.

Use getProcessTriple inside HostInfoBase::ComputeHostArchitectureSupport instead of getDefaultTargetTriple
ClosedPublic

Authored by ovyalov on Feb 25 2015, 5:38 PM.

Details

Summary

Make lldb (lldb-server or debugserver) to get architecture information using getProcessTriple instead of getDefaultTargetTriple.
It seems getProcessTriple produces more accurate results - when cross-compiling for Android x86 (LLVM_TARGET_ARCH=X86) getDefaultTargetTriple yields 'x86_64--linux-android' whereas getProcessTriple() returns a valid 'i386--linux-android' which is compatible with inferiors' architecture.

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 20720.Feb 25 2015, 5:38 PM
ovyalov retitled this revision from to Use getProcessTriple inside HostInfoBase::ComputeHostArchitectureSupport instead of getDefaultTargetTriple.
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added reviewers: vharron, clayborg, tberghammer.
ovyalov added a subscriber: Unknown Object (MLST).

Maybe I'm confusing what you're trying to do, but HostInfoBase::GetArchitecture() is supposed to return the triple of the host, by definition. If you want something that is compatible with a remote, you need a different function, maybe in Platform?

vharron accepted this revision.Feb 25 2015, 5:57 PM
vharron edited edge metadata.
This revision is now accepted and ready to land.Feb 25 2015, 5:57 PM

I think i get it, when you said inferior it made me think you were trying
to return the triple of the remote.

Anyway, this change looks correct to me, getProcessTriple() returns
LLVM_HOST_TRIPLE which is defined as "The triple of the process that LLVM
will run in", which matches what GetArchitecture should return

I think i get it, when you said inferior it made me think you were trying
to return the triple of the remote.

Sorry for confusion - I mentioned inferior here as rather a test case that allowed me to verify this change works properly on Android.

Anyway, this change looks correct to me, getProcessTriple() returns
LLVM_HOST_TRIPLE which is defined as "The triple of the process that LLVM
will run in", which matches what GetArchitecture should return

tberghammer accepted this revision.Feb 26 2015, 3:34 AM
tberghammer edited edge metadata.
clayborg accepted this revision.Feb 26 2015, 9:40 AM
clayborg edited edge metadata.

Looks good.

ovyalov closed this revision.Feb 26 2015, 12:05 PM

AFFECTED FILES

/lldb/trunk/source/Host/common/HostInfoBase.cpp

USERS

ovyalov (Author)

http://reviews.llvm.org/rL230674