From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 21 22:35:02 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 627D2318 for ; Mon, 21 Jul 2014 22:35:02 +0000 (UTC) Received: from mail-vc0-x22b.google.com (mail-vc0-x22b.google.com [IPv6:2607:f8b0:400c:c03::22b]) (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 2175E2C4C for ; Mon, 21 Jul 2014 22:35:02 +0000 (UTC) Received: by mail-vc0-f171.google.com with SMTP id hq11so11937569vcb.30 for ; Mon, 21 Jul 2014 15:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=hAVCzwPJP3MbqzGFvI6+dKrV54KYz0gWejbl0oFwMBI=; b=IGM8AIXrqnVyJhLLd07zj5jmzKIHH2ZIiELlOBZjTO9CjUHfkXJetzmTjJcSZ0hvjf +7qozNyaPGelyHZlCEy64dBwXNdXd8LD5Zrdc4vr3aroBVYvEzyWayi8cIK6DG+G30HP gEd5MdBs6BdiScp2Jn4HtpLKdH7gFpAvC/I2k7tIJ/Pcmd7niKOiBLO/MQ9TOYpvOs/C 0IT43z+sfWZgEECrhg5luYme3Y5Klm8MI6zXA6ZtsfylEi/pgZDowju5uaIQYcXAVsXU YpyjQ1rdNqptjbwGSFLpj+JeE+yrgFowaoyl8f/yNuWUIsIV6oAkS6Sp/j+lhhDhxX8M zOww== MIME-Version: 1.0 X-Received: by 10.52.157.164 with SMTP id wn4mr5966088vdb.81.1405982101290; Mon, 21 Jul 2014 15:35:01 -0700 (PDT) Received: by 10.220.20.74 with HTTP; Mon, 21 Jul 2014 15:35:01 -0700 (PDT) In-Reply-To: <53CD92A8.5000201@gmail.com> References: <53CD92A8.5000201@gmail.com> Date: Mon, 21 Jul 2014 15:35:01 -0700 Message-ID: Subject: Re: Remote kernel debugging question From: Nidal Khalil To: Navdeep Parhar Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: freebsd-hackers@freebsd.org 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:35:02 -0000 The documentation states to put hint.uart.0.flags="0x90" in /boot/device.hits However you hit on a good point. I see some parameters in boot/loader.conf. Can you please email this file I think that I need to do more configuration to this file. I will do it by comparison. Thanks Nidal On Mon, Jul 21, 2014 at 3:22 PM, Navdeep Parhar wrote: > 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 >