[Lldb-commits] [lldb] [lldb][Process/FreeBSDKernelCore] Add assertion for pcb (PR #183969)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 01:50:12 PDT 2026


DavidSpickett wrote:

> Am I missing something here?

That when cross-compiling, you would have an AArch64 sysroot which would provide the AArch64 `pcb.h`.

(*Some* software might compile ok using host headers, but it's basically random chance and not something anyone should rely on)

It's been a while since I tried it but I think I downloaded the `base.txz` from a release such as https://download.freebsd.org/ftp/releases/arm64/aarch64/15.0-RELEASE/. Then extracted that. This contains a `usr/include/machine/pcb.h` file that contains the AArch64 pcb:
```
struct pcb {
	uint64_t	pcb_x[12];
	/* These two need to be in order as we access them together */
	uint64_t	pcb_sp;
	uint64_t	pcb_tpidr_el0;
	uint64_t	pcb_tpidrro_el0;
```

I don't know if that's the official advice, but you see the idea. You tell the compiler: instead of searching from `/`, start from `/path-to-sysroot`. So then `include/machine/pcb.h` is the one in the sysroot.

We have cross compile instructions for Linux but not FreeBSD - https://lldb.llvm.org/resources/build.html#cross-compiling-lldb. You'll need to find out how to get cmake to pass the sysroot path to clang. But the options to disable libraries should be useful, for testing this PR, you can disable all the optional things to save you time cross compiling those too.

Perhaps in a FreeBSD system, you can install a foreign architecture sysroot. Like you can in Debian with multiarch.

https://github.com/llvm/llvm-project/pull/183969


More information about the lldb-commits mailing list