From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 21 22:22:35 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E979F15 for ; Mon, 21 Jul 2014 22:22:35 +0000 (UTC) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1DA92B62 for ; Mon, 21 Jul 2014 22:22:34 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id hz1so10559399pad.22 for ; Mon, 21 Jul 2014 15:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=zAw/KrLPyWnkc1RCU6wI3xJKgqOmUpZzFJoan35w8yM=; b=G6zwVtzuQb4GLlx12kIpAsEAnLhkQJMz65xs+vJdKwRCSVrZvU7oSOHcn061nfnPwe uXyOmIU1NlxY1PXABtedH+ozbMbHHDYKACyIfl8cW+Kd/JhVZhBfhiAmYJU8eNES1Q0/ EHNNNSGVC/gqkvlM69hnZcZE3CwoWDlMQ8oFX5DCbIpV27vFEiX6dOK1e3haL3Y9WOO3 TAGihN0f1Sv2pJ9aJmw+lwuigVjIJDb0mZbjw/WYJ4+/+r+ct5+fDXDsQnfkCTCnOQqM SqZ+Ccr8z8r/wYDN69VayW+3iu++HERB4lZhKYscEPhqpfftX4E9wt9g9ygqETksneLi jPyQ== X-Received: by 10.70.88.75 with SMTP id be11mr6942318pdb.140.1405981354374; Mon, 21 Jul 2014 15:22:34 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id an15sm62140301pac.6.2014.07.21.15.22.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 15:22:33 -0700 (PDT) Message-ID: <53CD92A8.5000201@gmail.com> Date: Mon, 21 Jul 2014 15:22:32 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Nidal Khalil , freebsd-hackers@freebsd.org Subject: Re: Remote kernel debugging question References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:22:35 -0000 On 07/21/14 12:22, Nidal Khalil wrote: > Hello All, > I am somewhat new to BSD kernel but I am trying to debug a kernel module > using remote debugging. > I am using 9.2 RELEASE. > I setup and compiled the kernel with the following: > > makeoptions DEBUG=-g > options KDB > options KDB_TRACE > options DDB_CTF > options DDB > options GDB > options ALT_BREAK_TO_DEBUGGER > > I setup the uart for serial1 flags to 0x90 and I can read and write to the > serial from either machine > Both machines have the same kernel booted. > I can enter ddb but I can not launch gdb > The remote GDB backend could not be selected. > sysctl -a | grep debug.kdb > > debug.kdb.available: ddb > Is that correct or it should be: > debug.kdb.available: ddb gdb The latter. > How do I enable gdb backend. I appreciate the help. All this on a recent HEAD. If your problem is 9.2 specific then this may not help, but at least we can compare notes. You did say you set flags to 0x90 for your serial port but it's not clear how. I have this in /boot/loader.conf: hint.uart.0.flags="0x90" When the system boots I see this right around when loader hands off to the kernel. GDB: debug ports: uart GDB: current port: uart KDB: debugger backends: ddb gdb KDB: current backend: ddb Copyright (c) 1992-2014 The FreeBSD Project. ... After the system boots I see both ddb and gdb in the available debug backends and all is well. # sysctl debug.kdb.available debug.kdb.available: ddb gdb # sysctl debug.kdb.current debug.kdb.current: ddb # sysctl debug.kdb.current=gdb debug.kdb.current: ddb -> gdb # sysctl debug.kdb.current debug.kdb.current: gdb Regards, Navdeep