From owner-freebsd-x11@freebsd.org Sat Feb 20 21:39:00 2016 Return-Path: Delivered-To: freebsd-x11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AFEBAAF4FD; Sat, 20 Feb 2016 21:39:00 +0000 (UTC) (envelope-from isoa@kapsi.fi) Received: from mail.kapsi.fi (mx1.kapsi.fi [IPv6:2001:1bc8:1004::1:25]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4266E13; Sat, 20 Feb 2016 21:38:59 +0000 (UTC) (envelope-from isoa@kapsi.fi) Received: from karviainen.kapsi.fi ([217.30.184.182] helo=roundcube.kapsi.fi) by mail.kapsi.fi with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1aXFEs-00037x-TG; Sat, 20 Feb 2016 23:38:55 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 20 Feb 2016 23:38:54 +0200 From: Arto Pekkanen To: Eax Melanhovich Cc: =?UTF-8?Q?Jean-S=C3=A9bastien_P=C3=A9dron?= , freebsd-x11@freebsd.org, owner-freebsd-x11@freebsd.org In-Reply-To: <20160220104349.2bc8b22a@fujitsu> References: <56C708E9.8050203@FreeBSD.org> <20160220104349.2bc8b22a@fujitsu> Message-ID: <18aa3dde9444d374eb3d665b850c621e@kapsi.fi> X-Sender: isoa@kapsi.fi User-Agent: RoundCube Webmail/0.9.4 X-SA-Exim-Connect-IP: 217.30.184.182 X-SA-Exim-Mail-From: isoa@kapsi.fi X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 Subject: Re: Guide to contribute to kernel video drivers X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mail.kapsi.fi) X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2016 21:39:00 -0000 Eax Melanhovich kirjoitti 20.02.2016 09:43: > Hello > > Thanks a lot for a guide! > > I have a few questions. > > Do I right understand that the only way to debug a kernel is to crash > it and then analyze a dump using gdb? Is it possible to attach to a > running kernel remotely? > What you probably want to do is force the target kernel (on the machine to be debugged) to enter into DDB (kernel debugger) at boot, and then use DDB to do the debugging work (set break points etc). After DDB has started, you can make it work with GDB on another machine via serial port. Here is a short tutorial for using DDB, which explains how to break into DDB on boot among other things: https://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug-online-ddb.html And here is the part explaining how to use GDB on remote: https://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug-online-ddb.html Intel also published a pretty good hands-on guide: https://software.intel.com/sites/default/files/profiling_debugging_freebsd_kernel_321772.pdf That being said, I've never done online kernel debugging myself. But the resources I referenced here give a pretty good idea on what can be done. -- Arto Pekkanen