我一直在尝试运行一些像这样的clang教程,并且不断地得到我用GDB跟踪的片段错误:
Starting program: /analyser/a.out PrintFunctions.cpp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
clang::Builtin::Conte
我使用的是manjaro linux和Visual Studio代码无法调试任何代码,在任何语言中,总是给我“找不到任务'xxx'”的错误。xxx部分对于每种语言、我尝试的每个程序和我选择的每种配置都是不同的。我做什么好? launch.json {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.
我有一台a.c #include <stdio.h>
int main() {
int a = 1;
int b = 2;
int c = a + b;
return 0;
} 当使用clang -g a.c编译时,我无法获得调试符号。 joey@voyager-arch /t/a4> lldb a.out
(lldb) target create "a.out"
Current executable set to '/tmp/a4/a.out' (x86_64).
(lldb) l
(lldb) 但是如果我
我有一个脚本,它使用命令文件运行gdb,如下所示:
set logging file file_name
set logging on
thread apply all bt
q
y
为什么p堆栈比这个脚本快得多?我能用gdb达到那种牢度吗?
编辑:区别是gdb版本。我使用了gdb-7.10,转储堆栈跟踪花了大约14秒的时间。使用gdb 7.0.1,使用的是p堆栈,它花费了2秒。大多数时间使用gdb-7.10从我们的库加载符号,而我在新版本中找不到合适的-readnever选项。
调试大型C应用程序时,我从gdb中看到奇怪的行为:我总是可以中断按Ctrl+C的程序
^C
Program received signal SIGINT, Interrupt.
0x76f58964 in select () at ../sysdeps/unix/syscall-template.S:81
81 in ../sysdeps/unix/syscall-template.S
(gdb)
但是,在程序运行足够长的时间(比如>1天)之后,我再也不能轻易地中断程序了。当试图用Ctrl+C中断程序时,gdb只显示
^C
Program received signal SIG
考虑以下简化的C++11代码,它只会包装两个静态变量A和B。
template<typename T, T INITIAL_VALUE>
struct StaticValue { static T value; };
template<typename T, T INITIAL_VALUE> T
StaticValue<T, INITIAL_VALUE>::value { INITIAL_VALUE };
int main()
{
using A = StaticValue< int* , nullptr >;
using B
我正在开发一个React Native应用程序,每当我尝试构建该应用程序时,我都会遇到这些错误。我知道在这个问题上有很多类似的问题,但那里给出的解决方案对我来说是行不通的。
clang: error: no such file or directory: '/Users/FaisalHussain/Library/Developer/Xcode/DerivedData/blonk-eatmzbgmhuzfadfqxgotpiqwsapb/Build/Products/Debug-iphonesimulator/libRCTRestart.a'
clang: error: no
使用以下测试程序(用clang 3.4编译并在gdb 7.6.1下运行):
#include <limits.h>
#include <stdio.h>
int main(void)
{
int a = INT_MAX + 1;
int b = INT_MAX + 2;
printf("Result: a = %d, b = %d\n", a, b);
}
我希望能够使用gdb在第二次出现未定义行为(int b = ...)时自动停止。
如果我用以下方式编译:
clang -fsanitize=undefined -O0 -gg