“No source available 0x” when debugging Linux kernel with Eclipse CDT - c

This is my first post to stackoverflow so apologise for any error :). I'm trying to debug a Linux Kernel using Eclipse/CDT by following the information provideed in multiple websites. However, everytime I try to debug the kernel I get a “No source available 0x....." message. (see the attached screenshot).
I run the linux kernel with a qemu virtualmachine "qemu -s -S -kernel bzImage ..."
I try to run the debug from Eclipse/CDT. For that, I configured a "C/C++ Attach to Application" debug. The application is the vmlinux file. The remote configuration of type gdbserver is configured as localhost:1234.
Altough I can't debug with Eclipse/CDT, I can debug the kernel with gdb CLI:
# gdb vmlinux
> remote target localhost:1234
> cont
Information about versions:
Linux Mint 17 KDE
Eclipse 4.4.1
CDT 8.5.0
qemu 2.0.0+dfsg-2ubuntu1.9
gcc 4.8.2-1ubuntu6
gdb 7.7.1-0ubuntu5~14.04.2

A "C/C++ Attach to Application" debug configuration is not appropriate for this setup. You could use a "C/C++ Remote Application" configuration instead, with the manual remote debugging launcher:
Open the Debug Configurations window in Eclipse and create a new a "C/C++ Remote Application" configuration
At the bottom section of the window there is the indication of which launcher is being used: if you see anything other than the manual remote debugging launcher, click on "Select other..." and in the launcher selection window select "GDB (DSF) Manual Remote Debugging Launcher"
In the Main tab of the debug configuration, in the Project field enter the Eclipse project where you have your Linux kernel, and in the C/C++ Application field enter your vmlinux file
In the Debugger tab, under Debugger Options, select the Connection tab, then select TCP as connection type, write "localhost" in the host address field, and write "1234" in the port number field
Possibly adjust the source lookup path in the Source tab
Start QEMU with the usual "-s -S" options
Now you should be able to start your debug session in Eclipse, with working symbol resolution and source lookup

Related

GDB stuck at “Configuring GDB Aborting configuring GDB”

I've installed (OSX Mojave 10.14.6.) Eclipse CDT and GNU MCU Eclipse plugin and finaly GNU Tools for ARM. My goal is to build and debug ARM code using GDB (arm-none-eabi-gdb).
I've created a Hello World project for Arm, which builds ok - but, debugging seems not to work with GDB (that comes with the Arm package). GDB gets stuck:
I have set the proper paths in Eclipse to arm-none-eabi-gdb.
I have signed the arm-none-eabi-gdb (with the same certificate that I used to sign GDB installed via brew into /usr/local/bin/gdb the day before - and it worked!).
I have also tried running Eclipse as root from command line.
Nothing helps.
The message is "Configuring GDB Aborting configuring GDB".
What to do?
Probably what is going on here is that you built to a given target (ARM based) and you're trying to run it (with gdb) on your mac (x86).
You'll need an emulator or QEMU to properly run on your mac or maybe a real board.

gdbserver --> Reply contains invalid character

I am trying to debug a cross-compiled application with gdbserver. Unfortunately I get the following error on my host:
Reply contains invalid hex digit 59
Here's what I did:
compiled my application "line-generator" (which is just a test program) with gcc -ggdb3 -std=gnu89 flags (using -g instead of -ggdb3 didn't make any difference)
copy the executable to my embedded system. The exec can be executed there
started gdbserver 192.168.10.20:54320 line-generator on the embedded system
On the host I start gdb: gdb line-generator.gdb
(gdb) target remote 192.168.10.102:54320
Got this response on host:
Remote debugging using 192.168.10.102:54320
Reply contains invalid hex digit 59
On the server I got this:
Remote debugging from host 192.168.10.20
readchar: Got EOF
Remote side has terminated connection. GDBserver will reopen the connection.
Listening on port 54320
I have never used gdb remotely so maybe I am running into a beginner's issue so every response might help.
edit: My gdbserver was provided by the manufacturer of the embedded hardware.
I found out that remote-debugging a cross-compiled executable needs gdb on the host computer to be compiled for this purpuse. In my case it means that I have to use this command
/opt/microblaze-uclinux-tools/bin/microblaze-uclinux-gdb line-g
enerator.gdb
instead of simple gdb line-generator.gdb
Luckily the correct file was provided by the embedded board manufacturer!
To be honest I don't fully understand the context so if someone has an explanation on this I'd be glad to hear this!
cheers, Stefan

mbedtls_printf not showing text on terminal

I want to test DTLS libraries on two K64F board with ARM Mbed OS. I have just created a new project:
mbed new .
I have created a folder called source and copied there dtls_client.c obtained from the mbeddtls project page. I have changed the value of the SERVER_ADDR constant.
I have repeated this process with dtls_server.c file.
Both project compiled without errors.
mbed compile -m K64F -t GCC_ARM -c
I copied each bin file to a different board but when I connect to them through the putty terminal I cannot see anything. I have been using this connection with the rest of my programs and it works. I think It may have something related to connection (now it is 115200).
I see that the code uses a mbedtls_printf function to print messages. I have tried inserting some printf traces but I don't see them either. How should I set the terminal to be able to see something?
#jordi,
Baudrate of 115200 should be OK for K64F.
You should verify that you have DEBUG_LEVEL set to a value higher than 0, and that Mbed TLS is compiled in debug mode.
Please compile your application with the following command:
mbed compile -m K64F -t GCC_ARM -c --profile=mbed-os/tools/profiles/debug.json
In addition, you should verify that your configuration file has MBEDTLS_DEBUG_C configured

Debugging in Eclipse with remote GDB

I have a Linux machine which is set up to cross-compile programs for an AVR target. It's easy to run and debug programs locally:
Run the program with simavr (acts as GDB server)
Run GDB (avr-gdb) and connect it to simavr
I'd like to to recreate this flow remotely from Eclipse on a Windows machine. The Windows machine isn't really set up for development — it has Eclipse installed and the source code for my project, but it doesn't have any local C/C++ dev tools like GDB. I'd ideally like to visually debug using the local copy of the source, but by interacting with the remote GDB over SSH.
This Eclipse plugin seems to be the recommended tool for the job. Unfortunately I can't get this working. Here's what I've done:
Created a new "C/C++ Remote Application" debug configuration.
Set the "Preferred Launcher" to "Direct Remote Debugging Launcher".
Pointed "Remote C/C++ exe file path" to the location of the binary on the remote machine
Pointed "Remote workspace directory" to the location of the project source on the remote machine
This does not seem to work. When I attempt to debug with this configuration, I get this error:
Error with command: gdb --version
Cannot run program "gdb": Launching failed
This error makes sense. If I look in the "Debugger" tab of my debug configuration, the "GDB debugger" is set to gdb. If I open the file browser for the debugger, it only shows files on my local Windows machine. It looks like the configuration is set up to execute gdb on my machine.
I thought the point of the plugin was the launch GDB on a remote machine, but I can't find a way to make a debug configuration that actually does that. Any help would be appreciated.
We use the package called GDB Hardware Debugger which lets you specify which GDB you want to use and how you want to launch it. We keep its eclipse configuration as empty as possible, with the minimum required, and continue configuring GDB through its scripting option -x which offers finer-grained control. That way, you are not required to understand how and when are those eclipse fields used to run GDB. For example, we needed to perform some extra GDB settings before connecting while this plugin connects first and then uses the provided GDB script.

Cannot debug C/C++ code using eclipse as debug information is missing

I am trying to debug a C project in mint Linux using eclipse Galileo IDE.
When I try to run the project in the DEBUG mode, the process terminates as it says- debugging information is missing.
In the eclipse console following messages appear
No source available for "main() "
and
Reading symbols from /home/project/netconf/target/bin/netconfd...(no debugging symbols found)...done.
I am using the custom build command
make DEBUG=1 STATIC=1 [eclipse >project >properties > c/c++ build > builder settings]
it builds and runs fine in RELEASE mode.
I am able to build the same application using normal command line build using command terminal, using the same build options
> sudo make DEBUG=1 STATIC=1
now I can start a command line gdb session, as the debugging info is generated, but it is very difficult to debug that way.
I need to know if there is any other setting that needs to be changed, so that I can start debugging in eclipse.
Thanks in advance.
Add -d (or probably -g) to your command line. I think DEBUG=1 is defining a macro rather than generating debug info

Resources