Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2021 00:26:26 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 257750] lldb p command crashes on Raspberry Pi 4
Message-ID:  <bug-257750-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257750

            Bug ID: 257750
           Summary: lldb p command crashes on Raspberry Pi 4
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: bc979@lafn.org

The following code - compile with cc -g

#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
        int i, randx, k, p;
        int initial;

        initial =3D atoi (argv[1]);
        randx =3D initial;
        k =3D atoi (argv[2]);
        p =3D atoi (argv[3]);

        i =3D 1;
        randx =3D (k * randx) % p;
        while (randx !=3D initial)
        {
                if (i < 5) printf ("count =3D %d randx =3D %d\n", i, randx);
                randx =3D (k * randx) % p;
                i++;
        }
        printf ("count =3D %d\n", i);
}

when run with lldb on Raspberry Pi 4 gives:

test% lldb rand
(lldb) target create "rand"
Current executable set to '/home/doug/rand/rand' (aarch64).
(lldb) b main
Breakpoint 1: where =3D rand`main + 24 at rand.c:11:18, address =3D
0x000000000021089c
(lldb) r 2357 109 100000
Process 1673 launching
Process 1673 launched: '/home/doug/rand/rand' (aarch64)
Process 1673 stopped
* thread #1, name =3D 'rand', stop reason =3D breakpoint 1.1
    frame #0: 0x000000000021089c rand`main(argc=3D4, argv=3D0x0000ffffffffe=
a68) at
rand.c:11:18
   8            int i, randx, k, p;
   9            int initial;
   10=20=20=20
-> 11           initial =3D atoi (argv[1]);
   12           randx =3D initial;
   13           k =3D atoi (argv[2]);
   14           p =3D atoi (argv[3]);
(lldb) n
Process 1673 stopped
* thread #1, name =3D 'rand', stop reason =3D step over
    frame #0: 0x00000000002108ac rand`main(argc=3D4, argv=3D0x0000ffffffffe=
a68) at
rand.c:12:10
   9            int initial;
   10=20=20=20
   11           initial =3D atoi (argv[1]);
-> 12           randx =3D initial;
   13           k =3D atoi (argv[2]);
   14           p =3D atoi (argv[3]);
   15=20=20=20
(lldb) p initial
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include =
the
crash backtrace.
Stack dump:
0.      Program arguments: lldb rand=20
1.      HandleCommand(command =3D "p initial")
#0 0x00000000034d9a4c PrintStackTrace
/usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
#1 0x00000000034d7fb0 __cxx_atomic_store<CallbackAndCookie::Status>
/usr/obj/usr/src/arm64.aarch64/tmp/usr/include/c++/v1/atomic:985:5
#2 0x00000000034d7fb0 store
/usr/obj/usr/src/arm64.aarch64/tmp/usr/include/c++/v1/atomic:1594:10
#3 0x00000000034d7fb0 RunSignalHandlers
/usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:70:16
#4 0x00000000034da070 SignalHandler
/usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#5 0x000000004457e994 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
Segmentation fault (core dumped)
test%=20


When run on amd64 yields:

master% lldb rand
(lldb) target create "rand"
Current executable set to '/home/doug/rand/rand' (x86_64).
(lldb) b main
Breakpoint 1: where =3D rand`main + 22 at rand.c:11:25, address =3D
0x0000000000201906
(lldb) r 2357 109 100000
Process 60280 launching
Process 60280 launched: '/home/doug/rand/rand' (x86_64)
Process 60280 stopped
* thread #1, name =3D 'rand', stop reason =3D breakpoint 1.1
    frame #0: 0x0000000000201906 rand`main(argc=3D4, argv=3D0x00007fffffffe=
a68) at
rand.c:11:25
   8            int i, randx, k, p;
   9            int initial;
   10=20=20=20
-> 11           initial =3D atoi (argv[1]);
   12           randx =3D initial;
   13           k =3D atoi (argv[2]);
   14           p =3D atoi (argv[3]);
(lldb) n
Process 60280 stopped
* thread #1, name =3D 'rand', stop reason =3D step over
    frame #0: 0x0000000000201916 rand`main(argc=3D4, argv=3D0x00007fffffffe=
a68) at
rand.c:12:17
   9            int initial;
   10=20=20=20
   11           initial =3D atoi (argv[1]);
-> 12           randx =3D initial;
   13           k =3D atoi (argv[2]);
   14           p =3D atoi (argv[3]);
   15=20=20=20
(lldb) p initial
(int) $0 =3D 2357
(lldb)=20


This appears to be the same as 248745 which is marked as Closed FIXED.  fr v
works fine on both architectures.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-257750-7>