C/C++知识点之Advanced+Apple+Debugging(2)
小标 2019-06-10 来源 : 阅读 905 评论 0

摘要:本文主要向大家介绍了C/C++知识点之Advanced+Apple+Debugging(2),通过具体的内容向大家展示,希望对大家学习C/C++知识点有所帮助。

本文主要向大家介绍了C/C++知识点之Advanced+Apple+Debugging(2),通过具体的内容向大家展示,希望对大家学习C/C++知识点有所帮助。

C/C++知识点之Advanced+Apple+Debugging(2)

LLDB官方文档


帮助命令


打开一个终端窗口键入lldb。LLDB会迅速出来在那里简单的键入。help命令:


(lldb) help
这将会显示出所有可以用的命令,包括从~/.lldbinit加载出来的自定义的命令,但是可能晚一点显示出来
page32image6336.png
这里有相当多的LLDB命令可以用。
然而,许多命令包含着几个子命令,这些子命令又有自己相关的文档。
以breakpoint命令为例。键入通过下面的指令来查看breakpoint命令的文档:


(lldb) help breakpoint
你会看到下面这些输出:


Commands for operating on breakpoints (see 'help b' for shorthand.)
Syntax: breakpoint <subcommand> [<command-options>]
The following subcommands are supported:
clear   -- Delete or disable breakpoints matching the specified
source file and line.
command -- Commands for adding, removing and listing LLDB commands
executed when a breakpoint is hit.
delete  -- Delete the specified breakpoint(s).  If no breakpoints
are specified, delete them all.
disable -- Disable the specified breakpoint(s) without deleting
them.  If none are specified, disable all breakpoints.
enable  -- Enable the specified disabled breakpoint(s). If no
breakpoints are specified, enable all of them.
list    -- List some or all breakpoints at configurable levels of
detail.
modify  -- Modify the options on a breakpoint or set of breakpoints
in the executable.  If no breakpoint is specified,
acts on the last created breakpoint.  With the exception
of -e, -d and -i, passing an empty argument clears
the modification.
name    -- Commands to manage name tags for breakpoints
set     -- Sets a breakpoint or set of breakpoints in the
executable.
For more help on any particular subcommand, type 'help <command>
<subcommand>'.
在这里你可以看到几个支持的子命令。要查看breakpoint name命令的文档,可以输入下面的内容:


(lldb) help breakpoint name
你将看到下面的输出:


The following subcommands are supported:
add    -- Add a name to the breakpoints provided.
delete -- Delete a name from the breakpoints provided.
list   -- List either the names for a breakpoint or the breakpoints
for a given name.
For more help on any particular subcommand, type 'help <command>
<subcommand>'.
如果此刻你不理解breakpoint name,别担心你将很快就会理解breakpoints和后面所有的命令。从现在开始,help是你要记住的最重要的命令。


中肯命令


有时你并不知道你要搜索的命令的名字,但是你知道它包含的关键词或者短语可以给你指出正确的方向。apropos就是为你做这件事的。这有点像在网络上用搜索引擎找东西。
apropos是不区分大小写的,并且将返回LLDB文档中匹配的任何结果例如搜索任何与斯威夫特有关内容:


(lldb) apropos swift
你将会看到下面这些输出:


The following built-in commands may relate to 'swift':
breakpoint set          -- Sets a breakpoint or set of breakpoints in
the executable.
expression              -- Evaluate an expression (ObjC++ or Swift) in
the current program context, using user defined variables and variables
currently in scope.
language swift          -- A set of commands for operating on the Swift
Language Runtime.
language swift demangle -- Demangle a Swift mangled name
language swift refcount -- Inspect the reference count data for a Swift
object
The following settings variables may relate to 'swift':
target.swift-framework-search-paths -- List of directories to be
searched when locating frameworks for Swift.
target.swift-module-search-paths -- List of directories to be searched
when locating modules for Swift.
target.use-all-compiler-flags -- Try to use compiler flags for all
modules when setting up the Swift expression parser, not just the main
executable.
这将选取出所有与单词Swift相关的内容。首先是相关的命令,然后是可以控制LLDB操作的LLDB设置。
你也可以使用apropos去搜索一个特定的句子。例如,如果你要搜索与reference counting相关的内容,你可以使用下面的命令:


(lldb) apropos "reference count"
The following built-in commands may relate to 'reference count':
language swift refcount -- Inspect the reference count data for a Swift
object
target modules list     -- List current executable and dependent shared
library images.
注意爱用双引号包裹着单词“reference count”,. apropos只会接收一个搜索的参数,因此双引号可以让它们作为一个单独的参数是必要的。
感觉不够整洁?apropos是一个用来查询的方便的工具。它不像现代互联网搜索引擎那么复杂,然而在平常的练习中你可以找到你想要的。
我们为什么要学这些?
我们很容易就会忘记我们将要学习的大量的LLDB命令,但是只要把help和apropos这两个命令记在心中。这些是查询命令信息的基础,在调试只路上你会不停的用到他们。

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言C/C+频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程