On Wed, 2012-05-30 at 10:06 +0200, Anders Johansson wrote:
On 05/30/2012 09:39 AM, Roger Oberholtzer wrote:
I have a threaded application that encounters a segmentation violation. I am fairly certain it is the initial thread that encounters the problem. But I just want to be sure of the following:
1. If a multi-threaded app encounters a seg violation, and a core dump is created, the core is of the thread that encountered the seg violation, and not of the main thread, right?
It will be of the whole process, all threads. You can do for example
thread apply all bt
to get a backtrace of all threads in the process
Thanks for that. Very interesting.
By default if you only run "bt" gdb will try to show you the backtrace of the thread that caused the segfault
OK.
2. If a process starts a thread, and that thread exits, the process does not know about this until it tries to join the thread, right? So, if a thread has a seg violation and exits, the 'parent' thread will also not be made exit. It has to detect the thread is gone by it's own mechanisms or by trying to join the thread. I ask this because I want to be certain I am not misinterpreting which thread in my application is the one that really is getting the seg violation.
If a thread segfaults, the whole process dies, threads and all. If you want threads to run independent of each other, you need to start them as processes, not threads
OK. In my case, based on what bt lists, I think it is the initial process that is having the seg violation. Oddly, it is in libz. The debugger seems to indicate that the values passed are as I expect them to be. So I am guessing that the file descriptor contents have become corrupt. Not the pointer, as that is the one I expect. But something in what it points to. Maybe the debug for libz will shed some light. Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org