From nobody Wed Sep 13 05:11:50 2023 X-Original-To: freebsd-arm@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 4RlpTh1HG2z4sq34; Wed, 13 Sep 2023 05:11:52 +0000 (UTC) (envelope-from kevans@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 4RlpTh0shPz3bT3; Wed, 13 Sep 2023 05:11:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694581912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cXRxXQk56ICagZ1+YTylMoCAdTHkKgI6y9ZEykknDL0=; b=VXVJypzVJjSP+2Ck0pCSa3bEJIZZ7DtBB2fwQpNwKKWgC/3O3TWC5SsBmB7D5D+f0GJnva dRYNFrtnbjZNHG8sSzKxF8NT+h4pG5p4PxzLpaA9igZTtXk0Vs6uymdj7YIaaAZYYbo3UC YxxEhrCsJcQfe7tSBV5TxO3fTnfAqG01VbM6doHiODOIAHLcX/Ao/VqxWZpSeSWU1lRvx8 8y+kbjt5Bb3bUY0lGqppYBr/QI4KIlhqGJ/zQtNlzlbrj2AJ62ZITxsHNx8WYji9WtJa49 ddmOOs67N2nXn9M/7GwNQrmukv48uRmGB9TphS6dNDI9K3tCFdmItZ1sclDWPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694581912; a=rsa-sha256; cv=none; b=jEMekcEl84N5bFwyXnQec+YgX4+oYBZqNegfH6vYb/g9Fx0Vlcpc1VRXlguBoKcexCQCR2 yl70381ssHPXJmrpDeBuv6FSCcQsQ8xC0CBLOGpfXKf9fC1komwA+DSHOcFQwLptrW3Owu ZHHPSZSpvBXgoq8jGAdpWPzxNvo+IivboLFJxzCKbyxu/SRD8n0KEll42cgN2mX1QOxrP5 VIb08og41vXlxgV7PSf5Lv0VOgsF83jQm3brFFcMLbwnl5csUfWssE/fzsxYiyy70WKp62 bqI/dHvxn9QGmq4Cez6YW2DxKTFscGLz1GOVV/qNEZiCFosl94gDCOsIXMeohA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694581912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cXRxXQk56ICagZ1+YTylMoCAdTHkKgI6y9ZEykknDL0=; b=X7KV+Zjf7/uyQdIpYyFVH4Y+T4GiGTJw2ddQK7Gg4ZEO0/YjNMpmhQw2ldRanLxhZGuQ7I /mQR/zqlToWtWhRwnn65srJdBpW66Kt1MlTYnJAMHQ3FtIuAwaWsj7hT5s2NW0334f5brA 2mB/8HTwlpy60rBCz0QDKoYx5otvHqxIFvy/ISk1x+IU7ofhwC41k2U3Nm6+1JtQu5mp0t WH76gI3q6NdglhAjZYdlJ341bcoCHeiM8SrgTwdvt9d6jMX/xz+MLBlwpqwkkjcpf/Q5CZ jcgwfRIMO8u6SRDW3d7lEOjD0JVWKsYv297HHyFCC/0aYHymS2ZwgOTd0lyGtw== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4RlpTg3qmmzpH7; Wed, 13 Sep 2023 05:11:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <1b3313d2-1054-8df3-4244-4e67d3778e75@FreeBSD.org> Date: Wed, 13 Sep 2023 00:11:50 -0500 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: aarch64 devel/gdb for kgdb use on main [so: 15] (and, likely, 14.0-????): dump core.txt.?'s kgdb backtraces are messed up To: Mark Millard , FreeBSD Mailing List , freebsd-arm Cc: Mark Johnston , jhb@FreeBSD.org References: <31BB2D7D-3A91-48AC-B29E-BDEA0CA59A73@yahoo.com> <6610DEB1-D2D7-48E8-8DC5-0B1E99C2041A@yahoo.com> Content-Language: en-US From: Kyle Evans In-Reply-To: <6610DEB1-D2D7-48E8-8DC5-0B1E99C2041A@yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/12/23 23:28, Mark Millard wrote: > [Trying to send to freebsd-ports accurately this time.] > > On Sep 12, 2023, at 21:23, Mark Millard wrote: > > [I've cc'd the last 2 devel/gdb authors of kgdb-related material.] > > kgdb 13.1_4 is an improvement over 13.1_3 for aarch64 but is still > broken. 13.1_3 example: > > 0x0000000000000000 in ?? () > (kgdb) #0 0x0000000000000000 in ?? () > #1 in ?? () > Backtrace stopped: not enough registers or memory available to unwind further > (kgdb) > > 13.1_4 example: > > get_curthread () at /usr/src/sys/arm64/include/pcpu.h:77 > 77 __asm __volatile("ldr %0, [x18]" : "=&r"(td)); > (kgdb) #0 get_curthread () at /usr/src/sys/arm64/include/pcpu.h:77 > #1 doadump (textdump=0, textdump@entry=1576585744) > at /usr/src/sys/kern/kern_shutdown.c:405 > #2 0xffff0000000ec18c in db_dump (dummy=, dummy2=, dummy3=, dummy4=) > at /usr/src/sys/ddb/db_command.c:591 > #3 0xffff0000000ebf88 in db_command (last_cmdp=, cmd_table=, dopager=true) > at /usr/src/sys/ddb/db_command.c:504 > #4 0xffff0000000ebc80 in db_command_loop () > at /usr/src/sys/ddb/db_command.c:551 > #5 0xffff0000000ef440 in db_trap (type=, code=) > at /usr/src/sys/ddb/db_main.c:268 > #6 0xffff0000004b4860 in kdb_trap (type=60, code=0, tf=) > at /usr/src/sys/kern/subr_kdb.c:790 > #7 > #8 > #9 > #10 > #11 > #12 > #13 > #14 > #15 > #16 > #17 > #18 > #19 > #20 > #21 > #22 > #23 > Backtrace stopped: Cannot access memory at address 0x10 > (kgdb) > Yeah, sorry, I see the problem now; looks like I didn't test it after one last change I ported from jhb's cheri branch: > tf_size = regcache_map_entry_size (trapframe_map); regcache_map_entry_size() is in-fact what we want, but I didn't realize that it doesn't do the magical translation from 0 -> register_size that seems to be done everywhere else. With the below patch[0] to populate all of the sizes, things look sane again. Thanks, Kyle Evans [0] https://people.freebsd.org/~kevans/kgdb-fix.diff @@ -126,13 +126,13 @@ aarch64_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr) static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] = { - { 1, AARCH64_SP_REGNUM, 0 }, - { 1, AARCH64_LR_REGNUM, 0 }, - { 1, AARCH64_PC_REGNUM, 0 }, - { 1, AARCH64_CPSR_REGNUM, 0 }, + { 1, AARCH64_SP_REGNUM, 8 }, + { 1, AARCH64_LR_REGNUM, 8 }, + { 1, AARCH64_PC_REGNUM, 8 }, + { 1, AARCH64_CPSR_REGNUM, 8 }, { 1, REGCACHE_MAP_SKIP, 8 }, /* esr */ { 1, REGCACHE_MAP_SKIP, 8 }, /* far */ - { 30, AARCH64_X0_REGNUM, 0 }, /* x0 ... x29 */ + { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */ { 0 }, }; @@ -141,12 +141,12 @@ static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] = static const struct regcache_map_entry aarch64_fbsd13_trapframe_map[] = { - { 1, AARCH64_SP_REGNUM, 0 }, - { 1, AARCH64_LR_REGNUM, 0 }, - { 1, AARCH64_PC_REGNUM, 0 }, + { 1, AARCH64_SP_REGNUM, 8 }, + { 1, AARCH64_LR_REGNUM, 8 }, + { 1, AARCH64_PC_REGNUM, 8 }, { 1, AARCH64_CPSR_REGNUM, 4 }, { 1, REGCACHE_MAP_SKIP, 4 }, /* esr */ - { 30, AARCH64_X0_REGNUM, 0 }, /* x0 ... x29 */ + { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */ { 0 }, };