GDB over RDI freezes

Grant Edwards grante@visi.com
Fri Sep 8 12:14:00 GMT 2000


On Fri, Sep 08, 2000 at 12:32:26PM -0600, Shaun Jackman wrote:

> I'm debugging a remote ARM target via serial tether RDI. The
> Angel monitor is running on the target board. When the target
> loses its mind, I of course also lose my RDI connection. So, if
> I'm in the middle of a continue (for example), and ctrl-c (send
> a SIGINT) to wake the target, I get no response from GDB. I
> have to send a SIGTERM to get my console back.

Yea, that sort of sucks.

> Is this the intended effect? 

Depends on your definition of "intended".

> or a hanging bug?

Depends on your definition of "bug".

;)

It's not the "intended effect" in that somebody sat down and
decided they wanted gdb to behave that way.  It is a
side-effect of the RDI protocol implimentation from ARM on
which the RDI target code in gdb is based.

The RDI protocol (or at least the ARM, Ltd. implimentation) is
fragile.  There are neither retries nor timeouts.  That means
that if anything doesn't happen as expected (lost packet, no
reply, etc.), the RDI target code sits there waiting forever
for whatever it expects to happen next (generally a particular
response packet from the target).

According to one SW engineering text a bug is "when a program
doesn't do what a user reasonably expects it to." (What's
"reasonable" is a whole other debate.) In this case, it is
reasonable, IMO, to expect that gdb not hang forever when the
target takes off into the weeds.  

Therefore, it's a bug.

However, all of the various pieces of code are doing (AFAICT)
what their author's intended, so its not an implimentation bug,
but a requirements bug: nobody was ever told that the RDI
target routines should recover from errors, so no such features
were designed in.

I'm not familiar with other gdb target implimentations, so I
don't know what mechanisms are used to avoid these problems for
other targets, or how easy it would be to do something similar 
for RDI.

I've gotten rather adept at the sequence below:

(gdb) ^C
[nothing happens: mumbled swearing]
^Z
[1]+  Stopped                 arm-elf-gdb -nw
$ kill %1
[1]+  Terminated              arm-elf-gdb -nw
$ arm-elf-gdb -nw

-- 
Grant Edwards
grante@visi.com


More information about the Gdb mailing list