Discussion:
"cannot find bounds of current function"
Turny Dávid
2006-10-16 01:05:19 UTC
Permalink
Hi,

I like to debug a C program which I compile using gcc for
ARM target. I use these arguments:
-march=armv4t -mcpu=arm7tdmi -g -gdwarf-2 -EL
When I try to execute the "step" or the "next" instruction
with the gdb, then I got this message:
"cannot find bounds of current function"
There is no function in my program except the main().
The "list" instruction is OK. I can see my C code.
How can I execute the next instruction? What I have to do?
Please somebody help me! Thanks!

David

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Daniel Jacobowitz
2006-10-16 09:15:53 UTC
Permalink
Post by Turny Dávid
I like to debug a C program which I compile using gcc
for
-march=armv4t -mcpu=arm7tdmi -g -gdwarf-2 -EL
When I try to execute the "step" or the "next"
instruction
"cannot find bounds of current function"
There is no function in my program except the main().
The "list" instruction is OK. I can see my C code.
How can I execute the next instruction? What I have to
do?
This means you are not yet in a function the debugger knows about.
Try "break main" "continue"?
--
Daniel Jacobowitz
CodeSourcery
Michael Snyder
2006-10-17 02:37:00 UTC
Permalink
Post by Turny Dávid
Hi,
I like to debug a C program which I compile using gcc for
-march=armv4t -mcpu=arm7tdmi -g -gdwarf-2 -EL
When I try to execute the "step" or the "next" instruction
Hold on -- need a little more context.
What did you do, and what was the state,
*before* you tried to execute a "step" or "next"?

Is this a remote target? Native? Were you in "main"?
Post by Turny Dávid
"cannot find bounds of current function"
There is no function in my program except the main().
The "list" instruction is OK. I can see my C code.
How can I execute the next instruction? What I have to do?
Please somebody help me! Thanks!
David
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Turny Dávid
2006-10-17 18:19:34 UTC
Permalink
Hi,

Thak You! The details:
My target is remote, the AT91SAM7S256 microcontoller. It has ARM7TDMI
core. The architecture of it is armv4t.
I use the openOCD created by Dominic Rath. Thank you Dominic! :)
I didnt try this on Linux only on window$ yet. I can use the yagarto
(native) or the sourcery g++ toolchain (native, but it can use the
cygwin as well)...the problem is the same in either case.

The code which I like to debug is this:
/*test.c*/
main () { /*This is just a test code, meaningless.*/
int a;
int b;
while (1) {
a=2;
b=3;
a+=b;
}
}
COMPILE
==========
CC -march=armv4t -mcpu=arm7tdmi -LE -g -gdwarf-2 -o test.elf test.c
where CC is arm-none-eabi-gcc (sourcery g++) or arm-elf-gcc (yagarto).
After that I create a .bin file.
OB -O binary test.elf test.bin
Where OB is arm-none-eabi-objcopy (sourcery g++) or
arm-elf-objcopy (yagarto)
I can compile without any error or warning message.
I load the test.bin in the flash using JTAG wiggler interface and the
openOCD.

OPENOCD
==========
My openOCD config file contain these lines:

#Deamon configuration
gdb_port 3333
telnet_port 4444
deamon_startup attach

#JTAG interface configuration
interface parport
jtag_speed 0
reset_config srst_only
jtag_device 4 0x1 0xf 0xe
#jtag_nsrst_delay
#jtag_ntrst_delay

#Parport options
parport_port 0x378
parport_cable wiggler

#target configuration
target arm7tdmi little reset_halt 0 arm7tdmi
#run_and_halt_time
#working_area

#Flash configuration
flash bank at91sam7 0 0 0 0 0

After the start I have got 2 info:
info: openocd.c:82 main(): Open On-Chip Debbuger (2006-09-28 20:00 CEST)
info: configuration.c:50 configuration_output_handler(): Command
deamon_startup not found

I dont know what is mean the second one, but there is no problem in during
the flash write. I load the test.bin in the flash using telnet.


LOAD the test.bin
===================
telnet localhost 4444
I get a prompt like this:

Open On-Chip Debugger
soft reset
flash erase 0 0 15
flash write 0 test.bin 0
soft reset
arm7_9 sw_bkpts enable
This works well.

Debug
=====================
I use the arm-elf or the arm-none-eabi gdb...I will sign this just gdb.
gdb test.elf
then it write some line information about himself. I think maybe
this would be
important:
This GDB was configured as "--host=i686-pc-mingw32
--target=arm-elf" ... (yagarto)

--target=arm-none-eabi" ...(sourcery g++)
I have a celeron 800MHz.
Then I connect to the remote target (the prompt is (gdb) now )
(gdb)target remote localhost:3333
Remote debugging using localhost:3333
0x000048a0 in ?? ()
(gdb)

Now if I try to execute a "step" or "next" I see:
(gdb)next
Cannot find bounds of current function
(gdb)step
Cannot find bounds of current function

Daniel Jacobowitz wrote me I am not in the main().I have to make a
breakpoint at the entry of the main and execute the continue
command. Thank You Daniel! If I do this then:
(gdb)break main
Breakpoint 1 at 0x821c: file test.c, line 6.
(gdb)continue
Continuing.

Thats all...I dont get back the (gdb) prompt...:(
Where is the mistake? What I can do? Please somebody help me!

The list command is alright and I can debug assembly code without
any trouble.

Thank You!
David

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Turny Dávid
2006-10-17 18:50:07 UTC
Permalink
Hi,

Sorry, I see just now when I execute the continue or step or next
command then the openOCD deamon write an error message:

error: arm7_9_common.c:1771 arm7_9_read_memory():memory read caused data abort

What is this? :) I dont understand. Please!

Thank You!

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Michael Snyder
2006-10-17 20:20:25 UTC
Permalink
Post by Turny Dávid
Hi,
Sorry, I see just now when I execute the continue or step or next
error: arm7_9_common.c:1771 arm7_9_read_memory():memory read caused data abort
What is this? :) I dont understand.
Personally, I'm not familiar with openOCD.

One thing you might do at this point would be, before you
tell gdb to "continue", tell it "set debug remote 1". This
will turn on "remote protocol debugging", so gdb will echo
all traffic between the debugger and the target to the console.

You can then see exactly what was the last thing that happened
before you got the above error.

You should consult the gdb doc to understand the remote protocol,
but here's a quick hint: messages that begin with "M" are memory
writes, and messages that begin with "m" are memory reads. You
are looking for a memory read (apparently). The hexadecimal address
of the memory access will be the first number following the "M" or
"m".

Loading...