如何更改彩车的显示格式?在Xcode调试窗口中翻倍? [英] How do you change the display format of floats & doubles in Xcode debug window?

查看:56
本文介绍了如何更改彩车的显示格式?在Xcode调试窗口中翻倍?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Xcode中调试C并在函数中设置断点以检查各种double的值. Xcode坚持使用科学符号来显示它们,这确实是一个痛苦.我需要看到一个十进制表示形式.右键单击十进制的查看值"菜单选项,会发生奇怪的事情.任何人都有任何想法如何使它在我想看的所有内容中都无法发挥作用吗?

Im debugging C in Xcode and setting breakpoints in functions to examine the value of various doubles. Xcode insists on displaying them using scientific notation, which is a real pain. I need to see a decimal representation. The right click "View Value" menu option of Decimal, does weird things. Anyone have any idea how to get this to play nice short of printf'n everything I want to see??

推荐答案

查看 LLDB变量格式文档,特别是顶部附近的 Type Format 部分.

Check out the LLDB Variable Formatting documentation, specifically the Type Format section near the top.

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

You can use the type format command to change the default output.

从上面的链接

类型格式使您可以快速覆盖默认格式 显示原始类型(通常的基本C/C ++/ObjC类型:int, 浮点数,字符,...).

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

如果由于某种原因您希望打印程序中的所有int变量 以十六进制格式显示,您可以为int类型添加格式.

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.

这是通过键入

(lldb)类型格式添加--format十六进制整数

(lldb) type format add --format hex int

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

To change the default display of your jDate objects you should be able to do something like

type format add -f float jDate

您可以使用help <format>从调试器本身获取更多信息,但是上面的链接页面阅读得很好.

You can get more info from the debugger itself with help <format> but the above linked page reads quite well.

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

If that doesn't solve your problem, you may need to read further down on Type Summaries. I can't remember what Xcode displays, be it the format or the summary.

此外,WWDC2012会话#415使用LLDB调试" 显示了更改这些显示格式并添加您自己的显示方法.相关的位在35分钟左右,但是整个会话很棒.

Additionally, the WWDC2012 session # 415 "Debugging with LLDB" shows methods to change these display formats and add your own. The relevant bits are around the 35 minute mark, but the whole session is great.

希望有帮助!

这篇关于如何更改彩车的显示格式?在Xcode调试窗口中翻倍?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆