A QFB agent: how to catch C-level crashes and last Python stack ?

Thomas Heller theller at python.net
Thu Apr 27 07:10:55 EDT 2006


robert wrote:
> When employing complex UI libs (wx, win32ui, ..) and other extension 
> libs, nice "only Python stack traces" remain a myth.
> 
> Currently I'm hunting again a rare C-level crash bug of a Python based 
> Windows app with rare user reports - and still in the dark (I get 
> snippets of machine stack traces / screenshots with random "mem. access 
> error" / "python caused the runtime to terminate in an unusual way" / ..)
> 
> I'd like to hook a kind of quality feedback agent a C-level to enable 
> the user transfer a report (similar to what Mozilla/Netscape has), e.g. 
> in a changed python.exe stub. Next to the machine stack/regs it should 
> grab the relevant last Python thread stack(s), if any, and maybe other 
> useful status and python global vars.
> (There are also Python threads going on. )
> 
> Is that possible?
> 
> -robert

It looks like this may be what you want.  Quoting from

http://www.usenix.org/events/usenix01/full_papers/beazley/beazley.pdf

"""
In recent years, scripting languages such as Perl,
Python, and Tcl have become popular development tools
for the creation of sophisticated application software.
One of the most useful features of these languages is
their ability to easily interact with compiled languages
such as C and C++. Although this mixed language approach
has many benefits, one of the greatest drawbacks
is the complexity of debugging that results from using
interpreted and compiled code in the same application.
In part, this is due to the fact that scripting language
interpreters are unable to recover from catastrophic errors
in compiled extension code. Moreover, traditional
C/C++ debuggers do not provide a satisfactory degree
of integration with interpreted languages. This paper
describes an experimental system in which fatal extension
errors such as segmentation faults, bus errors, and
failed assertions are handled as scripting language exceptions.
This system, which has been implemented as
a general purpose shared library, requires no modifications
to the target scripting language, introduces no performance
penalty, and simplifies the debugging of mixed
interpreted-compiled application software.
"""

It may be an interesting project to port this to Windows.

Hope that helps,

Thomas




More information about the Python-list mailing list