This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB requires software breakpoints?


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]