From: Jie Zhang <jie.zhang@analog.com>
To: Michael Snyder <msnyder@vmware.com>,
Dave Korn <dave.korn.cygwin@googlemail.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Reset breakpoint after load?
Date: Thu, 21 Jan 2010 22:41:00 -0000 [thread overview]
Message-ID: <4B58D811.8070604@analog.com> (raw)
In-Reply-To: <20100121211950.GA11880@caradoc.them.org>
On 01/22/2010 05:19 AM, Daniel Jacobowitz wrote:
> On Thu, Jan 21, 2010 at 10:29:06AM -0800, Michael Snyder wrote:
>>> On 19/01/2010 07:36, Jie Zhang wrote:
>>>
>>>> gdb-comm.exp sets breakpoints on exit and abort before load. The problem
>>>> is that GDB tries to skip prologue according to what it reads from
>>>> memory, which might contain random data since the executable has not
>>>> been loaded into memory. In my case, sometimes skip_prologue might skip
>>>> one or two more instructions, which happens to be an exception
>>>> instruction and will trap the processor into an exception event loop
>>>> after running the executable before hit the breakpoints.
>
> I've had this problem on a MIPS target, too.
>
I didn't notice this issue until recently a bug in toolchain linked in
simulator libc for bare metal executable, which made this issue easily
happen.
>> I don't believe that gdb can tell when the (remote) inferior
>> is started. All gdb knows is that target remote is started.
>> Thus, if we connect to target remote and then load the image,
>> there is an interval during which gdb will attempt to read
>> the prologue bytes from un-initialized target memory.
>>
>> Seems to me, that interval is a bad time to set breakpoints.
>
> The problem isn't just breakpoints set during the interval, but also before
> target remote. We adjust the breakpoints after target remote.
>
> GDB doesn't know whether we're going to need to load. Maybe it should
> be an option to target remote to load automatically? I don't know,
> that's a little strange.
>
Yeah, it's a little strange.
Jie
next prev parent reply other threads:[~2010-01-21 22:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 7:36 Jie Zhang
2010-01-21 10:01 ` Dave Korn
2010-01-21 12:52 ` Jie Zhang
2010-01-21 18:29 ` Michael Snyder
2010-01-21 21:20 ` Daniel Jacobowitz
2010-01-21 22:41 ` Jie Zhang [this message]
2010-01-22 2:15 ` Paul Koning
2010-01-22 3:05 ` Jie Zhang
2010-01-22 11:46 ` Paul Koning
2010-01-22 13:46 ` Daniel Jacobowitz
2010-01-22 18:19 ` Michael Snyder
2010-01-21 22:35 ` Jie Zhang
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=4B58D811.8070604@analog.com \
--to=jie.zhang@analog.com \
--cc=dave.korn.cygwin@googlemail.com \
--cc=gdb@sourceware.org \
--cc=msnyder@vmware.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