VS2010下Cannot find or open the PDB file

liangAsmtboy 2013-03-26 09:46:51
这是一个网络通讯的服务器程序,运行几个小时候就不知怎么的接收数据的线程收不到数据退出了。然后报类似下面的这种错误,程序也并没有退出,但就是没法正常收发数据了。请大家指点,谢谢啦。

“TCPSrv.exe”: 已加载“C:\Windows\System32\ws2_32.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\msvcrt.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\rpcrt4.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\nsi.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\mswsock.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\user32.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\gdi32.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\lpk.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\usp10.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\imm32.dll”,Cannot find or open the PDB file
“TCPSrv.exe”: 已加载“C:\Windows\System32\msctf.dll”,Cannot find or open the PDB file
...全文
152 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2013-03-27
  • 打赏
  • 举报
回复
特供调试多线程程序参考使用:
//循环向a函数每次发送200个字节长度(这个是固定的)的buffer,
//a函数中需要将循环传进来的buffer,组成240字节(也是固定的)的新buffer进行处理,
//在处理的时候每次从新buffer中取两个字节打印
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <process.h>
#include <io.h>
//Log{
#define MAXLOGSIZE 20000000
#define MAXLINSIZE 16000
#include <time.h>
#include <sys/timeb.h>
#include <stdarg.h>
char logfilename1[]="MyLog1.log";
char logfilename2[]="MyLog2.log";
static char logstr[MAXLINSIZE+1];
char datestr[16];
char timestr[16];
char mss[4];
CRITICAL_SECTION cs_log;
FILE *flog;
void Lock(CRITICAL_SECTION *l) {
    EnterCriticalSection(l);
}
void Unlock(CRITICAL_SECTION *l) {
    LeaveCriticalSection(l);
}
void LogV(const char *pszFmt,va_list argp) {
    struct tm *now;
    struct timeb tb;

    if (NULL==pszFmt||0==pszFmt[0]) return;
    _vsnprintf(logstr,MAXLINSIZE,pszFmt,argp);
    ftime(&tb);
    now=localtime(&tb.time);
    sprintf(datestr,"%04d-%02d-%02d",now->tm_year+1900,now->tm_mon+1,now->tm_mday);
    sprintf(timestr,"%02d:%02d:%02d",now->tm_hour     ,now->tm_min  ,now->tm_sec );
    sprintf(mss,"%03d",tb.millitm);
    printf("%s %s.%s %s",datestr,timestr,mss,logstr);
    flog=fopen(logfilename1,"a");
    if (NULL!=flog) {
        fprintf(flog,"%s %s.%s %s",datestr,timestr,mss,logstr);
        if (ftell(flog)>MAXLOGSIZE) {
            fclose(flog);
            if (rename(logfilename1,logfilename2)) {
                remove(logfilename2);
                rename(logfilename1,logfilename2);
            }
        } else {
            fclose(flog);
        }
    }
}
void Log(const char *pszFmt,...) {
    va_list argp;

    Lock(&cs_log);
    va_start(argp,pszFmt);
    LogV(pszFmt,argp);
    va_end(argp);
    Unlock(&cs_log);
}
//Log}
#define ASIZE    200
#define BSIZE    240
#define CSIZE      2
char Abuf[ASIZE];
char Cbuf[CSIZE];
CRITICAL_SECTION cs_HEX ;
CRITICAL_SECTION cs_BBB ;
struct FIFO_BUFFER {
    int  head;
    int  tail;
    int  size;
    char data[BSIZE];
} BBB;
int No_Loop=0;
void HexDump(int cn,char *buf,int len) {
    int i,j,k;
    char binstr[80];

    Lock(&cs_HEX);
    for (i=0;i<len;i++) {
        if (0==(i%16)) {
            sprintf(binstr,"%03d %04x -",cn,i);
            sprintf(binstr,"%s %02x",binstr,(unsigned char)buf[i]);
        } else if (15==(i%16)) {
            sprintf(binstr,"%s %02x",binstr,(unsigned char)buf[i]);
            sprintf(binstr,"%s  ",binstr);
            for (j=i-15;j<=i;j++) {
                sprintf(binstr,"%s%c",binstr,('!'<buf[j]&&buf[j]<='~')?buf[j]:'.');
            }
            Log("%s\n",binstr);
        } else {
            sprintf(binstr,"%s %02x",binstr,(unsigned char)buf[i]);
        }
    }
    if (0!=(i%16)) {
        k=16-(i%16);
        for (j=0;j<k;j++) {
            sprintf(binstr,"%s   ",binstr);
        }
        sprintf(binstr,"%s  ",binstr);
        k=16-k;
        for (j=i-k;j<i;j++) {
            sprintf(binstr,"%s%c",binstr,('!'<buf[j]&&buf[j]<='~')?buf[j]:'.');
        }
        Log("%s\n",binstr);
    }
    Unlock(&cs_HEX);
}
int GetFromRBuf(int cn,CRITICAL_SECTION *cs,FIFO_BUFFER *fbuf,char *buf,int len) {
    int lent,len1,len2;

    lent=0;
    Lock(cs);
    if (fbuf->size>=len) {
        lent=len;
        if (fbuf->head+lent>BSIZE) {
            len1=BSIZE-fbuf->head;
            memcpy(buf     ,fbuf->data+fbuf->head,len1);
            len2=lent-len1;
            memcpy(buf+len1,fbuf->data           ,len2);
            fbuf->head=len2;
        } else {
            memcpy(buf     ,fbuf->data+fbuf->head,lent);
            fbuf->head+=lent;
        }
        fbuf->size-=lent;
    }
    Unlock(cs);
    return lent;
}
void thdB(void *pcn) {
    char        *recv_buf;
    int          recv_nbytes;
    int          cn;
    int          wc;
    int          pb;

    cn=(int)pcn;
    Log("%03d thdB              thread begin...\n",cn);
    while (1) {
        Sleep(10);
        recv_buf=(char *)Cbuf;
        recv_nbytes=CSIZE;
        wc=0;
        while (1) {
            pb=GetFromRBuf(cn,&cs_BBB,&BBB,recv_buf,recv_nbytes);
            if (pb) {
                Log("%03d recv %d bytes\n",cn,pb);
                HexDump(cn,recv_buf,pb);
                Sleep(1);
            } else {
                Sleep(1000);
            }
            if (No_Loop) break;//
            wc++;
            if (wc>3600) Log("%03d %d==wc>3600!\n",cn,wc);
        }
        if (No_Loop) break;//
    }
}
int PutToRBuf(int cn,CRITICAL_SECTION *cs,FIFO_BUFFER *fbuf,char *buf,int len) {
    int lent,len1,len2;

    Lock(cs);
    lent=len;
    if (fbuf->size+lent>BSIZE) {
        lent=BSIZE-fbuf->size;
    }
    if (fbuf->tail+lent>BSIZE) {
        len1=BSIZE-fbuf->tail;
        memcpy(fbuf->data+fbuf->tail,buf     ,len1);
        len2=lent-len1;
        memcpy(fbuf->data           ,buf+len1,len2);
        fbuf->tail=len2;
    } else {
        memcpy(fbuf->data+fbuf->tail,buf     ,lent);
        fbuf->tail+=lent;
    }
    fbuf->size+=lent;
    Unlock(cs);
    return lent;
}
void thdA(void *pcn) {
    char        *send_buf;
    int          send_nbytes;
    int          cn;
    int          wc;
    int           a;
    int          pa;

    cn=(int)pcn;
    Log("%03d thdA              thread begin...\n",cn);
    a=0;
    while (1) {
        Sleep(100);
        memset(Abuf,a,ASIZE);
        a=(a+1)%256;
        if (16==a) {No_Loop=1;break;}//去掉这句可以让程序一直循环直到按Ctrl+C或Ctrl+Break或当前目录下存在文件No_Loop
        send_buf=(char *)Abuf;
        send_nbytes=ASIZE;
        Log("%03d sending %d bytes\n",cn,send_nbytes);
        HexDump(cn,send_buf,send_nbytes);
        wc=0;
        while (1) {
            pa=PutToRBuf(cn,&cs_BBB,&BBB,send_buf,send_nbytes);
            Log("%03d sent %d bytes\n",cn,pa);
            HexDump(cn,send_buf,pa);
            send_buf+=pa;
            send_nbytes-=pa;
            if (send_nbytes<=0) break;//
            Sleep(1000);
            if (No_Loop) break;//
            wc++;
            if (wc>3600) Log("%03d %d==wc>3600!\n",cn,wc);
        }
        if (No_Loop) break;//
    }
}
int main() {
    InitializeCriticalSection(&cs_log );
    Log("Start===========================================================\n");
    InitializeCriticalSection(&cs_HEX );
    InitializeCriticalSection(&cs_BBB );

    BBB.head=0;
    BBB.tail=0;
    BBB.size=0;

    _beginthread((void(__cdecl *)(void *))thdA,0,(void *)1);
    _beginthread((void(__cdecl *)(void *))thdB,0,(void *)2);

    if (!access("No_Loop",0)) {
        remove("No_Loop");
        if (!access("No_Loop",0)) {
            No_Loop=1;
        }
    }
    while (1) {
        Sleep(1000);
        if (No_Loop) break;//
        if (!access("No_Loop",0)) {
            No_Loop=1;
        }
    }
    Sleep(3000);
    DeleteCriticalSection(&cs_BBB );
    DeleteCriticalSection(&cs_HEX );
    Log("End=============================================================\n");
    DeleteCriticalSection(&cs_log );
    return 0;
}
镕羽 2013-03-26
  • 打赏
  • 举报
回复
同楼主,我的也是,用dev C++就可以成功运行 用VS2010 就不行,提示一大堆这种信息,不知道怎么解决,好奇怪 帮顶
liangAsmtboy 2013-03-26
  • 打赏
  • 举报
回复
所以我就想看看这里边到底是用到了什么东西,“调试->选项->符号->microsofe符号服务器上面打钩”这样子调试就太慢了。有没有其他方法呢?
liangAsmtboy 2013-03-26
  • 打赏
  • 举报
回复
没报的时候都是运行的好好地,一报就没有消息了。我的调试信息就都出不来了。
liangAsmtboy 2013-03-26
  • 打赏
  • 举报
回复
主要是报了这个信息之后,我的程序就运行不正常了,不能正常收发网络消息了。这是什么原因呢?
HayYoung 2013-03-26
  • 打赏
  • 举报
回复
仅是找不到符号,这个不是错误,而且这里一般不会出问题。你实在想要的话,可以在调试->选项->符号->microsofe符号服务器上面打钩,编译会很慢。
Athenacle_ 2013-03-26
  • 打赏
  • 举报
回复
你确定需要这些系统符号么???
liangAsmtboy 2013-03-26
  • 打赏
  • 举报
回复
请各位高手指点啊,网上说的“工具⇒选项⇒调试⇒符号⇒windows符号服务器”这种方法不行啊,太慢了。
镕羽 2013-03-26
  • 打赏
  • 举报
回复
我的问题解决了,是要读取的文件没放对位置,我在作业2目录里建立的VS2010 控制台程序,于是,系统又在该目录下建立了作业2目录,那个文件应该放在嵌套的作业2目录下,于是VS2010 成功运行了
liangAsmtboy 2013-03-26
  • 打赏
  • 举报
回复
不行啊,还是没解决啊,自己顶。。。

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧