简体   繁体   English

在 Debian docker 镜像结果中运行 gdb

[英]Running gdb in Debian docker image results

I have some trouble when running gdb in a docker image and I am not sure what is causing the problems since I am a complete newbie when it comes to gdb and docker.我在 docker 镜像中运行 gdb 时遇到了一些问题,我不确定是什么导致了问题,因为在 gdb 和 docker 方面我是一个完全的新手。

Background背景

I am trying to write a c++ program for the Lego EV3 which runs on ev3dev .我正在尝试为在ev3dev上运行的 Lego EV3 编写 C++ 程序。 In order to compile it, I have set up docker with the ev3dev image on my Windows machine and am able to successfully build inside that image, transfer the binary to the EV3 and execute it there.为了编译它,我在我的 Windows 机器上使用 ev3dev 映像设置了 docker,并且能够在该映像中成功构建,将二进制文件传输到 EV3 并在那里执行它。 This all works well until I need to start (remote) debugging.这一切都很好,直到我需要开始(远程)调试。 My plan is to start a gdbserver on the EV3 with the program and the open a gdb session inside the docker container in my Windows machine and connect to the EV3 gdbserver.我的计划是使用该程序在 EV3 上启动一个 gdbserver,并在我的 Windows 机器的 docker 容器内打开一个 gdb 会话并连接到 EV3 gdbserver。 After I have fixed the first error when remote debugging - I needed to use gdb-multiarch on my Windows machine - I have encountered more problems which I don't really find a solution too.在远程调试时修复了第一个错误后 - 我需要在我的 Windows 机器上使用 gdb-multiarch - 我遇到了更多我也没有真正找到解决方案的问题。

Problem问题

When running gdb directly on my Windows machine inside the docker container (or when connecting to the gdbserver from docker using gdb-multiarch) I always get the following output after starting the program with run :当在我的 Windows 机器上的 docker 容器内直接运行 gdb 时(或者当使用 gdb-multiarch 从 docker 连接到 gdbserver 时)我总是在使用run启动程序后得到以下输出:

(gdb) run
Starting program: /src/ev3/build/src/EV3_main
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Warning:
Cannot insert breakpoint -1.
Cannot access memory at address 0x4f58

and when using next or step I get:当使用nextstep我得到:

(gdb) next
Cannot find bounds of current function

Since I couldn't really find any solution online, I would really appreciate any help!由于我在网上找不到任何解决方案,我真的很感激任何帮助! Thanks in advance!提前致谢!

I always get the following output after starting the program with run使用 run 启动程序后,我总是得到以下输出

This error usually means that the dynamic loader in your docker container has been fully stripped.此错误通常意味着您的 docker 容器中的动态加载器已被完全剥离。 It's a packaging mistake by the creator of that container.这是该容器的创建者的包装错误。

If you are not using dlopen() , this isn't a big problem.如果您不使用dlopen() ,这不是大问题。

(gdb) next

Don't do that : you are not stopped in a location where GDB knows where the next line is.不要:你是不是在GDB知道哪里有下一行是一个位置停了下来。 Do continue instead.continue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM