473,513 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Stack Trace on segfault

Hello All,

The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like I
could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?
I would hope to produce something hauntingly reminiscent of

[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function
Presentation, of course, is irrelevant.
I read the docs on pdb, but it did not seem to do what I want--unless,
of course, I missed something.
James
Apr 6 '07 #1
5 2048
On Apr 6, 7:13 am, James Stroud <jstr...@mbi.ucla.eduwrote:
Hello All,

The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like I
could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?

I would hope to produce something hauntingly reminiscent of

[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function

Presentation, of course, is irrelevant.

I read the docs on pdb, but it did not seem to do what I want--unless,
of course, I missed something.

James
Hi,

I've never done that before, but I found a recipe that claims to do it
with meta-classes. Check it out:

http://aspn.activestate.com/ASPN/Coo.../Recipe/198078

I hope this gives you some ideas.

Mike

Apr 6 '07 #2
On Apr 6, 8:13 am, James Stroud <jstr...@mbi.ucla.eduwrote:
Hello All,

The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like I
could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?

I would hope to produce something hauntingly reminiscent of

[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function

Presentation, of course, is irrelevant.

I read the docs onpdb, but it did not seem to do what I want--unless,
of course, I missed something.

James
pydb (http://bashdb.sf.net0 has the ability to do noninteractive line
tracing. See http://bashdb.sourceforge.net/pydb/p...ction-set.html
or the showmedo demo. It would be kind of neat to extend this to allow
for method/fn tracing. Alas the simple hack I tried, didn't work
because of code obscurities. (The code could stand to use a rewrite.)

Apr 7 '07 #3
After a night's rest, I was able to add a function trace to pydb,
command option --fntrace, short option -F, and set/show command
"fntrace".

It's still a little bit funky. (Hey, I didn't get *that* good of a
rest). But it's out there in pydb's CVS in case folks want to try it.

Also, following an idea given in the recipe, I've extended the 'Call'
and 'Return' indicators so that we list the current stack level. For
"Return" we'll also list the return value (or at least a repr() of it
for strings and scalars) and/or return type. What's a little odd here
is that levels from the debugger are included in the nesting count. So
the top-level in the user program will be greater than 1.

It's possible there will be another release around the time of the
next ipython release since there is better coordination between the
two with respect to colorizing lines of code.

On Apr 6, 10:49 pm, "rocky.bernst...@gmail.com"
<rocky.bernst...@gmail.comwrote:
On Apr 6, 8:13 am, James Stroud <jstr...@mbi.ucla.eduwrote:
Hello All,
The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like I
could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?
I would hope to produce something hauntingly reminiscent of
[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function
Presentation, of course, is irrelevant.
I read the docs onpdb, but it did not seem to do what I want--unless,
of course, I missed something.
James

pydb (http://bashdb.sf.net0has the ability to do noninteractive line
tracing. Seehttp://bashdb.sourceforge.net/pydb/pydb/lib/subsubsection-set.html
or the showmedo demo. It would be kind of neat to extend this to allow
for method/fn tracing. Alas the simple hack I tried, didn't work
because of code obscurities. (The code could stand to use a rewrite.)

Apr 7 '07 #4
James Stroud <js*****@mbi.ucla.eduwrites:
Hello All,

The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like
I could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?
I would hope to produce something hauntingly reminiscent of

[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function
[...]

I remember David Beazley (of SWIG fame) wrote something called WAD
that claimed to turn segfaults into Python exceptions (hence
tracebacks). IIRC it was Linux-specific, and I have no idea how it
worked. I guess it could be ported to Windows with SEH, but no idea
about OS X.
John
Apr 11 '07 #5
GDB would could work. Here's how I use it to track down problems in a C
++ program controlled by python.

$ gdb python
GDB starts up, now at the gdb prompt, set the program args

(gdb) set arg testscript.py
(gdb) run
.... program running until crash
(gdb) where
gives you the backtrace if you compiled you're module code with debug
options

Cheers! Bernhard
On Apr 11, 10:51 pm, j...@pobox.com (John J. Lee) wrote:
James Stroud <jstr...@mbi.ucla.eduwrites:
Hello All,
The built-in mac osx vecLib is segfaulting in some cases--A very fun
fact to find out the hard way over two nights of work. I also spent an
embarrassing amount of time figuring out just where. Although I'm in
quite a self-congratulatory mood right now, in the future, I feel like
I could save a lot of time by coercing the interpreter to spew forth
method calls to stderr. Is this possible?
I would hope to produce something hauntingly reminiscent of
[] my_function
[my_function] another_function
[my_function -another_function] yet_a_deeper_function

[...]

I remember David Beazley (of SWIG fame) wrote something called WAD
that claimed to turn segfaults into Python exceptions (hence
tracebacks). IIRC it was Linux-specific, and I have no idea how it
worked. I guess it could be ported to Windows with SEH, but no idea
about OS X.

John

Apr 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6287
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When I installed Sharepoint Services I got the error and had to reboot and then everything was fine. I get it sometime when running aspx pages. It's...
7
2478
by: Andy Fish | last post by:
Hi, in my c# code I have something like this: try { ... } catch (Exception ex) { ... throw ex; }
1
4767
by: Jason Coyne | last post by:
I am trying to use the StackTrace class to get my current stack trace for some logging. Everything is working fine, except when I am using threading (specifically WaitCallBack and ThreadPool.QueueUserWorkItem) When I try to walk the stack from a location that has been called via QueueUserWorkItem, the stack stops at the point where the...
0
2473
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When I installed Sharepoint Services I got the error and had to reboot and then everything was fine. I get it sometime when running aspx pages. It's...
2
4367
by: Lasse Vågsæther Karlsen | last post by:
If I got the following code: try { // something that might throw an exception } catch (Exception ex) { // Log contents of ex here throw;
4
2995
by: Jeff Jarrell | last post by:
I have a block of code that during development is prone to casting errors. It is mostly a DataReader type thing. It looks something like this. _prtPNID = myDLReader.GetString("prtPNID") _prtSKU = myDLReader.GetString("prtSKU") _prtPic = myDLReader.GetString("prtPic") _prtRsvQty = myDLReader.GetInteger("prtRsvQty")
3
7213
by: Dave Anson | last post by:
I have a custom exception and I want to write the information to the event log, including the Stack Trace. I can create the message and write to the event log no problem, but the Stack Trace is empty. How do I append the Stack Trace in the custom exception? I can get the inner exception stack trace from the system exceptions, but how do I...
0
1983
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
2
4588
by: Scott | last post by:
I'm debugging an xmlrpc client/server application. Often when an exception occurs in the server, I receive only a very short error message on the client. For example: xmlrpclib.Fault: <Fault 1: "<type 'exceptions.AssertionError'>:"> Presumably this is because xmlrpclib on the server is catching the exception, and only sending the...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.