[Avila] gdb and gdbserver on 2348/0.6
gw at lunstad.com
gw at lunstad.com
Wed May 10 09:35:34 EDT 2006
Has anyone had luck getting gdb/gdbserver working on the Avila platform? I
am not able to set breakpoints or step through the code properly. What I
can do is start a program in gdb, load some source and run the whole
program to completion.
Here is an example in a simple hello program.
1. Compiled the program like this:
arm-linux-gcc -ggdb -mbig-endian hello.c
2. Ran gdb that was built in the tree:
avila/snapgear> ./user/gdb/host/gdb/gdb
GNU gdb 6.3
Copyright 2004 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-linux".
3. Targeted the machine and connected, but got a weird message:
(gdb) target remote 192.168.22.50:2345
Remote debugging using 192.168.22.50:2345
Cannot access memory at address 0x801b0040
4. Loaded the symbols. A very simple program...
(gdb) sym ~/<path>/a.out
Reading symbols from /home/ajl/<path>/a.out...done.
(gdb) list
3 void count(int i)
4 {
5 printf("And a %d\n", i);
6 }
7
8 main(int argc, char argv[][])
9 {
10 int i;
11
12 printf("Hello world.\n");
5. Cannot step
(gdb) step
Cannot access memory at address 0x801b0040
6. Set breakpoint OK?
(gdb) break count
Breakpoint 1 at 0x836c: file hello.c, line 5.
7. Continued and hit SIGSEGV, but did not seem to be at function.
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
Cannot access memory at address 0xa4000640
(gdb) list
13
14 for(i=0;i<10; i++) {
15 count(i);
16 }
17 }
8. Still can't step, but at different address?
(gdb) step
Cannot access memory at address 0xa4000640
9. Seems to know where main is, kind of:
(gdb) list main
4 {
5 printf("And a %d\n", i);
6 }
7
8 main(int argc, char argv[][])
9 {
10 int i;
11
12 printf("Hello world.\n");
13
10. Not sure if the regs look right. Still new to IXP425.
(gdb) info reg
r0 0x0 0
r1 0x0 0
r2 0x0 0
r3 0x6a89fcbe 1787428030
r4 0x0 0
r5 0x548efcbe 1418656958
r6 0x30820000 813826048
r7 0x8b00040 145752128
r8 0x1000000 16777216
r9 0x1000000 16777216
r10 0x701240 7344704
r11 0xdc8dfcbe -594674498
r12 0x0 0
sp 0x2488fcbe 612957374
lr 0x0 0
pc 0xa4000640 -1543502272
fps 0x0 0
cpsr 0x10000060 268435552
11. Can't disassemble
(gdb) disass
No function contains program counter for selected frame.
(gdb)
Any thoughts or advice would be greatly appreciated. As I said, the
program (a.out) runs fine, but I can not debug it. Here is the full
source:
> cat hello.c
#include <stdio.h>
void count(int i)
{
printf("And a %d\n", i);
}
main(int argc, char argv[][])
{
int i;
printf("Hello world.\n");
for(i=0;i<10; i++) {
count(i);
}
}
Andrew
More information about the Avila
mailing list