VS2017 远程调试linux出现的错误:Cannot access memory at address 0x570

xiaoxiao2021-02-28  122

描述

新建的linux默认工程

#include <stdio.h> int main() { printf("hello from linux_test!\n"); return 0; }

编译时没有任何问题:

1>------ 已启动生成: 项目: arptools, 配置: Debug x64 ------ 1>Validating architecture 1>Validating sources 1>Copying sources remotely to '192.168.1.136' 1>Starting remote build 1>Compiling sources: 1>main.cpp 1>Linking objects 1>arptools.vcxproj -> E:\projects\linux_test\bin\x64\Debug\linux_test.out 1>已完成生成项目“linux_test.vcxproj”的操作。 ========== 生成: 成功 1 个,失败 0 个,最新 0 个,跳过 0 个 ==========

但是一运行项目就报错了。

错误如下:

Warning: Cannot insert breakpoint -1. Cannot access memory at address 0x570

明明没有打任何断点,却显示不能插入断点(也的确不能在-1行插入断点)

解决方案

工程属性->调试->调试模式 把选项改为gdb,就可以了

然后就能运行了,运行结果如下:

Breakpoint 1, main () at /home/user001/projects/linux_test/main.cpp:5 5 printf("hello from linux_test!\n"); hello from linux_test! [Inferior 1 (process 16065) exited normally] 程序“”已退出,返回值为 0 (0x0)。
转载请注明原文地址: https://www.6miu.com/read-54187.html

最新回复(0)