I use another machine for development and deploy on another machine. How to set the source path in gdb to a different machine?
Note: The executable and the source program are on different machines. gdb only shows line number and shows error : no such file or directory
If you want to view the source code on the development machine from the deployment machine you'll first need to provide access to the source code in some way outside of GDB, for example using network filesystem to mount the development machine's file system onto the deployment machine.
Alternatively you could copy the source code over along with the executable.
Once the source code is visible on the deployment machine, inside GDB you can use the directory command to tell GDB were to find the source code.
For example, if on the development machine your source code is located in /project/file.c, and on the deployment machine you mount and make this available as /mnt/devel-machine/project/file.c, then in GDB you'd just do this:
(gdb) directory /mnt/devel-machine
after which GDB should be able to find the source code.
Related
I currently have a folder containing some .dll files, .bin files and some .exe files. The main .exe that I will be executing only works on windows, and I am not entirely sure what are all its dependencies. My goal is to package all the files in the folder into a docker container so I can integrate it into the rest of my pipeline. The main .exe is a command line tool which is only called once with some arguments and left to run.
I have tried to use windows server core as the container image and it works. However this image is too big for my needs. I have tried to use nano server but when I try to run the executable there is nothing printed in the command line and the program does not run. In that scenario, if I type:
C:\Bin\x64>echo %ERRORLEVEL%
I get the following output:
-1073741515
Meaning I am missing some dependencies.
So, I'm wondering if there is an alternate solution to packaging this folder since windows server core is too big.
Most likely you'll have to stick with the Server Core image. The main thing is that these images server different purposes, and the Nano Server is intended to new applications being developed with the targeted Nano Server API. Server Core is the image focused on existing apps, but its APIs make the image larger than what one would expect from a container.
Keep in mind that it's still better than a full VM. :)
I blogged about this here: https://techcommunity.microsoft.com/t5/containers/nano-server-x-server-core-x-server-which-base-image-is-the-right/ba-p/2835785
We usually use an IDE to develop programs.
However, the IDE is not smart enough to travel the library folder in the docker container.
So navigation to the source (for example, in PyCharm, you want to see the code in the installed third-party package) is usually not available. The IDE simply said "No module named xxxx".
How could this be fixed?
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.
Background
I am trying to write a c++ program for the Lego EV3 which runs on ev3dev. 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. 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. 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.
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:
(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:
(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
This error usually means that the dynamic loader in your docker container has been fully stripped. It's a packaging mistake by the creator of that container.
If you are not using dlopen(), this isn't a big problem.
(gdb) next
Don't do that: you are not stopped in a location where GDB knows where the next line is. Do continue instead.
I'm trying to use Eclipse Che as an IDE to develop a C++ application on a remote linux machine.
Che can access the source code on the host system because of the
-v <LOCAL_PATH>:/data
part when running the docker container.
But how am I supposed to access include directories (and later libraries to link with)?
Have you tried doing this on Kubernetes? In that case, you are not just exporting the source code volume, the remote Linux machine is your workspace.
I'm afraid I'm not sure how you would do this with Che in Docker without jumping through some hoops.
I followed these instructions while trying to get remote debugging working with Delphi 2007. After completing all the steps, the remote debugger is half working.
It is able to launch and halt the application but the break points I set do not work. The automatic break point (at line Application.Initialize;) is working but it goes right to the CPU window. The debugging information appears to be missing.
I triple checked, both 'Include TD32 debug info' and 'Include remote debug symbols' are checked, a clean build was performed, and the correct files have been moved to the remote machine.
What am I missing?
Any help would be greatly appreciated.
You might like to go through my own checkist for this, which is as follows. I hope its not too patronising, but there may be a step you've omitted. I also seem to recall that it was improtant to use IP addresses, not names. Also note that these instructions are for D7, howver I'm not aware that the principle has changed.
=======
In this description, TARGET refers to the machine being debugged (i.e the remote machine) and HOST refers to the machine being used fro debugging (i.e the local machine).
If necessary, install the remote debugger on the target by copying the RDEBUG folder to the target and running SETUP.
Run the remote debugger locally on the target using Start | Borland Remote Debugger | Remote debugger. A ‘spider’ icon should appear in the task bar. (It can be useful to double-click on this icon to obtain a connection status dialog – this shows how the local IDE is connecting to the remote in later steps here).
On the host machine, explode the project to be debugged. Check that this compiles locally and runs offline.
By convention, copy the SOFTWARE ROOT folder from the host to the target. This will be the working folder for the application when debugged. By copying the folder in its entirety, all support files will be found locally as needed. (This also fits nicely with using SecondCopy to duplicate the entire ART software tree on a remote machine and then to explode the required project – this will create the remote folder for you).
In the Delphi IDE on the local machine, use Run | Parameters | Remote to set the Remote Path to the remote exe file in the folder you have just copied, as it will be visible on the target machine. If you’ve copied it as instructed in ‘4’, this path will be identical to the file that the local IDE would create and debug, eg “C:\Art_Soft\RT290\Bench\Dev4all\RT290w.exe”
In the Delphi IDE on the local machine, use Run | Parameters | Remote to set Remote Host to the IP address of the target (you should use IPCONFIG on the target to find out what the IP address is). Before leaving the dialog, select ‘Debug Project On Remote Machine’.
Enable “Include remote debug symbols” on the “EXE and DLL options” pane under Project|Options|Linker
Compile and run the file from the IDE. The remote connection status should show connection progress and a the remote screen should show the application running.
What are the correct files? I assume both the .exe and .rsm file?
(disclaimer: I only know remote debugging in D2009)