From: Michael Snyder <Michael.Snyder@palmsource.com>
To: "Veenu Verma (AS/EAB)" <veenu.verma@ericsson.com>
Cc: gdb@sourceware.org
Subject: Re: Breakpoint Handling in GDB
Date: Wed, 30 Aug 2006 20:30:00 -0000 [thread overview]
Message-ID: <1156969799.24250.36.camel@localhost.localdomain> (raw)
In-Reply-To: <3DAB128F75626444BB9DEA00DC59AD5501B1F7A1@esealmw104.eemea.ericsson.se>
On Wed, 2006-08-30 at 15:40 +0200, Veenu Verma (AS/EAB) wrote:
> Hello
> I was going through the gdb internals on software breakpoint handling
> and have a question regarding that.
> Gdb replaces the program instruction with a trap which means target does
> not have any control over setting a bp.
> What happens if the connection with the gdb breaks down ?
> Does it mean that the illegal instruction won't be restored and the
> application will crash ?
In the general case, yes, that's what it means.
> If that's the case, then how can it be handled ?
The newer z0/Z0 remote commands will allow the target debug agent
(eg. gdbserver) to handle the breakpoints. But if you're using the
original method of breakpointing by writing trap instructions into
target memory, then yes, you're vulnerable to the scenario that you
describe.
If you can't reboot the target, you MIGHT try re-connecting with
gdb, and "fixing" the trap instructions by hand. Obviously this
is "at your own risk". GDB does not have any built-in capability
to help with the situation that you describe.
However, I *have* used the following method:
1) If possible, get the locations of the breakpoints using
gdb's "info break" command.
2) WITHOUT reconnecting to the target, load the target's
executable file into gdb, and examine (and record) the contents
of memory at those locations, eg. like this:
(gdb) print /x *(unsigned int *) 0xabcdef
3) Now reconnect to the target, and modify those locations
to match what's in the original binary file, eg.:
(gdb) set *(unsigned int *) 0xabcdef = <value>
Again, YMMV, use at your own risk, operators are trained
professionals etc. etc.
Remember, there may be trap instructions that you don't know about,
eg. if you were in the middle of a "next" or "finish" when you lost
communication with the target.
next prev parent reply other threads:[~2006-08-30 20:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 10:11 How to call operator<< functions? Michael Veksler
2006-08-30 11:13 ` Frederic RISS
2006-08-30 13:30 ` Frederic RISS
2006-08-30 13:40 ` Breakpoint Handling in GDB Veenu Verma (AS/EAB)
2006-08-30 13:43 ` Daniel Jacobowitz
2006-08-30 20:30 ` Michael Snyder [this message]
2006-08-31 11:34 ` Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?) Frederic RISS
2006-08-31 12:09 ` Michael Veksler
2006-08-31 12:26 ` Frederic RISS
2006-08-31 13:02 ` Michael Veksler
2006-08-31 13:23 ` Frederic RISS
2006-08-31 16:48 ` Frederic RISS
2006-08-31 16:57 ` Daniel Jacobowitz
2006-08-31 17:41 ` Frédéric Riss
2006-08-31 17:45 ` Daniel Jacobowitz
2006-08-31 19:48 ` Michael Veksler
2006-08-31 19:52 ` Daniel Jacobowitz
2006-08-30 12:46 ` How to call operator<< functions? Daniel Jacobowitz
2006-08-30 20:05 ` Michael Veksler
2006-08-30 20:24 ` Daniel Jacobowitz
2006-08-30 20:45 ` Michael Veksler
2006-08-30 20:54 ` Daniel Jacobowitz
2006-08-31 12:05 ` Michael Veksler
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=1156969799.24250.36.camel@localhost.localdomain \
--to=michael.snyder@palmsource.com \
--cc=gdb@sourceware.org \
--cc=veenu.verma@ericsson.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