Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB 5.1 on Solaris 2.8
@ 2001-11-11 13:41 Dan Nicolaescu
  2001-11-11 18:14 ` gdb
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Nicolaescu @ 2001-11-11 13:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

  > I've just built GDB 5.1 on Solaris 2.8, and I have a problem: GDB says
  > there's no debugging symbols in every executable I find, even though
  > they
  > were compiled and linkes with -g.  dbx does find the debugging info.
  > >From what I see, GDB does find the minimal symbols, since I can put
  > breakpoints, but it cannot find the source line information.
  > 
  > This is the first time I build GDB on Solaris, so I don't know whether
  > this is a known issue (not a word in README, though), or maybe I
  > goofed
  > during the build.
  > 
  > The compiler used to compile GDB and the programs I try to debug was
  > SunWspro ANSI C compiler.
  > 
  > Any ideas are welcome.


It sounds that this is due to the fact that Sun's compiler+linker do not
put the full debugging information in the binary by default. 
They only put some minimal debug info in the binary and leave the
rest in the object files. 

Try compiling with -g -xs and see if you can debug then. 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB 5.1 on Solaris 2.8
  2001-11-11 13:41 GDB 5.1 on Solaris 2.8 Dan Nicolaescu
@ 2001-11-11 18:14 ` gdb
  0 siblings, 0 replies; 7+ messages in thread
From: gdb @ 2001-11-11 18:14 UTC (permalink / raw)
  To: gdb

On Fri, Nov 23, 2001 at 08:55:39AM -0800, Dan Nicolaescu wrote:
>   > I've just built GDB 5.1 on Solaris 2.8, and I have a problem: GDB says
>   > there's no debugging symbols in every executable I find, even though
>   > they
>   > were compiled and linkes with -g.  dbx does find the debugging info.
>   > >From what I see, GDB does find the minimal symbols, since I can put
>   > breakpoints, but it cannot find the source line information.
>   > 
>   > This is the first time I build GDB on Solaris, so I don't know whether
>   > this is a known issue (not a word in README, though), or maybe I
>   > goofed
>   > during the build.
>   > 
>   > The compiler used to compile GDB and the programs I try to debug was
>   > SunWspro ANSI C compiler.
>   > 
>   > Any ideas are welcome.
> 
> 
> It sounds that this is due to the fact that Sun's compiler+linker do not
> put the full debugging information in the binary by default. 
> They only put some minimal debug info in the binary and leave the
> rest in the object files. 
> 
> Try compiling with -g -xs and see if you can debug then. 

$ pwd
/opt/src/devel/gdb-5.1
$ ls -ld a.c
-rw-rw-r--   1 china    src           33 Nov 23 15:25 a.c
$ cat a.c
int
main (void) {
  int a = 1;
}
$ cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
$ cc -g -xs a.c
$ dbx a.out
dbx> list 1,+
    1   int
    2   main (void) {
    3     int a = 1;
    4   }
dbx> exit
$ gdb a.out
gdb> list
/opt/src/devel/gdb-5.1: Is a directory.

-- 
albert chin (china@thewrittenword.com)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB 5.1 on Solaris 2.8
@ 2001-11-26  4:16 debashis  mahata
  2001-11-14  0:50 ` debashis  mahata
  0 siblings, 1 reply; 7+ messages in thread
From: debashis  mahata @ 2001-11-26  4:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dan Nicolaescu, gdb

Hi all,

 I also hit this problem. Probably this is a problem with 
 "Sun WorkShop 6 
 update 2 C 5.3" compiler. This compiler does not generate the last back 
 slash ("/") in the first N_SO stab that represents the directory name. 
 The second N_SO is actually represents the source file name. GDB 
 identify the directory name using the last '/' as an indicator. For the 
 program

 $pwd
 /h/mahatad/DBG/GDB
 $cat a.c
 int 
 main (void) {
         int a = 1;
 }
 $

 The N_SO stab entries are - 

 With "Sun WorkShop 6 update 2 C 5.3" - 

 "/h/mahatad/DBG/GDB" ,64, 0, 0, 0
 "a.c" ,64, 0, 3, 0

 With the old version of compiler - 

 "/h/mahatad/DBG/GDB/" ,64, 0, 0, 0
 "a.c" ,64, 0, 3, 0


 It is clear that new compiler does not generate the last '/' in first 
 N_SO stab.

 Because of that GDB takes "/h/mahatad/DBG/GDB" as a file name. The 
 corresponding code is in the partial-stab.h -
   case N_SO:
    {
     ....
       p = strrchr (namestring, '/');
       if (p && *(p + 1) == '\000')
         continue; /* Simply ignore directory name SOs */

    }
 GDB is not ignoring the directory name. This requires a fix. Most 
 probably another fix is required in dbxread.c (function - 
 process_one_symbol()) for N_SO case. The corresponding code - 
     case N_SO:
         .....
     start_stabs ();
     start_symtab (name, NULL, valu);
     record_debugformat ("stabs");
       break;

 Here, the 'name' is again a directory name without the last back slash.


 I have put some fix for these two places in my local GDB source. After 
 the fix -

 $cc -V 
 cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
 $cc -g -xs a.c
 $/vob/opnpde/solaris-sparc/debug/package/00.00.00.00/bin/gdb a.out
 GNU gdb 4.18 + 02.00.01.00 (sparc64-sun-solaris2.7),
 Copyright 1998 Free Software Foundation, Inc...
 (gdb) list
 1 int 
 2 main (void) {
 3 int a = 1;
 4 }
 (gdb) 


 I found another problem with this compiler. The structures are suppose 
 to end with two consecutive ';'. GDB logic depends upon that. But this 
 compiler generate only one ';'. Just for an example - 

 For the structure 
 struct node{
         int i;
         char c;
 };

 With "Sun WorkShop 6 update 2 C 5.3" - 
 "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;" ,80, 0, 8, 0

 With the old version of compiler -
 "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;;" ,80, 0, 8, 0

 Again it is clear the new compiler does not generate the last ';' and 
 this will break the GDB logic in read_struct_fields() function (file: 
 stabsread.c).


 Thanks,
 debashis mahata

----- Original Message -----
From: Eli Zaretskii <eliz@is.elta.co.il>
Date: Sunday, November 25, 2001 2:08 pm
Subject: Re: GDB 5.1 on Solaris 2.8

> 
> On Sat, 24 Nov 2001, Dan Nicolaescu wrote:
> 
> >    > $ gdb a.out
> >    > gdb> list
> >    > /opt/src/devel/gdb-5.1: Is a directory.
> > 
> > Well, it works for me... But it seems that you have a newer 
> version of
> > the Sun compiler than I do:
> > 
> > cc -V
> > cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11
> 
> Thanks to everyone who replied; -xs seems to be what I need.
> 
> The example above works for me as well, but I have an even older
> version of the compiler.
> 
> However, it sounds like turning on optimizations makes GDB debugging
> impossible with this compiler.  Is that expected?  Am I spoiled by
> GCC?
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB 5.1 on Solaris 2.8
  2001-11-26  4:16 debashis  mahata
@ 2001-11-14  0:50 ` debashis  mahata
  0 siblings, 0 replies; 7+ messages in thread
From: debashis  mahata @ 2001-11-14  0:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dan Nicolaescu, gdb


Hi all,

 I also hit this problem. Probably this is a problem with 
 "Sun WorkShop 6 
 update 2 C 5.3" compiler. This compiler does not generate the last back 
 slash ("/") in the first N_SO stab that represents the directory name. 
 The second N_SO is actually represents the source file name. GDB 
 identify the directory name using the last '/' as an indicator. For the 
 program

 $pwd
 /h/mahatad/DBG/GDB
 $cat a.c
 int 
 main (void) {
         int a = 1;
 }
 $

 The N_SO stab entries are - 

 With "Sun WorkShop 6 update 2 C 5.3" - 

 "/h/mahatad/DBG/GDB" ,64, 0, 0, 0
 "a.c" ,64, 0, 3, 0

 With the old version of compiler - 

 "/h/mahatad/DBG/GDB/" ,64, 0, 0, 0
 "a.c" ,64, 0, 3, 0


 It is clear that new compiler does not generate the last '/' in first 
 N_SO stab.

 Because of that GDB takes "/h/mahatad/DBG/GDB" as a file name. The 
 corresponding code is in the partial-stab.h -
   case N_SO:
    {
     ....
       p = strrchr (namestring, '/');
       if (p && *(p + 1) == '\000')
         continue; /* Simply ignore directory name SOs */

    }
 GDB is not ignoring the directory name. This requires a fix. Most 
 probably another fix is required in dbxread.c (function - 
 process_one_symbol()) for N_SO case. The corresponding code - 
     case N_SO:
         .....
     start_stabs ();
     start_symtab (name, NULL, valu);
     record_debugformat ("stabs");
       break;

 Here, the 'name' is again a directory name without the last back slash.


 I have put some fix for these two places in my local GDB source. After 
 the fix -

 $cc -V 
 cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
 $cc -g -xs a.c
 $/vob/opnpde/solaris-sparc/debug/package/00.00.00.00/bin/gdb a.out
 GNU gdb 4.18 + 02.00.01.00 (sparc64-sun-solaris2.7),
 Copyright 1998 Free Software Foundation, Inc...
 (gdb) list
 1 int 
 2 main (void) {
 3 int a = 1;
 4 }
 (gdb) 


 I found another problem with this compiler. The structures are suppose 
 to end with two consecutive ';'. GDB logic depends upon that. But this 
 compiler generate only one ';'. Just for an example - 

 For the structure 
 struct node{
         int i;
         char c;
 };

 With "Sun WorkShop 6 update 2 C 5.3" - 
 "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;" ,80, 0, 8, 0

 With the old version of compiler -
 "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;;" ,80, 0, 8, 0

 Again it is clear the new compiler does not generate the last ';' and 
 this will break the GDB logic in read_struct_fields() function (file: 
 stabsread.c).


 Thanks,
 debashis mahata

----- Original Message -----
From: Eli Zaretskii <eliz@is.elta.co.il>
Date: Sunday, November 25, 2001 2:08 pm
Subject: Re: GDB 5.1 on Solaris 2.8

> 
> On Sat, 24 Nov 2001, Dan Nicolaescu wrote:
> 
> >    > $ gdb a.out
> >    > gdb> list
> >    > /opt/src/devel/gdb-5.1: Is a directory.
> > 
> > Well, it works for me... But it seems that you have a newer 
> version of
> > the Sun compiler than I do:
> > 
> > cc -V
> > cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11
> 
> Thanks to everyone who replied; -xs seems to be what I need.
> 
> The example above works for me as well, but I have an even older
> version of the compiler.
> 
> However, it sounds like turning on optimizations makes GDB debugging
> impossible with this compiler.  Is that expected?  Am I spoiled by
> GCC?
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB 5.1 on Solaris 2.8
  2001-11-11 21:24 ` Dan Nicolaescu
@ 2001-11-12  1:49   ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2001-11-12  1:49 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: gdb


On Sat, 24 Nov 2001, Dan Nicolaescu wrote:

>    > $ gdb a.out
>    > gdb> list
>    > /opt/src/devel/gdb-5.1: Is a directory.
> 
> Well, it works for me... But it seems that you have a newer version of
> the Sun compiler than I do:
> 
> cc -V
> cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11

Thanks to everyone who replied; -xs seems to be what I need.

The example above works for me as well, but I have an even older
version of the compiler.

However, it sounds like turning on optimizations makes GDB debugging
impossible with this compiler.  Is that expected?  Am I spoiled by
GCC?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB 5.1 on Solaris 2.8
       [not found] <ur9r8qpa0l0.fsf@totally-fudged-out-message-id>
@ 2001-11-11 21:24 ` Dan Nicolaescu
  2001-11-12  1:49   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Nicolaescu @ 2001-11-11 21:24 UTC (permalink / raw)
  To: gdb

gdb@thewrittenword.com writes:

   > >   > I've just built GDB 5.1 on Solaris 2.8, and I have a problem: GDB says
   > >   > there's no debugging symbols in every executable I find, even though
   > >   > they
   > >   > were compiled and linkes with -g.  dbx does find the debugging info.
   > >   > >From what I see, GDB does find the minimal symbols, since I can put
   > >   > breakpoints, but it cannot find the source line information.
   > >   > 
   > >   > This is the first time I build GDB on Solaris, so I don't know whether
   > >   > this is a known issue (not a word in README, though), or maybe I
   > >   > goofed
   > >   > during the build.
   > >   > 
   > >   > The compiler used to compile GDB and the programs I try to debug was
   > >   > SunWspro ANSI C compiler.
   > >   > 
   > >   > Any ideas are welcome.
   > > 
   > > 
   > > It sounds that this is due to the fact that Sun's compiler+linker do not
   > > put the full debugging information in the binary by default. 
   > > They only put some minimal debug info in the binary and leave the
   > > rest in the object files. 
   > > 
   > > Try compiling with -g -xs and see if you can debug then. 
   > 
   > $ pwd
   > /opt/src/devel/gdb-5.1
   > $ ls -ld a.c
   > -rw-rw-r--   1 china    src           33 Nov 23 15:25 a.c
   > $ cat a.c
   > int
   > main (void) {
   >   int a = 1;
   > }
   > $ cc -V
   > cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
   > $ cc -g -xs a.c
   > $ dbx a.out
   > dbx> list 1,+
   >     1   int
   >     2   main (void) {
   >     3     int a = 1;
   >     4   }
   > dbx> exit
   > $ gdb a.out
   > gdb> list
   > /opt/src/devel/gdb-5.1: Is a directory.

Well, it works for me... But it seems that you have a newer version of
the Sun compiler than I do:

cc -V
cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11

gdb /tmp/a.out
GNU gdb 5.1
Copyright 2001 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 "sparc-sun-solaris2.7"...
(gdb) l
1       int
2       main (void) {
3
4         int a =  1;
5         return 0;
6       }

Same thing on solaris2.8


^ permalink raw reply	[flat|nested] 7+ messages in thread

* GDB 5.1 on Solaris 2.8
@ 2001-11-11 11:39 Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2001-11-11 11:39 UTC (permalink / raw)
  To: gdb

I've just built GDB 5.1 on Solaris 2.8, and I have a problem: GDB says 
there's no debugging symbols in every executable I find, even though they 
were compiled and linkes with -g.  dbx does find the debugging info.
From what I see, GDB does find the minimal symbols, since I can put 
breakpoints, but it cannot find the source line information.

This is the first time I build GDB on Solaris, so I don't know whether 
this is a known issue (not a word in README, though), or maybe I goofed 
during the build.

The compiler used to compile GDB and the programs I try to debug was 
SunWspro ANSI C compiler.

Any ideas are welcome.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-11-26 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-11 13:41 GDB 5.1 on Solaris 2.8 Dan Nicolaescu
2001-11-11 18:14 ` gdb
  -- strict thread matches above, loose matches on Subject: below --
2001-11-26  4:16 debashis  mahata
2001-11-14  0:50 ` debashis  mahata
     [not found] <ur9r8qpa0l0.fsf@totally-fudged-out-message-id>
2001-11-11 21:24 ` Dan Nicolaescu
2001-11-12  1:49   ` Eli Zaretskii
2001-11-11 11:39 Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox