You are not logged in.
Hi,
Can anyone tell me how to get a traceback when running a python2.7 program from the commandline? I get a segmentation fault instead:
$ python2 test.py
[3] 31328 segmentation fault (core dumped) python2 test.pyRunning in gdb shows that a TypeError is raised (as expected):
$ gdb python2
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 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/>...
Reading symbols from /usr/bin/python2...(no debugging symbols found)...done.
(gdb) run test.py
Starting program: /usr/bin/python2 test.py
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3400.3-gdb.py", line 9, in <module>
from gobject import register
File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
import gdb.backtrace
ImportError: No module named backtrace
Traceback (most recent call last):
File "test.py", line 2, in <module>
m = Rectangle(0,0,0,0,0,0)
File "/usr/lib/python2.7/site-packages/dolfin/cpp/mesh.py", line 8805, in __init__
_mesh.Rectangle_swiginit(self,_mesh.new_Rectangle(*args))
TypeError: new_Rectangle expected 4 arguments, got 6
[Inferior 1 (process 31777) exited with code 01]To get rid of the ImportError I have tried reinstalling gdb and some of the following gobject packages:
$ sudo pacman -Ss gobject | grep gobject | grep installed
extra/gobject-introspection 1.34.2-1 [installed]
extra/pygobject-devel 3.4.2-1 [installed]
extra/pygobject2-devel 2.28.6-8 [installed]
extra/python-gobject 3.4.2-1 [installed]
extra/python2-gobject 3.4.2-1 [installed]
extra/python2-gobject2 2.28.6-8 [installed]The file test.py uses a hard-to-get module from dolfin-bzr in the AUR, I haven't found a more common module that produces the same error yet.
$ cat test.py
from dolfin import *
m = Rectangle(0,0,0,0,0,0)I did pacman -Syu today.
Thanks.
Last edited by myles (2012-12-18 22:31:24)
Offline
Strange, if I look at some help() first then I don't get the segmentation fault:
$ python2
Python 2.7.3 (default, Dec 12 2012, 07:12:24)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
help> modules
help> q
>>> from dolfin import *Any ideas what is wrong? I have tried rebuilding dolfin and it's dependencies but there is no improvement.
Offline
start off with a -Syu, never do partial updates.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Yes I've done -Syu a few times, and generally don't do partial
upgrades. I think I have tracked the segfault down to when a
shared library that is loaded, a bit like this:
fp, pathname, description = imp.find_module('_common', [dirname(__file__)])
_mod = imp.load_module('_common', fp, pathname, description)So now my problems are, 1) how to get a nice traceback rather
than a segfault (as before), and 2) how can I determine what the
problem is with the shared library, I have tried objdumb (output
below) but don't know what to do now, and as to why it doesn't segfault
after doing help(modules) is still a mystery to me.
$ objdump -x _common.so
_common.so: file format elf64-x86-64
_common.so
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x0000000000016940
Program Header:
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**21
filesz 0x0000000000051c38 memsz 0x0000000000051c38 flags r-x
LOAD off 0x0000000000052688 vaddr 0x0000000000252688 paddr 0x0000000000252688 align 2**21
filesz 0x000000000000aad8 memsz 0x000000000000b730 flags rw-
DYNAMIC off 0x0000000000052b98 vaddr 0x0000000000252b98 paddr 0x0000000000252b98 align 2**3
filesz 0x0000000000000260 memsz 0x0000000000000260 flags rw-
NOTE off 0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2
filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off 0x00000000000492a0 vaddr 0x00000000000492a0 paddr 0x00000000000492a0 align 2**2
filesz 0x0000000000000d24 memsz 0x0000000000000d24 flags r--
STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
RELRO off 0x0000000000052688 vaddr 0x0000000000252688 paddr 0x0000000000252688 align 2**0
filesz 0x0000000000000978 memsz 0x0000000000000978 flags r--
Dynamic Section:
NEEDED libdolfin.so.1.0
NEEDED libpython2.7.so.1.0
NEEDED libboost_mpi.so.1.50.0
NEEDED libpetsc.so
NEEDED libmpi.so.1
NEEDED libstdc++.so.6
NEEDED libgcc_s.so.1
NEEDED libpthread.so.0
NEEDED libc.so.6
SONAME _common.so
RPATH /home/myles/myaur/dev/dolfin-bzr/src/dolfin-build/build/dolfin:/lib64:/opt/petsc/arch-linux2-cxx-opt/lib:/usr/lib/openmpi:/usr/lib/vtk-5.10
INIT 0x0000000000015480
FINI 0x000000000003a074
INIT_ARRAY 0x0000000000252688
INIT_ARRAYSZ 0x0000000000000010
FINI_ARRAY 0x0000000000252698
FINI_ARRAYSZ 0x0000000000000008
GNU_HASH 0x00000000000001f0
STRTAB 0x0000000000003988
SYMTAB 0x0000000000000ac0
STRSZ 0x00000000000048b2
SYMENT 0x0000000000000018
PLTGOT 0x0000000000253000
PLTRELSZ 0x0000000000001ed8
PLTREL 0x0000000000000007
JMPREL 0x00000000000135a8
RELA 0x0000000000008700
RELASZ 0x000000000000aea8
RELAENT 0x0000000000000018
VERNEED 0x0000000000008620
VERNEEDNUM 0x0000000000000004
VERSYM 0x000000000000823a
RELACOUNT 0x000000000000069a
Version References:
required from libgcc_s.so.1:
0x0b792650 0x00 11 GCC_3.0
required from libpthread.so.0:
0x09691a75 0x00 10 GLIBC_2.2.5
required from libc.so.6:
0x0d696914 0x00 07 GLIBC_2.4
0x09691974 0x00 06 GLIBC_2.3.4
0x09691a75 0x00 05 GLIBC_2.2.5
0x06969194 0x00 04 GLIBC_2.14
required from libstdc++.so.6:
0x02297f89 0x00 09 GLIBCXX_3.4.9
0x0297f861 0x00 08 GLIBCXX_3.4.11
0x08922974 0x00 03 GLIBCXX_3.4
0x056bafd3 0x00 02 CXXABI_1.3
Sections:
Idx Name Size VMA LMA File off Algn
0 .note.gnu.build-id 00000024 00000000000001c8 00000000000001c8 000001c8 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .gnu.hash 000008cc 00000000000001f0 00000000000001f0 000001f0 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .dynsym 00002ec8 0000000000000ac0 0000000000000ac0 00000ac0 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .dynstr 000048b2 0000000000003988 0000000000003988 00003988 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .gnu.version 000003e6 000000000000823a 000000000000823a 0000823a 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .gnu.version_r 000000e0 0000000000008620 0000000000008620 00008620 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .rela.dyn 0000aea8 0000000000008700 0000000000008700 00008700 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .rela.plt 00001ed8 00000000000135a8 00000000000135a8 000135a8 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .init 0000001a 0000000000015480 0000000000015480 00015480 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
9 .plt 000014a0 00000000000154a0 00000000000154a0 000154a0 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
10 .text 00023734 0000000000016940 0000000000016940 00016940 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .fini 00000009 000000000003a074 000000000003a074 0003a074 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .rodata 0000f220 000000000003a080 000000000003a080 0003a080 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
13 .eh_frame_hdr 00000d24 00000000000492a0 00000000000492a0 000492a0 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
14 .eh_frame 000047fc 0000000000049fc8 0000000000049fc8 00049fc8 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
15 .gcc_except_table 00003474 000000000004e7c4 000000000004e7c4 0004e7c4 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
16 .init_array 00000010 0000000000252688 0000000000252688 00052688 2**3
CONTENTS, ALLOC, LOAD, DATA
17 .fini_array 00000008 0000000000252698 0000000000252698 00052698 2**3
CONTENTS, ALLOC, LOAD, DATA
18 .jcr 00000008 00000000002526a0 00000000002526a0 000526a0 2**3
CONTENTS, ALLOC, LOAD, DATA
19 .data.rel.ro 000004d8 00000000002526c0 00000000002526c0 000526c0 2**5
CONTENTS, ALLOC, LOAD, DATA
20 .dynamic 00000260 0000000000252b98 0000000000252b98 00052b98 2**3
CONTENTS, ALLOC, LOAD, DATA
21 .got 000001f8 0000000000252df8 0000000000252df8 00052df8 2**3
CONTENTS, ALLOC, LOAD, DATA
22 .got.plt 00000a60 0000000000253000 0000000000253000 00053000 2**3
CONTENTS, ALLOC, LOAD, DATA
23 .data 00009700 0000000000253a60 0000000000253a60 00053a60 2**5
CONTENTS, ALLOC, LOAD, DATA
24 .bss 00000c58 000000000025d160 000000000025d160 0005d160 2**5
ALLOC
25 .comment 00000011 0000000000000000 0000000000000000 0005d160 2**0
CONTENTS, READONLY
SYMBOL TABLE:
no symbolsOne thing that does look suspicious is the line
RPATH /home/myles/myaur/dev/dolfin-bzr/src/dolfin-build/build/dolfin:/lib64:/opt/petsc/arch-linux2-cxx-opt/lib:/usr/lib/openmpi:/usr/lib/vtk-5.10which has the path to where the package was built but I don't know if it
is significant that it is assigned to the RPATH variable.
Any ideas?
Last edited by myles (2012-12-16 00:20:39)
Offline
After the segfault comes the core dump, then I used "journalctl" to see if the core file was really dumped, "systemctl-coredump gdb PID" to inspect the corefile but it was truncated, so then I tried rebuilding dolfin with "CMAKE_BUILD_TYPE=Debug" which showed the shared libraries that were too old (hdf5, etc), so now I am updating their packages, in extra and community, and will send patches to the maintainers. There was an error with gobject so I remove one of the gobject packages and it went away. So, the issue is probably solved, I'll see if I can finally build a debug version of dolfin then do "from dolfin import *" in python2.
Last edited by myles (2012-12-18 22:30:08)
Offline