DDD 可以解释字符串吗?

发布于 2024-08-20 03:20:17 字数 158 浏览 4 评论 0原文

我试图找出我的 C++ 代码中的问题,并在 Sun 机器上使用 DDD 进行调试。我需要根据我们的某些标准使用字符串。但每当 DDD 遇到字符串变量时,它总是显示为空。我想记得之前在 SGI 上使用 CVD 时遇到过同样的问题。
除了重写我的代码来删除字符串之外,还有什么我可以尝试/使用的吗?

I am trying to figure out a problem in my c++ code and have DDD to debug with on a Sun machine. I am required to use strings per some standard we have. But whenever DDD encounters a string variable, it always comes up as being empty. I want to remember having the same trouble using CVD before on an SGI.
Short of re-writing my code to remove string is there anything else I could try/use?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

榆西 2024-08-27 03:20:17

看看这里

他们通过实现一个辅助函数来解决这个问题可以由 gdb 使用(也应该适用于 DDD,因为它使用 gdb)

Have a look here

They solve it by implementing a helper function that can be used by gdb (should also work for DDD as it uses gdb)

拥醉 2024-08-27 03:20:17
p variablename.c_str()

display variablename.c_str()
p variablename.c_str()

or

display variablename.c_str()
柠檬 2024-08-27 03:20:17

基本上,您需要创建一个包装函数,通过向其传递内存地址来打印出字符串:

void gs(string &s) { cout << s << endl; }

然后在 gdb 中:

call gs(somevariable)

参考

Basically, you need to create a wrapper function that prints out your string, by passing it a memory address:

void gs(string &s) { cout << s << endl; }

and then in gdb:

call gs(somevariable)

Reference

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文