Debugging a .py script using gdb: "not in executable format"

Asked by Christopher Stanbridge

Today I was trying to run the gdb debugger on a Python script file for use with Yade (let's call it myscriptfile.py) and received the following error message:
' "[path]/myscriptfile.py": not in executable format: File format not recognized '

How would I correctly debug a .py script file using gdb? I've seen some people say you have to run gdb on the binary version of the file, but I don't know where to find the binary. If a binary is indeed needed, what is the general form for the path to a binary?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Anton Gladky
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Christopher Stanbridge (cws105) said :
#1

Out of curiosity, I'm running Linux -- Ubuntu 14.04.

Revision history for this message
Anton Gladky (gladky-anton) said :
#3

Hi

what do you want to debug? Python script itself?

You can compile Yade with -DDEBUG=1 option, which will give you some more information during a runtime or (and) crash.

Cheers

Anton

Revision history for this message
Christopher Stanbridge (cws105) said :
#4

Actually, I already tried -DDEBUG (without the "=1" after it; I typed "yade myscriptfile.py -DDEBUG") and it still just said "Segmentation fault (core dumped)" with no further information. This was the same response I got when I didn't include the -DDEBUG.

Revision history for this message
Best Anton Gladky (gladky-anton) said :
#5

-DDEBUG=1 should be done during "cmake-command" when you want to compile yade from the source.
It looks like, your Yade was not compiled in a DEBUG-mode.

What script do you use, getting segfault?

Anton

Revision history for this message
Christopher Stanbridge (cws105) said :
#6

Thanks Anton Gladky, that solved my question.