This is the mail archive of the gdb-patches@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: [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message.


On 11/19/2013 03:06 PM, Richard Earnshaw wrote:
> On 08/11/13 16:34, Will Newton wrote:
>>
>> Since as far back as the beginning of the sourceware repository
>> the ARM port has printed an error "Infinite loop detected" when
>> the next_pc calculated is the same as the current one, for example
>> when encountering a branch to the current PC address.
>>
>> This causes the test gdb.base/random-signal.exp as the error message
>> is not expected. I have not been able to find a good reason for the
>> message to be here so remove it and let the test pass.
>>
>> gdb/ChangeLog:
>>
>> 2013-11-08  Will Newton  <will.newton@linaro.org>
>>
>> 	* arm-tdep.c (arm_get_next_pc): Remove "Infinite loop detected"
>> 	error message.
> 
> I guess the reasoning for this is that you can't single-step a
> 'branch-to-self' instruction, since the next instruction (where the new
> breakpoint has to go) is the same as the current instruction.

You should.  It should stop again in the same place.

> However, it ought to be the higher levels of GDB that handle this, not
> some random low-level function like get-next-pc.
> 

I just tried it on x86-64 (on a gdb branch that makes x86 use
software single-step), and it works as expected:

(gdb) disassemble
Dump of assembler code for function main:
   0x000000000040049c <+0>:     push   %rbp
   0x000000000040049d <+1>:     mov    %rsp,%rbp
=> 0x00000000004004a0 <+4>:     jmp    0x4004a0 <main+4>
   0x00000000004004a2 <+6>:     pop    %rbp
   0x00000000004004a3 <+7>:     retq
End of assembler dump.
(gdb) si
6               asm ("here: jmp here");
(gdb) set debug infrun 1
(gdb) si
infrun: clear_proceed_status_thread (process 29432)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 29432] at 0x4004a0
next pc: 0x4004a0 ==> 0x4004a0
infrun: inserting single-step breakpoint at 0x4004a0
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun:   29432 [process 29432],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4004a0
infrun: stepi/nexti
infrun: stop_stepping
6               asm ("here: jmp here");
(gdb)

-- 
Pedro Alves


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