From nobody Tue Nov 02 15:38:40 2021 X-Original-To: hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C760218294D9; Tue, 2 Nov 2021 15:38:43 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HkDZq59Vjz3lxF; Tue, 2 Nov 2021 15:38:43 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from [192.168.0.88] (unknown [195.64.148.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 24116423D; Tue, 2 Nov 2021 15:38:43 +0000 (UTC) (envelope-from avg@freebsd.org) From: Andriy Gapon To: Konstantin Belousov Cc: freebsd-stable List , hackers@freebsd.org References: <7064dc89-202e-36ea-02c5-a8872eac8eb4@FreeBSD.org> Subject: Re: gdb cannot cross doreti_ast ? Message-ID: <10219850-96bc-fcd7-518e-304e7c922edb@FreeBSD.org> Date: Tue, 2 Nov 2021 17:38:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On 01/11/2021 11:39, Konstantin Belousov wrote: > On Mon, Nov 01, 2021 at 10:51:11AM +0200, Andriy Gapon wrote: >> >> I have a crash dump and kgdb (from gdb 10.2) cannot cross doreti_ast() when >> examining a stack trace: >> >> #0 sched_switch (td=0xfffff801291507c0, newtd=0xfffff80061bc97c0, >> flags=) at /usr/src/sys/kern/sched_ule.c:2146 >> #1 0xffffffff80748494 in mi_switch (flags=266, newtd=0x0) at >> /usr/src/sys/kern/kern_synch.c:452 >> #2 0xffffffff80751154 in thread_suspend_switch (td=0xfffff801291507c0, >> p=) at /usr/src/sys/kern/kern_thread.c:1118 >> #3 0xffffffff80750f74 in thread_single (p=0xfffff8011df70000, >> mode=) at /usr/src/sys/kern/kern_thread.c:862 >> #4 0xffffffff80702b86 in exit1 (td=0xfffff801291507c0, rval=0, signo=15) at >> /usr/src/sys/kern/kern_exit.c:240 >> #5 0xffffffff80740f3a in sigexit (td=0xfffff801291507c0, sig=15) at >> /usr/src/sys/kern/kern_sig.c:3194 >> #6 0xffffffff8074230f in postsig (sig=15) at /usr/src/sys/kern/kern_sig.c:3079 >> #7 0xffffffff80794b43 in ast (framep=0xfffffe0105a76c00) at >> /usr/src/sys/kern/subr_trap.c:331 >> #8 0xffffffff809b5449 in doreti_ast () at /usr/src/sys/amd64/amd64/exception.S:1150 >> #9 0x00000008020c7400 in ?? () >> #10 0x0000000000000011 in ?? () >> #11 0x0000000000000000 in ?? () >> >> It's only a minor annoyance, but I would like to get it fixed. >> Maybe some markers need to be added to doreti_ast? >> Or some smarts need to be added to gdb to recognize doreti_ast? > > What do you want to see above doreti_ast? Basically there is no kernel > frames, except the struct trapframe at the very top. doreti_ast is the > last point with interrupts enabled (again) before return to usermode. > > The only wrong thing in this trace is that gdb did not stopped the > unwinding. It might be that we could add some dwarf annotation to > indicate the 'no frame' place. Oh, oops. I think I got confused by a post-processed output from ddb and expected to see something that couldn't be there. It looks that ddb also does not know that doreti_ast is a "terminal" function. So, the post processing I have here joined stacks from the thread that I showed and a next thread in the process but I did not notice that. -- Andriy Gapon