【发布时间】:2013-12-06 11:15:20
【问题描述】:
我正在尝试使用 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)
【问题讨论】:
-
您能否列出在您的 TCF 代理中运行的 TCF 服务?一种有点骇人听闻的方法是在 TCF 端口上使用 telnet 进行连接;然后您从服务定位器获取服务枚举
-
这是定位器问候消息:
E Locator Hello ["ZeroCopy","Diagnostics","Profiler","Disassembly","DPrintf","Terminals","PathMap","Streams","Expressions","SysMonitor","FileSystem","ProcessesV1","Processes","LineNumbers","Symbols","StackTrace","Registers","MemoryMap","Memory","Breakpoints","RunControl","ContextQuery","Locator"]。 -
好的,看起来您已经拥有所有必需的服务。通常服务 LineNumbers 也用于将地址转换为行。
-
下一个问题:1.你添加了符号文件吗?您可以检查当前调试上下文是否在模块视图中映射了符号文件。 2. 如果是这种情况,您可以使用表达式视图来评估函数名称和全局变量等符号。有用吗?
-
嗯我不确定我是否在关注,您应该在调试视图中至少有一个调试上下文来显示反汇编。您能否发布 Debug 透视图的屏幕截图?
标签: eclipse debugging remote-debugging