From nobody Tue Nov 04 13:04:54 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d17w73nDCz6G2mL; Tue, 04 Nov 2025 13:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d17w70sV2z3tPx; Tue, 04 Nov 2025 13:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762261495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LZTIGpZdZng5lJKlkFEsIUOSbtRyqBTfEedINOAQffE=; b=ViPOiCMbd5A+LSiN8OCPDJIPXOjSfHrUfqhrr7ohy47eiorqQdhA3HOtb2B25aUjOT3oVk XHCvSwZzCJoOKmCMvSOgrIXi1qV3wIR11bUbf/ssexDe3GOAH9znmE2NIO7owkxXBdI6ZE OCidCAmAoR35EyKilUKV0FWK6019VuY3y0eAYE9uEqYRrGJOXxIalP7m+lZJ80kreSOWa7 V9Kd97AXnlA4o5V6zS0MJ3hd5gvmFg6okFV7fBrcsRf+YeL5LOKa9jU06Xhb6LsurtkoIA 8pY9kbr6hv2CCAEcQ8HkWdLsFvYpY+Cqu5nRFg1gGhqgvC8hGZWZmGT9Nvy9Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762261495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LZTIGpZdZng5lJKlkFEsIUOSbtRyqBTfEedINOAQffE=; b=jDBc2KVEJfYwvgic4R1ESGLRRkuAKNycLbvWD/OrPJD8qWuoPTcdvkjzCK4WV0ZZ54lQG1 2Ybtd/iRN5qJhaThpmkAx0aWnO3a3qaxqaFw6uUGmYmj4WwCbi0oRFDse34V65/K3/BWsj AtDQY+M63RYGTLTnqZ1cUXtlsX9R57h8rp61QbVH5b2F3eCynJsLn0znvsCP129U7+5Hwr H2EXNY1DTOnI3UVEs3cC3dEa5fDb7Tc8H4U9I4/kW2sf/Q9JRCVuInUN/kIS+ZaS8wZ6FF R/PVTxdc3+HCsq/ZZnSo94jraD8BDCsDGh4IhXcuGRPDGWh/mIx5xh990KTRhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762261495; a=rsa-sha256; cv=none; b=TH3+eYb1ygjB5RDcFk3kh77A3sndY5qMyILb/cncbF634jw/jGU6OuIRDWdP9WGjBG/0P/ +n8yzAWRqoizZIBXgUnMN7lBDiB6gO66hGkUtQe4CXWcrtBtzM64jN8IksDveQJEBYN0Od 1AtOduutSoAcle9X5aDD5U57XvRsF6evinmN+X7RTdPcSEwBMzfNw6UV3kQpuiVIeIlhVt puT9Xk7HIZ4Tl0mB0QOqALZrsx2og1CBSCCBsk9pMleoDtlrL8AUyd/E4STIJOF4/W6Bf3 RxAwWu/mTUjZot4xhQi2UsgxhvbQ9JQByPhljtxyyIWtjh5HFD3opesdaXGAkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d17w708q8zyKN; Tue, 04 Nov 2025 13:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5A4D4skB034668; Tue, 4 Nov 2025 13:04:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A4D4sCN034665; Tue, 4 Nov 2025 13:04:54 GMT (envelope-from git) Date: Tue, 4 Nov 2025 13:04:54 GMT Message-Id: <202511041304.5A4D4sCN034665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 090beeed90c3 - stable/15 - gdb: Make development a bit easier List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 090beeed90c3aaa3b2c2a25effb555c0e886b5c2 Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=090beeed90c3aaa3b2c2a25effb555c0e886b5c2 commit 090beeed90c3aaa3b2c2a25effb555c0e886b5c2 Author: Mark Johnston AuthorDate: 2025-10-27 16:33:34 +0000 Commit: Mark Johnston CommitDate: 2025-11-04 12:46:19 +0000 gdb: Make development a bit easier Provide a command which can be used to reload gdb modules. MFC after: 1 week (cherry picked from commit d5d47e1e67cdf1707cb460c2722894305f3cb34d) --- sys/tools/gdb/README.txt | 5 +++++ sys/tools/kernel-gdb.py | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/sys/tools/gdb/README.txt b/sys/tools/gdb/README.txt index 8c31565ddc42..ad1544912c3c 100644 --- a/sys/tools/gdb/README.txt +++ b/sys/tools/gdb/README.txt @@ -8,6 +8,9 @@ be automatically loaded by kgdb when opening a vmcore, so if you add new GDB commands or functions, that script should be updated to import them, and you should document them here. +When improving these scripts, you can use the "kgdb-reload" command to reload +them from /usr/lib/debug/boot/kernel/gdb/*. + To provide some rudimentary testing, selftest.py tries to exercise all of the commands and functions defined here. To use it, run selftest.sh to panic the system. Then, create a kernel dump or attach to the panicked kernel, and invoke @@ -15,6 +18,8 @@ the script with "python import selftest" in (k)gdb. Commands: acttrace Display a backtrace for all on-CPU threads +kgdb-reload Reload all gdb modules, useful when developing the modules + themselves. Functions: $PCPU([, ]) Display the value of a PCPU/DPCPU field diff --git a/sys/tools/kernel-gdb.py b/sys/tools/kernel-gdb.py index 8a41ef6efab1..990bdaf31fda 100644 --- a/sys/tools/kernel-gdb.py +++ b/sys/tools/kernel-gdb.py @@ -4,12 +4,40 @@ # SPDX-License-Identifier: BSD-2-Clause # +import importlib import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "gdb")) -# Import FreeBSD kernel debugging commands and modules below. -import acttrace -import pcpu -import vnet +modules = [ + "acttrace", + "freebsd", + "pcpu", + "vnet" +] + + +def reload_modules(modules): + for mod in modules: + if mod in sys.modules: + importlib.reload(sys.modules[mod]) + else: + importlib.import_module(mod) + +reload_modules(modules) + + +class reload(gdb.Command): + """ + Reload the FreeBSD kernel GDB helper scripts. + """ + def __init__(self): + super(reload, self).__init__("kgdb-reload", gdb.COMMAND_USER) + + def invoke(self, arg, from_tty): + reload_modules(modules) + + +# Register the reload command with gdb. +reload()