This is the mail archive of the gdb@sourceware.org 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]

Re: Reset breakpoint after load?


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



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