TCF调试:未解析的源行信息

时间:2013-12-06 11:15:21

标签: eclipse debugging remote-debugging

我正在尝试使用TCF调试一个简单的C程序。

它基本上有效,但问题是,我只看到反汇编但没有任何调试信息 - 所以只是机器代码。

这就是如何调用gcc(使用MinGW):

gcc -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "..\\main.c" 
gcc -o debugme.exe main.o

而这是TCF追踪:

360.192 Inp: E Breakpoints status "file:/C:/Users/falkstef/runtime-EclipseApplication/test/main.c:3703" {Instances:[{LocationContext:"P7092",Error:"Unresolved source line information"}]}
360.192 Inp: E Breakpoints status "file:/C:/Users/falkstef/runtime-EclipseApplication/test/main.c:3697" {Instances:[{LocationContext:"P7092",Error:"Unresolved source line information"}]}
360.192 Inp: E Breakpoints status "file:/C:/Users/falkstef/runtime-EclipseApplication/test/main.c:3701" {Instances:[{LocationContext:"P7092",Error:"Unresolved source line information"}]}
360.192 Inp: E Breakpoints status "file:/C:/Users/falkstef/runtime-EclipseApplication/debugme/main.c:3717" {Instances:[{LocationContext:"P7092",Error:"Unresolved source line information"}]}
...
360.468 Out: C 1778 Symbols findByAddr "P7092" 2003398832
360.468 Inp: R 1778 {Format:"Symbol not found",Time:1386328360468,Code:22} null
360.469 Out: C 1779 Symbols findByAddr "P7092" 2003398833
360.469 Inp: R 1779 {Format:"Symbol not found",Time:1386328360469,Code:22} null
360.469 Out: C 1780 Symbols findByAddr "P7092" 2003398834
360.469 Inp: R 1780 {Format:"Symbol not found",Time:1386328360469,Code:22} null
360.469 Out: C 1781 Symbols findByAddr "P7092" 2003398835
...

有人可以帮我吗?

更新1 根据Locator Hello Message运行服务:

["ZeroCopy","Diagnostics","Profiler","Disassembly","DPrintf",
"Terminals","PathMap","Streams","Expressions","SysMonitor",
"FileSystem","ProcessesV1","Processes","LineNumbers",
"Symbols","StackTrace","Registers","MemoryMap","Memory",
"Breakpoints","RunControl","ContextQuery","Locator"]

更新2

// .. somewhere in linenumberswin32.c
    if (!SymGetLineFromName(get_context_handle(ctx), NULL, file, line, &offset, &img_line)) {

            DWORD win_err = GetLastError();
            if (win_err != ERROR_NOT_FOUND) {
                err = set_win32_errno(win_err);
            }
        }
// ...

请参阅defenition of SymGetLineFromName64

// this returns false:
BOOL SymGetLineFromName(HANDLE hProcess, PCSTR ModuleName, PCSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINE Line) {
    typedef BOOL (FAR WINAPI * ProcType)(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE);
    static ProcType proc = NULL;
    if (proc == NULL) {
        proc = (ProcType)GetProc("SymGetLineFromName");
        if (proc == NULL) return 0;
    }
    return proc(hProcess, ModuleName, FileName, dwLineNumber, plDisplacement, Line);
}

更新3 屏幕截图(direct link

enter image description here

1 个答案:

答案 0 :(得分:1)

Stefan,您将无法使用当前的TCF实现来调试此文件,因为使用MinGW生成的文件是PE文件格式,但调试信息是DWARF。据我所知,TCF现在不支持,只有GDB支持。请参阅this other SO question

我建议您使用Visual Studio构建一个新的.exe文件,它将生成一个带有MS调试格式的PE文件,或者您切换到Linux(ELF + DWARF)