#730630 Line number 16 out of range; d2.c has 11 lines.

Package:
gdb
Source:
gdb
Description:
GNU Debugger
Submitter:
Mathieu Malaterre
Date:
2025-07-28 02:13:02 UTC
Severity:
normal
#730630#5
Date:
2013-11-27 13:24:15 UTC
From:
To:
gdb/gcc does not like \r in C comment and get lost counting lines. See
attached C code.

Steps:

$ gcc -o demo -g d2.c
$ gdb ./demo
[...]
Reading symbols from /tmp/demo...done.
(gdb) b main
Breakpoint 1 at 0x4004c7: file d2.c, line 16.
(gdb) r
Starting program: /tmp/./demo
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Breakpoint 1, main (argc=1, argv=0x7fffffffe8d8) at d2.c:16
(gdb) list
Line number 16 out of range; d2.c has 11 lines.

#730630#10
Date:
2014-05-08 12:30:02 UTC
From:
To:
I am unable to reproduce with upcoming 7.7-1 package.
Please verify again once it hits proper Debian.

#730630#15
Date:
2015-01-16 15:04:10 UTC
From:
To:
Still present in jessie:

$ wget "https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=d2.c;att=1;bug=730630"
$ gcc -o demo -g d2.c
$ gdb ./demo
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./demo...done.
(gdb) b main
Breakpoint 1 at 0x4004d0: file d2.c, line 16.
(gdb) r
Starting program: /tmp/demo

Breakpoint 1, main (argc=1, argv=0x7fffffffe918) at d2.c:16
(gdb) list
Line number 16 out of range; d2.c has 11 lines.
(gdb) quit
A debugging session is active.

Inferior 1 [process 30379] will be killed.

Quit anyway? (y or n) y

with:

$ apt-cache policy gdb
gdb:
  Installed: 7.7.1+dfsg-5
  Candidate: 7.7.1+dfsg-5
  Version table:
 *** 7.7.1+dfsg-5 0
        500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
        100 /var/lib/dpkg/status

#730630#22
Date:
2025-07-28 02:01:53 UTC
From:
To:
Control: reassign -1 gcc-14

GDB's output nowadays is better: