- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 OSX 上进行了 C、Make 和 lldb 的基本事件,但它似乎没有按照文档中的规定工作。学习“lldb”调试器的简单 C 编码练习是“Learning C The Hard Way”(Shaw,Zed A.,2015)中的练习 4,因此这是一个陈旧的、没有复杂性的示例,说明了应该如何进行工作。只有 OSX 的行为不像其手册和帮助页面所说的那样。
Makefile 中是否有根本性的缺失?文档给我的语法是否不正确?此版本的 OSX 或编译器或 lldb 是否存在错误?你能不能不在 OSX 上的 C 语言的 main() 方法上设置断点,这样这个练习就有根本性的缺陷并且两年内没有人注意到?
感谢您花时间查看...
这是整个用例输出:
My-MacBook-Pro:Exercises Me$ ls -als total 48
0 drwxr-xr-x 7 Me staff 238 Mar 12 20:56 .
0 drwxr-xr-x 8 Me staff 272 Feb 26 02:11 ..
24 -rw-r--r--@ 1 Me staff 10244 Mar 12 20:56 .DS_Store
0 drwxr-xr-x 5 Me staff 170 Mar 3 02:48 BonusContent
8 -rw-r--r--@ 1 Me staff 48 Mar 12 20:56 Makefile
8 -rw-r--r--@ 1 Me staff 322 Feb 28 00:50 ex1.c
8 -rw-r--r-- 1 v staff 184 Mar 12 19:53 ex3.c
My-MacBook-Pro:Exercises Me$ cat ex3.c
#include <stdio.h>
int main(int argc, char *argv[])
{
int age = 10;
int height = 72;
printf(" I am %d years old.\n", age);
printf(" I am %d inches tall.\n", height);
return 0;
}
My-MacBook-Pro:Exercises Me$ cat Makefile
CFLAGS=-Wall -g
all: ex3
clean:
rm -f ex3
My-MacBook-Pro:Exercises Me$ make ex3
cc -Wall -g ex3.c -o ex3
My-MacBook-Pro:Exercises Me$
My-MacBook-Pro:Exercises Me$ lldb ex3
(lldb) target create "ex3"
Current executable set to 'ex3' (x86_64).
(lldb) breakpoint set --method main
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb)
My-MacBook-Pro:Exercises Me$ ls -als
total 72
0 drwxr-xr-x 9 Me staff 306 Mar 12 20:57 .
0 drwxr-xr-x 8 Me staff 272 Feb 26 02:11 ..
24 -rw-r--r--@ 1 Me staff 10244 Mar 12 20:57 .DS_Store
0 drwxr-xr-x 5 Me staff 170 Mar 3 02:48 BonusContent
8 -rw-r--r--@ 1 Me staff 48 Mar 12 20:56 Makefile
8 -rw-r--r--@ 1 Me staff 322 Feb 28 00:50 ex1.c
24 -rwxr-xr-x 1 Me staff 8712 Mar 12 20:57 ex3
8 -rw-r--r-- 1 Me staff 184 Mar 12 19:53 ex3.c
0 drwxr-xr-x 3 Me staff 102 Mar 12 20:57 ex3.dSYM
My-MacBook-Pro:Exercises Me$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G1217
My-MacBook-Pro:Exercises Me$
My-MacBook-Pro:Exercises Me$ clang --version -g
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
My-MacBook-Pro:Exercises Me$
My-MacBook-Pro:Exercises Me$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
My-MacBook-Pro:Exercises Me$
My-MacBook-Pro:Exercises Me$ lldb --version
lldb-360.1.70
回复“奥拉夫”: LLDB Documentation
(lldb) breakpoint set --name main
(lldb) br s -n main
(lldb) b main
在旧版本的 OSX 上,还有另一个线程在 2015 年出现了类似的错误消息,但其“解决方案”不起作用,并且实际上根本不使用 Make 来忽略该问题。
我想尝试避免正交或复杂的“建议”,比如“你为什么不使用 C,尝试使用其他语言”,或者“我更喜欢使用不同的调试器,所以使用这个一”...这些不会回答问题:)
最佳答案
b
命令和breakpoint set
命令有很大不同。 b
是一个 DWIM 类型命令,它尽可能地尝试模拟 gdb 断点解析器的语法。它最终会使用适当的断点类型分派(dispatch)到中断集
。
breakpoint set -n foo
创建通用“符号名称匹配”断点。例如,它将匹配一个名为“foo”的函数或一个 ObjC 选择器“foo”或一个名为“foo”的 C++ 方法... b foo
分派(dispatch)到 breakpoint set -n foo
。
但有时您知道只想在类方法(C++ 或 Swift)上设置断点,在这种情况下您可以使用 --method
选项来适当限制搜索。 ObjC 选择器和 --selector
选项也是如此。
就您而言, --name
有效,但 --method
无效,这是正确的行为。你的 main 是一个纯 C 函数,而不是一个类方法。
顺便说一句,b
实际上是一个lldb“正则表达式命令”,请参阅
(lldb) help command regex
了解更多详情。您可以通过打开回显正则表达式命令解析来查看该命令实际执行的操作:
(lldb) set set interpreter.expand-regex-aliases 1
然后尝试一些断点:
(lldb) b main
breakpoint set --name 'main'
(lldb) b foo.c:11
breakpoint set --file 'foo.c' --line 11
等等...
关于c - OSX 10.11.6 lldb 说断点 1 : no locations (pending),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42753523/
我正在尝试使用 lldb 远程启动和调试新进程没有太大的成功。 通过运行以下命令附加到已启动的进程效果很好: process connect process attach -P gdb-remote
如果我针对给定主题调用 lldb 帮助,大部分内容都会从屏幕上消失。例子: (lldb) help expression 我可以退出调试器,并在 typescript 中收集帮助,但这很笨拙。 lld
在 lldb 中有没有办法继续直到循环结束?我正在寻找 finish 的类似物,但它不是跳出堆栈帧,而是跳出循环。 for (int i = 0; i < 10000000; i++) { .
我已阅读 this tutorial ,但我还没有发现任何有关反向调试的信息。 lldb 是否有一些功能,例如 target record在 gdb 中?如果是,我在哪里可以阅读它? 最佳答案 还没有
lldb 是否具有 gdb 的等效项 shell命令从提示符运行外部命令? (见 How can I execute external commands from the gdb command pr
LLDB 有 convenience variables ?如果是这样,我该如何使用它们?如果没有,我可以使用类似的东西吗? 引用:http://software.intel.com/sites/pr
有没有办法使用 lldb 调试器设置零标志? 类似 gdb 中的 set ($eflags)=似乎只有 register write rflags ... 来设置所有 最佳答案 这是在 lldb 中设
有没有办法使用 lldb 调试器设置零标志? 类似 gdb 中的 set ($eflags)=似乎只有 register write rflags ... 来设置所有 最佳答案 这是在 lldb 中设
我正在使用 lldb 来跟踪调用 CoreFoundation 函数(例如 CFRunLoopTimerCreate)的一些纯 C 或 C++ 代码(32 位)。 我在 CFRunLoopTimerC
我在 lldb 中为我在 MacOS 上安装的基于 C 语言的应用程序设置了很多断点。断点大多设置在应用程序的同一函数中。然而,第二天我回到应用程序继续工作,我又开始在同一个函数中设置断点,出现了一个
您最喜欢的打印 NSArray 内容的方式是什么?使用LLDB? 一个python脚本? 内联 for 循环? 一个Objective-C 方法调用? 我知道按索引打印对象很容易。我想一次打印所有对象
我想从脚本中运行类似以下命令的内容: lldb -f /path/to/my/file -o command1 -o command2 ... -o detach 有没有办法在执行后退出lldb而不进
众所周知,我们可以在 GDB 中使用命令“catch syscall”来中断每个系统函数。 LLDB 中是否有类似的命令? (gdb) catch syscall Catchpoint 1 (sysc
使用 Xcode 10,当我使用断点停止我的应用程序并尝试在控制台中打印对象的内容时,我获得: "Couldn't IRGen expression, no additional error" 但是,
由于这些天在 Mac 上使用 gdb 变得越来越困难(至少我觉得我正在与 Apple 进行艰苦的斗争),所以我开始尝试使用 lldb。 是否有与 gdb -tui 等效的模式,可以显示源代码的良好、持
使用 Xcode 10,当我使用断点停止我的应用程序并尝试在控制台中打印对象的内容时,我得到: "Couldn't IRGen expression, no additional error" 但是,
$cat testleak01.cpp #include int main() { int*p=new int[3]; return 0; } 用调试信息编译它 $g++ testle
如何检查LLDB中不同线程中运行和步进的线程数? GDB 有信息线程。 LLDB 有类似的命令吗? 最佳答案 跑过: (lldb) help thread 命令来看看你可以用 lldb 中的线程做什么
我正在运行 Xubuntu 16.04。从存储库安装 lldb 后,当我尝试使用它时,我得到以下输出: lldb foo (lldb) target create "foo" Current exec
我目前正在为 C++ 中的自定义对象开发绘图命令。我正在使用 Xcode v10.1。 我使用command script import test.py 导入我自己的命令,其中有一个函数如下: imp
我是一名优秀的程序员,十分优秀!