Remote debugging using GDB

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

I'am trying to debugg a program loaded into a freescale M52233DEMO
evaluation board.

I'am starting GDB and than connects to the ev-board using the following
command:

target remote | m68k-elf-cfpe-stub -d USBMultilink -t m52235evb

I can than communicate with the board using different GDB commands. I
can view memory and register content, disassemble, set and view
breakpoints. So it seams to work ok. But! At this stage I se that my
programcounter is pointing att some odd point in memory. Probably due
to some bug in my program. Than I want to set a breakpoint and restart
the program, and as beginner at using GDB I found in the manual that
this is done using the 'run' command. But then I get:

"
(gdb) b start
Breakpoint 6 at 0x408: file system/crt0.S, line 54.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: C:\Projects\Test/test.elf
Don't know how to run.  Try "help target".
"

And after this I have no conntact with my board any more.....

Why!? What to do? (And obviously, I have tried "help target", but now
help there. I did use the target command to connect to the board).

Any help highly appreciated!

Rgds,
Mats


Re: Remote debugging using GDB

Quoted text here. Click to load it

Don't use the 'run' command.  AFAICT, 'run' isn't aplicable to
remote debugging.

Use the 'continue' command instead of 'run'.  If you want to
'restart' your program, you might have to set the
PC/SP/whatever to the proper values.  Or depending on the
target, you be able to 'load' the program to get things
initialized:

 (gdb) load 'myprog.elf'
 [...]
 (gdb) continue


--
Grant Edwards
snipped-for-privacy@visi.com

Re: Remote debugging using GDB
Quoted text here. Click to load it

I didn't see in your description any indication that you have loaded the
program into the target memory - don't forget that step!

When the program is loaded by gdb from a file with symbols (e.g., an elf
file), gdb will set the program counter correctly to the entry point of
the program.  If your program is there from before (in flash, for
example), you may have to set the program counter manually with
something like "set $pc = start".


Quoted text here. Click to load it

Exactly.  It's a common (and understandable) mistake when first using
gdb.  "Run" is used by gdb to set up a program's environment, link in
dynamic libraries, etc., which is only appropriate if you are using a
proper OS.  For most embedded work, what you want to do is make sure
your program counter is at the program's entry point, and "continue"
from the start.

Quoted text here. Click to load it

Site Timeline