Bug 192261 - LTC23886-edit command in gdb doesn't work
LTC23886-edit command in gdb doesn't work
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
5
powerpc Linux
medium Severity urgent
: ---
: ---
Assigned To: Alexandre Oliva
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-18 13:39 EDT by IBM Bug Proxy
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: gdb-6.5-1.fc6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-18 02:42:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch that fixes the bug (1.44 KB, patch)
2006-07-18 02:16 EDT, Alexandre Oliva
no flags Details | Diff

  None (edit)
Description IBM Bug Proxy 2006-05-18 13:39:53 EDT
Problem description:
When debugging an elf executable file with debug info, the edit command(use vi)
didn't work properly. vi showed incorrect file path.

[root@junolp1 ~]# uname -a
Linux junolp1.upt.austin.ibm.com 2.6.16-1.2181_FC6 #1 SMP Sun Apr 30 23:03:19
EDT 2006 ppc64 ppc64 ppc64 GNU/Linux

Hardware Environment
   Power5

Additional information:
[root@junolp1 ~]# cat test.c
int main()
{
        return 0;
}

[root@junolp1 ~]# gcc test.c -g -o test
[root@junolp1 ~]# rpm -q gdb
gdb-6.3.0.0-1.128.FC6

[root@junolp1 ~]# export EDITOR=/usr/bin/vim
[root@junolp1 ~]# gdb -silent /root/test
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) edit

vi showes incorrect file path:
"/roottest.c" [New File]
But it should be /root/test.c.

Ths problem was reported in gdb community:
http://sources.redhat.com/cgi-bin/gnatsweb.pl
view # 1608
Comment 1 IBM Bug Proxy 2006-05-30 00:57:09 EDT
----- Additional Comments From shenlinf@cn.ibm.com  2006-05-30 01:01 EDT -------
The problem still exists in May 26 version. 
Comment 2 IBM Bug Proxy 2006-06-06 03:19:33 EDT
changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|FC5                         |devel




------- Additional Comments From shenlinf@cn.ibm.com  2006-06-06 03:21 EDT -------
I am changing the version to 'devel' to properly reflect that this recreates on
rawhide. 
Comment 3 IBM Bug Proxy 2006-06-16 18:12:09 EDT
----- Additional Comments From salina@us.ibm.com  2006-06-16 18:16 EDT -------
I got the latest gdb cvs .. /gdb-6.5.50.20060616 and the bug is fixed in that 
version

the code that works look like this
...
 
 if ((editor = (char *) getenv ("EDITOR")) == NULL)
      editor = "/bin/ex";

  /* Approximate base-10 log of line to 1 unit for digit count */
  for(log10=32, m=0x80000000; !(sal.line & m) && log10>0; log10--, m=m>>1);
  log10 = 1 + (int)((log10 + (0 == ((m-1) & sal.line)))/3.32192809);

  /* If we don't already know the full absolute file name of the
     source file, find it now.  */
  if (!sal.symtab->fullname)
    {
      fn = symtab_to_fullname (sal.symtab);
      if (!fn)
        fn = "unknown";
    }
  else
    fn = sal.symtab->fullname;

  /* Quote the file name, in case it has whitespace or other special
     characters.  */
  p = xstrprintf ("%s +%d "%s"", editor, sal.line, fn);
  shell_escape(p, from_tty);
  xfree(p);
} 
Comment 4 Alexandre Oliva 2006-07-18 02:16:12 EDT
Created attachment 132585 [details]
Patch that fixes the bug

This patch fixes the problem, but I don't feel that it's worth spinning an
update for FC5 for it alone.  Upgrading to GDB 6.5, tracking rawhide, is an
option on the table, but that also feels like too much of an upgrade.
Comment 5 Fedora Update System 2006-09-14 21:46:53 EDT
gdb-6.3.0.0-1.134.fc5 has been pushed for fc5, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 6 IBM Bug Proxy 2006-10-10 07:41:23 EDT
----- Additional Comments From shenlinf@cn.ibm.com  2006-10-10 07:36 EDT -------
Test edit in gdb with fc6-test3 and it works fine.
-------------
[root@auroralp2 ~]# uname -r
2.6.17-1.2630.fc6
[root@auroralp2 ~]# gcc test.c -g -o test
[root@auroralp2 ~]# rpm -q gdb
gdb-6.5-7.fc6
gdb-6.5-7.fc6
[root@auroralp2 ~]# export EDITOR=/usr/bin/vim
[root@auroralp2 ~]#
[root@auroralp2 ~]# gdb -silent /root/test
Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) edit
int main()
{
        return 0;
} 
Comment 7 IBM Bug Proxy 2007-01-17 00:16:18 EST
changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ACCEPTED                    |CLOSED




------- Additional Comments From shenlinf@cn.ibm.com  2007-01-17 00:12 EDT -------
Closing this defect. Thank you all. 

Note You need to log in before you can comment on or make changes to this bug.