From nobody Mon Jul 29 05:10:53 2024 X-Original-To: freebsd-drivers@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 4WXRK20fsnz5RCJP for ; Mon, 29 Jul 2024 05:11:02 +0000 (UTC) (envelope-from quail5101os@use.startmail.com) Received: from mx-out2.startmail.com (mx-out2.startmail.com [145.131.90.155]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WXRK10vjqz57Kd for ; Mon, 29 Jul 2024 05:11:01 +0000 (UTC) (envelope-from quail5101os@use.startmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=startmail.com header.s=2020-07 header.b=fWqZwewz; dmarc=pass (policy=quarantine) header.from=use.startmail.com; spf=pass (mx1.freebsd.org: domain of quail5101os@use.startmail.com designates 145.131.90.155 as permitted sender) smtp.mailfrom=quail5101os@use.startmail.com Content-Type: multipart/alternative; boundary="===============4209039786258324174==" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=startmail.com; s=2020-07; t=1722229853; bh=EXHGH5vkQa102dKXl/7BzgGNzujQ5+kN2VgUBI4TQ3E=; h=Content-Type:Subject:Message-ID:Date:From:To:Mime-Version:From: Subject:To:Date:Sender:Content-Type:Content-Transfer-Encoding: Content-Disposition:Mime-Version:Reply-To:In-Reply-To:References: Message-Id:Autocrypt; b=fWqZwewzJBvy7Su5WgtZue62yI/3OgWNsRpfjgYuu43wPNNbjw19he1qW2dfHgqlL qxPVa+dT+DN35kf7k5E/BVw0JdzKJhWS6kojqVMWyz6fUtynamGYRfLebYVKOhoDod GYB61sLi2dWOYliWgWizaJxj9LvNnFopSzXtzR7MU+/lm0KCNroTNkh/pFPu73j0La iYyIE2LmloSEcm0PDevO1WOQhdklFFs8ReeRmcoj3Cbs6ywlHnEK817PdECK9pvar0 oNAWYTXW//3jOcSufPxcDIlsDmhK9R3QjdtpZSYVkG6sLpafLUgwMvOTs+o5N12/28 +cC2zGmrnLRIg== Subject: How to live debug a FreeBSD kernel module? Message-ID: <172222985287.138720.11163516792060957897@startmail.com> Date: Mon, 29 Jul 2024 05:10:53 -0000 From: quail5101os@use.startmail.com To: freebsd-drivers@freebsd.org List-Id: Writing device drivers for FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-drivers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-drivers@FreeBSD.org Mime-Version: 1.0 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.50 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[use.startmail.com,quarantine]; R_SPF_ALLOW(-0.20)[+ip4:145.131.90.128/27]; R_DKIM_ALLOW(-0.20)[startmail.com:s=2020-07]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:28685, ipnet:145.131.64.0/18, country:NL]; MISSING_XM_UA(0.00)[]; FROM_NO_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_NONE(0.00)[]; MLMMJ_DEST(0.00)[freebsd-drivers@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[startmail.com:+] X-Rspamd-Queue-Id: 4WXRK10vjqz57Kd --===============4209039786258324174== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Estimated FreeBSD mailing list, =20 =20 I am following Joseph Kong's FreeBSD device driver's: A guide for the intrepid. Now I am at the chapter 4, where rather than copy the example= from the bug I wrote a examples the day later which follows the same ioctl c= alls as those which the books gives, except that they are named differently, bu= t every time that I try to run the command line utility that interacts with my = ioctl calls I get a broken ssh connection to my development Virtual Machine. Therefore, how can I debug my kernel module? =20 =20 Note, that I had tried to consult the manpage ddb, kgdb, and also have = tried to run ``sysctl debug.kdb.enter=3D1`` from , a= nd nothing have worked in my ssh session. This last may be because it is n= ot enabled, but the handbook page is not clear in how to compile a kernel. =20 =20 For I cannot imagine the pain= of setting from the virtual machine to the Linux Host and back to another = virtual machine, it certainly could be done with the FreeBSD guest doing nested virtualization with bhyve, and doing the procedure with that, but no id= ea of how to setup it, likewise not idea of how to setup with bhyve. =20 =20 Cordially, Quail5101. =20 --===============4209039786258324174== Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Esti= mated FreeBSD mailing list,


I am following Jo= seph Kong's FreeBSD device driver's: A guide for the intrepid. Now I am= at the chapter 4, where rather than copy the example from the bug I wr= ote a examples the day later which follows the same ioctl calls as thos= e which the books gives, except that they are named differently, but ev= ery time that I try to run the command line utility that interacts with= my ioctl calls I get a broken ssh connection to my development Virtual= Machine. Therefore, how can I debug my kernel module?

=


Note, = that I had tried to consult the manpage ddb, kgdb, and also have tried = to run `sysctl debug.kdb.enter=3D1` from https://docs.freebsd.org/en/b= ooks/developers-handbook/kerneldebug/, and nothing have worked in m= y ssh session. This last may be because it is not enabled, but the hand= book page https://docs.freebsd.org/en/books/handboo= k/kernelconfig/#kernelconfig-building is not clear in how to compil= e a kernel.


For https://docs.freebsd.org/en/books/developers-handbook/ker= neldebug/#kerneldebug-online-gdb I cannot imagine the pain of setti= ng from the virtual machine to the Linux Host and back to another virtu= al machine, it certainly could be done with the FreeBSD guest doing nes= ted virtualization with bhyve, and doing the procedure with that, but n= o idea of how to setup it, likewise not idea of how to setup https://docs.freebsd.org/en/books/developers-handbook/k= erneldebug/#kerneldebug-dcons with bhyve.


Cordially, Quail5101.

--===============4209039786258324174==--