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 02:29 AM, Michael Snyder wrote:
Dave Korn 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.

Something is wrong here. Before the inferior is started, gdb should be looking at the prologue bytes from the executable image file, not the inferior memory. Is something going wrong in gdb_comm_file_cmd()?

Dave, Jie,


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.

I agree that that interval is a bad time to set breakpoints. But if GDB re-set breakpoints after load, it still can get the breakpoint set at the right addresses.


Jie



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