Search code examples
eclipsedebuggingremote-debugging

TCF Debug: Unresolved source line information


I am trying to debug a simple C program using TCF.

It basically works, but the problem is, that I only see the disassembly but without any debug informatione - so just the machine code.

This is how gcc (using MinGW) is called:

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

Whereas ths is the TCF Trace:

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
...

Can anyone help me here?

Update 1 Running services according to the 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"]

Update 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);
            }
        }
// ...

See 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);
}

Update 3 Screenshot (direct link)

enter image description here


Solution

  • Stefan, you won't be able to debug this file using the current implementation of TCF because the file you generated using MinGW is in the PE file format but the debug information are in DWARF. As far as I know this is not supported by TCF right now, only by GDB. See this other SO question.

    I suggest you build a new .exe file using Visual Studio which will generate a PE file with MS debug format or that you switch to Linux (ELF + DWARF)