From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 055813858D33; Thu, 27 Apr 2023 12:59:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 055813858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682600387; bh=nuwrdGCd0Hhhwtk7YT7YVDql7Svm+IZw771bBIJzaUI=; h=From:To:Subject:Date:From; b=c3G5tQEDHZUrgpb+YPUYaulDx0YllNjpGy3mudya/SZjIokeDBTJCFeh4KFE4ekcp 4FYKAhHxBLtkKF6ExHxsBWESfS14fhHoSZEtIgim76A7aenrTAfob8aDTh3p4WHz9w pRK7e6LWA+bOOQ/eb3Q8dOScO+FFOroEawzemaXc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/doc: extend the documentation of the jump command X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 08ec06d6440745ef9204d39197aa1e732df41056 X-Git-Newrev: 0d42948f0c822ed3782a45771c8fbc21aa2d6553 Message-Id: <20230427125947.055813858D33@sourceware.org> Date: Thu, 27 Apr 2023 12:59:47 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0d42948f0c82= 2ed3782a45771c8fbc21aa2d6553 commit 0d42948f0c822ed3782a45771c8fbc21aa2d6553 Author: Andrew Burgess Date: Mon Apr 24 15:27:27 2023 +0100 gdb/doc: extend the documentation of the jump command =20 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. =20 The bug points out that 'jump 0x...' is not always the same as 'set $pc =3D 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. =20 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. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D7946 =20 Approved-By: Eli Zaretskii 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 stoppe= d. @xref{Continuing and Stepping, ,Continuing and Stepping}. =20 +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