CString -> RString

This commit is contained in:
Chris Danford
2006-01-22 01:00:06 +00:00
parent 870ed267fc
commit 7f821e8cfc
578 changed files with 3943 additions and 3946 deletions
@@ -53,7 +53,7 @@ void UnexpectedExceptionHandler()
int iStatus = -1;
char *pDem = abi::__cxa_demangle( pName, 0, 0, &iStatus );
const CString error = ssprintf("Unhandled exception: %s", iStatus? pName:pDem);
const RString error = ssprintf("Unhandled exception: %s", iStatus? pName:pDem);
#if defined(CRASH_HANDLER)
sm_crash( error );
#else
@@ -71,19 +71,19 @@ void BacktraceNames::Demangle() { }
#endif
CString BacktraceNames::Format() const
RString BacktraceNames::Format() const
{
CString ShortenedPath = File;
RString ShortenedPath = File;
if( ShortenedPath != "" )
{
/* Abbreviate the module name. */
size_t slash = ShortenedPath.rfind('/');
if( slash != ShortenedPath.npos )
ShortenedPath = ShortenedPath.substr(slash+1);
ShortenedPath = CString("(") + ShortenedPath + ")";
ShortenedPath = RString("(") + ShortenedPath + ")";
}
CString ret = ssprintf( "%0*lx: ", int(sizeof(void*)*2), (long) Address );
RString ret = ssprintf( "%0*lx: ", int(sizeof(void*)*2), (long) Address );
if( Symbol != "" )
ret += Symbol + " ";
ret += ShortenedPath;
@@ -304,10 +304,10 @@ void BacktraceNames::FromAddr( const void *p )
}
/* "path(mangled name+offset) [address]" */
void BacktraceNames::FromString( CString s )
void BacktraceNames::FromString( RString s )
{
/* Hacky parser. I don't want to use regexes in the crash handler. */
CString MangledAndOffset, sAddress;
RString MangledAndOffset, sAddress;
unsigned pos = 0;
while( pos < s.size() && s[pos] != '(' && s[pos] != '[' )
File += s[pos++];
@@ -333,7 +333,7 @@ void BacktraceNames::FromString( CString s )
else
{
Symbol = MangledAndOffset.substr(0, plus);
CString str = MangledAndOffset.substr(plus);
RString str = MangledAndOffset.substr(plus);
if( sscanf(str, "%i", &Offset) != 1 )
Offset=0;
}
@@ -397,7 +397,7 @@ void BacktraceNames::FromAddr( const void *p )
fprintf(stderr, "FromAddr read() failed: %s\n", strerror(errno));
return;
}
vector<CString> mangledAndFile;
vector<RString> mangledAndFile;
split(f, " ", mangledAndFile, true);
if (mangledAndFile.size() == 0)
@@ -3,13 +3,13 @@
struct BacktraceNames
{
CString Symbol, File;
RString Symbol, File;
intptr_t Address;
int Offset;
void FromAddr( const void *p );
void FromString( CString str );
void FromString( RString str );
void Demangle();
CString Format() const;
RString Format() const;
BacktraceNames(): Address(0), Offset(0) { }
};
@@ -387,7 +387,7 @@ void CrashHandler::ForceCrash( const char *reason )
RunCrashHandler( &crash );
}
void CrashHandler::ForceDeadlock( CString reason, uint64_t iID )
void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
{
CrashData crash;
memset( &crash, 0, sizeof(crash) );
+1 -1
View File
@@ -11,7 +11,7 @@ namespace CrashHandler
void InitializeCrashHandler();
void CrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc );
void ForceCrash( const char *reason );
void ForceDeadlock( CString reason, uint64_t CrashHandle );
void ForceDeadlock( RString reason, uint64_t CrashHandle );
}
#endif
@@ -186,7 +186,7 @@ bool child_read( int fd, void *p, int size )
}
/* Once we get here, we should be * safe to do whatever we want;
* heavyweights like malloc and CString are OK. (Don't crash!) */
* heavyweights like malloc and RString are OK. (Don't crash!) */
static void child_process()
{
/* 1. Read the CrashData. */
@@ -232,7 +232,7 @@ static void child_process()
if( !child_read(3, temp, size) )
return;
vector<CString> Checkpoints;
vector<RString> Checkpoints;
split(temp, "$$", Checkpoints);
delete [] temp;
@@ -242,7 +242,7 @@ static void child_process()
temp = new char [size];
if( !child_read(3, temp, size) )
return;
const CString CrashedThread(temp);
const RString CrashedThread(temp);
delete[] temp;
/* Wait for the child to either finish cleaning up or die. XXX:
@@ -263,7 +263,7 @@ static void child_process()
}
const char *home = getenv( "HOME" );
CString sCrashInfoPath = "/tmp";
RString sCrashInfoPath = "/tmp";
if( home )
sCrashInfoPath = home;
sCrashInfoPath += "/crashinfo.txt";
@@ -283,12 +283,12 @@ static void child_process()
fprintf( CrashDump, "--------------------------------------\n" );
fprintf( CrashDump, "\n" );
CString reason;
RString reason;
switch( crash.type )
{
case CrashData::SIGNAL:
{
CString Signal = SignalName( crash.signal );
RString Signal = SignalName( crash.signal );
#if !defined(MACOSX)
reason = ssprintf( "%s - %s", Signal.c_str(), SignalCodeName(crash.signal, crash.si.si_code) );
+2 -2
View File
@@ -4,7 +4,7 @@
#include <sys/utsname.h>
void GetKernel( CString &sys, int &vers )
void GetKernel( RString &sys, int &vers )
{
utsname uts;
uname( &uts );
@@ -15,7 +15,7 @@ void GetKernel( CString &sys, int &vers )
if( sys == "Linux" )
{
static Regex ver( "([0-9]+)\\.([0-9]+)\\.([0-9]+)" );
vector<CString> matches;
vector<RString> matches;
if( ver.Compare(uts.release, matches) )
{
ASSERT( matches.size() >= 2 );
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef GET_SYS_INFO_H
void GetKernel( CString &sys, int &vers );
void GetKernel( RString &sys, int &vers );
#endif
@@ -36,7 +36,7 @@ static _syscall0(pid_t,gettid)
#endif
CString ThreadsVersion()
RString ThreadsVersion()
{
char buf[1024] = "(error)";
int ret = confstr( _CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf) );
@@ -1,7 +1,7 @@
#ifndef PID_THREAD_HELPERS_H
#define PID_THREAD_HELPERS_H
CString ThreadsVersion();
RString ThreadsVersion();
/* Get the current thread's ThreadID. */
uint64_t GetCurrentThreadId();