RE: Debugging freeamp on RedHat Linux 6.2 (long)

2000-09-10 Thread Isaac Richards


On 10-Sep-2000 Chris Kuklewicz wrote:
 Simply running freeamp produced my first Segfault to track down:
 
 1) It asked about default file associations, where I clicked "No"
 2) The main freeamp window appeared, "Welcome to FreeAmp!"
 3) I clicked the close button in the corner
 4) The window disappeared.
 5) "Segmentation fault" was printed on the terminal.

Ya, there's definately a reproducible segfault on exit on linux.. think it was
introduced in beta 7 or 8.  

 Now try gdb

 Program received signal SIGTRAP, Trace/breakpoint trap.

This is a tad odd..  definately shouldn't be getting this, and I'd say it's an
artifact of the debugger not getting along completely w/ your version of glibc
and/or gcc.

 [Switching to Thread 6151 (runnable)]
snip

 Program received signal SIGILL, Illegal instruction.

Again, rather odd..

 And so the "We assume n is properly aligned" bothers me.  Perhaps this
 is an id3lib problem created by removing the compiler option
 "-mpreferred-stack-boundary=2".  But the id3lib-examples command line
 programs do not seem to segfault.  So I get a different crash when
 running under gdb, which effectively prevents me from doing *anything*
 under gdb.

 Any advice on understanding this SIGTRAP/SIGILL?  Or should I use another
 debugging technique (e.g. "printf and/or cerr " everywhere).

It seems to me that there are a very few combinations of gcc/gdb/glibc that
actually work with complex threaded c++ programs..  My old work machine had an
old(er) version of debian woody, and I could debug w/ gdb fine..  My current 
box has a current version of woody, and gdb's almost worthless on it.  So, 
I can't give you any good advice :/

Currently, I debug w/ printfs and the like.  More work, but it at least
usually produces results.

 I looked into doing an easy upgrade to egcs 2.96 with the rawhide src
 and i386 rpms, but the dependency requirements bleed over to rpm v4,
 and tcltk, and bzip2.  And from there to most of my system!  Attempts
 to see a clean upgrade path using -ivh and rebuilding from src rpms
 has yet to yield success.  Any advice on the easiest way to "get from
 here (egcs 2.91) to there (egcs 2.96)" ?
 
 Last question: I did not happen to --enable-mutex-debug or
 --enable-dmalloc. What would your recommendations be for options for
 ./configure for trying to track down the crashes?

the --enable-dmalloc option probably won't work for you, as it was geared for
my setup of a few months ago -- it needs to be updated to work more generically,
but dmalloc's basically only useful for a small subset of error tracking, and
segfaults aren't really one of them.

--enable-mutex-debug just allows you to tell freeamp to spit out the status 
of the internal mutexes, and is thus only really useful for tracking down
deadlocks.

Best thing to do, IMO, is not spend too much time working on getting gdb to
work.  For regular segfaults, printfs should work just fine..

And thanks for trying to help make freeamp better! =)

Isaac


___
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev



First segfault patch

2000-09-10 Thread Chris Kuklewicz

I gave up on gdb.  I brought over the printf/cerr macros I favor.

Only residual question from last email: what is an efficient
way to upgrade egcs / glibc on linux (e.g. Redhat 6.2) ?

I found the cause of the immedate segfault (open, close, segfault).
The ~Player was calling StopTimer with a null m_cdTimer, and StopTimer
would dereference it and die.  A simple patch is attached.

Hmmm...freeamp is not leaving behind a core fileany ideas on that?

-- 
Chris Kuklewicz


Index: base/src/timer.cpp
===
RCS file: /src/repository/freeamp/base/src/timer.cpp,v
retrieving revision 1.13
diff -u -r1.13 timer.cpp
--- base/src/timer.cpp  2000/08/30 09:20:53 1.13
+++ base/src/timer.cpp  2000/09/10 21:36:38
@@ -29,7 +29,7 @@
 #endif
 
 #include "config.h"
-#include "timer.h"
+//#include "timer.h"
 
 #if defined(__linux__) || defined(solaris) || defined(__FreeBSD__)
 #include unistd.h
@@ -91,20 +91,25 @@
 
 void TimerManager::StopTimer(TimerRef timer)
 {
-timer-ticks = 0;
-timer-duration = 0;
+// CEK : debugging linux segfault when run  close immediately
+// CEK : in ~Profile it calls StopTimer(NULL)
+if (NULL!=timer)
+{
+timer-ticks = 0;
+timer-duration = 0;
 
-vectorTimerRef::iterator i = m_list.begin();
+vectorTimerRef::iterator i = m_list.begin();
 
-for(; i != m_list.end(); i++)
-{
-if(*i == timer)
+for(; i != m_list.end(); i++)
 {
-m_mutex.Acquire();
-m_list.erase(i);
-delete timer;
-m_mutex.Release();
-break;
+if(*i == timer)
+{
+m_mutex.Acquire();
+m_list.erase(i);
+delete timer;
+m_mutex.Release();
+break;
+}
 }
 }
 }