Discussion:
[Bug cli/17669] New: edit command wrong source line
kraftcheck at gmail dot com
2014-12-02 15:26:19 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17669

Bug ID: 17669
Summary: edit command wrong source line
Product: gdb
Version: 7.8
Status: NEW
Severity: normal
Priority: P2
Component: cli
Assignee: unassigned at sourceware dot org
Reporter: kraftcheck at gmail dot com

The source line passed to the editor for the 'edit' command appears to
consistently be off by five. The script below will produce this output:

Breakpoint 1, main () at test.c:3
3 int i = 5;
edit +8 /tmp/test.c

Note that source line is 3. Line number passed to editor is 8.


#!/bin/sh

GDB=${HOME}/opt/gdb-7.8.1/bin/gdb

cat >test.c <<end_of_source
int main()
{
int i = 5;
int j = 6;
int k = 1;
return i - j + k;
}
end_of_source

gcc test.c -g -o test

cat <<end_of_gdb | EDITOR=echo $GDB test
b 2
r
edit
q
end_of_gdb
--
You are receiving this mail because:
You are on the CC list for the bug.
kraftcheck at gmail dot com
2014-12-02 15:28:30 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17669

--- Comment #1 from Jason Kraftcheck <kraftcheck at gmail dot com> ---
Script and output don't quite match up. Corrected script (cosmetic change).

#!/bin/sh

GDB=${HOME}/opt/gdb-7.8.1/bin/gdb

cat >test.c <<end_of_source
int main()
{
int i = 5;
int j = 6;
int k = 1;
return i - j + k;
}
end_of_source

gcc test.c -g -o test

cat <<end_of_gdb | EDITOR="echo edit" $GDB test
b 2
r
edit
q
end_of_gdb
--
You are receiving this mail because:
You are on the CC list for the bug.
dje at google dot com
2014-12-02 20:17:47 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17669

dje at google dot com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at google dot com

--- Comment #2 from dje at google dot com ---
I wonder if this is related to the list window size.

Yeah, simple experiments suggest it is.

E.g., do "set listsize 1", and I get the cursor on the right line.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-11-15 10:56:35 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17669

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |lijiang1489 at 163 dot com

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 23337 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...