Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: <gdb@sourceware.org>
Cc: Luis Machado <lgustavo@codesourcery.com>
Subject: how to fix internal errors on connection to remote stub?
Date: Fri, 23 Jan 2015 18:07:00 -0000	[thread overview]
Message-ID: <54C2893B.5000900@codesourcery.com> (raw)

We have a GDB stub we use to interface to various hardware probes.  In 
GDB we normally run programs on the target using a series of commands like

(gdb) target remote ....
(gdb) load
(gdb) c

This works about 99.9% of the time.  The other .1%, we get "a problem 
internal to GDB has been detected" from the "target remote" command, 
because it is trying to ask the target for a backtrace *before* it has 
loaded the program.  At that point, the contents of memory and registers 
on the target have no relation to the program gdb is trying to debug, 
and GDB gets mighty confused.  Maybe this isn't so awful for manual use, 
but it certainly screws up automated testing.

Luis and I have been discussing this and we both think the most likely 
solution is for the stub to answer the initial '?' packet with some 
response that indicates it's in an inconsistent state, rather than the 
"S00" it is sending now, and have GDB recognize it and at least suppress 
the initial backtrace, and perhaps also sets a flag disallowing other 
commands to view target state (variable values, etc) until it's cleared 
by the "load" command.  Maybe the 'W' stop reply could be used for this 
purpose, or maybe we need to introduce a new one?

Alternatively, maybe we could have a separate GDB command that can be 
issued before the "target remote" to suppress the auto-backtrace?

Any other ideas?  What do other folks think is the right solution?  We'd 
much rather fix this in a way that's acceptable for mainline rather than 
having to carry a patch locally.

-Sandra


             reply	other threads:[~2015-01-23 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 18:07 Sandra Loosemore [this message]
2015-01-23 19:37 ` Paul Koning
2015-01-25  5:54   ` Sandra Loosemore

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=54C2893B.5000900@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=lgustavo@codesourcery.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