[lldb-dev] [Bug 40287] New: lldb cannot debug an i386 elf (32 bit) executable on an amd64 platform, (FreeBSD 11.1 and 11.2)

via lldb-dev lldb-dev at lists.llvm.org
Thu Jan 10 13:42:08 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40287

            Bug ID: 40287
           Summary: lldb cannot debug an i386 elf (32 bit) executable on
                    an amd64 platform, (FreeBSD 11.1 and 11.2)
           Product: lldb
           Version: 6.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: john.hazard at fisglobal.com
                CC: llvm-bugs at lists.llvm.org

I posted this over a week ago on the BSD forums and while I had 50+ views, not
one reply.  
This use to work on FreeBSD 11.0 which I believe was version 3.x.
I have distilled the problem down to the simplest example below.  As a note, I
also tried it on the executable BSD utility uptime from a 32bit, i386, platform
snd it fails

prompt>uname -mKr
11.2-RELEASE amd64 1102000
prompt>

Code:
prompt>cat hello.cpp
#include<stdio.h>
int main()
{
    printf("Hello World\n");
}
prompt>

Building (CLANG with -m32 and verbose)

prompt>clang++ -m32 -v -static hello.cpp
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM
6.0.0)
Target: i386-unknown-freebsd11.2
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/clang++" -cc1 -triple i386-unknown-freebsd11.2 -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -discard-value-names -main-file-name
hello.cpp -static-define -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu i486
-dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib/clang/6.0.0
-internal-isystem /usr/include/c++/v1 -fdeprecated-macro
-fdebug-compilation-dir
/srctree/release_11_11_b0_test/ridsbase/batch_params/libbatch_params
-ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gnustep -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/hello-669b69.o -x c++ hello.cpp
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target
x86_64-unknown-freebsd11.2
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/v1
 /usr/lib/clang/6.0.0/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -Bstatic -m elf_i386_fbsd -o a.out
/usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbeginT.o -L/usr/lib32
/tmp/hello-669b69.o -lc++ -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
/usr/lib32/crtend.o /usr/lib32/crtn.o
prompt>

Running the program checking the file type:

prompt>file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically
linked, for FreeBSD 11.2, FreeBSD-style, not stripped
prompt>./a.out
Hello World
prompt>

prompt>lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (i386).
(lldb) r
Process 25772 launching
Process 25772 launched: './a.out' (i386)
Process 25772 stopped
* thread #1, name = 'a.out', stop reason = signal SIGBUS: hardware error
    frame #0: 0xffffffff
error: Bad address
(lldb)

It runs under gdb.
And of course lldb works beautifully on X86-64 elf format.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190110/a285bbe3/attachment.html>


More information about the lldb-dev mailing list