This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Configuring an eCos application to debug it using GDB
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Jérémy Alles <jeremy dot alles at orange-ftgroup dot com>
- Cc: 'eCos Discussion' <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 27 Mar 2008 08:54:47 -0600
- Subject: Re: [ECOS] Configuring an eCos application to debug it using GDB
- References: <200803271438.m2REcYVO002173@smtp.silicomp.fr>
Jérémy Alles wrote:
Thank you for your answers...
After some check, I'm able to use GDB over serial line (and by loading
properly the symbols as you describe).
However, it is quite long to load a 4.5MB programm...
Any idea why this is not working throught Ethernet ? Am I supposed to change
something in eCos's configuration ?
You should not have to do anything. That said, debugging via ethernet
can be very tricky since your eCos application (if it is!) and RedBoot
are sharing the same ethernet device.
There are a couple ways around this - both involve separating the load
and execute/debug steps. You do need to know the entry address.
1. Load the application using Redboot, then start GDB over the serial
port.
(via serial or telnet)
RedBoot> load main.elf
disconnect from RedBoot - by serial, just drop out (minicom, etc)
by network, close the telnet session
$ arm-elf-gdb main.elf
(gdb) tar rem /dev/ttyXX
(gdb) set $pc=XXX
(gdb) c
2. Load the application using GDB over the network, then change to use
serial.
$ arm-elf-gdb main.elf
(gdb) tar rem redboot-IP:9000
(gdb) load
(gdb) detach
(gdb) tar rem /dev/ttyXX
(gdb) c
-----Message d'origine-----
De : ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] De la part de Gary Thomas
Envoyé : jeudi 27 mars 2008 13:13
À : Jérémy Alles
Cc : 'eCos Discussion'
Objet : Re: [ECOS] Configuring an eCos application to debug it using GDB
Jérémy Alles wrote:
Hi,
I'm trying to configure properly my eCos application in order to
debug it using GDB (over Ethernet). I'm using an AT91 based
development kit with Redboot already flashed on it (by someone else in
my company). My board has IP 192.168.1.20, and I can successfully connect
to it from arm-elf-gdb.
The problem is I think that I'm missing something in my
configuration
(ecos.ecc), as when my application starts, it returns 54321 and not
something like $O3534313231#56+. That is why I think i'm doing
something wrong.
Where/when did you get this?
If you load and run your application directly from RedBoot, then when you
print (via diag_printf()) to the console, the mangling is disabled and
you'll see the actual string.
If you load and start your application via GDB (even if it's RedBoot
providing the GDB support), then mangling is enabled and the strings are
sent through the GDB protocol. Only if you somehow got eCos confused and it
thought there was a GDB agent on the console would you ever see the $O..#..
line.
jalles@jalles1475:~/local_repository/drivers/led$ arm-elf-gdb GNU gdb
5.3 (eCosCentric) Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
(gdb) target remote 192.168.1.20:9000
Remote debugging using 192.168.1.20:9000 0x10027580 in ?? ()
(gdb) load main.elf
Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section
.text, size 0x6948 lma 0x20040040 Loading section .rodata, size 0x284
lma 0x20046988 Loading section .data, size 0x6cc lma 0x20046c0c Start
address 0x20040040, load size 29400 Transfer rate: 235200 bits/sec,
294 bytes/write.
(gdb) c
Continuing.
Moreover, if I want to use a break point, the load command is not
enough:
(gdb) load main.elf
Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section
.text, size 0x7f07c lma 0x20040040 Loading section .rodata, size
0x4f5d4 lma 0x200bf0bc Loading section .data, size 0x5264 lma
0x2010e690 Start address 0x20040040, load size 866548 Transfer rate:
407787 bits/sec, 299 bytes/write.
(gdb) b main
No symbol table is loaded. Use the "file" command.
Whereas I build my application using the -g option... Any idea ?
You've not told GDB about the symbols. It's much better to start GDB like
this:
$ arm-elf-gdb main.elf
(gdb) target remote XYZ:9000
(gdb) load
(gdb) b main
(gdb) cont
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss