LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-28-2004, 12:58 AM   #1
jg167
Member
 
Registered: Jun 2004
Posts: 40

Rep: Reputation: 15
gdb has lost its mind


Or more accurately its view of the address space/symbol mapping. Would anyone care to expalin the folliwing and suggest what I can do to fix it? np.c is just a simple program that only calls getopt so far, yet gdb can not seem to output the correct value for the extern int optind. Obviously this is rather unwelcome behavior for a debugger. gdb is still from rh9, gcc and its core libs have been updated from fc2 (rpm did not complain about a gdb dependency on the old versions). Np is built simply with gcc -g -o np np.c

[jrg@PC-linux src]$ gdb np
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) b 56
Breakpoint 1 at 0x804888f: file np.c, line 56.
(gdb) run -o -l 4003 hello
Starting program: /home/jrg/src/np -o -l 4003 hello

# note gdb has a different view of optind than the program
Breakpoint 1, main (argc=5, argv=0xbffff964) at np.c:56
56 printf("optind %d\n",optind);
(gdb) p optind
$1 = 1
(gdb) n
optind 3
57 if ( !in && !out )


(gdb) q
The program is running. Exit anyway? (y or n) y
[jrg@PC-linux src]$ ldd np
libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[jrg@PC-linux src]$ gcc --version
gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
Old 10-28-2004, 02:29 AM   #2
jg167
Member
 
Registered: Jun 2004
Posts: 40

Original Poster
Rep: Reputation: 15
Well its not due to the rev of gdb, as if I boot FC2 the same thing happpens. If I just rearrange some of the program (no functional change, add/remove some as yet uneeded includes, move the printf up or down a line, etc ) I can make it go away (for either gdb 5 or FC2's gdb 6). So this is not a version issue between gcc and its libs and gdb. Which does not help me much...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM
of all the things ive lost i miss my mind the most KOA Linux - Hardware 3 09-07-2003 10:18 PM
yenta has lost its mind! tisource Linux - Hardware 4 04-28-2003 11:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration