使用GDB调试无法查找D程序符号

标签 debugging gdb d symbol-table

我已经成功构建并安装了 Ian Buclaw 的 (ibuclaw) GDB 分支 我的 Ubuntu 13.10 x86_64 上的 github 及其默认编译器 GCC 4.8.1。

否则我必须从 bin 子目录中删除文件 ld DMD 提示链接阶段的 sysroot 问题。

当我编译我的测试程序并通过 GDB 运行它时,我得到了 问题。

我可以break main,运行并且GDB在main的开头停止,但是当我执行next时,我得到以下不需要的输出

  Single stepping until exit from function main,
  which has no line number information.
  0x00007ffff760ede5 in __libc_start_main () from 
  /lib/x86_64-linux-gnu/libc.so.6

ibuclaw 的 GDB 不应该在这里工作吗?

我的测试程序编译为

dmd -debug -g -gs -wi t_array.d -oft_array

没有任何警告或错误。我也尝试过假装自己是C

dmd -debug -g -gc -gs -wi t_array.d -oft_array

结果相同。

此外,当我执行 b 后跟制表符时,大多数符号 完成列表未分解。

我的测试程序看起来像

import std.stdio, std.algorithm;

void main(string args[]) {
    int[] x;
    writeln(x.sizeof);

    if (x) {
        writeln("Here!");
    } else {
        writeln("There!");
    }

    int xx[2];
    auto xc = xx;
    xc[0] = 1;
    writeln(xx);
    writeln(xc);
    int[2] xx_;


    auto hit = x.find(1);
    if (hit) {
        writeln("Hit: ", hit);
    } else {
        writeln("No hit");
    }
    int[2] z;                   // arrays are zero initialized
    writeln(z);

    assert([].ptr == null);
    assert("ab"[$..$] == []);
    auto p = "ab"[$..$].ptr;
    writeln(p);
    assert(p != null);
}

最佳答案

对于我来说,使用 monodevelop 和 GDB 调试器(不适用于 D 的 gdb 调试器)效果很好,你应该使用 start 命令而不是 break main。更多详细信息请参见您的 dlangs 论坛帖子:http://forum.dlang.org/thread/avbpulzptddlekkczwse@forum.dlang.org

关于使用GDB调试无法查找D程序符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21027517/

相关文章:

php - 使用 php 和 apache 意外重置服务器

c++ - 为什么调试器不知道#define'd 常量?

gdb反汇编: show function offsets in base 16

d - 链接到静态库

templates - 是否可以在 d/dlang 中使用 AliasSeq 拥有模板类方法?

android - 使用 Eclipse 在 Android 上调试挂起 "Application is waiting for debugger to attach"

c++ - SymFromAddr 返回 ERROR_INVALID_ADDRESS 标志,如何在 mingw 中获取堆栈跟踪?

linux - 如何使 "next"在 cgdb 中工作

gdb可以自动在SIGSEGV上附加一个进程吗

linux - 在 FreeBSD 上测试 D 程序以在 OSX 上编译