Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* A question about data-directory
@ 2010-08-30 22:46 Srinath Avadhanula
  2010-08-30 23:00 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Srinath Avadhanula @ 2010-08-30 22:46 UTC (permalink / raw)
  To: gdb

Hi,

I am trying to play around the python pretty-printing stuff in 7.1
(sweet!). However, I cannot seem to get my pretty printers loaded as
documented here:

http://sourceware.org/gdb/current/onlinedocs/gdb/objfile_002dgdb_002epy-file.html#objfile_002dgdb_002epy-file

I think I am unclear on what "real-name" means. I tried the following setup.

/tmp/test/test.cpp      # source file
/tmp/test/test            # executable
/tmp/test/data/python/auto-load/test-gdb.py    # auto-loadable file.
/tmp/test/data/python/auto-load/test.py          # auto-loadable file.
/tmp/test/data/python/auto-load/test              # auto-loadable file.
/tmp/test/data/python/auto-load/test.o           # auto-loadable file.

I basically created as many variants of the executable as I could
think of. All of these files are simple python scripts which contain a
single line "print 'getting here'"

I then started GDB and within it

(gdb) set data-directory /tmp/test/data
(gdb) file test
Reading symbols from /tmp/test/test...done.
(gdb)

I was expecting the output from the auto-load script to say 'getting
here' before getting back to the prompt. If I place test-gdb.py in the
same directory as the executable (i.e. at /tmp/test/test-gdb.py) then
I do get a line saying 'getting here'.

Could you please let me know what I am doing wrong?

Regards,
Srinath

PS: This is the version I am using:

savadhan@mint /tmp/test $ gdb --version
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.


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

* Re: A question about data-directory
  2010-08-30 22:46 A question about data-directory Srinath Avadhanula
@ 2010-08-30 23:00 ` Daniel Jacobowitz
  2010-08-30 23:22   ` Srinath Avadhanula
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2010-08-30 23:00 UTC (permalink / raw)
  To: Srinath Avadhanula; +Cc: gdb

On Mon, Aug 30, 2010 at 06:46:49PM -0400, Srinath Avadhanula wrote:
> I was expecting the output from the auto-load script to say 'getting
> here' before getting back to the prompt. If I place test-gdb.py in the
> same directory as the executable (i.e. at /tmp/test/test-gdb.py) then
> I do get a line saying 'getting here'.

IIUC, that's what's supposed to happen right now.  The 'python'
directory in datadir is added to the Python search path, but gdb.py
files are searched for next to the object file.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: A question about data-directory
  2010-08-30 23:00 ` Daniel Jacobowitz
@ 2010-08-30 23:22   ` Srinath Avadhanula
  2010-08-31 13:08     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Srinath Avadhanula @ 2010-08-30 23:22 UTC (permalink / raw)
  To: Srinath Avadhanula, gdb

Hi Daniel,

On Mon, Aug 30, 2010 at 7:00 PM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Mon, Aug 30, 2010 at 06:46:49PM -0400, Srinath Avadhanula wrote:
>> I was expecting the output from the auto-load script to say 'getting
>> here' before getting back to the prompt. If I place test-gdb.py in the
>> same directory as the executable (i.e. at /tmp/test/test-gdb.py) then
>> I do get a line saying 'getting here'.
>
> IIUC, that's what's supposed to happen right now.  The 'python'
> directory in datadir is added to the Python search path, but gdb.py
> files are searched for next to the object file.
>

That seems to flatly contradict what is mentioned in the doc:

----------%<------------
Finally, if this file does not exist, then gdb will look for a file
named data-directory/python/auto-load/real-name, where data-directory
is gdb's data directory (available via show data-directory, see Data
Files), and real-name is the object file's real name, as described
above.
----------%<------------

It does say that "gdb will look for a file named ..." rather than it
being only available on Python's search path.

Is the doc wrong/out-dated?

Regards,
Srinath


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

* Re: A question about data-directory
  2010-08-30 23:22   ` Srinath Avadhanula
@ 2010-08-31 13:08     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2010-08-31 13:08 UTC (permalink / raw)
  To: Srinath Avadhanula; +Cc: gdb

On Mon, Aug 30, 2010 at 07:21:59PM -0400, Srinath Avadhanula wrote:
> Hi Daniel,
> 
> On Mon, Aug 30, 2010 at 7:00 PM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> > On Mon, Aug 30, 2010 at 06:46:49PM -0400, Srinath Avadhanula wrote:
> >> I was expecting the output from the auto-load script to say 'getting
> >> here' before getting back to the prompt. If I place test-gdb.py in the
> >> same directory as the executable (i.e. at /tmp/test/test-gdb.py) then
> >> I do get a line saying 'getting here'.
> >
> > IIUC, that's what's supposed to happen right now.  The 'python'
> > directory in datadir is added to the Python search path, but gdb.py
> > files are searched for next to the object file.
> >
> 
> That seems to flatly contradict what is mentioned in the doc:
> 
> ----------%<------------
> Finally, if this file does not exist, then gdb will look for a file
> named data-directory/python/auto-load/real-name, where data-directory
> is gdb's data directory (available via show data-directory, see Data
> Files), and real-name is the object file's real name, as described
> above.
> ----------%<------------

I think this is a different search option - and you're misreading
REAL-NAME.  The real name is going to be $DATADIR/tmp/test/test.
Also, the docs appear to be wrong, by stracing GDB:

open("../gdb", O_RDONLY)                = 7
open("/space/fsf/x86-64/commit-gdb/gdb/gdb-gdb.py", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib/debug/space/fsf/x86-64/commit-gdb/gdb/gdb-gdb.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/share/gdb/auto-load/space/fsf/x86-64/commit-gdb/gdb/gdb-gdb.py",
O_RDONLY) = -1 ENOENT (No such file or directory)

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2010-08-31 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-30 22:46 A question about data-directory Srinath Avadhanula
2010-08-30 23:00 ` Daniel Jacobowitz
2010-08-30 23:22   ` Srinath Avadhanula
2010-08-31 13:08     ` Daniel Jacobowitz

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