public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* error using pretty printing
@ 2009-04-01 23:28 Tiago Maluta
  2009-04-01 23:51 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Tiago Maluta @ 2009-04-01 23:28 UTC (permalink / raw)
  To: archer

I followed the steps to Pretty Printing (part 1) [1] after reading the
blog post about Installing a Python-enabled debugger [2]


[1] http://tromey.com/blog/?p=524
[2] http://tromey.com/blog/?p=494


Trying the little example to print 'str' value I got the same result
that gdb without python support would print.

/opt/gdb/archer/install/bin/gdb a.out
GNU gdb (GDB) 6.8.50.20090106-cvs
Copyright (C) 2009 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 "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) l
1       #include <string>
2       std::string str = "hello world";
3       int main ()
4       {
5         return 0;
6       }
(gdb) break 5
Breakpoint 1 at 0x804865e: file 1.cpp, line 5.
(gdb) r
Starting program: /home/maluta/foo.d/s.cpp/a.out

Breakpoint 1, main () at 1.cpp:5
5         return 0;
(gdb) print str
$1 = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    _M_p = 0x804b014 "hello world"}}

But I had python support enabled:

(gdb) python print 44
44

* I'm libstdc++.so.6.0.10 with gcc 4.3.1 (gentoo)
* Using the 'today' git pull has the same problem

May I forgot something?


--tm


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

* Re: error using pretty printing
  2009-04-01 23:28 error using pretty printing Tiago Maluta
@ 2009-04-01 23:51 ` Tom Tromey
  2009-04-02 15:24   ` Phil Muldoon
  2009-04-03 11:40   ` Vladimir Prus
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2009-04-01 23:51 UTC (permalink / raw)
  To: Tiago Maluta; +Cc: archer

>>>>> "Tiago" == Tiago Maluta <maluta_tiago@yahoo.com.br> writes:

Tiago> I followed the steps to Pretty Printing (part 1) [1] after
Tiago> reading the blog post about Installing a Python-enabled
Tiago> debugger [2]

Oops, sorry I didn't respond to you privately.

Tiago> Trying the little example to print 'str' value I got the same result
Tiago> that gdb without python support would print.

With today's git you need to run two commands first:

    python import gdb.libstdcxx.v6.printers
    python gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)

This is kind of inconvenient, and undocumented -- but that is because
we're going to push these printers upstream into libstdc++, and have
them be auto-activated, at least in the distros.

Tom

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

* Re: error using pretty printing
  2009-04-01 23:51 ` Tom Tromey
@ 2009-04-02 15:24   ` Phil Muldoon
  2009-04-02 16:13     ` Tom Tromey
  2009-04-03 11:40   ` Vladimir Prus
  1 sibling, 1 reply; 5+ messages in thread
From: Phil Muldoon @ 2009-04-02 15:24 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Tiago Maluta, archer

Tom Tromey wrote:
> With today's git you need to run two commands first:
>
>     python import gdb.libstdcxx.v6.printers
>     python gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)
>
>   
FWIW the: "python 
gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)" step is not 
necessary as the git upstream version of printers.py still does this 
step for you. So when you import it, it automatically registers the 
lookup-function. I believe the copy of printers.py in the rawhide Fedora 
rpm (which uses hooks) is where this was removed.  At least this is the 
case for me.

It sure will be nice when this is all automatic, whether it is one 
statement or two  ;)

Regards

Phil


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

* Re: error using pretty printing
  2009-04-02 15:24   ` Phil Muldoon
@ 2009-04-02 16:13     ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2009-04-02 16:13 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: Tiago Maluta, archer

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

>> python import gdb.libstdcxx.v6.printers
>> python gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)

Phil> FWIW the: "python
Phil> gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)" step is
Phil> not necessary as the git upstream version of printers.py still does
Phil> this step for you. So when you import it, it automatically registers
Phil> the lookup-function. I believe the copy of printers.py in the rawhide
Phil> Fedora rpm (which uses hooks) is where this was removed.  At least
Phil> this is the case for me.

Oh, thanks.
I've been using the archer branch lately, and I forgot about this :)

Tom

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

* Re: error using pretty printing
  2009-04-01 23:51 ` Tom Tromey
  2009-04-02 15:24   ` Phil Muldoon
@ 2009-04-03 11:40   ` Vladimir Prus
  1 sibling, 0 replies; 5+ messages in thread
From: Vladimir Prus @ 2009-04-03 11:40 UTC (permalink / raw)
  To: archer

Tom Tromey wrote:

>>>>>> "Tiago" == Tiago Maluta <maluta_tiago@yahoo.com.br> writes:
> 
> Tiago> I followed the steps to Pretty Printing (part 1) [1] after
> Tiago> reading the blog post about Installing a Python-enabled
> Tiago> debugger [2]
> 
> Oops, sorry I didn't respond to you privately.
> 
> Tiago> Trying the little example to print 'str' value I got the same result
> Tiago> that gdb without python support would print.
> 
> With today's git you need to run two commands first:
> 
>     python import gdb.libstdcxx.v6.printers
>     python gdb.libstdcxx.v6.printers.register_libstdcxx_printers(None)
> 
> This is kind of inconvenient, and undocumented -- but that is because
> we're going to push these printers upstream into libstdc++, and have
> them be auto-activated, at least in the distros.

Does this assume GDB was installed? Can I make it work in a build tree?

- Volodya


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

end of thread, other threads:[~2009-04-03 11:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-01 23:28 error using pretty printing Tiago Maluta
2009-04-01 23:51 ` Tom Tromey
2009-04-02 15:24   ` Phil Muldoon
2009-04-02 16:13     ` Tom Tromey
2009-04-03 11:40   ` Vladimir Prus

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).