From owner-freebsd-stable@freebsd.org Tue Apr 19 15:10:58 2016 Return-Path: Delivered-To: freebsd-stable@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 4A952B13547; Tue, 19 Apr 2016 15:10:58 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FA001A11; Tue, 19 Apr 2016 15:10:57 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-252-92.lns20.per4.internode.on.net [121.45.252.92]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u3JFAq6i017989 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 19 Apr 2016 08:10:55 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: Toggling between remote KGDB and local DDB within a debugging session To: Aijaz Baig , freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org References: From: Julian Elischer Message-ID: <57164A76.4050403@freebsd.org> Date: Tue, 19 Apr 2016 23:10:46 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 15:10:58 -0000 On 19/04/2016 8:49 PM, Aijaz Baig wrote: > Hello > > I think the title says it all!! :) > > I would like to know if there is indeed a way to toggle between gdb > and ddb while debugging a remote kernel. I am already at the gdb (or > rather kgdb) prompt. From here how do I switch to local ddb on the > debugged machine?? you don't .. at teh moment I think it' s a one way street, but at one stage you could "detach" and it wuld switch back to ddb.. I don't think that works any more.. I've looked at making it work more than once but never got enough of an understanding to make it work, I suspect that it is a case of setting the appropriate word somewhere to teh appropriate value. How to find that location from gdb is the hard part. > My kernel configuration file already contains 'options > BREAK_TO_DEBUGGER' and I have BOTH GDB and DDB configured aka: > options GDB > options DDB > > I tried adding 'options KDB_UNATTENDED' but that does not make any difference. > > As per the developer's handbook, "Every time you type gdb, the mode > will be toggled between remote GDB and local DDB. In order to force a > next trap immediately, simply type s (step). Your hosting GDB will now > gain control over the target kernel:" Now when you type 'gdb' at the > DDB prompt, KGDB takes over remotely. On continuing at the KGDB > prompt, you arrive back at the debugged machine but it is not longer > under the control of DDB. > > My question is, how do I drop to DDB from within a running machine > whose serial ports (albeit virtual ones) are remotely attached to > another machine? When remote remote KGDB is listening and I force a > panic using 'sysctl debug.kdb.enter=1', it drops into remote KGDB. > However, when it is NOT listening on the serial port, the local system > just freezes > > What I want, is to enter ddb on the local machine. Do some debugging > using it; drop to remote KGDB for things that are best done using > KGDB, then switch back to local DDB when I'm done. > > Is there a way to do that? If yes please do let me know >