Simple demo: #include <stdio.h> int main() { puts("hello world"); return 42; } Compiled as: $ clang -O0 -g -o test test.c $ lldb -O 'breakpoint set -n main' test (lldb) r Process 19470 launched: '/home/martin/forums/test' (x86_64) Process 19470 stopped * thread #1, name = 'test', stop reason = breakpoint 1.1 frame #0: 0x00000000002016bf test`main at test.c:4:2 1 #include <stdio.h> 2 3 int main() { -> 4 puts("hello world"); 5 return 42; 6 } (lldb) breakpoint list Current breakpoints: 1: name = 'main', locations = 1, resolved = 1, hit count = 1 1.1: where = test`main + 15 at test.c:4:2, address = 0x00000000002016bf, resolved, hit count = 1 Works as expected. However breakpoint is not hit with 32b version of the same program: $ clang -m32 -O0 -g -o test test.c $ lldb -a i386 -O 'breakpoint set -n main' test (lldb) breakpoint set -n main Breakpoint 1: no locations (pending). Breakpoint set in dummy target, will get copied into future targets. (lldb) target create --arch=i386 "test" Current executable set to '/home/martin/forums/test' (i386). (lldb) r Process 19490 launched: '/home/martin/forums/test' (i386) hello world Process 19490 exited with status = 42 (0x0000002a) (lldb) Doesn't help if I sent the breakpoint on address either: $ readelf -h test | grep Entry Entry point address: 0x401470 lldb -a i386 -O 'breakpoint set -a 0x401470' test (lldb) breakpoint set -a 0x401470 Breakpoint 1: address = 0x0000000000401470 Breakpoint set in dummy target, will get copied into future targets. (lldb) target create --arch=i386 "test" Current executable set to '/home/martin/forums/test' (i386). (lldb) r Process 19502 launched: '/home/martin/forums/test' (i386) hello world Process 19502 exited with status = 42 (0x0000002a) (lldb) breakpoint list Current breakpoints: 1: address = 0x0000000000401470, locations = 1 1.1: address = 0x0000000000401470, unresolved, hit count = 0 That address is a bit suspicious too as it should be working with 32b address.
confirmed; for a 64-bit hello world with `log enable lldb break` I see, after `run`: lldb Breakpoint::ModulesChanged: num_modules: 1 load: 1 delete_locations: 0 lldb Target::AddBreakpoint (internal = yes) => break_id = -1: names = {'_dl_debug_state', 'rtld_db_dlactivity', '__dl_rtld_db_dlactivity', 'r_debug_state', '_r_debug_state', '_rtld_debug_state'}, language = c, module = ld-elf.so.1 lldb GDBRemoteCommunicationClient::SendGDBStoppointTypePacket() add at addr = 0x1943d8a625b0 lldb Breakpoint::ModulesChanged: num_modules: 1 load: 1 delete_locations: 0 lldb GDBRemoteCommunicationClient::SendGDBStoppointTypePacket() add at addr = 0x4004d6 lldb 0x000016c0f8a4f318 Broadcaster("lldb.target")::BroadcastEvent (event_sp = 0x16c0f8c1eef8 Event: broadcaster = 0x16c0f7f8f620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations resolved}, unique=false) hijack = 0x0000000000000000 lldb Breakpoint::ModulesChanged: num_modules: 1 load: 1 delete_locations: 0 for 32-bit: lldb Breakpoint::ModulesChanged: num_modules: 1 load: 0 delete_locations: 1 lldb 0x00003c7a9584f318 Broadcaster("lldb.target")::BroadcastEvent (event_sp = 0x3c7a94c48b68 Event: broadcaster = 0x3c7a94d8f620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations removed}, unique=false) hijack = 0x0000000000000000
See: https://github.com/llvm/llvm-project/pull/162811 which partially fix the issue.
The second one, totally fix it. You can apply the previous patch and this patch to try. https://github.com/llvm/llvm-project/pull/162890
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fa1c56b3affaab7be6ece43070b36da2e75787cb commit fa1c56b3affaab7be6ece43070b36da2e75787cb Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:28:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-11-23 17:49:51 +0000 lldb: Fix Architecture parsing by reading the ELF header. (#162811) Currently, LLDB in FreeBSD host sets the Process Architecture used by lldbserver as Default one. Which cause problem when trying to debug a 32bit binary on amd64 platform since the lldb itself will found mismatch architecture with lldbserver's return. Notice that this patch is only a partial fix for the debugging problem. We are still unable to debug x86 on x86_64 so that we don't provide testcase in this patch. PR: 289945 Obtained from: llvm-project 394e7ded8b6bcff1382468b407ca620a2837f41b .../llvm-project/lldb/source/Host/freebsd/Host.cpp | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=1d1a2e6932d682c40ab878bf83cbbde02d8d0af1 commit 1d1a2e6932d682c40ab878bf83cbbde02d8d0af1 Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:30:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-11-23 17:49:51 +0000 lldb: Fix empty register set when trying to get size of register The register set information is stored as a singleton in GetRegisterInfo_i386. However, other functions later access this information assuming it is stored in GetSharedRegisterInfoVector. To resolve this inconsistency, we remove the original construction logic and instead initialize the singleton using llvm::call_once within the appropriate function (GetSharedRegisterInfoVector_i386). PR: 289945 Obtained from: llvm-project 41859c27842eeda1ef6ff18f3b2fb269388c0857 .../Utility/RegisterContextFreeBSD_x86_64.cpp | 44 ++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=87fdc35e586930d9782efee4c0217d5e19b9274a commit 87fdc35e586930d9782efee4c0217d5e19b9274a Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:28:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-12-09 15:49:10 +0000 lldb: Fix Architecture parsing by reading the ELF header. (#162811) Currently, LLDB in FreeBSD host sets the Process Architecture used by lldbserver as Default one. Which cause problem when trying to debug a 32bit binary on amd64 platform since the lldb itself will found mismatch architecture with lldbserver's return. Notice that this patch is only a partial fix for the debugging problem. We are still unable to debug x86 on x86_64 so that we don't provide testcase in this patch. PR: 289945 Obtained from: llvm-project 394e7ded8b6bcff1382468b407ca620a2837f41b (cherry picked from commit fa1c56b3affaab7be6ece43070b36da2e75787cb) .../llvm-project/lldb/source/Host/freebsd/Host.cpp | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ee286907ad455f967233f715bd468f1d0ff01f6c commit ee286907ad455f967233f715bd468f1d0ff01f6c Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:30:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-12-09 15:49:11 +0000 lldb: Fix empty register set when trying to get size of register The register set information is stored as a singleton in GetRegisterInfo_i386. However, other functions later access this information assuming it is stored in GetSharedRegisterInfoVector. To resolve this inconsistency, we remove the original construction logic and instead initialize the singleton using llvm::call_once within the appropriate function (GetSharedRegisterInfoVector_i386). PR: 289945 Obtained from: llvm-project 41859c27842eeda1ef6ff18f3b2fb269388c0857 (cherry picked from commit 1d1a2e6932d682c40ab878bf83cbbde02d8d0af1) .../Utility/RegisterContextFreeBSD_x86_64.cpp | 44 ++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=58be4610c91f4ed1a6c29482ca555b2798f70b05 commit 58be4610c91f4ed1a6c29482ca555b2798f70b05 Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:28:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-12-09 15:52:31 +0000 lldb: Fix Architecture parsing by reading the ELF header. (#162811) Currently, LLDB in FreeBSD host sets the Process Architecture used by lldbserver as Default one. Which cause problem when trying to debug a 32bit binary on amd64 platform since the lldb itself will found mismatch architecture with lldbserver's return. Notice that this patch is only a partial fix for the debugging problem. We are still unable to debug x86 on x86_64 so that we don't provide testcase in this patch. PR: 289945 Obtained from: llvm-project 394e7ded8b6bcff1382468b407ca620a2837f41b (cherry picked from commit fa1c56b3affaab7be6ece43070b36da2e75787cb) (cherry picked from commit 87fdc35e586930d9782efee4c0217d5e19b9274a) .../llvm-project/lldb/source/Host/freebsd/Host.cpp | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=20133eccbdd854915e88c6f720212814f2f5313b commit 20133eccbdd854915e88c6f720212814f2f5313b Author: ShengYi Hung <aokblast@FreeBSD.org> AuthorDate: 2025-11-21 18:30:25 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-12-09 15:52:31 +0000 lldb: Fix empty register set when trying to get size of register The register set information is stored as a singleton in GetRegisterInfo_i386. However, other functions later access this information assuming it is stored in GetSharedRegisterInfoVector. To resolve this inconsistency, we remove the original construction logic and instead initialize the singleton using llvm::call_once within the appropriate function (GetSharedRegisterInfoVector_i386). PR: 289945 Obtained from: llvm-project 41859c27842eeda1ef6ff18f3b2fb269388c0857 (cherry picked from commit 1d1a2e6932d682c40ab878bf83cbbde02d8d0af1) (cherry picked from commit ee286907ad455f967233f715bd468f1d0ff01f6c) .../Utility/RegisterContextFreeBSD_x86_64.cpp | 44 ++++++++++------------ 1 file changed, 20 insertions(+), 24 deletions(-)