以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML工具及XML开发环境 』  (http://bbs.xml.org.cn/list.asp?boardid=7)
----  关于xml解析的问题,大家帮帮忙啊,急  (http://bbs.xml.org.cn/dispbbs.asp?boardid=7&rootid=&id=36527)


--  作者:moneyfire
--  发布时间:8/8/2006 9:42:00 AM

--  关于xml解析的问题,大家帮帮忙啊,急
模块出错的地方
pthread_detach(pthread_self());
    CPutResult* _this = (CPutResult*)arg;

    int retn;
    xmlDocPtr pDoc;
    xmlChar* buf = NULL;
    int buflen = 0;
    while (5) {
        pthread_mutex_lock(&g_result_mutex);
        while (g_result_target == "")
            pthread_cond_wait(&g_result_cond, &g_result_mutex);

        pDoc = xmlParseFile(g_result_target.c_str());    //模块执行几次到这就CORE掉
        if (!pDoc) {
            g_pApp->Logit("PutResult !xmlParseFile()");
        }
        xmlDocDumpMemory(pDoc, &buf, &buflen);

        int head_type = 0;
        if (strstr(g_result_target.c_str(), RESULT_STATIC_FILE))
            head_type = HEAD_TYPE_STATIC;
        else if (strstr(g_result_target.c_str(), RESULT_DYNAMIC_FILE))
            head_type = HEAD_TYPE_DYNAMIC;

        retn = _this->doPutResult(buf, buflen, head_type);
        if (pDoc)
            xmlFreeDoc(pDoc);
        xmlFree(buf);

        switch (retn) {
        case 0:
            break;
        default:
            g_pApp->Logit("发送聚合结果'%s'失败", g_result_target.c_str());
            break;
        }

        g_result_target = "";
        pthread_mutex_unlock(&g_result_mutex);
    }

    return NULL;
}


用GDB调试后出现下面情况:

# dbx nfb core
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.1' in your .dbxrc
Reading nfb
core file header read successfully
Reading ld.so.1
Reading libsocket.so.1
Reading libpthread.so.1
Reading libxml2.so.2
Reading libnsl.so.1
Reading libstdc++.so.5.0.5
Reading libiconv.so.2.1.0
Reading libz.so.1
Reading libm.so.1
Reading libc.so.1
Reading libgcc_s.so.1
Reading libdl.so.1
Reading libmp.so.2
Reading libc_psr.so.1
Reading libthread.so.1
Reading zh_CN.gbk%UTF-8.so
Reading UTF-8%zh_CN.gbk.so
detected a multithreaded program
t@7 (l@7) terminated by signal SEGV (no mapping at the fault address)
0xff22e074: xmlParserInputShrink+0x0044:        ld      [%o2], %o0
(dbx) where
current thread: t@7
=>[1] xmlParserInputShrink(0x85bf8, 0x3c, 0x11, 0xff224880, 0x7, 0x1), at 0xff22e074
  [2] xmlSHRINK(0x1cc860, 0x216077, 0x85bf8, 0x32, 0x4ef, 0x480c95), at 0xff231318
  [3] xmlParseContent(0x1cc860, 0x85bf8, 0x3e, 0xff224880, 0x216065, 0x85bf8), at 0xff2404f8
  [4] xmlParseElement(0x1cc860, 0x21605f, 0x85bf8, 0x3c, 0x4e2, 0xff966018), at 0xff24082c
  [5] xmlParseContent(0x1cc860, 0x85bf8, 0x3e, 0xff224880, 0x216057, 0x85bf8), at 0xff240444
  [6] xmlParseElement(0x1cc860, 0x216052, 0x85bf8, 0x3c, 0x4b3, 0xffe6e334), at 0xff24082c
  [7] xmlParseContent(0x1cc860, 0x85bf8, 0x3e, 0xd8d7, 0x216029, 0x85bf8), at 0xff240444
  [8] xmlParseElement(0x1cc860, 0x216023, 0x85bf8, 0x3c, 0xc2d108, 0x0), at 0xff24082c
  [9] xmlParseContent(0x1cc860, 0x85bf8, 0x3e, 0xff2a8cf0, 0x215b81, 0x85bf8), at 0xff240444
  [10] xmlParseElement(0x1cc860, 0x215b73, 0x85bf8, 0xff2d1338, 0xff246724, 0xff246704), at 0xff24082c
  [11] xmlParseDocument(0x1cc860, 0x8b320, 0x6, 0x8, 0x7, 0x11), at 0xff24276c
  [12] xmlSAXParseFileWithData(0x0, 0x8b4ac, 0x0, 0x0, 0x2e, 0xff065c34), at 0xff2460cc
  [13] _ZN10CPutResult9PutResultEPv(0x80678, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x2eb3c
(dbx)


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms