A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-February/042845.html below:

[Python-Dev] How to debug pyexpat SIGSEGV with GDB?

[Python-Dev] How to debug pyexpat SIGSEGV with GDB?Michael Hudson mwh at python.net
Sat Feb 28 07:46:39 EST 2004
"Brad Clements" <bkc at murkworks.com> writes:

> Sorry if this is OT.

Marginally.

> I've hit a repeatable segfault in pyexpat on RH Linux 9 with Python
> 2.3.3 (I'm trying rss2email).
>
> It seems that XML_parse is returning an error, but when
> XML_GetCurrentLineNumber is called positionPtr is not valid.
>
> I catch this in GDB and have looked at the stack (see below), but
> when I get back up the stack into PyCFunction_Call I don't know what
> to do.

That's possibly because you haven't gone far enough.  PyCFunction_Call
is what you call to execute a builtin function.  You need to work your
way a couple more levels up the stack.

> Ideally, I want to find out the Python source file and line number
> that is currently being executed, then look at the Python source to
> figure out exactly which pyexpat call is being made just before the
> call to get_parse_result.
>
> It seems strange that (it appears) that Python code is calling
> get_parse_result directly.

Build a debug build, maybe?

If a function looks like:

PyObject* foo()
{
    /* stuff with no function calls, or only inlineable 
       function calls */

    return Function(args);
}

gcc, at least, will not set up a stack frame for foo.

> So, how can I figure out where in the Python source the function
> call is coming from using gdb? I'm sure it involves "print" and some
> casts.. I couldn't find a howto on python.org

Read lots of source.

Cheers,
mwh

-- 
31. Simplicity does not precede complexity, but follows it.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4