public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: 庄秋彬 <mark.zhuang@spacemit.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: why gdb try to read address 0x0 when I set $pc,how to suppress this behavior?
Date: Wed, 19 Jul 2023 20:44:30 +0800	[thread overview]
Message-ID: <16c8bb4f69de36253945d0fb7891fb770dd49697.26b424ad.7399.46ec.bbc7.764fae79349e@feishu.cn> (raw)
In-Reply-To: <16c8bb4f69de36253945d0fb7891fb770dd49697.5b4244aa.a4ef.425c.9c3b.f2b37af9ec63@feishu.cn>

[-- Attachment #1: Type: text/plain, Size: 2823 bytes --]

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 = (void (*)()) 0xffffffff80003e4a
(gdb) set $pc=0xffffffff80003e4a
[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: 000000000000000014ed5c80ffffffffd03d2081ffffffff78a13181ffffffff40c22081ffffffff40d71e7ed8ffffff00000000000000006036e080ffffffffe03d2081ffffffff00000000000000000000000000000000f872f180ffffffff000000000000000040c22081ffffffff010000000000000000a050fdd8ffffff0000000000000000454d495400000000f8c13181ffffffffd0c33181ffffffff000000000000000018c03181ffffffff08008080ffffffff7f000000000000003850034000000000987605400000000000000000000000000000000000000000fe030000000000000000000000000000ebdecce0000000000000000000000000 [16 bytes omitted]
[remote] Sending packet: $m0,2#fb
[remote] Packet received: 7310
[remote] Sending packet: $m2,2#fd
[remote] Packet received: 4030
> From: "庄秋彬"<mark.zhuang@spacemit.com>
> Date:  Wed, Jul 19, 2023, 15:59
> Subject:  why gdb try to read address 0x0 when I set $pc,how to suppress this behavior?
> To: "gdb@sourceware.org"<gdb@sourceware.org>
> Hi,
> 
> I use gdb with openocd to debug a riscv board, and found that when set $pc=xxx(a non-zero value) in gdb, gdb would first read the address 0x0, which caused an error on this riscv device.
> Is there any documentation or suggestions for reading the source code to solve this problem? 
> Thanks


This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not an intended recipient of this message, please delete it and any attachment from your system and notify the sender immediately by reply e-mail. Unintended recipients should not use, copy, disclose or take any action based on this message or any information contained in this message. Emails cannot be guaranteed to be secure or error free as they can be intercepted, amended, lost or destroyed, and you should take full responsibility for security checking. 
 
本邮件及其任何附件具有保密性质,并可能受其他保护或不允许被披露给第三方。如阁下误收到本邮件,敬请立即以回复电子邮件的方式通知发件人,并将本邮件及其任何附件从阁下系统中予以删除。如阁下并非本邮件写明之收件人,敬请切勿使用、复制、披露本邮件或其任何内容,亦请切勿依本邮件或其任何内容而采取任何行动。电子邮件无法保证是一种安全和不会出现任何差错的通信方式,可能会被拦截、修改、丢失或损坏,收件人需自行负责做好安全检查。

  reply	other threads:[~2023-07-19 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  7:59 庄秋彬
2023-07-19 12:44 ` 庄秋彬 [this message]
2023-07-26 16:09 ` Tom Tromey
2023-07-27 15:51   ` 庄秋彬
2023-07-27 17:36     ` Torbjorn SVENSSON

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16c8bb4f69de36253945d0fb7891fb770dd49697.26b424ad.7399.46ec.bbc7.764fae79349e@feishu.cn \
    --to=mark.zhuang@spacemit.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).