gdb resolves symbolic links for executables in argv[0]
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Calling gdb on an executable that is a symbolic link will pass the target of the symbolic link rather than the specified link as argv[0] to the program.
As a result, if the program relies on the contents of argv[0] (for example, for figuring out paths relative to the executable or making decisions based on the name the executable has been called under), debugging fails.
This seems to be a problem newly introduced in Raring.
ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: gdb 7.6~20130417-
ProcVersionSign
Uname: Linux 3.8.0-19-generic i686
ApportVersion: 2.9.2-0ubuntu8
Architecture: i386
Date: Sat Apr 27 13:22:35 2013
InstallationDate: Installed on 2011-10-14 (560 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111011)
MarkForUpload: True
SourcePackage: gdb
UpgradeStatus: Upgraded to raring on 2013-04-05 (21 days ago)
Here is an example for a program relying on its argv[0] name: /usr/bin/latex is a symbolic link to /usr/bin/pdftex, and pdftex loads a format depending on the name under which it has been called. As a result,
latex '\stop'
will load the latex.fmt format and finish processing while the same will fail under gdb since argv[0] is being passed as /usr/bin/pdftex instead of /usr/bin/latex:
dak@lola:/tmp$ latex '\stop' 2.4-1.40. 13 (TeX Live 2012/Debian)
This is pdfTeX, Version 3.1415926-
restricted \write18 enabled.
entering extended mode
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, bu
lgarian, ukrainian, russian, loaded.
No pages of output.
Transcript written on texput.log.
dak@lola:/tmp$ gdb latex 20130417- cvs-ubuntu gnu.org/ licenses/ gpl.html> www.gnu. org/software/ gdb/bugs/>... pdftex. ..(no debugging symbols found)...done. 2.4-1.40. 13 (TeX Live 2012/Debian)
GNU gdb (GDB) 7.5.91.
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://
Reading symbols from /usr/bin/
(gdb) run '\stop'
Starting program: /usr/bin/pdftex '\stop'
This is pdfTeX, Version 3.1415926-
restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> \stop
?