Discussion:
[OpenWrt-Devel] Debugging OpenWRT ELF image with GDB on host system
Madhavi Manchala
2011-04-11 11:30:14 UTC
Permalink
Dear All,

We are unable to debug the OpenWRT image through GDB from a host
system. When we try to debug, we are seeing the following error
messages on the GDB screen. We are running the GDB from Cygwin on a
Windows XP system.

No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load?

We also tried to load the executable image from <gdb> prompt with
"file" command. This time, we are seeing the following error messages.
<no debugging symbols found> ...done.

We enabled the following from "make menuconfig" which we run from the trunk.

Advanced configuration options (for developers) [enter] → Toolchain
Options → [*] Build gdb
Utilities → gdbserver

Shall we need to be changed CFLAGS in any Makefile for including the -g option?

Any suggestions / ideas / links would be appreciated and help us a lot.

Thanks and Regards,
Madhavi M.
Sławomir Cygan
2011-04-11 21:39:41 UTC
Permalink
Hi,
Post by Madhavi Manchala
We are unable to debug the OpenWRT image through GDB from a host
system. When we try to debug, we are seeing the following error
messages on the GDB screen. We are running the GDB from Cygwin on a
Windows XP system.
Please use cross-compiled version of gdb - the one build by OpenWRT.
Post by Madhavi Manchala
Shall we need to be changed CFLAGS in any Makefile for including the -g option?
Propably, or modify global CFLAGS setting in OpenWRT. By default all
programs are build without debug info (and can be stripped, but I am
not sure about this at the moment).
Post by Madhavi Manchala
Any suggestions / ideas / links would be appreciated and help us a lot
My own point of view: usually it is better to use printf() instead of
gdb and printk() instead of kgdb.
--
Pozdrawiam,
Sławomir Cygan
Madhavi Manchala
2011-04-12 11:14:20 UTC
Permalink
Dear Slawomir Cygan,

Thank you very much for your infromation.
Post by Sławomir Cygan
Hi,
Post by Madhavi Manchala
We are unable to debug the OpenWRT image through GDB from a host
system. When we try to debug, we are seeing the following error
messages on the GDB screen. We are running the GDB from Cygwin on a
Windows XP system.
Please use cross-compiled version of gdb - the one build by OpenWRT.
I am trying to debug the vmlinux OpenWRT image which is build for my
target device. The procedure that I am following is as follows.

I build the OpenWRT image (vmlinux) on a Linux box in the ELF format
for my Samsung MCU. Then, I am trying to load it on to my device's RAM
area using a J-Link J-TAG and J-LinkGDBServer tool with a .gdbinit
script from a Windows XP system. The .gdbinit script contains the
initialization of the address map and CPU registers UART etc. Then, I
am running the gdb from Cygwin on Windows XP system. If this is the
case, how can I use OpenWRT gdb? Where is OpenWRT gdb available? Is
it in staging_dir?
Post by Sławomir Cygan
Post by Madhavi Manchala
Shall we need to be changed CFLAGS in any Makefile for including the -g option?
Propably, or modify global CFLAGS setting in OpenWRT. By default all
programs are build without debug info (and can be stripped, but I am
not sure about this at the moment).
Yes. By default all are build without debugging information. I added
-g option in the Makefile which is located at the
trunk/target/linux/board directory.
Post by Sławomir Cygan
Post by Madhavi Manchala
Any suggestions / ideas / links would be appreciated and help us a lot
My own point of view: usually it is better to use printf() instead of
gdb and printk() instead of kgdb.
I am not able to see any debug messages on the hyper terminal. That is
the reason, I want to put some break points in the HAL code and need
to check whether it is reaching there or not through gdb. I explained
the loading procedure above.

Please let me know, if you need any additional information. I will provide.

Thanks and Regards,
Madhavi M.
Post by Sławomir Cygan
--
Pozdrawiam,
Sławomir Cygan
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Sławomir Cygan
2011-04-12 11:29:23 UTC
Permalink
This post might be inappropriate. Click to display it.
Madhavi Manchala
2011-04-12 11:46:06 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...