* gdb for AT91SAM7
@ 2008-05-14 7:43 Roman Mashak
2008-05-14 11:39 ` Daniel Jacobowitz
2008-05-14 18:13 ` Michael Snyder
0 siblings, 2 replies; 4+ messages in thread
From: Roman Mashak @ 2008-05-14 7:43 UTC (permalink / raw)
To: gdb
Hello.
My question concerns to debugging of embedded code on AT91SAM7
targets. Briefly about the background of the problem:
1) I'm using gdb-6.8.50.20080308-cvs
2) toolchain is based on gcc-4.2.2 for Windows
3) JTAG is by Segger, they also provide GDB server
What I'm trying to do is to debug step-by-step the C-startup, written
in ARM assembly language in order to clearly understand the process of
chip initialization, peripheral setup and other low-level stuffs.
I compiled C-startup and my simple application (printing string out of
the USRT), with "-gdwarf-2 -O0" options as recommended. Then I run
gdb, attach to the target. Since the application is linked to 0x100000
I set breakpoint on this address:
#arm-elf-gdb main.elf
#target remote localhost:2331
#break *0x100000
#continue
Continuing.
...
At this point it hangs and doesn't step over. But if I do "jump
*0x100000" right after setting up the breakpoint, it works! This is
kind of strange, isn't it?
Are there any explanations to this? Or such behavior is rather sane?
Thank you in advance for your comments!
--
Roman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb for AT91SAM7
2008-05-14 7:43 gdb for AT91SAM7 Roman Mashak
@ 2008-05-14 11:39 ` Daniel Jacobowitz
2008-05-14 23:39 ` Roman Mashak
2008-05-14 18:13 ` Michael Snyder
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-05-14 11:39 UTC (permalink / raw)
To: Roman Mashak; +Cc: gdb
On Wed, May 14, 2008 at 12:42:46AM -0700, Roman Mashak wrote:
> #arm-elf-gdb main.elf
> #target remote localhost:2331
> #break *0x100000
> #continue
> Continuing.
> ...
Is the application already loaded or in flash? And is the PC already
pointing at 0x100000? You have to get it pointing to there somehow.
If the PC is already 0x100000 when you say continue, GDB assumes
you're trying to continue, not stop at the current location.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb for AT91SAM7
2008-05-14 7:43 gdb for AT91SAM7 Roman Mashak
2008-05-14 11:39 ` Daniel Jacobowitz
@ 2008-05-14 18:13 ` Michael Snyder
1 sibling, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2008-05-14 18:13 UTC (permalink / raw)
To: Roman Mashak; +Cc: gdb
On Wed, 2008-05-14 at 00:42 -0700, Roman Mashak wrote:
> Hello.
>
> My question concerns to debugging of embedded code on AT91SAM7
> targets. Briefly about the background of the problem:
> 1) I'm using gdb-6.8.50.20080308-cvs
> 2) toolchain is based on gcc-4.2.2 for Windows
> 3) JTAG is by Segger, they also provide GDB server
>
> What I'm trying to do is to debug step-by-step the C-startup, written
> in ARM assembly language in order to clearly understand the process of
> chip initialization, peripheral setup and other low-level stuffs.
>
> I compiled C-startup and my simple application (printing string out of
> the USRT), with "-gdwarf-2 -O0" options as recommended. Then I run
> gdb, attach to the target. Since the application is linked to 0x100000
> I set breakpoint on this address:
When you say the application is linked to 0x100000,
do you mean that that is the start address?
> #arm-elf-gdb main.elf
> #target remote localhost:2331
> #break *0x100000
> #continue
> Continuing.
> ...
>
> At this point it hangs and doesn't step over. But if I do "jump
> *0x100000" right after setting up the breakpoint, it works! This is
> kind of strange, isn't it?
Before you say "continue", or "jump *0x100000", if you
ask gdb for the current instruction pointer (presumably
"info reg pc"), what does it say?
I've had somewhat similar problems in the past. The
start address is special in many ways, and so is the
whole start-up process.
Can you try setting your breakpoint at the 2nd or 3rd
instruction after the start address?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb for AT91SAM7
2008-05-14 11:39 ` Daniel Jacobowitz
@ 2008-05-14 23:39 ` Roman Mashak
0 siblings, 0 replies; 4+ messages in thread
From: Roman Mashak @ 2008-05-14 23:39 UTC (permalink / raw)
To: Roman Mashak, gdb
Hello.
thanks for feedback.
2008/5/14 Daniel Jacobowitz <drow@false.org>:
> On Wed, May 14, 2008 at 12:42:46AM -0700, Roman Mashak wrote:
>> #arm-elf-gdb main.elf
>> #target remote localhost:2331
>> #break *0x100000
>> #continue
>> Continuing.
>> ...
>
> Is the application already loaded or in flash? And is the PC already
> pointing at 0x100000? You have to get it pointing to there somehow.
The application is in flash before GDB runs. I checked PC value right
after GDB has started and it's not 0x100000, it varies with every
start, for example 0x10009a0, next it's 0x0.
Should I set PC value in the .gdbinit:
set $pc = 0x100000
>
> If the PC is already 0x100000 when you say continue, GDB assumes
> you're trying to continue, not stop at the current location.
>
--
Roman
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-14 23:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-14 7:43 gdb for AT91SAM7 Roman Mashak
2008-05-14 11:39 ` Daniel Jacobowitz
2008-05-14 23:39 ` Roman Mashak
2008-05-14 18:13 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox