public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/14802] New: Declaring a convenience function using Python does not work as documented
@ 2012-11-04 12:48 dholmster at gmail dot com
  2012-11-04 12:53 ` [Bug python/14802] " dholmster at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dholmster at gmail dot com @ 2012-11-04 12:48 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

             Bug #: 14802
           Summary: Declaring a convenience function using Python does not
                    work as documented
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: critical
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dholmster@gmail.com
    Classification: Unclassified


I have tried to declare a convenience function as described in the
documentation [1] but I am unable to call the new function afterwards. This has
been tried using GDB 7.5 on Gentoo GNU/Linux as well as GDB 7.5 on MacOS X
(installed via Homebrew) with the same result.

Here is the result when running the example from the documentation:

    (gdb) python
    >import gdb
    >class Greet(gdb.Function):
    >    def __init__(self):
    >        super(Greet, self).__init__('greet')
    >
    >    def invoke(self, name):
    >        return 'Hello %s' % name.string()
    >
    >Greet ()
    >end
    (gdb) greet test
    Undefined command: "greet".  Try "help".
    (gdb) greet
    Undefined command: "greet".  Try "help".

gdb.Command and gdb.Parameter both work as expected in the two GDB
installations that I tried gdb.Function in.

GDB 7.5 on OSX:
    $ uname -a
    Darwin moonglow.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25
00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

    $ gcc -v
    Using built-in specs.
    Target: i686-apple-darwin11
    Configured with:
/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure
--disable-checking --enable-werror
--prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2
--mandir=/share/man --enable-languages=c,objc,c++,obj-c++
--program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin11
--enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local
--program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11
--target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
    Thread model: posix
    gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

    $ gdb
    GNU gdb (GDB) 7.5
    [..]
    This GDB was configured as "x86_64-apple-darwin12.1.0".


GDB 7.5 on Gentoo:
    $ uname -a
    Linux moonglow-gentoo 3.5.2-gentoo #3 SMP PREEMPT Sat Aug 25 07:32:50 CEST
2012 x86_64 Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz GenuineIntel GNU/Linux

    $ gcc -v
    Using built-in specs.
    COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper
    Target: x86_64-pc-linux-gnu
    Configured with:
/var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --disable-nls
--with-system-zlib --enable-obsolete --disable-werror --enable-secureplt
--enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python
--enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.6.3 p1.6, pie-0.5.2'
    Thread model: posix
    gcc version 4.6.3 (Gentoo 4.6.3 p1.6, pie-0.5.2) 

    $ gdb
    GNU gdb (Gentoo 7.5 p1) 7.5
    [..]
    This GDB was configured as "x86_64-pc-linux-gnu".


 [1]
http://sourceware.org/gdb/current/onlinedocs/gdb/Functions-In-Python.html#Functions-In-Python

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
@ 2012-11-04 12:53 ` dholmster at gmail dot com
  2012-11-04 13:08 ` dholmster at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dholmster at gmail dot com @ 2012-11-04 12:53 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

--- Comment #1 from David Holm <dholmster at gmail dot com> 2012-11-04 12:53:13 UTC ---
The convenience function shows up when running 'show convenience' but I'm still
not able to call it. I also tried calling it as '$greet'.

    (gdb) show convenience 
    $greet = <internal function greet>
    $_thread = 0
    $_siginfo = void
    $_probe_arg11 = <error: No frame selected>
    $_probe_arg10 = <error: No frame selected>
    $_probe_arg9 = <error: No frame selected>
    $_probe_arg8 = <error: No frame selected>
    $_probe_arg7 = <error: No frame selected>
    $_probe_arg6 = <error: No frame selected>
    $_probe_arg5 = <error: No frame selected>
    $_probe_arg4 = <error: No frame selected>
    $_probe_arg3 = <error: No frame selected>
    $_probe_arg2 = <error: No frame selected>
    $_probe_arg1 = <error: No frame selected>
    $_probe_arg0 = <error: No frame selected>
    $_probe_argc = <error: No frame selected>
    $_sdata = void
    $_tlb = void

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
  2012-11-04 12:53 ` [Bug python/14802] " dholmster at gmail dot com
@ 2012-11-04 13:08 ` dholmster at gmail dot com
  2012-11-04 13:09 ` dholmster at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dholmster at gmail dot com @ 2012-11-04 13:08 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

--- Comment #2 from David Holm <dholmster at gmail dot com> 2012-11-04 13:08:22 UTC ---
Having reread the chapter on GDB convenience functions [1] I believe I
misunderstood the purpose of them. I thought it would be similar to a
user-defined command [2] but I see now it is something else and actually much
more useful. :)

 [1]
http://sourceware.org/gdb/current/onlinedocs/gdb/Convenience-Funs.html#Convenience-Funs
 [2] http://sourceware.org/gdb/current/onlinedocs/gdb/Define.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
  2012-11-04 12:53 ` [Bug python/14802] " dholmster at gmail dot com
  2012-11-04 13:08 ` dholmster at gmail dot com
@ 2012-11-04 13:09 ` dholmster at gmail dot com
  2012-11-05 19:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dholmster at gmail dot com @ 2012-11-04 13:09 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

David Holm <dholmster at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|7.4                         |7.5

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-04 13:09 ` dholmster at gmail dot com
@ 2012-11-05 19:36 ` cvs-commit at gcc dot gnu.org
  2012-11-05 19:38 ` tromey at redhat dot com
  2012-11-05 19:41 ` dholmster at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-11-05 19:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-11-05 19:36:45 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    tromey@sourceware.org    2012-11-05 19:36:40

Modified files:
    gdb/doc        : ChangeLog gdb.texinfo 

Log message:
    PR python/14802:
    * gdb.texinfo (Functions In Python): Add example.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.1376&r2=1.1377
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.1016&r2=1.1017

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
                   ` (3 preceding siblings ...)
  2012-11-05 19:36 ` cvs-commit at gcc dot gnu.org
@ 2012-11-05 19:38 ` tromey at redhat dot com
  2012-11-05 19:41 ` dholmster at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-11-05 19:38 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at redhat dot com
         Resolution|                            |FIXED
   Target Milestone|---                         |7.6

--- Comment #4 from Tom Tromey <tromey at redhat dot com> 2012-11-05 19:38:01 UTC ---
I added an example to the documentation that should
help future readers.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14802] Declaring a convenience function using Python does not work as documented
  2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
                   ` (4 preceding siblings ...)
  2012-11-05 19:38 ` tromey at redhat dot com
@ 2012-11-05 19:41 ` dholmster at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: dholmster at gmail dot com @ 2012-11-05 19:41 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14802

--- Comment #5 from David Holm <dholmster at gmail dot com> 2012-11-05 19:41:13 UTC ---
Awesome, thank you Tom!
..and thank you for the Python API for GDB. We have made some really great
debugging aids with them at work that has saved us numerous hours of
interpreting data.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-11-05 19:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-04 12:48 [Bug python/14802] New: Declaring a convenience function using Python does not work as documented dholmster at gmail dot com
2012-11-04 12:53 ` [Bug python/14802] " dholmster at gmail dot com
2012-11-04 13:08 ` dholmster at gmail dot com
2012-11-04 13:09 ` dholmster at gmail dot com
2012-11-05 19:36 ` cvs-commit at gcc dot gnu.org
2012-11-05 19:38 ` tromey at redhat dot com
2012-11-05 19:41 ` dholmster at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).