From: Gary Johnson <garyjohn@spocom.com>
To: gdb@sourceware.org
Subject: [PATCH] Fix 5-line offset of edit command
Date: Sat, 11 Feb 2023 02:08:14 -0800 [thread overview]
Message-ID: <20230211100814.GA17240@phoenix> (raw)
When gdb is paused at a line and I open the current file with the
edit command, gdb uses vim to open the file at the current line, but
the line number given to vim is always too high by 5.
For example, using gdb-12.1 and the gdb-12.1 source, cd to
gdb-12.1/gdb and run gdb on itself.
$ gdb gdb
(gdb) b main
(gdb) run
Gdb will stop at line 25.
(gdb) edit
will open vim at line 30. Executing
:ps -fH
confirms that vim was started with the argument "+30".
The problem appears to be in the edit_command() function in
cli-cmds.c, at line 966 in version 12.1. The solution is to
delete that line. The patch is below.
Regards,
Gary
--------------------------------------------------------------------
--- cli-cmds.c.orig 2022-05-01 11:46:31.000000000 -0700
+++ cli-cmds.c 2023-02-11 00:54:01.695108617 -0800
@@ -963,7 +963,6 @@
{
if (sal.symtab == 0)
error (_("No default source file yet."));
- sal.line += get_lines_to_list () / 2;
}
else
{
next reply other threads:[~2023-02-11 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-11 10:08 Gary Johnson [this message]
2023-02-11 10:58 ` Eli Zaretskii
2023-02-11 22:52 ` Gary Johnson
2023-02-12 6:14 ` Eli Zaretskii
2023-02-12 9:23 ` Andreas Schwab
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=20230211100814.GA17240@phoenix \
--to=garyjohn@spocom.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).