【问题标题】:Debugging with GDB Cannot Lookup D Program symbols使用 GDB 调试无法查找 D 程序符号
【发布时间】:2014-01-09 17:49:11
【问题描述】:

我已经成功构建并安装了 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);
}

【问题讨论】:

    标签: debugging gdb d symbol-table


    【解决方案1】:

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

    【讨论】:

    • 当我像上面那样运行它时,在 GDB 中执行 print SYMBOL 时几乎没有正确显示任何 D 符号,涉及名称解构及其值。这是 ibuclaw 的 GDB 的当前状态还是我错过了什么?
    • GDB 还不能解开所有的 D 符号。 Iain Buclaw(GDC 项目的核心开发人员)最近做了一些改进,有望很快合并到 GDB 主代码中,这对我们有很大帮助。你试过用 GDC 编译你的 D 程序吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-14
    • 2012-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多