public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
@ 2013-11-08 16:39 Will Newton
  2013-11-19 15:08 ` Richard Earnshaw
  0 siblings, 1 reply; 4+ messages in thread
From: Will Newton @ 2013-11-08 16:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Patch Tracking


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.
---
 gdb/arm-tdep.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 1ed21ea..035894c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -4970,17 +4970,9 @@ arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
   CORE_ADDR nextpc;

   if (arm_frame_is_thumb (frame))
-    {
-      nextpc = thumb_get_next_pc_raw (frame, pc);
-      if (nextpc == MAKE_THUMB_ADDR (pc))
-	error (_("Infinite loop detected"));
-    }
+    nextpc = thumb_get_next_pc_raw (frame, pc);
   else
-    {
-      nextpc = arm_get_next_pc_raw (frame, pc);
-      if (nextpc == pc)
-	error (_("Infinite loop detected"));
-    }
+    nextpc = arm_get_next_pc_raw (frame, pc);

   return nextpc;
 }
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
  2013-11-08 16:39 [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message Will Newton
@ 2013-11-19 15:08 ` Richard Earnshaw
  2013-11-19 17:43   ` Pedro Alves
  2013-11-20 11:21   ` Will Newton
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Earnshaw @ 2013-11-19 15:08 UTC (permalink / raw)
  To: Will Newton; +Cc: gdb-patches, Patch Tracking

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.

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

Ok.

R.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
  2013-11-19 15:08 ` Richard Earnshaw
@ 2013-11-19 17:43   ` Pedro Alves
  2013-11-20 11:21   ` Will Newton
  1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2013-11-19 17:43 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: Will Newton, gdb-patches, Patch Tracking

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
  2013-11-19 15:08 ` Richard Earnshaw
  2013-11-19 17:43   ` Pedro Alves
@ 2013-11-20 11:21   ` Will Newton
  1 sibling, 0 replies; 4+ messages in thread
From: Will Newton @ 2013-11-20 11:21 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: gdb-patches, Patch Tracking

On 19 November 2013 15:06, Richard Earnshaw <rearnsha@arm.com> 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.
>
> However, it ought to be the higher levels of GDB that handle this, not
> some random low-level function like get-next-pc.

Thanks, applied.

Single stepping an infinite loop works before and after this patch,
the patch just prevents an error message getting printed on every
step.

-- 
Will Newton
Toolchain Working Group, Linaro

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-20 11:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 16:39 [PATCH] gdb/arm-tdep.c: Remove "Infinite loop detected" error message Will Newton
2013-11-19 15:08 ` Richard Earnshaw
2013-11-19 17:43   ` Pedro Alves
2013-11-20 11:21   ` Will Newton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).