[lldb-dev] breakpoint not hit on ppc64

Konrad Kleine via lldb-dev lldb-dev at lists.llvm.org
Wed Mar 25 01:48:08 PDT 2020


Hi,

I'm on a machine like this:

    Linux <MACHINENAME> #1 SMP Tue Feb 18 16:40:30 EST 2020 ppc64
ppc64 ppc64 GNU/Linux
    Red Hat Enterprise Linux Server release 7.8 (Maipo)

It seems that on PPC64 breakpoints are not able to hit, and it doesn't
matter which strategy you choose. Here's an example:

    $ scl enable llvm-toolset-9.0 bash

    $ clang++ --version
    clang version 9.0.1 (Red Hat 9.0.1-1.el7)
    Target: powerpc64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /opt/rh/llvm-toolset-9.0/root/usr/bin

    $ echo "int main() { return 42; }" > ~/42.cpp

    $ clang++ -g ~/42.cpp

Here's an example to set breakpoint by function name:

    $ lldb -x -b -o "b main" -o "run" a.out
    (lldb) target create "a.out"
    Current executable set to 'a.out' (powerpc64le).
    (lldb) b main
    Breakpoint 1: 2 locations.
    (lldb) run
    Process 3279 exited with status = 42 (0x0000002a)

    Process 3279 launched: '/root/a.out' (powerpc64le)
    (lldb)

Please also notice that the process is identified as "powerpc64le"
even though this is a "powerpc64" machine.

The "-b" flag doesn't cause lldb to exit for some reason as well.

I hope someone with more experience than me with ppc64 can enlighten this:

Here are some findings:

* I'm testing now if the error remains to exist in LLVM master (a day
old or so). Then I will continue with looking at the findings further
below.

* Apparently ‘target list’ gets the architecture wrong and outputs
“ppc64le” instead of “ppc64”. Tom S. found out that this is because
there’s a problem with a list of architectures that’s being search
linearly: https://github.com/llvm/llvm-project/blob/0ce3b710b49c7b9ab837d220547aec92564dd78d/lldb/source/Utility/ArchSpec.cpp#L402

* I found that maybe the bug was introduced by this patch but I'm
still validating this: Add initial support to PowerPC64 little endian
(POWER8)
https://reviews.llvm.org/D36804

* I have written a test that just reproduces the wrong identification
of ppc64le instead of ppc64:

https://gist.github.com/kwk/a5febc24fae07f23022d2ff430667cfb



More information about the lldb-dev mailing list