From nobody Wed Sep 13 06:28:33 2023 X-Original-To: freebsd-ports@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 4RlrBW1ylsz4sTpr for ; Wed, 13 Sep 2023 06:28:51 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-19.consmr.mail.gq1.yahoo.com (sonic306-19.consmr.mail.gq1.yahoo.com [98.137.68.82]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RlrBV5LjSz4Smh for ; Wed, 13 Sep 2023 06:28:50 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694586528; bh=aS8GZIVpVGOr+IGBOzGnjBs5IsEcXZJwhHHINYgiiVw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=VE2/Ilam3aVVu+Ip22lex3v68O2o3ukWoQY2/uF/i6zOdoKBJGZpVTD3xPqZNNy2EecQNmbUeG7AmLZWbppZrATlU5r+icoWatJMl/yvx3BWEo6h2cSEQsa3WerezV1FsGKnXtQbr4kQdZMcDABqVkL1UeY6Wgv7u8ZeCDKNfy8Lwg/g8m9ljJrl3dCLG65zPIGmtU5OMC+GXzF+MOs3KPYPZ+f3SnSYvNFy1ZmhHOV1FjbWbkesCtVIVNFaOnbtvYfmi+BKKqYlfFlzlesh8VRHlTfmsmo1Owb59If3JuOL2e8/ZxmIiCi3s9s1k3UQPkUKIfoy9oWZ5Iw6vfZHng== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694586528; bh=ye7rQpEw1dcakePu1Z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wzGC6qON7258q2p54p1VFvShszCJV0A8o.CYtiI84aDNOu96Jh0zv iWadZTt1JXtbZVWFLffXcAK5K_xm_4aZLsniVY32YS.Pdvr5pd1n0eRDyAvRYS.2gzHW1wAeotjt JHGod6L9DmeuuymmRU2Iyk5J7Fh1Xbem69Nj245pQzDWHMeYaQATv2J_sbCCkArtooETs5HKtYBK hJro2SpFPf1kLgnNvQ3RT5.e0S0Lr8FIKuASNsgoHc3VyzeBtHltGRQx5682IBe3O_YA4uJ3aBK7 hodWtBhgLFuu_89Hih_Pz7p0Sd8Rz2H1HT7nz2HMtzgS_QTlMYQUmSbeSEdOV2dAXQXuBugYNa4e ExwJ9ziN7eMr295_0AYhkXEEjtyx4qSQfCwX21NUrXv9p8oWXRL4PvoX3OnJ9dHagH3zxvWRFbQx mkc.zubKOKXLx5NiXquft6JOsFuGvo6yg73In6PC3IqTcQlf6RmSTJ1vgiWnG3L50ds432dZgCwD HndevsSWVUMTGAVjomO84DnEaK2mkLaB9KK6aSRAX5C5eLq.QNojGL4XWoqqvKOTGYN80KiLpADz B X-Sonic-MF: X-Sonic-ID: 5e010f44-77e4-4a98-a14a-461f25d832ae Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.gq1.yahoo.com with HTTP; Wed, 13 Sep 2023 06:28:48 +0000 Received: by hermes--production-bf1-865889d799-kbgm8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8a86448d6b8ce0362330905e9135ab10; Wed, 13 Sep 2023 06:28:46 +0000 (UTC) Content-Type: text/plain; charset=us-ascii List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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 From: Mark Millard In-Reply-To: <1b3313d2-1054-8df3-4244-4e67d3778e75@FreeBSD.org> Date: Tue, 12 Sep 2023 23:28:33 -0700 Cc: FreeBSD Mailing List , freebsd-arm , Mark Johnston , "jhb@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <008EEE6D-893C-4205-9E2C-D9922B870CBC@yahoo.com> References: <31BB2D7D-3A91-48AC-B29E-BDEA0CA59A73@yahoo.com> <6610DEB1-D2D7-48E8-8DC5-0B1E99C2041A@yahoo.com> <1b3313d2-1054-8df3-4244-4e67d3778e75@FreeBSD.org> To: Kyle Evans X-Mailer: Apple Mail (2.3731.700.6) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US] X-Rspamd-Queue-Id: 4RlrBV5LjSz4Smh On Sep 12, 2023, at 22:11, Kyle Evans wrote: > 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]" : "=3D&r"(td)); >> (kgdb) #0 get_curthread () at /usr/src/sys/arm64/include/pcpu.h:77 >> #1 doadump (textdump=3D0, textdump@entry=3D1576585744) >> at /usr/src/sys/kern/kern_shutdown.c:405 >> #2 0xffff0000000ec18c in db_dump (dummy=3D, = dummy2=3D, dummy3=3D, dummy4=3D) >> at /usr/src/sys/ddb/db_command.c:591 >> #3 0xffff0000000ebf88 in db_command (last_cmdp=3D, = cmd_table=3D, dopager=3Dtrue) >> 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=3D, = code=3D) >> at /usr/src/sys/ddb/db_main.c:268 >> #6 0xffff0000004b4860 in kdb_trap (type=3D60, code=3D0, tf=3D) >> 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) >=20 > 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: >=20 > > tf_size =3D regcache_map_entry_size (trapframe_map); >=20 > 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. >=20 > Thanks, >=20 > Kyle Evans >=20 > [0] https://people.freebsd.org/~kevans/kgdb-fix.diff >=20 > @@ -126,13 +126,13 @@ aarch64_fbsd_supply_pcb(struct regcache = *regcache, CORE_ADDR pcb_addr)=20 >=20 >=20 > static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] =3D=20= > {=20 > - { 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 }, > }; >=20 > @@ -141,12 +141,12 @@ static const struct regcache_map_entry = aarch64_fbsd_trapframe_map[] =3D >=20 > static const struct regcache_map_entry aarch64_fbsd13_trapframe_map[] = =3D > { > - { 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 }, > }; >=20 Thanks. For my personal build's non-debug kernel the updated kgdb that I built and installed produced: get_curthread () at /usr/main-src/sys/arm64/include/pcpu.h:77 77 __asm __volatile("ldr %0, [x18]" : "=3D&r"(td)); (kgdb) #0 get_curthread () at /usr/main-src/sys/arm64/include/pcpu.h:77 #1 doadump (textdump=3D0, textdump@entry=3D1648929296) at /usr/main-src/sys/kern/kern_shutdown.c:405 #2 0xffff0000000f7704 in db_dump (dummy=3D, = dummy2=3D, dummy3=3D, dummy4=3D) at /usr/main-src/sys/ddb/db_command.c:591 #3 0xffff0000000f74e0 in db_command (last_cmdp=3D, = cmd_table=3D, dopager=3Dtrue) at /usr/main-src/sys/ddb/db_command.c:504 #4 0xffff0000000f71b8 in db_command_loop () at /usr/main-src/sys/ddb/db_command.c:551 #5 0xffff0000000fad9c in db_trap (type=3D, = code=3D) at /usr/main-src/sys/ddb/db_main.c:268 #6 0xffff0000004f4ec4 in kdb_trap (type=3D60, code=3D0, tf=3D) at /usr/main-src/sys/kern/subr_kdb.c:790 #7 #8 kdb_enter (why=3D, msg=3D) at /usr/main-src/sys/kern/subr_kdb.c:556 #9 0xffff0000004a5350 in vpanic ( fmt=3D0xffff00000099d39c "vm_fault failed: 0x%lx error %d", ap=3D...) at /usr/main-src/sys/kern/kern_shutdown.c:958 #10 0xffff0000004a5168 in panic ( fmt=3D0x12 ) at /usr/main-src/sys/kern/kern_shutdown.c:894 #11 0xffff00000083c708 in data_abort (td=3D0xffff000157796260, = frame=3D0xffff00016248b360, esr=3D2516582404, far=3D, = lower=3D0) at /usr/main-src/sys/arm64/arm64/trap.c:392 #12 #13 dump_sa (nw=3Dnw@entry=3D0xffff00016248b7f0, attr=3Dattr@entry=3D1, = sa=3D0x44572d4338374143) at = /usr/main-src/sys/netlink/route/iface.c:226 #14 0xffff0000006b8fe0 in dump_iface (nw=3D0xffff00016248b7f0, = ifp=3D0xffffa00316119800, hdr=3D, = if_flags_mask=3D, if_flags_mask@entry=3D1648932336) at /usr/main-src/sys/netlink/route/iface.c:327 #15 0xffff0000006bb0bc in dump_cb (ifp=3D0x1, _arg=3D, = _arg@entry=3D0xffff00016248b690) at /usr/main-src/sys/netlink/route/iface.c:433 #16 0xffff0000005cf488 in if_foreach_sleep (match_cb=3D, = match_arg=3Dmatch_arg@entry=3D0xffff00016248b6d0, = cb=3D0xffff0000006bb0a0 , = cb_arg=3Dcb_arg@entry=3D0xffff00016248b690) at /usr/main-src/sys/net/if.c:4594 #17 0xffff0000006ba1c0 in rtnl_handle_getlink (hdr=3D0xffffa003198a6800, = nlp=3D0xffffa002ef454300, npt=3D) at /usr/main-src/sys/netlink/route/iface.c:503 #18 0xffff0000006b8390 in rtnl_handle_message ( hdr=3Dhdr@entry=3D0xffffa003198a6800, = npt=3Dnpt@entry=3D0xffff00016248b830) at /usr/main-src/sys/netlink/netlink_route.c:104 #19 0xffff0000006b5818 in nl_receive_message (hdr=3D0xffffa003198a6800, = remaining_length=3D32, nlp=3D0xffffa002ef454300, = npt=3D0xffff00016248b830) at /usr/main-src/sys/netlink/netlink_io.c:508 #20 nl_process_mbuf (m=3D, nlp=3D0xffffa002ef454300) at /usr/main-src/sys/netlink/netlink_io.c:582 #21 nl_process_received_one (nlp=3D0xffffa002ef454300) at /usr/main-src/sys/netlink/netlink_io.c:295 #22 nl_process_received (nlp=3D0xffffa002ef454300) at /usr/main-src/sys/netlink/netlink_io.c:322 #23 nl_taskqueue_handler (_arg=3D0xffffa002ef454300, pending=3D) at /usr/main-src/sys/netlink/netlink_io.c:373 #24 0xffff00000050c668 in taskqueue_run_locked ( queue=3Dqueue@entry=3D0xffffa009ff851180) at /usr/main-src/sys/kern/subr_taskqueue.c:512 #25 0xffff00000050db70 in taskqueue_thread_loop (arg=3D, = arg@entry=3D0xffffa002ef454360) at /usr/main-src/sys/kern/subr_taskqueue.c:824 #26 0xffff00000045b7bc in fork_exit ( callout=3D0xffff00000050daa0 , = arg=3D0xffffa002ef454360, frame=3D0xffff00016248ba00) at /usr/main-src/sys/kern/kern_fork.c:1160 #27 (kgdb)=20 (I do not strip symbols and such from non-debug builds.) Much better. =3D=3D=3D Mark Millard marklmi at yahoo.com