gdb unable to read python frame information

W

Wesley

Hi guys,
My env: centos 6.5 64 bit; gdb 7.1; python 2.6.6

I wanna use gdb to attach my running python scripts.
Successfully import libpython in gdb, but seems all py operations failed to read python information.

Here is the snippet:
(gdb) python
import libpython
end
(gdb) py-bt
#3 (unable to read python frame information)
#5 (unable to read python frame information)
#7 (unable to read python frame information)
#9 (unable to read python frame information)
#18 (unable to read python frame information)
#22 (unable to read python frame information)
#26 (unable to read python frame information)
#28 (unable to read python frame information)
#29 (unable to read python frame information)
#38 (unable to read python frame information)
#39 (unable to read python frame information)
#40 (unable to read python frame information)
#42 (unable to read python frame information)
#44 (unable to read python frame information)
#45 (unable to read python frame information)
#47 (unable to read python frame information)
#49 (unable to read python frame information)
#51 (unable to read python frame information)
#55 (unable to read python frame information)
#62 (unable to read python frame information)
#64 (unable to read python frame information)
#76 (unable to read python frame information)
#88 (unable to read python frame information)
#100 (unable to read python frame information)
(gdb) py-locals
Unable to read information on python frame
(gdb)

Is there anything wrong?
Thanks.
Wesley
 
D

dieter

Wesley said:
I wanna use gdb to attach my running python scripts.
Successfully import libpython in gdb, but seems all py operations failed to read python information.

Here is the snippet:
(gdb) python
(gdb) py-bt
#3 (unable to read python frame information)
#5 (unable to read python frame information)

The simplest possible interpretation would be that your
Python lacks debugging symbols. That often happens with
system installed Python installations (which usually are stripped
to the bare minimal symbol set - as "normal" users do not need
debugging).

Try with a Python that you have generated yourself.
 
W

Wesley

Then, how to make python get debug symbols?

Install python from source with some special configure options?
 
N

Neal Becker

dieter said:
The simplest possible interpretation would be that your
Python lacks debugging symbols. That often happens with
system installed Python installations (which usually are stripped
to the bare minimal symbol set - as "normal" users do not need
debugging).

Try with a Python that you have generated yourself.

You probably need to install the python-debuginfo package
 
N

Ned Deily

Then, how to make python get debug symbols?

Install python from source with some special configure options?

If your distribution doesn't have a debug version of Python and you need
to build your own, add --with-pydebug to your ./configure options. See:

../configure --help
 
D

dieter

Wesley said:
Install python from source with some special configure options?

When I last generated Python from source, there was no need
to do anything special to get debugging symbols (the option
("gcc") option "-g" was automatically included).
 
W

Wesley

1. install gdb from source with configure option --with-python

2. install python from source with configure option --with-pydebug

3. Got error in gdb here:
2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
(gdb) py-bt
Undefined command: "py-bt". Try "help".
(gdb) python
import libpython
end
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/share/gdb/python/libpython.py", line 49, in <module>
_type_size_t = gdb.lookup_type('size_t')
gdb.error: No type named size_t.
Error while executing Python code.
(gdb)
 
W

Wesley

python debuginfo is installed...
Still,py-bt, py-locals.etc cannot read python frame
 
M

Mark Lawrence

python debuginfo is installed...
Still,py-bt, py-locals.etc cannot read python frame

If you don't provide context people are less likely to help you.
 
W

Wesley

Now I use gdb python -p <pid>
then, import libpython
py-bt is null, py-locals raise here:
Unable to locate python frame

What's going on...
 
W

Wesley

So, let me clarify here, in order to try, I get a clean machine.

Centos 6.5 64bit.
Now , I try this:
1. install gdb 7.7 from source , with configure option --with-python

2. install python 2.6.6 from source, with configure option --with-pydebug

3. run a python script

4. from command line, gdb python -p <pid> to attach the running script

5. within gdb, issue python, import libpython, end
no errors
6. py-bt outputs nothing, py-locals says Unable to locate python frame
here is the snippet:
[root@localhost Python-2.6.6]# gdb python 52315
GNU gdb (GDB) 7.7
Copyright (C) 2014 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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...done.
Attaching to program: /home/nipen/test/Python-2.6.6/python, process 52315
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00000030a98e15c3 in ?? ()
(gdb) bt
#0 0x00000030a98e15c3 in ?? ()
#1 0x00007f4cf68d1219 in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) py-bt
Undefined command: "py-bt". Try "help".
(gdb) python
import libpython
end
(gdb) py-bt
(gdb)
(gdb) py-locals
Unable to locate python frame
(gdb)
Unable to locate python frame
 
M

Mark Lawrence

Anybody has suggestions?

This really makes me crazy...

What makes you crazy? You keep sending messages with no context. We
might be smart, but we're not (yet :) mind readers.
 
T

Terry Reedy

Don't expect crazy things.
Send suggestions to the right place (a gdb list for a gdb enhancement).
What makes you crazy?

The supposed fact that GnuDeBug does not understand Python frames on the
stack.
You keep sending messages with no context. We
might be smart, but we're not (yet :) mind readers.

But we do speculate ;-)
 
W

Wesley

What's information do you want?

I told the OS, gdb and python version.

And my operation steps.

What do you want more, then, I can type here.

Wesley
 
M

Mark Lawrence

What's information do you want?

I told the OS, gdb and python version.

And my operation steps.

What do you want more, then, I can type here.

Wesley

Context, you just keep sending messages like the above which on its own
is meaningless. Why should anybody answer your question when you can't
be bothered to supply all the needed data in one hit?
 
W

Wesley

If you don't read the loop from the top, and don't tell me exactly what youwant by just keep saying context, please ingore this post.

Thanks.
Wesley

在 2014å¹´3月10日星期一UTC+8上åˆ9æ—¶48分41秒,Mark Lawrence写é“:
 
M

Mark Lawrence

If you don't read the loop from the top, and don't tell me exactly what you want by just keep saying context, please ingore this post.

Thanks.
Wesley

在 2014å¹´3月10日星期一UTC+8上åˆ9æ—¶48分41秒,Mark Lawrence写é“:

Ah, that explains things, you're using the notoriously bug ridden google
groups. You could read and action this
https://wiki.python.org/moin/GoogleGroupsPython but I'd suggest you
equip yourself with a decent email client. Thunderbird comes highly
recommended.
 
D

dieter

Wesley said:
So, let me clarify here, in order to try, I get a clean machine.

Centos 6.5 64bit.
Now , I try this:
1. install gdb 7.7 from source , with configure option --with-python

2. install python 2.6.6 from source, with configure option --with-pydebug

3. run a python script

4. from command line, gdb python -p <pid> to attach the running script

5. within gdb, issue python, import libpython, end
no errors
6. py-bt outputs nothing, py-locals says Unable to locate python frame
here is the snippet:
[root@localhost Python-2.6.6]# gdb python 52315
GNU gdb (GDB) 7.7
....
Attaching to program: /home/nipen/test/Python-2.6.6/python, process 52315
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00000030a98e15c3 in ?? ()
(gdb) bt
#0 0x00000030a98e15c3 in ?? ()
#1 0x00007f4cf68d1219 in ?? ()
#2 0x0000000000000000 in ?? ()

This looks like a very strange backtrace on C level as well.

The most natural explanation would be: your process is in a very strange
state (due to some C level problem). But, of course, your
"gdb" might have general problems, as well.
 
D

dieter

Mark Lawrence said:
On 10/03/2014 01:06, Wesley wrote:
...
Context, you just keep sending messages like the above which on its
own is meaningless.

The original poster has send messages lacking important pieces
of information -- but on request from the list, he has fixed this
initial error. Thus, on his side, there was progress ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top