Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb python setup problem
@ 2010-03-17 21:19 Yogesh Mundada
  2010-03-17 21:27 ` Zi Shen Lim
  2010-03-18 15:55 ` Tom Tromey
  0 siblings, 2 replies; 7+ messages in thread
From: Yogesh Mundada @ 2010-03-17 21:19 UTC (permalink / raw)
  To: gdb

Hi,

I am  trying to use gdb scripting using python on karmic. My gdb
version is 7.0-ubuntu. If I start gdb and execute python command then
I get a python prompt (making me think that python patch is accepted
in gdb mainline now). However, if I write following script
(http://tromey.com/blog/?p=548):
----------------------
#!/home/yogesh/build/gdb/gdb -P
import sys
import gdb
print "Here"
----------------------

and execute it, I get following error:
----------------------
/home/yogesh/build/gdb/gdb: unrecognized option '-P'
Use `/home/yogesh/build/gdb/gdb --help' for a complete list of options.
----------------------

Then I got the source code from archer-tromey-python branch as
mentioned in http://sourceware.org/gdb/wiki/PythonGdb. I compiled that
source code but still it did not have any -P option for python
scripting.

What should I do to get python scripting working with gdb?

-Yogesh


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

* Re: gdb python setup problem
  2010-03-17 21:19 gdb python setup problem Yogesh Mundada
@ 2010-03-17 21:27 ` Zi Shen Lim
  2010-03-17 21:52   ` Joel Brobecker
  2010-03-18 15:55 ` Tom Tromey
  1 sibling, 1 reply; 7+ messages in thread
From: Zi Shen Lim @ 2010-03-17 21:27 UTC (permalink / raw)
  To: Yogesh Mundada; +Cc: gdb

In GDB 7.0, you can get into a python shell: '(gdb) python'.

To source a python script (e.g. '(gdb) source myscript.py'), you'll
need GDB 7.1.


On Wed, Mar 17, 2010 at 2:19 PM, Yogesh Mundada
<yogesh.mundada@gmail.com> wrote:
> Hi,
>
> I am  trying to use gdb scripting using python on karmic. My gdb
> version is 7.0-ubuntu. If I start gdb and execute python command then
> I get a python prompt (making me think that python patch is accepted
> in gdb mainline now). However, if I write following script
> (http://tromey.com/blog/?p=548):
> ----------------------
> #!/home/yogesh/build/gdb/gdb -P
> import sys
> import gdb
> print "Here"
> ----------------------
>
> and execute it, I get following error:
> ----------------------
> /home/yogesh/build/gdb/gdb: unrecognized option '-P'
> Use `/home/yogesh/build/gdb/gdb --help' for a complete list of options.
> ----------------------
>
> Then I got the source code from archer-tromey-python branch as
> mentioned in http://sourceware.org/gdb/wiki/PythonGdb. I compiled that
> source code but still it did not have any -P option for python
> scripting.
>
> What should I do to get python scripting working with gdb?
>
> -Yogesh
>


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

* Re: gdb python setup problem
  2010-03-17 21:27 ` Zi Shen Lim
@ 2010-03-17 21:52   ` Joel Brobecker
  0 siblings, 0 replies; 7+ messages in thread
From: Joel Brobecker @ 2010-03-17 21:52 UTC (permalink / raw)
  To: Zi Shen Lim; +Cc: Yogesh Mundada, gdb

> To source a python script (e.g. '(gdb) source myscript.py'), you'll
> need GDB 7.1.

As a workaround, you can also use:

    (gdb) python execfile("toto.py")
    Hello world

-- 
Joel


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

* Re: gdb python setup problem
  2010-03-17 21:19 gdb python setup problem Yogesh Mundada
  2010-03-17 21:27 ` Zi Shen Lim
@ 2010-03-18 15:55 ` Tom Tromey
  2010-03-23  6:26   ` Yogesh Mundada
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2010-03-18 15:55 UTC (permalink / raw)
  To: Yogesh Mundada; +Cc: gdb

>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:

A few things that the other responses didn't cover...

Yogesh> #!/home/yogesh/build/gdb/gdb -P

We haven't submitted the -P patch yet.

Yogesh> Then I got the source code from archer-tromey-python branch as
Yogesh> mentioned in http://sourceware.org/gdb/wiki/PythonGdb. I compiled that
Yogesh> source code but still it did not have any -P option for python
Yogesh> scripting.

Make sure you are on the right branch -- archer-tromey-python.

Tom


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

* Re: gdb python setup problem
  2010-03-18 15:55 ` Tom Tromey
@ 2010-03-23  6:26   ` Yogesh Mundada
  2010-03-23 15:31     ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Yogesh Mundada @ 2010-03-23  6:26 UTC (permalink / raw)
  To: tromey; +Cc: gdb

I followed instructions from http://sourceware.org/gdb/wiki/PythonGdb.
But I don't think I am getting the correct branch.
Here are commands for your reference:

yogesh@destiny:~$ git clone git://sourceware.org/git/archer.git
git: /usr/local/lib/libidn.so.11: no version information available
(required by /usr/lib/libcurl-gnutls.so.4)
Initialized empty Git repository in /home/yogesh/archer/.git/
git: /usr/local/lib/libidn.so.11: no version information available
(required by /usr/lib/libcurl-gnutls.so.4)
git-index-pack: /usr/local/lib/libidn.so.11: no version information
available (required by /usr/lib/libcurl-gnutls.so.4)
remote: Counting objects: 309735, done.
remote: Compressing objects: 100% (57761/57761), done.
Receiving objects: 100% (309735/309735), 116.01 MiB | 758 KiB/s, done.
remote: Total 309735 (delta 245181), reused 309056 (delta 244653)
Resolving deltas: 100% (245181/245181), done.
Checking out files: 100% (7324/7324), done.
yogesh@destiny:~$
yogesh@destiny:~$ ls -ltr
total 708
-rw-r--r--  1 yogesh yogesh 668436 2010-03-08 09:46
ws7_replay_linux_technote.pdf
-rw-r--r--  1 yogesh yogesh     63 2010-03-17 17:43 gp-cont.py
drwxr-xr-x  3 yogesh yogesh   4096 2010-03-22 23:48 vmware
drwxr-xr-x  4 yogesh yogesh   4096 2010-03-23 01:07 Downloads
drwxr-xr-x  2 yogesh yogesh   4096 2010-03-23 01:12 Desktop
drwxr-xr-x 16 yogesh yogesh   4096 2010-03-23 01:15 archer
yogesh@destiny:~$
yogesh@destiny:~$ cd archer; git checkout --track -b python
origin/archer-tromey-python
git: /usr/local/lib/libidn.so.11: no version information available
(required by /usr/lib/libcurl-gnutls.so.4)
Branch python set up to track remote branch archer-tromey-python from origin.
Switched to a new branch 'python'
yogesh@destiny:~/archer$

I think that libidn related messages are harmless. I've the blog
entries from "The Cliffs of Inanity" and I really want to try this gdb
scripting feature. What can I do to checkout the correct branch?

Any help is greatly appreciated.

On Thu, Mar 18, 2010 at 11:55 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:
>
> A few things that the other responses didn't cover...
>
> Yogesh> #!/home/yogesh/build/gdb/gdb -P
>
> We haven't submitted the -P patch yet.
>
> Yogesh> Then I got the source code from archer-tromey-python branch as
> Yogesh> mentioned in http://sourceware.org/gdb/wiki/PythonGdb. I compiled that
> Yogesh> source code but still it did not have any -P option for python
> Yogesh> scripting.
>
> Make sure you are on the right branch -- archer-tromey-python.
>
> Tom
>


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

* Re: gdb python setup problem
  2010-03-23  6:26   ` Yogesh Mundada
@ 2010-03-23 15:31     ` Tom Tromey
  2010-03-23 15:42       ` Yogesh Mundada
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2010-03-23 15:31 UTC (permalink / raw)
  To: Yogesh Mundada; +Cc: gdb

>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:

Yogesh> I followed instructions from http://sourceware.org/gdb/wiki/PythonGdb.
Yogesh> But I don't think I am getting the correct branch.

Your commands look ok to me.
However, you don't mention why you think you got the wrong branch.
What happened, and what did you expect to happen?

Tom


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

* Re: gdb python setup problem
  2010-03-23 15:31     ` Tom Tromey
@ 2010-03-23 15:42       ` Yogesh Mundada
  0 siblings, 0 replies; 7+ messages in thread
From: Yogesh Mundada @ 2010-03-23 15:42 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

Actually I had not enabled --with-python in the configure script
(incidentally configure --help does not say anything about
--with-python). I came to know about it after chatting on irc channel.
So now "gdb -P" is working. Thank you for responding back.

On Tue, Mar 23, 2010 at 11:31 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:
>
> Yogesh> I followed instructions from http://sourceware.org/gdb/wiki/PythonGdb.
> Yogesh> But I don't think I am getting the correct branch.
>
> Your commands look ok to me.
> However, you don't mention why you think you got the wrong branch.
> What happened, and what did you expect to happen?
>
> Tom
>


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

end of thread, other threads:[~2010-03-23 15:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-17 21:19 gdb python setup problem Yogesh Mundada
2010-03-17 21:27 ` Zi Shen Lim
2010-03-17 21:52   ` Joel Brobecker
2010-03-18 15:55 ` Tom Tromey
2010-03-23  6:26   ` Yogesh Mundada
2010-03-23 15:31     ` Tom Tromey
2010-03-23 15:42       ` Yogesh Mundada

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