From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from s01.bc.larksuite.com (s01.bc.larksuite.com [209.127.230.19]) by sourceware.org (Postfix) with UTF8SMTPS id 461D43858C33 for ; Wed, 19 Jul 2023 12:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 461D43858C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=spacemit.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=spacemit.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2303021642; d=spacemit.com; t=1689770671; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=rVNFhFS4+I9uOdPmuFyzFuh05D+eAJV0Y7fDRDlWxcc=; b=woQ5ix6z5lbPhvfCTTMVtwH6Yi8SXd+uq/9GXMaKWVFUNWrVfRrawcsLGYdS014lgXLHw4 Nm+HPiI9E4TK321Rr6Uhh6qiDkZwPl28WRdhO0JEUBegkpxpi2+7ifkH6UTFSIg+t4bnBH 3I0GJnRIATEqIcCFGhThU7MBK30TkGlIo9LwR0+BJA1kbDxKa0zwykx1v9SnB6CW7J2+wg ht8JVEpaQWgzYH03UimGEdEcPu7wXg+TIZj1oz3T/u1nE0d2S/zJhEjbgSkx78K+X5ZGle gGJQRPcBqa1JXA4sU2hsHeSNUzrR2bv6u/eU9QiNi42IXw+QXd2kjlMi8xnpqQ== Date: Wed, 19 Jul 2023 20:44:30 +0800 Message-Id: <16c8bb4f69de36253945d0fb7891fb770dd49697.26b424ad.7399.46ec.bbc7.764fae79349e@feishu.cn> Subject: =?UTF-8?q?Re:_why_gdb_try_to_read_address_0x0_when_I_set_$pc=EF=BC=8Chow_?= =?UTF-8?q?to_suppress_this_behavior=3F?= Mime-Version: 1.0 X-Lms-Return-Path: To: "gdb@sourceware.org" From: =?utf-8?q?=E5=BA=84=E7=A7=8B=E5=BD=AC?= In-Reply-To: <16c8bb4f69de36253945d0fb7891fb770dd49697.5b4244aa.a4ef.425c.9c3b.f2b37af9ec63@feishu.cn> Content-Type: multipart/alternative; boundary=b713ddcdd34bd06d0605a10b0b72fc8dc7b80aa5e13ec6f0b263011a6b02 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_50,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,KAM_LOTSOFHASH,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --b713ddcdd34bd06d0605a10b0b72fc8dc7b80aa5e13ec6f0b263011a6b02 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Some debug info on another board that allows read address 0, shows that gdb= did read address 0 when set pc: (gdb) set debug remote 1 (gdb) p $pc $2 =3D (void (*)()) 0xffffffff80003e4a (gdb) set $pc=3D0xffffffff80003e4a [remote] Sending packet: $m0,2#fb [remote] Packet received: 7310 [remote] Sending packet: $m2,2#fd [remote] Packet received: 4030 [remote] Sending packet: $g#67 [remote] Packet received: 000000000000000014ed5c80ffffffffd03d2081ffffffff7= 8a13181ffffffff40c22081ffffffff40d71e7ed8ffffff00000000000000006036e080ffff= ffffe03d2081ffffffff00000000000000000000000000000000f872f180ffffffff0000000= 00000000040c22081ffffffff010000000000000000a050fdd8ffffff000000000000000045= 4d495400000000f8c13181ffffffffd0c33181ffffffff000000000000000018c03181fffff= fff08008080ffffffff7f000000000000003850034000000000987605400000000000000000= 000000000000000000000000fe030000000000000000000000000000ebdecce000000000000= 0000000000000 [16 bytes omitted] [remote] Sending packet: $m0,2#fb [remote] Packet received: 7310 [remote] Sending packet: $m2,2#fd [remote] Packet received: 4030 > From: "=E5=BA=84=E7=A7=8B=E5=BD=AC" > Date: Wed, Jul 19, 2023, 15:59 > Subject: why gdb try to read address 0x0 when I set $pc=EF=BC=8Chow to s= uppress this behavior? > To: "gdb@sourceware.org" > Hi, >=20 > I use gdb with openocd to debug a riscv board, and found that when set $p= c=3Dxxx(a non-zero value) in gdb, gdb would first read the address 0x0, whi= ch caused an error on this riscv device. > Is there any documentation or suggestions for reading the source code to = solve this problem?=C2=A0 > Thanks This message and any attachment are confidential and may be privileged or o= therwise protected from disclosure. If you are not an intended recipient of= this message, please delete it and any attachment from your system and not= ify the sender immediately by reply e-mail. Unintended recipients should no= t use, copy, disclose or take any action based on this message or any infor= mation contained in this message. Emails cannot be guaranteed to be secure = or error free as they can be intercepted, amended, lost or destroyed, and y= ou should take full responsibility for security checking.=20 =20 =E6=9C=AC=E9=82=AE=E4=BB=B6=E5=8F=8A=E5=85=B6=E4=BB=BB=E4=BD=95=E9=99=84=E4= =BB=B6=E5=85=B7=E6=9C=89=E4=BF=9D=E5=AF=86=E6=80=A7=E8=B4=A8=EF=BC=8C=E5=B9= =B6=E5=8F=AF=E8=83=BD=E5=8F=97=E5=85=B6=E4=BB=96=E4=BF=9D=E6=8A=A4=E6=88=96= =E4=B8=8D=E5=85=81=E8=AE=B8=E8=A2=AB=E6=8A=AB=E9=9C=B2=E7=BB=99=E7=AC=AC=E4= =B8=89=E6=96=B9=E3=80=82=E5=A6=82=E9=98=81=E4=B8=8B=E8=AF=AF=E6=94=B6=E5=88= =B0=E6=9C=AC=E9=82=AE=E4=BB=B6=EF=BC=8C=E6=95=AC=E8=AF=B7=E7=AB=8B=E5=8D=B3= =E4=BB=A5=E5=9B=9E=E5=A4=8D=E7=94=B5=E5=AD=90=E9=82=AE=E4=BB=B6=E7=9A=84=E6= =96=B9=E5=BC=8F=E9=80=9A=E7=9F=A5=E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=8C=E5=B9= =B6=E5=B0=86=E6=9C=AC=E9=82=AE=E4=BB=B6=E5=8F=8A=E5=85=B6=E4=BB=BB=E4=BD=95= =E9=99=84=E4=BB=B6=E4=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8=B4=A3=E5=81=9A= =E5=A5=BD=E5=AE=89=E5=85=A8=E6=A3=80=E6=9F=A5=E3=80=82= --b713ddcdd34bd06d0605a10b0b72fc8dc7b80aa5e13ec6f0b263011a6b02--