Error while using Visual studio Remote GDB debugger - c++

I have tried with no success for a good 4 hours to debug a program using Visual studio remote debugger and I keep getting the same error message:
could not launch gdbserver. gdbserver could either be missing on your system and need to be installed, or it failed to start the program.
-My attempted solutions so far:
I logged into the Linux (fedora)remote system and installed gdb, and all the required depencises. However I get another message saying:
no package gdbserver available.
Is there a difference between gdb and gdbserver?
Realizing that I was not succeeding with the Fedora I decided to try and install gdb/dependencies on a Centos7 system. Going to Visual studio and launching the remote debugger. I still get the same error message.
Your expertise will be very appreciated

i installed the gdbserver this works for me on the raspberry pi
sudo apt-get install gdbserver

Related

how to run compiled project in windows

I started to get acquainted with c ++ and there was a problem. I can’t understand how I can compile and test. I installed the compiler in vm Linux and configured the clion on a remote host. I connected the gtk to develop the interface and when I compile I get this 1.
How can i run it? If i am do this from clion getting this error
Gtk-WARNING **: 12:53:54.419: cannot open display: :0, so i need run it in windows without install something. Help me pls.
cmakelist.txt

Can't target WSL from VS 2017 - Error Could not find 'zip' archiver

I was attempting to setup VS 2017 15.7.6 to compile a console app I have for Linux. Then I was going to attempt to target WSL.
Following this:
https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/
I get to the Connect Remote System step and add enter in the information, choose Connect and get:
Error Dialog "Downloading and updating headers for Intellisense" pops up with the text "An error has occurred. Could not find the 'zip' archiver, please install it using your system package manager..."
I'm assuming I need to issue an apt-get command from my WSL prompt. But I'm not sure which one.
Anyone else run into this?
I'm very new to WSL and Linux.

Visual Studio 2017 Linux remote debugging (gdbserver)

After I installed gdbserver on my remote machine (Ubuntu 16.04.4 LTS), I tested the following c++ code by making a "cross-platform console application (linux)" project in Visual Studio 2017:
#include <cstdio>
int main()
{
printf("hello from testLinuxDebug!\n");
return 0;
}
I added the connection information (ip address, id, password) of my Ubuntu machine to connection manager and selected "gdbserver" for debugging mode.
Then I started debugging and got the following message:
Unable to start debugging. Unexpected GDB output from command
"-interpreter-exec console "target remote localhost63361"". Remote
connection closed.
Message after starting to debugging (Image captured from VS2017)
By the way, I got the following message from the Linux Console Window of debug menu of Visual Studio 2017:
Process /home/.../projects/testLinuxDebug/bin/x64/Debug/testLinuxDebug.out
created; pid = 29277 Listening on port 4444 Remote debugging from host
127.0.0.1 /build/gdb-9un5Xp/gdb-7.11.1/gdb/gdbserver/regcache.c:264: A problem > internal to GDBserver has been detected. Unknown register ymm0h requested
Message from Linux Console Window (Image captured from VS2017)
Could anybody help me with this problem?
I was having this exact same problem on my Ubuntu 16.04 machine.
I went through the source code on gdbserver, and it appears to be a problem with a processor register (ymm0h) which is only available to i386 processors.
The thing is, I don't know how to fix gdbserver to not use this register in particular, but you can solve the error by upgrading your gdb & gdbserver to version 8.3 on the Ubuntu machine. If my guess is correct, version 8.1 was the one that fixed this issue, but by default, Ubuntu 16.04 has version 7.11.1 for both gdb & gdbserver.
You can run these commands on the linux machine to do that:
wget "http://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.gz"
tar xzf gdb-8.3.tar.gz
cd gdb-8.3
./configure --prefix=/usr --with-system-readline
make
sudo make install
You may need to install some extra packages in order to compile the gdb:
sudo apt-get install libreadline6-dev texinfo
If you still have problems trying to install gdb, try this example from Linux from Scratch.
Good luck!
I encountered the same problem as you, although for me the issue was on Microsoft's Visual Studio Online platform - I couldn't use pwntools' gdb.debug/gdb.attach functionality (that relies on gdbserver) due to this very same error in VSOnline's docker environment.
Leaving this answer here for people who might encounter the same issues that I have.
The issue and the steps are pretty similar to what Canella described - the root of the problem is indeed the old GDB version in the environment (7.12 at the time of writing).
I've compiled my GDB with python3 bindings, and you might want to do that too if you're planning to use GEF or similar GDB extensions.
Here's how to do that in your VSOnline environment's terminal:
# I needed to get rid of the apt-provided gdb for it to work properly
sudo apt remove gdb
# VSOnline has a weird way of handling python versions
# you're better off installing python3 from apt, if it's not installed yet
sudo apt update
sudo apt install libreadline6-dev texinfo python3 python3-dev
wget "http://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.gz"
tar xzf gdb-8.3.tar.gz
cd gdb-8.3
mkdir build && cd build
../configure --prefix=/usr --with-system-readline --with-python=/usr/bin/python3
make
sudo make install

Jetbrains CLion Toolchains: "CMake: test run timed out"

I've just installed Jetbrains CLion onto a Windows 10 machine and I can't seem to get the toolchains set up correctly. I've installed all the required packages using Cgywin (packages located at C:\cygwin64\bin) but CLion can't seem to find these and gives the error "CMake: test run timed out". Please see the screenshot showing the error below. Anyone got any ideas?
Seems you need to install CMake for cygwin. CMake is not in set of default packages. Please, read
How to install CMake on Cygwin?

Error when using GDB in Eclipse: "Command '-list-features' is timed out"

When I try to debug my c++ program in Eclipse (Neon 4.6.2 on mac), the progress bar stops at 33% and the operation eventually times out. I get an error saying:
Error in services launch sequence -
Command '-list-features' is timed out
I've verified my GDB build and uninstalled and reinstalled using brew multiple times. GDB works perfectly in terminal, but I'm not able to run it in eclipse at all and I greatly prefer having a GUI when debugging. I have ensured that the path to the debugger in the eclipse debug configuration is correct. In addition, I've tried adding -g as a debugging flag.
Any help/suggestions would be great!
This sounds like a known problem with CDT 9.2, See Bug 509737. It is fixed for 9.2.1 released in a month or so. Your choices are to downgrade CDT to 9.1 or to install the most recent, but unreleased, build of 9.2.1.