From owner-freebsd-stable@freebsd.org Tue Apr 19 17:19:17 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 4CF4DB145D9; Tue, 19 Apr 2016 17:19:17 +0000 (UTC) (envelope-from aijazbaig1@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 E19731F92; Tue, 19 Apr 2016 17:19:16 +0000 (UTC) (envelope-from aijazbaig1@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id v188so171277871wme.1; Tue, 19 Apr 2016 10:19:16 -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; bh=E0liS+HEFC7I/YmWoZCnxIKMEjXn7ltj53KdAqJw7lY=; b=LF9ULmGYEJn51kwdzTHeJzb5gIsx4IVRTupv3csxrWbvfoQUYJCK7zzFWwNw2tmYeC Ws1M4aGWwV5Eer+STlNzHsgM0HX6bToPWq0WECnm7X6klSKzkgc8dBvagmyCyOoAlTJ7 Fatm0K9wzTEJIVVXtq/G7tTg+IEPErsy7DPrHCc69pZGvffHhWKQPsY5uwIJBGJmjqvL Fx31YwbtMMcO5fSj4u27fQjukJE1lHxXNKH2kVM2dFdEKbnChZf1hBwSk4KoOs7d0UqY W33NMtXz+iJVW2yd9notCBV1ynPZaIj1aXBftjCDiUsGzdcFbhJCse0AtEENdSHtrrPj bJWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=E0liS+HEFC7I/YmWoZCnxIKMEjXn7ltj53KdAqJw7lY=; b=DiJbhP2ESAgu12y4CdWvLsfCT7rn1KrTBoabUVW73Lrac8QfsyU7EXr+mO842gdonY 2hePYxhW3ZJPhPiLmOIwwtheX8Dt1Gjol7k+0CDJriCyIe1dtA7LGDRHWJNTeLuNd9bE YzAPhR+JMaA/Xy4RVmaauqfP9x1sJvBxODwEuhXYQn7wQjeLAaGiVhNWbo5FywlC6W1w CLLj0rlGkcNMF03OyshrbCovkirhgKnu3QZqsIglsJHnbtPoqod8VY8CTYsHQ0al8LQp oCvObPzXFM0ZaBOB1ks2NB19xwlk5UrPx76uK7Lp1Xbo1FtZIdsatnaHgEOVFki2z3mK W94w== X-Gm-Message-State: AOPr4FXjYR3Fr+OY2y7Rsg2u8M+6WChmrdW9/zo+4g6sjVrTzFdG8MygJC1cNfWVwbcojVHhEYfzUniakqg2cw== MIME-Version: 1.0 X-Received: by 10.194.77.42 with SMTP id p10mr4218921wjw.111.1461086355463; Tue, 19 Apr 2016 10:19:15 -0700 (PDT) Received: by 10.194.21.162 with HTTP; Tue, 19 Apr 2016 10:19:15 -0700 (PDT) In-Reply-To: References: Date: Tue, 19 Apr 2016 22:49:15 +0530 Message-ID: Subject: Re: Toggling between remote KGDB and local DDB within a debugging session From: Aijaz Baig To: cem@freebsd.org Cc: FreeBSD Hackers , freebsd-stable@freebsd.org Content-Type: text/plain; charset=UTF-8 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 17:19:17 -0000 On Tue, Apr 19, 2016 at 10:17 PM, Conrad Meyer wrote: > On Tue, Apr 19, 2016 at 9:35 AM, Aijaz Baig wrote: >> On Tue, Apr 19, 2016 at 9:08 PM, Conrad Meyer wrote: >>> On Tue, Apr 19, 2016 at 5:49 AM, Aijaz Baig wrote: >>>> 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?? >>> >>> Ctrl-c on the serial console. >> For me I merely see 'Quit' being spat out when I do a ctrl-c > > Ctrl-C on the serial console, not in GDB. It looks like this: Yes I tried ctrl-c on the serial console (in-fact it even says so at the ddb promp) but it doesn't work I find the control still with the kgdb Has it got anything to do with the fact that I am on a VM? Has anyone been successful in doing this with VMs? > > # sysctl debug.kdb.enter=1 > debug.kdb.enter:KDB: enter: sysctl debug.kdb.enter > [ thread pid 21907 tid 102340 ] > Stopped at kdb_sysctl_enter+0x87: movq $0,kdb_why > db> gdb > (ctrl-c will return control to ddb) > Switching to gdb back-end > Received ^C; trying to switch back to ddb. > using longjmp, hope it works! > KDB: reentering > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffea79d0e6140 > kdb_backtrace() at kdb_backtrace+0x39/frame 0xfffffea79d0e61f0 > kdb_reenter() at kdb_reenter+0x33/frame 0xfffffea79d0e6200 > gdb_tx_end() at gdb_tx_end+0x28a/frame 0xfffffea79d0e6240 > gdb_trap() at gdb_trap+0x1f9/frame 0xfffffea79d0e6390 > kdb_trap() at kdb_trap+0x169/frame 0xfffffea79d0e63f0 > trap() at trap+0x71d/frame 0xfffffea79d0e6600 > calltrap() at calltrap+0x8/frame 0xfffffea79d0e6600 > --- trap 0x3, rip = 0xffffffff8058f177, rsp = 0xfffffea79d0e66c0, rbp > = 0xfffffea79d0e66f0 --- > kdb_sysctl_enter() at kdb_sysctl_enter+0x87/frame 0xfffffea79d0e66f0 > sysctl_root() at sysctl_root+0x24a/frame 0xfffffea79d0e6740 > userland_sysctl() at userland_sysctl+0x1d2/frame 0xfffffea79d0e67f0 > sys___sysctl() at sys___sysctl+0x74/frame 0xfffffea79d0e68a0 > amd64_syscall() at amd64_syscall+0x397/frame 0xfffffea79d0e6ab0 > Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffea79d0e6ab0 > --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80095ed4a, rsp > = 0x7fffffffc948, rbp = 0x7fffffffc980 --- > gdb_trap bailing, hopefully back to ddb! > Switching to ddb back-end > [ thread pid 21907 tid 102340 ] > Stopped at kdb_sysctl_enter+0x87: movq $0,kdb_why > db> c > 0 -> 0 > > Best, > Conrad -- Best Regards, Aijaz Baig