Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2016 09:47:14 -0700
From:      Conrad Meyer <cem@FreeBSD.org>
To:        Aijaz Baig <aijazbaig1@gmail.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, freebsd-stable@freebsd.org
Subject:   Re: Toggling between remote KGDB and local DDB within a debugging session
Message-ID:  <CAG6CVpXXOhP4PHu-bgVjFsawUiydDBwVAnL%2BwBBTtgtRacMujg@mail.gmail.com>
In-Reply-To: <CAHB2L%2BfKTSDk-Ke6UWubE_X4gaxaHLULgWKu_Je8tNUddht5tw@mail.gmail.com>
References:  <CAHB2L%2Bde=Bxn4G2uEDdN%2BSPY=SREN9REGShV=gnRombjqStYzw@mail.gmail.com> <CAG6CVpV_P2eCERSjQ3cwAMvNkuO8d919Td3DxkQJR1SGHSvLag@mail.gmail.com> <CAHB2L%2BfKTSDk-Ke6UWubE_X4gaxaHLULgWKu_Je8tNUddht5tw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 19, 2016 at 9:35 AM, Aijaz Baig <aijazbaig1@gmail.com> wrote:
> On Tue, Apr 19, 2016 at 9:08 PM, Conrad Meyer <cem@freebsd.org> wrote:
>> On Tue, Apr 19, 2016 at 5:49 AM, Aijaz Baig <aijazbaig1@gmail.com> 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:

# 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXXOhP4PHu-bgVjFsawUiydDBwVAnL%2BwBBTtgtRacMujg>