gpt4 book ai didi

ios - Xcode 调试窗口如何改变 float 和 double 的显示格式?

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:14:44 24 4
gpt4 key购买 nike

我在 Xcode 中调试 C 并在函数中设置断点以检查各种 double 值。 Xcode 坚持使用科学记数法来显示它们,这是一个真正的痛苦。我需要看到十进制表示。右键单击 Decimal 的“View Value”菜单选项,会发生奇怪的事情。任何人都知道如何让这个在 printf'n 我想看到的一切之外发挥得很好??

enter image description here

最佳答案

查看 LLDB Variable Formatting文档,特别是靠近顶部的类型格式部分。

您可以使用 type format命令更改默认输出。

来自上面的链接

Type formats enable you to quickly override the default format for displaying primitive types (the usual basic C/C++/ObjC types: int, float, char, ...).

If for some reason you want all int variables in your program to print out as hex, you can add a format to the int type.

This is done by typing

(lldb) type format add --format hex int

要更改 jDate 对象的默认显示,您应该能够执行类似

的操作
type format add -f float jDate

您可以使用 help <format> 从调试器本身获取更多信息但上面的链接页面读起来很好。

如果这不能解决您的问题,您可能需要进一步阅读类型摘要。我不记得 Xcode 显示了什么,无论是格式还是摘要。

此外,WWDC2012 session # 415 “Debugging with LLDB” 展示了更改这些显示格式和添加您自己的格式的方法。相关部分大约在 35 分钟左右,但整个 session 都很棒。

希望对您有所帮助!

关于ios - Xcode 调试窗口如何改变 float 和 double 的显示格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11488028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com