Fix ObjectFileELF to determine architectures independent of host.
authorTodd Fiala <todd.fiala@gmail.com>
Fri, 27 Jun 2014 16:52:49 +0000 (16:52 +0000)
committerTodd Fiala <todd.fiala@gmail.com>
Fri, 27 Jun 2014 16:52:49 +0000 (16:52 +0000)
commitb91de7861c0a466f52d10d9b203f8374a1296224
tree9e4b99e987137c826228e03592358957436404cc
parent642d2e78b3b1bbb71df478de3eed9979378c983a
Fix ObjectFileELF to determine architectures independent of host.

Previously ObjectFileELF was simplifying and assuming the object file it was
looking at was the same as the host architecture/triple.  This would break
attempts to run, say, lldb on MacOSX against lldb-gdbserver on Linux since
the MacOSX lldb would say that the linux elf file was really an Apple MacOSX
architecture.  Chaos would ensue.

This change allows the elf file to parse ELF notes for Linux, FreeBSD and
NetBSD, and determine the OS appropriately from them.  It also initializes
the OS type from the ELF header OSABI if it is set (which it is for FreeBSD
but not for Linux).

Added a test with freebsd and linux images that verify that
'(lldb) image list -t -A' prints out the expected architecture for each.

llvm-svn: 211907
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/test/functionalities/object-file/TestImageListMultiArchitecture.py [new file with mode: 0644]
lldb/test/functionalities/object-file/ls-freebsd-10.0-x86_64 [new file with mode: 0755]
lldb/test/functionalities/object-file/sleep-ubuntu-14.04-x86_64 [new file with mode: 0755]