I'm trying to run after setting a breakpoint in cgdb
Starting program: /path/to/my/executable
Unable to find Mach task port for process-id 1996: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
I tried both these guides with no success:
https://opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt
https://sourceware.org/gdb/wiki/BuildingOnDarwin
Running macOS Sierra 10.12.2 (16C67)
Related
As stated in the title, I'm trying to use QEMU and GDB to debug xv6 as part of an OS project.
I'm able to make qemu and make qemu-nox perfectly, but when I run
make qemu-gdb or make qemu-nox-gdb the command hangs and the output is like:
qemu-system-i386 -nographic -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp 1 -m 512 -S -gdb tcp::25502
with no prompt showing up.
When I try connect using GDB the result is:
localhost:25502: cannot resolve name: nodename nor servname provided, or not known
Anyone able to troubleshoot? Thanks!
Info:
Development OS: Mac OS X Mojave
QEMU: qemu-system-i386 (installed using Homebrew)
GDB: 8.3 (installed using Homebrew)
Cross-compile toolchain: compiled from source code
I am using Ubuntu 16.04 on x86_64 workstation, and I'm cross-compiling a small demo program in C++, and deploying it to an embedded linux target running ARM architecture (environment-setup-cortexa9hf-neon-poky-linux-gnueabi, arm-poky-linux-gnueabi-g++).
I am able to successfully do this which gives me a debug session on commandline:
Target:
rpm -ivh gdbserver-7.10.1-r0.cortexa9hf_neon.rpm
gdbserver :9091 ${APPNAME}
Host:
sudo apt-get install gdb-multiarch
gdb-multiarch $APPNAME
target remote 192.168.0.212:9091
...
I can now use gdb-multiarch on commandline!
However from here... I really want to be able to use one of the many gdb frontend tools to provide a GUI to set breakpoints and step through the code (akin to gdbgui, or using vscode and configuring for a debugger). Are there any gdb frontend tools that specifically support gdb-multiarch?
Any tool I try, I believe no matter what it uses base gdb executable and gives this error because of mismatched architecture:
target remote 192.168.0.212:9091
Remote debugging using 192.168.0.212:9091
warning: Architecture rejected target-supplied description
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070fdff7e00000000c0fafc76100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
UPDATE 1 --
I can kinda sorta get this to work using ddd tool:
ddd --eval-command="target remote $MY_TARGET_IP:9091" --debugger gdb-multiarch
However! This is ancient and buggy, and I can't set breakpoints in loaded .so's right now with this.
I tried gdbgui with its options to specify debugger, but that's not currently working either. I filed a feature request report here:
https://github.com/cs01/gdbgui/issues/237
I found a way using gdbgui, but it required me to rebuild gdb from source code against my specific remote target architecture. Details of how I got it to work are here:
https://github.com/cs01/gdbgui/issues/237
Important bits in case the above link breaks:
TLDR Solution:
I was trying to rely on a prebuild gdb-multiarch from ubuntu apt repos, which didn't work. When I decided to download gdb and rebuild from source while configuring for arm-linux-gnuabi target arch.
Build method:
downloaded latest gdb source code
unzip it, go into folder, and build it like this:
./configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=arm-linux-gnuabi && make -j8 && sudo make install
Important to note that for my particular remote gdb server it's running on ARM so i had to say target=arm-linux-gnuabi in configure. GDB is building for my PC x86 arch, but it knows when debugging to recognize the target as ARM!
Now, arm-linux-gnuabi-gdb is installed by default to /usr/local/bin ... but you can instead provide prefix=<path> to where you want it to install in ./configure script above.
Using this, I was able to build a secondary copy of gdb called arm-linux-gnuabi-gdb which i could feed to gdbgui like this:
gdbgui -g arm-linux-gnuabi-gdb
From there, I can give gdb commands to connect to my remote gdbserver. I'm having to set breakpoints beforehand. My gdb commands are like this to set a few breakpoints:
set breakpoint pending on
break my_object.cpp:<line number for breakpoint>
b example_function_name
target remote <remote arm machine IP>:<gdbserver port>
c
Works great! This is leaps and bounds better than running gdb on commandline on my remote target.
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
I have been trying to enable debugging on NetBeans 8.2 C++ (OS X - Sierra - 10.12.5) without success. I have tried the following:
Using Mac Ports version of gdb with code-signing: result: gdb gives a standard error:
Unable to find Mach task port for process-id 3016: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
Using Mac's /usr/bin/llvm: result:
GDB has unexpectedly stopped with return 0
Anyone have any success getting this to work?
This is a question from an absolute beginner.
I have a Ubuntu 14.04 host, gdb 7.7.1 installed on it and a project cross-compiled for qnx. I also have a qnx target, that I want to debug my app on.
The instructions on the internet tell me to use either gdb on PC + gdbserver, but I don't have gdbserver installed and I don't think I can compile gdb for qnx. I have something called pdebug. Instructions for qnx tell me that gdb has to have the target qnx command, that it clearly does not posess.
Here's what I've done:
# Assuming that 255.255.255.255 is the target ip and 1234 is the port
# On target
pdebug 1234
On host
gdb
gdb> target remote 255.255.255.255:1234
Then I got a couple of warnings and the gdb> again, as it was normal.
I managed to install a connection between my host and target, but when I hit run in gdb, it tries to run my local copy of the app, instead of running it on target.
There is no way one can debug qnx apps with Ubuntu's gdb.
You have to use qnx's gdb built for the exact this purpose, that is able to run target qnx and many other commands you will need. You have to use qnx's gdb on your host and pdebug on your target and run the same commands you ran:
# on target
pdebug 1234
# on host
ntoarm-gdb
(gdb) file MyQnxApp
(gdb) target qnx 255.255.255.255:1234
(gdb) upload MyQnxApp /mnt/myWorkingDir/MyQnxApp
(gdb) b main
(gdb) r
Then you will see the info about your connection:
Remote debugging using 255.255.255.255:1234
Remote target is <your_endianness>
See this detailed instructions.