- 论坛徽章:
- 0
|
我现在有一个程序原来在linux平台(AS4.0 + gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4))下运行。一切正常。
现在需要将这个程序移植到solaris9平台下(sunos 5.9 + gcc version 3.3.2)。
但是程序总是在 new 的地方core掉,实在是不理解。
core内容:
- (gdb) bt
- #0 0xfefc3004 in _malloc_unlocked () from /usr/lib/libc.so.1
- #1 0xfefc2db4 in malloc () from /usr/lib/libc.so.1
- #2 0xff0e1e34 in operator new(unsigned) (sz=376) at ../../../../libstdc++-v3/libsupc++/new_op.cc:48
复制代码
部分代码
- int InitLogFile()
- {
- char strFileName[PATH_MAX] = {0};
-
- g_pcDebugLog = g_pcFWDGWLog = g_pcTotalLog = NULL;
-
- snprintf(strFileName,PATH_MAX,"%sdebug.log",g_ocCfgParam.m_strLogFilePath);
- g_pcDebugLog = new CLogFile(strFileName, CLogFile::timeDateTime,CLogFile::modeBoth, 4096, 3);
- if( 0 == g_pcDebugLog->IsInit() )
- {
- printf("%s 调试日志创建失败![LogFileName:%s]\n",
- g_ocSysTime.m_strTime,strFileName);
- return -1;
- }
- else
- {
- printf("%s 调试日志创建成功![LogFileName:%s]\n",
- g_ocSysTime.m_strTime,strFileName);
- }
- snprintf(strFileName,PATH_MAX,"%sfwdgwpacket.log",g_ocCfgParam.m_strLogFilePath);
- g_pcFWDGWLog = new CLogFile(strFileName, CLogFile::timeDateTime,CLogFile::modeBoth, 4096, 3);
- if( 0 == g_pcFWDGWLog->IsInit() )
- {
- delete g_pcDebugLog;
- g_pcDebugLog = NULL;
- printf("%s 接受网关信息包日志创建失败![LogFileName:%s]\n",
- g_ocSysTime.m_strTime,strFileName);
- return -3;
- }
- else
- {
- printf("%s 接受网关信息包日志创建成功![LogFileName:%s]\n",
- g_ocSysTime.m_strTime,strFileName);
- }
复制代码
该函数可以正常制成第一个new,也就是 debug.log日志可以正常建立。但是在建立第二个的时候,就会core掉。百思不得其解啊,请各位帮忙 |
|