public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/doc: extend the documentation of the jump command Date: Thu, 27 Apr 2023 12:59:47 +0000 (GMT) [thread overview] Message-ID: <20230427125947.055813858D33@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d42948f0c822ed3782a45771c8fbc21aa2d6553 commit 0d42948f0c822ed3782a45771c8fbc21aa2d6553 Author: Andrew Burgess <aburgess@redhat.com> Date: Mon Apr 24 15:27:27 2023 +0100 gdb/doc: extend the documentation of the jump command This commit addresses PR gdb/7946. While checking for bugs relating to the jump command I noticed a long standing bug that points out a deficiency with GDB's documentation of the jump command. The bug points out that 'jump 0x...' is not always the same as 'set $pc = 0x...' and then 'continue'. Writing directly to the $pc register does not update any auxiliary state, e.g. $npc on SPARC, while using 'jump' does. It felt like this would be an easy issue to address by adding a paragraph to the docs, so I took a stab at writing something suitable. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7946 Approved-By: Eli Zaretskii <eliz@gnu.org> Diff: --- gdb/doc/gdb.texinfo | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d8f7413dc48..263326d54e7 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20618,6 +20618,14 @@ makes the next @code{continue} command or stepping command execute at address @code{0x485}, rather than at the address where your program stopped. @xref{Continuing and Stepping, ,Continuing and Stepping}. +However, writing directly to @code{$pc} will only change the value of +the program-counter register, while using @code{jump} will ensure that +any additional auxiliary state is also updated. For example, on +SPARC, @code{jump} will update both @code{$pc} and @code{$npc} +registers prior to resuming execution. When using the approach of +writing directly to @code{$pc} it is your job to also update the +@code{$npc} register. + The most common occasion to use the @code{jump} command is to back up---perhaps with more breakpoints set---over a portion of a program that has already executed, in order to examine its execution in more
reply other threads:[~2023-04-27 12:59 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230427125947.055813858D33@sourceware.org \ --to=aburgess@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).