From owner-freebsd-hackers@freebsd.org Tue Apr 19 12:49:51 2016 Return-Path: Delivered-To: freebsd-hackers@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 21A57B1311C; Tue, 19 Apr 2016 12:49:51 +0000 (UTC) (envelope-from aijazbaig1@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF6BA18A6; Tue, 19 Apr 2016 12:49:50 +0000 (UTC) (envelope-from aijazbaig1@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id n3so27896432wmn.0; Tue, 19 Apr 2016 05:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=zy2HrFFzM9gHWymH4CXb2AUCo3ApgxNdonvFdA1XSmo=; b=OQf7TZn/RQWEZMTCkZVjoGslq3itUCnQCEVNGUg0fWDktQtPzGcLMovMFqBO7T02Tk YhY5tKTIWdp4aiL7Wqs+v+Ls8cr+9znLicojWy8eMr1uP8YLPcx8H7nbawAiF3Zaif9M kDfbL/5EM3dgweMwet+vnwPLConUfui7XS+cW1aXTP53cgLnkote2yXzdI6vJD7o9M8l CWxJbjg5VG4LYC609zMZnRZXDfSXYwSuri+xJLdi1HW5Cl+0RvTZLDARLAmwJGU9UoCG AeGBH7qSuuL66UETqUtp0ebM9Lgkb9V1OsmOE2xsp+JUE5pBV7WezwiundyJsDB2yy0R dmYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=zy2HrFFzM9gHWymH4CXb2AUCo3ApgxNdonvFdA1XSmo=; b=PdZtCHUh6A5OteWkMN9eSc3utBUZlzokYn8IcnmJYOddZZ9T2l0X/IMVTBRpVR9DM8 bkdBVJocRKf3Lc3m6PE7GIeivzmpogA0zKaiD9J6SXGEWJ7VXmnL6I7c93QN1PQkQNwe mAvo1t7Z4BYRcp/8mvo3J/WY1bt0bSomkRm7YB2vzFJzhrfI0M2Dlg8otoX9CEqfmH8W jGmi/fR2F1WdznLZw/YdYAW3mmwSrcS7Pz0Nuf6SUJlOfZE403Ngf6AfOjrdqKxSqizn 1azvCdqkNY3A6gqLMetCrsvU6ebVtwqNNu9gfRExaNyTSE2xM4QnY4+bK/OgpVF5zd2z 7T6g== X-Gm-Message-State: AOPr4FUt/LEHNqrNMUzLfLshpc7W9Wd1KpmaV/QXd07wZcAxIbpw+FNSuoUdim5urYwIrEwHnmAJ20kf8rV2sg== MIME-Version: 1.0 X-Received: by 10.28.51.5 with SMTP id z5mr3727707wmz.101.1461070188325; Tue, 19 Apr 2016 05:49:48 -0700 (PDT) Received: by 10.194.21.162 with HTTP; Tue, 19 Apr 2016 05:49:48 -0700 (PDT) Date: Tue, 19 Apr 2016 18:19:48 +0530 Message-ID: Subject: Toggling between remote KGDB and local DDB within a debugging session From: Aijaz Baig To: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Tue, 19 Apr 2016 13:42:56 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 12:49:51 -0000 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?? 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 -- Best Regards, Aijaz Baig