Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* List command question
@ 2004-05-14 18:29 Manoj Iyer
  2004-05-14 19:27 ` Andreas Schwab
  2004-05-15  7:40 ` Monika Chaddha
  0 siblings, 2 replies; 10+ messages in thread
From: Manoj Iyer @ 2004-05-14 18:29 UTC (permalink / raw)
  To: gdb


List command has different out put when the program is compiled with -g
option and when it is not...

I checked out the lastest CVS head of GDB and wrote a small hello world
program, comppiled it with and without -g on a PowerPC 64bit machine, and
here is the diff in output.

manjo@nefertiti:~/projects/src> cc -o ~/tests/test ~/tests/test.c
manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
GNU gdb 2004-04-17-cvs
Copyright 2004 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 "powerpc64-gnu-linux"...Using host libthread_db
libra
ry "/lib64/tls/libthread_db.so.1".

(gdb) list
1       ../sysdeps/powerpc/powerpc32/elf/start.S: No such file or
directory.
        in ../sysdeps/powerpc/powerpc32/elf/start.S
(gdb) quit




manjo@nefertiti:~/projects/src> cc -g -o ~/tests/test ~/tests/test.c
manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
GNU gdb 2004-04-17-cvs
Copyright 2004 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 "powerpc64-gnu-linux"...Using host libthread_db
libra
ry "/lib64/tls/libthread_db.so.1".

(gdb) list
1       #include <stdio.h>
2
3       main()
4       {
5           printf("hello world\n");
6       }
7
(gdb)


I am not sure how the list command should look like when no "-g" is used
to compile the test. Any suggestion? comments??


Thanks
Manoj Iyer


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

* Re: List command question
  2004-05-14 18:29 List command question Manoj Iyer
@ 2004-05-14 19:27 ` Andreas Schwab
  2004-05-15  8:37   ` Eli Zaretskii
  2004-05-15  7:40 ` Monika Chaddha
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2004-05-14 19:27 UTC (permalink / raw)
  To: Manoj Iyer; +Cc: gdb

Manoj Iyer <manjo@austin.ibm.com> writes:

> I am not sure how the list command should look like when no "-g" is used
> to compile the test. Any suggestion? comments??

You can't expect meaningful results without debugging information as
nothing else is providing information about source files.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* RE: List command question
  2004-05-14 18:29 List command question Manoj Iyer
  2004-05-14 19:27 ` Andreas Schwab
@ 2004-05-15  7:40 ` Monika Chaddha
  2004-05-17 15:29   ` Manoj Iyer
  1 sibling, 1 reply; 10+ messages in thread
From: Monika Chaddha @ 2004-05-15  7:40 UTC (permalink / raw)
  To: 'Manoj Iyer', gdb

Hi Manoj

I m not sure but according to my knowledge, whenever we compile any
program with -g option, the compiler generates some debugging
information, which also includes the path of source file. Without
debugging information, it's not possible to use GDB and surely we will
get unexpected results from GDB

Monika



>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Manoj Iyer
>Sent: Friday, May 14, 2004 11:44 PM
>To: gdb@sources.redhat.com
>Subject: List command question
>
>
>List command has different out put when the program is compiled with -g
>option and when it is not...
>
>I checked out the lastest CVS head of GDB and wrote a small hello world
>program, comppiled it with and without -g on a PowerPC 64bit machine,
and
>here is the diff in output.
>
>manjo@nefertiti:~/projects/src> cc -o ~/tests/test ~/tests/test.c
>manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
>GNU gdb 2004-04-17-cvs
>Copyright 2004 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 "powerpc64-gnu-linux"...Using host
libthread_db
>libra
>ry "/lib64/tls/libthread_db.so.1".
>
>(gdb) list
>1       ../sysdeps/powerpc/powerpc32/elf/start.S: No such file or
>directory.
>        in ../sysdeps/powerpc/powerpc32/elf/start.S
>(gdb) quit
>
>
>
>
>manjo@nefertiti:~/projects/src> cc -g -o ~/tests/test ~/tests/test.c
>manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
>GNU gdb 2004-04-17-cvs
>Copyright 2004 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 "powerpc64-gnu-linux"...Using host
libthread_db
>libra
>ry "/lib64/tls/libthread_db.so.1".
>
>(gdb) list
>1       #include <stdio.h>
>2
>3       main()
>4       {
>5           printf("hello world\n");
>6       }
>7
>(gdb)
>
>
>I am not sure how the list command should look like when no "-g" is
used
>to compile the test. Any suggestion? comments??
>
>
>Thanks
>Manoj Iyer


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

* Re: List command question
  2004-05-14 19:27 ` Andreas Schwab
@ 2004-05-15  8:37   ` Eli Zaretskii
  2004-05-15 13:16     ` Andreas Schwab
  2004-05-15 18:07     ` Ramana Radhakrishnan
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2004-05-15  8:37 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: manjo, gdb

> From: Andreas Schwab <schwab@suse.de>
> Date: Fri, 14 May 2004 21:27:18 +0200
> 
> You can't expect meaningful results without debugging information as
> nothing else is providing information about source files.

I tried this with GDB 6.1 and the DJGPP toolchain, and GDB said "(no
debugging symbols found)", which is reasonable, IMHO.

Why didn't it do so in Manoj's case?


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

* Re: List command question
  2004-05-15  8:37   ` Eli Zaretskii
@ 2004-05-15 13:16     ` Andreas Schwab
  2004-05-15 18:07     ` Ramana Radhakrishnan
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2004-05-15 13:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: manjo, gdb

"Eli Zaretskii" <eliz@gnu.org> writes:

>> From: Andreas Schwab <schwab@suse.de>
>> Date: Fri, 14 May 2004 21:27:18 +0200
>> 
>> You can't expect meaningful results without debugging information as
>> nothing else is providing information about source files.
>
> I tried this with GDB 6.1 and the DJGPP toolchain, and GDB said "(no
> debugging symbols found)", which is reasonable, IMHO.
>
> Why didn't it do so in Manoj's case?

Because there is _some_ debugging info, presumably from libc.  And once
gdb has found any debugging info at all it will not say "(no debugging
symbols found)" any more, even if more objects without debugging info are
crossed.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: List command question
  2004-05-15  8:37   ` Eli Zaretskii
  2004-05-15 13:16     ` Andreas Schwab
@ 2004-05-15 18:07     ` Ramana Radhakrishnan
  1 sibling, 0 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2004-05-15 18:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andreas Schwab, manjo, gdb


Thus spake Eli Zaretskii
>> From: Andreas Schwab <schwab@suse.de>
>> Date: Fri, 14 May 2004 21:27:18 +0200
>>
>> You can't expect meaningful results without debugging information as
>> nothing else is providing information about source files.
>
> I tried this with GDB 6.1 and the DJGPP toolchain, and GDB said "(no
> debugging symbols found)", which is reasonable, IMHO.
>
> Why didn't it do so in Manoj's case?

Is it possible that bis start.S is alone compiled with debug info in such
a case  ? Would that be a valid enough reason for this to happen  ? But
isnt it strange that it can find just one file even if libc was compiled
with debug info ?




cheers
Ramana


>


----
Ramana Radhakrishnan
Codito Technologies


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

* RE: List command question
  2004-05-15  7:40 ` Monika Chaddha
@ 2004-05-17 15:29   ` Manoj Iyer
  2004-05-17 18:35     ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Manoj Iyer @ 2004-05-17 15:29 UTC (permalink / raw)
  To: Monika Chaddha; +Cc: gdb



> >manjo@nefertiti:~/projects/src> cc -o ~/tests/test ~/tests/test.c
> >manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
> >GNU gdb 2004-04-17-cvs
> >Copyright 2004 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 "powerpc64-gnu-linux"...Using host
> libthread_db
> >libra
> >ry "/lib64/tls/libthread_db.so.1".
> >
> >(gdb) list
> >1       ../sysdeps/powerpc/powerpc32/elf/start.S: No such file or
> >directory.
> >        in ../sysdeps/powerpc/powerpc32/elf/start.S
> >(gdb) quit
> >
> >

IMHO this output is simply misleading, it should print something
meaningful, like no symbols found, or no debug info in executable, or
compile with -g to generate more debug info etc.... 'file not found' is
not a clear indicator of what is going on.

--
Manoj Iyer


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

* Re: List command question
  2004-05-17 15:29   ` Manoj Iyer
@ 2004-05-17 18:35     ` Andrew Cagney
  2004-05-19  2:24       ` Manoj Iyer
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2004-05-17 18:35 UTC (permalink / raw)
  To: Manoj Iyer; +Cc: Monika Chaddha, gdb

>>>> >manjo@nefertiti:~/projects/src> cc -o ~/tests/test ~/tests/test.c
>>>> >manjo@nefertiti:~/projects/src> ./gdb/gdb ~/tests/test
>>>> >GNU gdb 2004-04-17-cvs
>>>> >Copyright 2004 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 "powerpc64-gnu-linux"...Using host
>>
>>> libthread_db
>>
>>>> >libra
>>>> >ry "/lib64/tls/libthread_db.so.1".
>>>> >
>>>> >(gdb) list
>>>> >1       ../sysdeps/powerpc/powerpc32/elf/start.S: No such file or
>>>> >directory.
>>>> >        in ../sysdeps/powerpc/powerpc32/elf/start.S
>>>> >(gdb) quit
>>>> >
>>>> >
> 
> 
> IMHO this output is simply misleading, it should print something
> meaningful, like no symbols found, or no debug info in executable, or
> compile with -g to generate more debug info etc.... 'file not found' is
> not a clear indicator of what is going on.

As others pointed out, the above is correct.  It found debug information 
for ``entry-point'' and then tried to use it.  Only to barf because the 
the corresponding source files were not installed.  There's not much GDB 
can do when a user's program contains debug info but is missing the 
corresponding source.

What happens if you enter:

	(gdb) list main

Andrew




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

* Re: List command question
  2004-05-17 18:35     ` Andrew Cagney
@ 2004-05-19  2:24       ` Manoj Iyer
  2004-05-19 14:22         ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Manoj Iyer @ 2004-05-19  2:24 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Monika Chaddha, gdb


> As others pointed out, the above is correct.  It found debug information
> for ``entry-point'' and then tried to use it.  Only to barf because the
> the corresponding source files were not installed.  There's not much GDB
> can do when a user's program contains debug info but is missing the
> corresponding source.
>
> What happens if you enter:
>
> 	(gdb) list main
>
> Andrew
>

I get no line number known for main...

manjo@nefertiti:~/tests> gdb64 hellow1
GNU gdb 6.1
Copyright 2004 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 "ppc64-suse-linux"...Using host libthread_db
library "/lib64/tls/libthread_db.so.1".

(gdb) list
1       ../sysdeps/powerpc/powerpc64/elf/start.S: No such file or
directory.
        in ../sysdeps/powerpc/powerpc64/elf/start.S
(gdb) list main
No line number known for main.
(gdb)


But for a C program I get the following...

manjo@nefertiti:~/tests> gdb64 ./test1
GNU gdb 6.1
Copyright 2004 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 "ppc64-suse-linux"...Using host libthread_db
library "/lib64/tls/libthread_db.so.1".

(gdb) list main
1       #include <stdio.h>
2
3       main()
4       {
5           printf("hello world\n");
6       }
7
(gdb)


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

* Re: List command question
  2004-05-19  2:24       ` Manoj Iyer
@ 2004-05-19 14:22         ` Andrew Cagney
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Cagney @ 2004-05-19 14:22 UTC (permalink / raw)
  To: Manoj Iyer; +Cc: Monika Chaddha, gdb


> I get no line number known for main...
> 
> manjo@nefertiti:~/tests> gdb64 hellow1
> GNU gdb 6.1
> Copyright 2004 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 "ppc64-suse-linux"...Using host libthread_db
> library "/lib64/tls/libthread_db.so.1".
> 
> (gdb) list
> 1       ../sysdeps/powerpc/powerpc64/elf/start.S: No such file or
> directory.
>         in ../sysdeps/powerpc/powerpc64/elf/start.S
> (gdb) list main
> No line number known for main.
> (gdb)

GDB has the concept of a current source-and-line (SAL).  When GDB starts 
it initializes it to something.  Looking at the behavior you've 
illustrated, it tries in order: main's SAL; entry-point's SAL; ???

I guess the question is, should GDB set SAL to main when main doesn't 
have any line number information?

Note here that this will end up interacting with the ``start'' mechanism 
that Joel is playing with - its a mechanism for doing run-to ``main''. 
So this will be a language dependent concept.

Andrew



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

end of thread, other threads:[~2004-05-19 14:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 18:29 List command question Manoj Iyer
2004-05-14 19:27 ` Andreas Schwab
2004-05-15  8:37   ` Eli Zaretskii
2004-05-15 13:16     ` Andreas Schwab
2004-05-15 18:07     ` Ramana Radhakrishnan
2004-05-15  7:40 ` Monika Chaddha
2004-05-17 15:29   ` Manoj Iyer
2004-05-17 18:35     ` Andrew Cagney
2004-05-19  2:24       ` Manoj Iyer
2004-05-19 14:22         ` Andrew Cagney

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