* Source a python script to gdb plugin?
@ 2008-08-07 7:40 Neo Jia
2008-08-07 14:03 ` Tom Tromey
0 siblings, 1 reply; 8+ messages in thread
From: Neo Jia @ 2008-08-07 7:40 UTC (permalink / raw)
To: gdb ml
hi,
I am going to source the following script through gdb plugin, but it
doesn't work.
#!/usr/bin/python
from ctypes import *
cdll.LoadLibrary("libc.so.6")
libc = CDLL("libc.so.6")
libc.printf("%d\n", 100)
Any suggestions?
Thanks,
Neo
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Source a python script to gdb plugin?
2008-08-07 7:40 Source a python script to gdb plugin? Neo Jia
@ 2008-08-07 14:03 ` Tom Tromey
2008-08-07 17:01 ` Neo Jia
0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2008-08-07 14:03 UTC (permalink / raw)
To: Neo Jia; +Cc: gdb ml
>>>>> "Neo" == Neo Jia <neojia@gmail.com> writes:
Neo> I am going to source the following script through gdb plugin, but it
Neo> doesn't work.
Neo> Any suggestions?
That isn't enough information. What platform is this? What version
of Python are you using? How did it fail? Does it work with the
ordinary python interpreter?
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Source a python script to gdb plugin?
2008-08-07 14:03 ` Tom Tromey
@ 2008-08-07 17:01 ` Neo Jia
2008-08-07 17:08 ` Paul Pluzhnikov
0 siblings, 1 reply; 8+ messages in thread
From: Neo Jia @ 2008-08-07 17:01 UTC (permalink / raw)
To: tromey; +Cc: gdb ml
On Thu, Aug 7, 2008 at 7:02 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Neo" == Neo Jia <neojia@gmail.com> writes:
>
> Neo> I am going to source the following script through gdb plugin, but it
> Neo> doesn't work.
>
> Neo> Any suggestions?
>
> That isn't enough information. What platform is this? What version
> of Python are you using? How did it fail? Does it work with the
> ordinary python interpreter?
Linux x86_64. Python is 2.5.1.
> /opt/gdb_plugin/bin/gdb
GNU gdb (GDB) 6.8.50.20080716-cvs
Copyright (C) 2008 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) source ./load_libc
/home/cjia/workareas/gdb_nvwatch/scripts/load_libc:3: Error in sourced command f
ile:
Undefined command: "from". Try "help".
(gdb)
execute the script out of the gdb.
> ./load_libc
100
Thanks,
Neo
>
> Tom
>
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Source a python script to gdb plugin?
2008-08-07 17:01 ` Neo Jia
@ 2008-08-07 17:08 ` Paul Pluzhnikov
2008-08-07 17:13 ` Tom Tromey
0 siblings, 1 reply; 8+ messages in thread
From: Paul Pluzhnikov @ 2008-08-07 17:08 UTC (permalink / raw)
To: Neo Jia; +Cc: tromey, gdb ml
On Thu, Aug 7, 2008 at 10:00 AM, Neo Jia <neojia@gmail.com> wrote:
> (gdb) source ./load_libc
> /home/cjia/workareas/gdb_nvwatch/scripts/load_libc:3: Error in sourced command file:
> Undefined command: "from". Try "help".
Don't you want to switch to python interpreter before doing 'source'
(or rather its python equivalent)?
--
Paul Pluzhnikov
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Source a python script to gdb plugin?
2008-08-07 17:08 ` Paul Pluzhnikov
@ 2008-08-07 17:13 ` Tom Tromey
2008-08-07 19:09 ` Neo Jia
0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2008-08-07 17:13 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: Neo Jia, gdb ml
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
>> (gdb) source ./load_libc
>> /home/cjia/workareas/gdb_nvwatch/scripts/load_libc:3: Error in sourced command file:
>> Undefined command: "from". Try "help".
Paul> Don't you want to switch to python interpreter before doing 'source'
Paul> (or rather its python equivalent)?
Yes. The "source" command remains unchanged -- it reads gdb command
scripts.
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Source a python script to gdb plugin?
2008-08-07 17:13 ` Tom Tromey
@ 2008-08-07 19:09 ` Neo Jia
2008-08-07 19:17 ` Tom Tromey
0 siblings, 1 reply; 8+ messages in thread
From: Neo Jia @ 2008-08-07 19:09 UTC (permalink / raw)
To: Tom Tromey; +Cc: Paul Pluzhnikov, gdb ml
On Thu, Aug 7, 2008 at 10:12 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
>
>>> (gdb) source ./load_libc
>>> /home/cjia/workareas/gdb_nvwatch/scripts/load_libc:3: Error in sourced command file:
>>> Undefined command: "from". Try "help".
>
> Paul> Don't you want to switch to python interpreter before doing 'source'
> Paul> (or rather its python equivalent)?
>
> Yes. The "source" command remains unchanged -- it reads gdb command
> scripts.
> /opt/gdb_plugin/bin/gdb
GNU gdb (GDB) 6.8.50.20080716-cvs
Copyright (C) 2008 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) python ./load_libc
File "<string>", line 1
./load_libc
^
SyntaxError: invalid syntax
(gdb)
Is this the right way to use it?
Thanks,
Neo
>
> Tom
>
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Source a python script to gdb plugin?
2008-08-07 19:09 ` Neo Jia
@ 2008-08-07 19:17 ` Tom Tromey
2008-08-07 19:18 ` Neo Jia
0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2008-08-07 19:17 UTC (permalink / raw)
To: Neo Jia; +Cc: Paul Pluzhnikov, gdb ml
>>>>> "Neo" == Neo Jia <neojia@gmail.com> writes:
Neo> (gdb) python ./load_libc
Neo> File "<string>", line 1
Neo> ./load_libc
Neo> ^
Neo> SyntaxError: invalid syntax
Neo> Is this the right way to use it?
Nope, try:
python execfile('./load_libc')
Anything after "python" is passed directly to the python interpreter.
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Source a python script to gdb plugin?
2008-08-07 19:17 ` Tom Tromey
@ 2008-08-07 19:18 ` Neo Jia
0 siblings, 0 replies; 8+ messages in thread
From: Neo Jia @ 2008-08-07 19:18 UTC (permalink / raw)
To: Tom Tromey; +Cc: Paul Pluzhnikov, gdb ml
On Thu, Aug 7, 2008 at 12:16 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Neo" == Neo Jia <neojia@gmail.com> writes:
>
> Neo> (gdb) python ./load_libc
> Neo> File "<string>", line 1
> Neo> ./load_libc
> Neo> ^
> Neo> SyntaxError: invalid syntax
>
> Neo> Is this the right way to use it?
>
> Nope, try:
>
> python execfile('./load_libc')
This works! Thanks a lot!
Neo
>
> Anything after "python" is passed directly to the python interpreter.
>
> Tom
>
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-08-07 19:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-07 7:40 Source a python script to gdb plugin? Neo Jia
2008-08-07 14:03 ` Tom Tromey
2008-08-07 17:01 ` Neo Jia
2008-08-07 17:08 ` Paul Pluzhnikov
2008-08-07 17:13 ` Tom Tromey
2008-08-07 19:09 ` Neo Jia
2008-08-07 19:17 ` Tom Tromey
2008-08-07 19:18 ` Neo Jia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox