From: hypo <hyp...@gm...> - 2008-11-18 22:45:41
|
can you GDB at run time to see why it's faulting? Do you have multiple threads running? can you write simple test code that just outputs from a stringstream (and that would all that main contains) and demonstrate that this is only due to turning on multi-threading? i guess i'm trying to determine if the bug might be in your code or how multi-threading is enabled or (rather unlikely, but not impossible) fstream library implementation. hth, hypo rketcham wrote: > > Hello, > I've written a logging class which I want to use with other applications > for logging process information. The logging class works on my desktop > (which is using Ubuntu) but when I cross-compile it with the 1508 > buildroot (with threading enabled - fixed via toolchain/Makefile.in) and > deploy it on a gumstix, the class segfaults when it tries to write to an > already opened file. When the toolchain is rebuilt with threading > disabled, the program miraculously works and is able to write to the file > it creates. My other buildroot versions (1552, 1627, 1633) have threading > enabled and don't work as well. > > These are the includes for my class: > > #include <string> //String > #include <fstream> //File IO > #include <sstream> //String Editing > #include <stdio.h> > #include <time.h> > > The class segfaults here: > > m_logFile.write(logString.c_str(),logString.size()); > > logString is a string created from a stringstream object: > > ostringstream logLine; > logLine<<"stuff"; > string logString = logLine.str(); > > > I need to be able to use this logging class within an application that is > also using threading. Any ideas? > > Thanks, > Rich > > -- View this message in context: http://www.nabble.com/fstream-with-threading-enabled-segfaults-tp20567377p20569138.html Sent from the Gumstix mailing list archive at Nabble.com. |