Remote debugging Beaglebone from a 64 bit machine - linux

I am running Xubuntu on a 64 bit machine. When trying to debug a Beaglebone using gdb (via Eclipse) I get the following error message:
"Remote 'g' packet reply is too long"
See here for more details:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=509479
At the host I am using gdb-multiarch.
When start it, it announces:
"This GDB was configured as "x86_64-linux-gnu"."
Can you please tell me how to configure GDB to work with a 32 bit target? Any other thoughts?
Thank you.

As far as I know the BeagleBone uses an ARM processor.
You'll have to get the ARM version (more precise: version for debugging ARM processors) of GDB to debug - you cannot do this with the x86 version.
For Windows the ARM version is available in the "WinARM" packet.
Maybe for Linux such a packet does not exist and you'll have to re-compile GDB.

Add "set architecture arm" to the .gdbinit file referenced in Eclipse under Debug Configurations -- Debugger -- GDB command file. Make sure the .gdbinit file can be found at run-time by making sure GDB command file contains full path to file.

I encountered a similar issue trying to set up cross compilation through Eclipse with a Ubuntu 12.04 Host VM running on a Mac connecting to a Beaglebone Black target. When trying to debug my project, I would get the same "Remote 'g' packet reply is too long" error. What solved this issue for me was to go into the Debug Configuration for your project, select the Debugger tab, and replace gdb to gdb-multiarch the GDB debugger field.

Related

How do you specify a debugger program in Code::Blocks in LINUX

I was trying to debug a c++ program in Code::Blocks, but it didn't work and gave me this message: "ERROR: You need to specify a debugger program in the debugger's settings.
(For GCC compilers, it's 'gdb' (without the quotes))"
When I opened the debugger settings, I found the debugger path empty and don't know what its path.
Anyone has an idea about where can I found the debugger file.
Note: I use Manjaro Linux
The Error appeared because I hadn't installed the GDB, after I install it the debugger path automatically set as "/usr/bin/gdb".

How to change configuration of installed GDB in Ubuntu for cross debugging ARM-LINUX

I have installed GDB using apt-get. The host and targets are the same. I want to use it for cross debugging. Could anyone help out how to achieve this ?
Thanks in advance,
The host and targets are the same. I want to use it for cross debugging.
You can't.
You need to build (or install a prebuilt one -- it's often included with your cross-compiler) a cross-gdb, and use that to perform cross-debugging.
You should install gdb multiarch in ubuntu and gdbserver in the arm-linux target, that will allow you to remote debug programs in the arm target.
Example:
In the target:
target> gdbserver :2345 emacs foo.txt
In the ubuntu machine, start gdb and execute the command:
(gdb) target remote the-target:2345
See the manual for more details:
Using the gdbserver program

Kernel Code : where can I find and how to debug the kernel

Recently I have installed Ubuntu 12.04 LTS ISO image in my desktop. Below is the output of the kernel version I have installed:
# uname -r
3.5.0-41-generic
I am trying to develop a VFS and want the kernel source code version '3.5.0-41-generic' for reference purpose - where can I find the same?
What are the excellent kernel debugging options looking at logs and mapping them to kernel code?
How and which debugger I can use to debug a live kernel flow execution?
Are there ways I can add more printk methods and re-modify the modules? Say I want to know how a FS mount method works - I can modify the required FS code (adding more printk functions) re-compile and reload the modules. Now with aid of my new printk functions I can understand the flow
Why don't you install vanilla 3.5 kernel and try to develop on it?
As a kernel debugger you can use kGDB or just printk.
But... I suggest you to test your vfs on linux running on qemu. Qemu is able to debug the running linux - so you can connect gdb to it and debug the whole emulating system.

qemu installation in ubuntu ? shows some error

I'm installed qemu in my ubuntu 12.04, in both ways [through source and from the software center in ubuntu] it shows same error. It does not pop up the qemu window. when i'm given a dummy filesystem,kernel,initrd, it simply shows some "VNC SERVER listening 127.0.0.1" screen and hangs no more response. Please give me the installation steps and needful libraries to run simple qemu for x86.
Try to include SDL support to QEMU and add option -sdl to run it. VNC is by default probably means you don't have SDL devel lib. Install libsdl-dev with apt.

How can I change how eclipse invokes gdb in linux?

In short, I need to understand how to configure eclipse to run "optirun gbd" instead of "gdb". An explanation of what exactly I'm trying to accomplish follows.
I need to run my debug app in eclipse such that it will use the nvidia optimus card instead of the integrated card. My app requires opengl support that is only available this way.
I've got a laptop with an nvidia optimus video card. I'm running linux (ubuntu). I've successfully set up bumblebee such that I can take advantage of the optimus technology. This requires that, to use the nvidia card, I run a given program "foo" with the program "optirun:" optirun foo.
I need to configure eclipse to launch my program in debug mode under optirun. If I run from command line: optirun gdb app everything works as expected.
Edit: Changing the "GDB Debugger" field inside the debug configuration to optirun gdb does not work. Lanching eclipse by optirun eclipse does, however. But this is a detriment to battery life.
Go to "Debug Configurations", open "Debugger" tab. Change "GDB debugger" from gdb to optirun gdb.
Works in Eclipse Juno, Ubuntu 12.04.
Since I'm sure eclipse uses the shell to execute the program, a workaround is to alias gdb to optirun gdb in ~/.bashrc
I look into this issue today and I found another solution. As long as you have Bumblebee installed (http://www.bumblebee-project.org/) and you know you can attach optirun to an executable (try with glxgears for example) you can attach it to cuda-gdb.
What I did is create a script:
#!/bin/bash
optirun /usr/local/cuda/bin/cuda-gdb $*
And save it to /usr/local/cuda/bin or somewhere else it doesn't matter, with the appropriate permissions for execution (755).
What it does is very simple, it runs optirun cuda-gdb args where args is whatever the command line sends it.
In terminal just run opti_cuda-gdb with or without arguments.
For example I named it opti_cuda-gdb and placed it in that directory (which conveniently is added to the path if CUDA is properly configured).
If you use an IDE to develop, like say Netbeans, point the debbuger executable to that script.
I've been successfully compiled and debbuged code using CuSparse and CuBlas with NetBeans running in a SAMSUNG SF410 with Nvidia Optimus and Ubuntu 11.04 and 11.10.
I'm open to provide further details if you think I omitted something.

Resources