Crash on branch to address with breakpoint set
tommy9 opened this issue ยท 3 comments
Had this occur when setting a breakpoint at the start of a loop, then stepping through the code until it branched back to the initial breakpoint. b2 Debug exits without warning.
To reproduce, paste the following text in and RUN
the program:
10 FOR O=0 TO 3 STEP 3
20 P%=&2000
30 [OPT O
40 .START LDA #00
50 BEQ START
60 ]
70 NEXT
80 CALL START
Then set a breakpoint on execute address $2000. Press the Step In button a couple of times to get execution back to $2000 and b2 crashes.
I've extracted some relevant looking bits from the crash log:
Process: b2 [72104]
Path: /Volumes/VOLUME/*/b2 Debug.app/Contents/MacOS/b2
Identifier: com.tom-seddon.b2
Version: 20240423-163255-0fcf3c3 (20240423-163255-0fcf3c3)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 502
Date/Time: 2024-05-12 09:45:50.5094 +0100
OS Version: macOS 14.4.1 (23E224)
Report Version: 12
Anonymous UUID: 18F4F6F8-A74A-22F5-9301-22A3D5ADE52C
Sleep/Wake UUID: B80AD04F-BC86-46C1-82AA-E18EEAD52811
Time Awake Since Boot: 260000 seconds
Time Since Wake: 7617 seconds
System Integrity Protection: enabled
Crashed Thread: 20 BeebThread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000058
Exception Codes: 0x0000000000000001, 0x0000000000000058
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [72104]
VM Region Info: 0x58 is not in any region. Bytes before following region: 4484173736
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 10b471000-10b99d000 [ 5296K] r-x/r-x SM=COW /var/folders/*/b2 Debug.app/Contents/MacOS/b2
Thread 0:: Main Thread Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x7ff8104e4609 _platform_memmove$VARIANT$Haswell + 41
1 b2 0x10b6fc9b8 TVOutput::CopyTexturePixels(void*, unsigned long) const + 56
2 b2 0x10b49c587 BeebWindow::EndUpdateTVTexture(bool, BeebWindow::VBlankRecord*, void*, int) + 183
3 b2 0x10b49ca66 BeebWindow::HandleVBlank(unsigned long long) + 534
4 b2 0x10b49e910 BeebWindow::HandleVBlank(VBlankMonitor*, void*, unsigned long long) + 128
5 b2 0x10b4a65a1 BeebWindows::HandleVBlank(VBlankMonitor*, void*, unsigned long long) + 225
6 b2 0x10b4e429a main2(int, char**, std::__1::shared_ptr<MessageList> const&) + 11530
7 b2 0x10b4e148d main + 221
8 dyld 0x7ff81012c366 start + 1942
.
.
.
Thread 20 Crashed:: BeebThread
0 b2 0x10b529ee5 BBCMicro::DebugHandleStep() + 21
1 b2 0x10b586b3b unsigned int BBCMicro::UpdateTemplated<266u>(VideoDataUnit*, SoundDataUnit*) + 699
2 b2 0x10b48d2f7 BeebThread::ThreadMain() + 4087
3 b2 0x10b49207e void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, std::__1::__bind<void (BeebThread::*)(), BeebThread*>>>(void*) + 62
4 libsystem_pthread.dylib 0x7ff8104b818b _pthread_start + 99
5 libsystem_pthread.dylib 0x7ff8104b3ae3 thread_start + 15
.
.
.
Thread 20 crashed with X86 Thread State (64-bit):
rax: 0x0728d55a331200fd rbx: 0x00007fcb20581580 rcx: 0x00007fcb20960018 rdx: 0x0000000000000000
rdi: 0x00007fcb32841a00 rsi: 0x0000000000000000 rbp: 0x000070000e9c9600 rsp: 0x000070000e9c95f0
r8: 0x000070000e9c9328 r9: 0x000070000e9c95a0 r10: 0x00000000000003e7 r11: 0x00000fcb1201be2b
r12: 0x00007fcb20581505 r13: 0x00007fcb32841a00 r14: 0x00007fcb32841a00 r15: 0x000000003182d700
rip: 0x000000010b529ee5 rfl: 0x0000000000010297 cr2: 0x0000000000000058
Logical CPU: 0
Error Code: 0x00000004 (no mapping for user data read)
Trap Number: 14
Thread 20 instruction stream:
f9 42 00 4c 89 f7 31 c0-e8 1e e5 ff ff 41 f6 c7 .B.L..1......A..
04 74 2b 80 7b 22 03 77-25 49 8b 14 24 41 0f b7 .t+.{".w%I..$A..
8e b0 01 00 00 48 8d 35-6e f9 42 00 4c 89 f7 31 .....H.5n.B.L..1
c0 5b 41 5c 41 5e 41 5f-5d e9 ed e4 ff ff 5b 41 .[A\A^A_].....[A
5c 41 5e 41 5f 5d c3 0f-1f 40 00 55 48 89 e5 41 \A^A_]...@.UH..A
56 53 49 89 fe 48 8b 8f-30 25 00 00 48 8b 51 08 VSI..H..0%..H.Q.
[48]8b 42 58 8b 71 04 83-fe 02 74 26 83 fe 01 0f H.BX.q....t&.... <==
85 9e 00 00 00 8a 5a 22-80 fb 06 74 33 80 fb 05 ......Z"...t3...
0f 85 8d 00 00 00 48 8b-10 48 8d 35 fb f8 42 00 ......H..H.5..B.
eb 10 80 7a 22 05 75 7b-48 8b 10 48 8d 35 0c f9 ...z".u{H..H.5..
42 00 4c 89 f7 31 c0 5b-41 5e 5d e9 7b e4 ff ff B.L..1.[A^].{...
0f b7 72 28 8b 50 08 48-85 c9 74 1d 66 85 d2 48 ..r(.P.H..t.f..H
Thanks for the report! I've pushed a fix for this and there should be a new prerelease version on its way.
(No ETA for the macOS versions unfortunately. The CI system produce the Windows zips pretty quickly but the macOS ones often take a lot longer.)
Brilliant, thanks for the super quick fix! I confirm it works for me. ๐