Date: Mon, 9 Feb 2026 11:45:19 -0500 From: John Baldwin <jhb@FreeBSD.org> To: Minsoo Choo <minsoochoo0122@proton.me> Cc: Konstantin Belousov <kib@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8f23665fed2f - main - pcb.h: mark struct pcb to be preserved Message-ID: <eed3e673-ce22-414b-8787-84981492869a@FreeBSD.org> In-Reply-To: <bafAtYtkiQ-8-cLlyxu4WUlhcBp6PPxb6y5XE1KZw-qvN8xi-2wjc8uL_6OZJAW2cg9OqyCorL4knqNazkRt44btbusFZU_I53vAVWlxdKY=@proton.me> References: <69896027.2112e.2852c0dd@gitrepo.freebsd.org> <5bec84ad-a01e-4931-98e6-4ba06adb1237@FreeBSD.org> <bafAtYtkiQ-8-cLlyxu4WUlhcBp6PPxb6y5XE1KZw-qvN8xi-2wjc8uL_6OZJAW2cg9OqyCorL4knqNazkRt44btbusFZU_I53vAVWlxdKY=@proton.me>
index | next in thread | previous in thread | raw e-mail
On 2/9/26 10:56, Minsoo Choo wrote: > On Monday, February 9th, 2026 at 10:12 AM, John Baldwin <jhb@FreeBSD.org> wrote: > >> On 2/8/26 23:18, Konstantin Belousov wrote: >> >>> The branch main has been updated by kib: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=8f23665fed2fbaf4481359b4d2fcdd7b9feb40e3 >>> >>> commit 8f23665fed2fbaf4481359b4d2fcdd7b9feb40e3 >>> Author: Minsoo Choo minsoochoo0122@proton.me >>> AuthorDate: 2026-02-06 20:03:53 +0000 >>> Commit: Konstantin Belousov kib@FreeBSD.org >>> CommitDate: 2026-02-09 04:17:16 +0000 >>> >>> pcb.h: mark struct pcb to be preserved >>> >>> There are programs that depend on this structure (e.g. kernel debuggers) >>> that breaks when the ABI changes. >>> >>> Signed-off-by: Minsoo Choo minsoochoo0122@proton.me >>> Reviewed by: kib >>> MFC after: 1 week >>> Differential Revision: https://reviews.freebsd.org/D55149 >> >> >> Hmmm, I think it is useful to know which fields debuggers use (typically just >> registers) vs which ones can be safely changed without impacting debuggers. >> >> -- >> John Baldwin > > In the review, kib said: >> I had to add and preserve the padding fields pcb_pad in the amd64 structure to be compatible with kgdb at least. This makes me sure that the whole pcb layout is fixed by ABI. It is no longer needed and hasn't been needed in a decade. Back when the field was first added, kgdb did indeed assume a fixed size for `struct pcb`. However, back in 2015 I added a pcb_size variable that debuggers can use to determine this size (to properly index the stoppcbs[] array) even if debug symbols weren't present: commit 645743ea99829e6d578cca5a580cf0a4102fb7dd Author: John Baldwin <jhb@FreeBSD.org> Date: Thu Nov 12 22:00:59 2015 +0000 Export various helper variables describing the layout and size of certain kernel structures for use by debuggers. This mostly aids in examining cores from a kernel without debug symbols as a debugger can infer these values if debug symbols are available. One set of variables describes the layout of 'struct linker_file' to walk the list of loaded kernel modules. A second set of variables describes the layout of 'struct proc' and 'struct thread' to walk the list of processes in the kernel and the threads in each process. The 'pcb_size' variable is used to index into the stoppcbs[] array. The 'vm_maxuser_address' is used to distinguish kernel virtual addresses from user addresses. This doesn't have to be perfect, and 'vm_maxuser_address' is a cheap and simple way to differentiate kernel pointers from simple values like TIDs and PIDs. While here, annotate the fields in struct pcb used by kgdb on amd64 and i386 to note that their ABI should be preserved. Annotations for other platforms will be added in the future. This was even the commit that added the annotations just removed, so a simple blame for why the annotations were present would have turned this up. -- John Baldwinhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eed3e673-ce22-414b-8787-84981492869a>
