From: Chad Phillips <jcphillips@yahoo.com>
Cc: gdb@sources.redhat.com
Subject: Re: GDB requires software breakpoints?
Date: Tue, 28 Jun 2005 14:19:00 -0000 [thread overview]
Message-ID: <42C15C66.6070600@yahoo.com> (raw)
In-Reply-To: <42BC6F5D.1080506@yahoo.com>
I took the advice of having the software breakpoint requests actually
set hardware breakpoints. However, the problem of gdb insisting on
setting a software breakpoint at main has now been compounded by gdb
issueing a continue command after the software breakpoint is
successfully set. It is as if gdb thinks it must break at main before
it can go on to do anything else.
In the following session, the target has been stopped in main before gdb
starts. Then gdb attaches to the target. A step command is then issued
to gdb. The step occurs correctly, but at the end of the step, gdb sets
a breakpoint at main and then issues a continue command. Any
suggestions for getting around this?
Thanks,
Chad
--------------- gdb remote transcript -------------------
(gdb) target remote localhost:1000
Remote debugging using localhost:1000
Sending packet: $Hc-1#09...Ack
Packet received:
Sending packet: $qC#b4...Ack
Packet received:
Sending packet: $qOffsets#4b...Ack
Packet received:
Sending packet: $?#3f...Ack
Packet received: S05
Sending packet: $Hg0#df...Ack
Packet received:
Sending packet: $p40#d4...Ack
Packet received: 00004396
Sending packet: $p0#a0...Ack
Packet received: 00801D8C
0x00004396 in main () at main.c:160
160 asm("doze");
(gdb) s //step command
Sending packet: $p1#a1...Ack
Packet received: 00C70000
Sending packet: $vCont?#49...Ack
Packet received:
Packet vCont (verbose-resume) is NOT supported
Sending packet: $Hc0#db...Ack
Packet received:
Sending packet: $s#73...Ack
Packet received: S05
Sending packet: $p40#d4...Ack
Packet received: 0000438C
Sending packet: $p0#a0...Ack
Packet received: 00801D8C
Sending packet: $p1#a1...Ack
Packet received: 00C70000
Sending packet: $pf#d6...Ack
Packet received: 0000438C
Sending packet: $Z0,4188,2#e9...Ack //break at main?
Packet received: OK
Packet Z0 (software-breakpoint) is supported
Sending packet: $c#63...Ack //and continue?
Packet received: S05
Sending packet: $p40#d4...Ack
Packet received: 00004396
//I caused a debug trap on the target here
Program received signal SIGTRAP, Trace/breakpoint trap.
Sending packet: $z0,4188,2#09...Ack
Packet received: OK
Sending packet: $p0#a0...Ack
Packet received: 00801D8C
0x00004396 in main () at main.c:160
160 asm("doze");
(gdb)
--------------- end gdb remote transcript -------------------
Chad Phillips wrote:
> Context:
> I'm rewriting MCORE support.
> My remote MCORE target executes code from flash.
> I've written a stub that resides on the same computer as GDB, talks to
> GDB using the remote protocol, and manipulates the target using the
> target's JTAG interface. As a result, only hardware breakpoints (2 of
> them) are supported.
>
> A log is included below (created using 'set debug remote 1') with my
> comments along the right side.
>
> Problem 1:
> After attaching to the target which is stopped in main, I issue the step
> command. The target correctly steps to the next source line. At the
> end of the stepping process, GDB tries to set a breakpoint at main.
> Using 'info break' replies "No breakpoints or watchpoints."
>
> First: How can I prevent it from trying to do this?
>
> Second: It attempt to set a software breakpoint, which is not supported
> by the stub. Then it tries to write a software breakpoint (instruction
> 0x0000) to memory at the start of main, which fails since the stub
> cannot write to flash. Why is it doing this if the stub has already
> indicated that software breakpoints are not supported?
>
> Problem 2:
> After two more commanded steps, the target jumps into a function.
> Issueing a 'finish' command tries to set another software breakpoint at
> the correct return location. However, that fails because the return
> location is in flash. How can I get GDB to use available hardware
> breakpoints for this functionality and to stop trying to write to flash?
>
> Thanks,
> Chad
>
> ---------------------------------------------------------
> (gdb) s //Commanded step
> Sending packet: $p1#a1...Ack
> Packet received: 00C70000
> Sending packet: $vCont?#49...Ack
> Packet received:
> Packet vCont (verbose-resume) is NOT supported
> Sending packet: $Hc0#db...Ack
> Packet received:
> Sending packet: $s#73...Ack //automatic steps...
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 0000439A
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 0000439C
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 0000439E
> Sending packet: $p0#a0...Ack //finished stepping
> Packet received: 00801D8C
> Sending packet: $p1#a1...Ack
> Packet received: 00C70000
> Sending packet: $pf#d6...Ack
> Packet received: 0000438C
> Sending packet: $Z0,4188,2#e9...Ack //break at main !?!
> Packet received:
> Packet Z0 (software-breakpoint) is NOT supported
> Sending packet: $m4188,2#a0...Ack
> Packet received: 6007
> Sending packet: $X4188,0:#c3...Ack
> Packet received:
> binary downloading NOT suppported by target
> Sending packet: $M4188,2:0000#7a...Ack //break at main !?!
> Packet received: E00
> Warning:
> Cannot insert breakpoint 0.
> Error accessing memory address 0x4188: Input/Output error.
>
> (gdb) s
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043A0
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043A2
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043A4
> Sending packet: $p0#a0...Ack
> Packet received: 00801D8C
> Sending packet: $p1#a1...Ack
> Packet received: 00C70000
> Sending packet: $pf#d6...Ack
> Packet received: 0000438C
> Sending packet: $m4188,2#a0...Ack //still breaking main?
> Packet received: 6007
> Sending packet: $M4188,2:0000#7a...Ack
> Packet received: E00
> Warning:
> Cannot insert breakpoint 0.
> Error accessing memory address 0x4188: Input/Output error.
>
> (gdb) s
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043A6
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043A8
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043AA
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043AC
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043AE
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043B0
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043B2
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043B4
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 000043B6
> Sending packet: $s#73...Ack
> Packet received: S05
> Sending packet: $p40#d4...Ack
> Packet received: 00008CCC
> Sending packet: $p0#a0...Ack //did not break main !?!
> Packet received: 00801D8C
> Sending packet: $p1#a1...Ack
> Packet received: 00C70000
> Sending packet: $pf#d6...Ack
> Packet received: 000043B8
> mQueueReadString () at mQueue.s:385
> 385 mQueue.s: No such file or directory.
> in mQueue.s
> Current language: auto; currently asm
>
> //now finish command tries to set break instruction at return addr
>
> (gdb) finish
> Run till exit from #0 mQueueReadString () at mQueue.s:385
> Sending packet: $m43b8,2#cc...Ack
> Packet received: 1227
> Sending packet: $M43b8,2:0000#a6...Ack
> Packet received: E00
> Warning:
> Cannot insert breakpoint 0.
> Error accessing memory address 0x43b8: Input/Output error.
>
> (gdb)
>
next prev parent reply other threads:[~2005-06-28 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-24 20:40 Chad Phillips
2005-06-25 4:32 ` Daniel Jacobowitz
2005-06-28 14:19 ` Chad Phillips [this message]
2005-06-28 14:23 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42C15C66.6070600@yahoo.com \
--to=jcphillips@yahoo.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox