[Bug 257750] lldb p command crashes on Raspberry Pi 4

[email protected]
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257750

            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: [email protected]
          Reporter: [email protected]

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 = atoi (argv[1]);
        randx = initial;
        k = atoi (argv[2]);
        p = atoi (argv[3]);

        i = 1;
        randx = (k * randx) % p;
        while (randx != initial)
        {
                if (i < 5) printf ("count = %d randx = %d\n", i, randx);
                randx = (k * randx) % p;
                i++;
        }
        printf ("count = %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 = rand`main + 24 at rand.c:11:18, address =
0x000000000021089c
(lldb) r 2357 109 100000
Process 1673 launching
Process 1673 launched: '/home/doug/rand/rand' (aarch64)
Process 1673 stopped
* thread #1, name = 'rand', stop reason = breakpoint 1.1
    frame #0: 0x000000000021089c rand`main(argc=4, argv=0x0000ffffffffea68) at
rand.c:11:18
   8            int i, randx, k, p;
   9            int initial;
   10   
-> 11           initial = atoi (argv[1]);
   12           randx = initial;
   13           k = atoi (argv[2]);
   14           p = atoi (argv[3]);
(lldb) n
Process 1673 stopped
* thread #1, name = 'rand', stop reason = step over
    frame #0: 0x00000000002108ac rand`main(argc=4, argv=0x0000ffffffffea68) at
rand.c:12:10
   9            int initial;
   10   
   11           initial = atoi (argv[1]);
-> 12           randx = initial;
   13           k = atoi (argv[2]);
   14           p = atoi (argv[3]);
   15   
(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 
1.      HandleCommand(command = "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% 


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 = rand`main + 22 at rand.c:11:25, address =
0x0000000000201906
(lldb) r 2357 109 100000
Process 60280 launching
Process 60280 launched: '/home/doug/rand/rand' (x86_64)
Process 60280 stopped
* thread #1, name = 'rand', stop reason = breakpoint 1.1
    frame #0: 0x0000000000201906 rand`main(argc=4, argv=0x00007fffffffea68) at
rand.c:11:25
   8            int i, randx, k, p;
   9            int initial;
   10   
-> 11           initial = atoi (argv[1]);
   12           randx = initial;
   13           k = atoi (argv[2]);
   14           p = atoi (argv[3]);
(lldb) n
Process 60280 stopped
* thread #1, name = 'rand', stop reason = step over
    frame #0: 0x0000000000201916 rand`main(argc=4, argv=0x00007fffffffea68) at
rand.c:12:17
   9            int initial;
   10   
   11           initial = atoi (argv[1]);
-> 12           randx = initial;
   13           k = atoi (argv[2]);
   14           p = atoi (argv[3]);
   15   
(lldb) p initial
(int) $0 = 2357
(lldb) 


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

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.