Reset breakpoint after load?
Jie Zhang
jie.zhang@analog.com
Thu Jan 21 12:52:00 GMT 2010
On 01/21/2010 06:18 PM, 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()?
>
Originally gdb_comm_load () did as below:
1. set breakpoints at abort and exit
2. target $protocol $targetname
3. load
At 1, gdb reads from executable image file when analyze prologue. At 2,
gdb re-set breakpoints according the bytes read from target memory. So
after 3 we need to re-set breakpoint again.
I have proposed a patch to dejagnu to change the order to
1. target $protocol $targetname
2. load
3. set breakpoints at abort and exit
which has been accepted and committed. But I think it's still a good
idea to add the breakpoint re-set in GDB after load.
Jie
More information about the Gdb
mailing list