Kindly pinging.

Thanks!

--Mohamed

 



From: Mohamed Bouhaouel
Sent: Friday, October 2, 2026 4:35 PM
To: gdb-patches@sourceware.org
Cc: abdul.b.ijaz@intel.com; mohamed.bouhaouel@intel.com
Subject: Re: [PATCH 1/1] gdb, infcall, breakpoint: Handle cycles in conditional expr evaluation

Take the following scenario: (gdb) break foo if foo (1) == 2 (gdb) run The program stops at 'foo', then GDB tries to evaluate the condition. The condition triggers an inferior call of 'foo', which causes a stop at 'foo' again, and GDB is stuck in this infinite cycle. The same issue exists also for indirect cycles, e.g., (gdb) break foo if bar (1) (gdb) break bar if foo (1) (gdb) run To avoid this, check for cycles just before evaluating a breakpoint condition. If a breakpoint is hit again while its own condition is being evaluated, the evaluation of that condition is aborted with an error message. With the patch, the behavior becomes: (gdb) break foo if foo (1) == 2 Breakpoint 2 at 0x55555555514c: file infcall-from-bp-cond-cycle.c, line 27. (gdb) continue Continuing. Error in testing condition for breakpoint 2: Aborting expression evaluation for the conditional bp: A cycle was detected during the evaluation. Breakpoint 2, foo (a=1) at infcall-from-bp-cond-cycle.c:27 27 return a + add_one (a); Error in testing condition for breakpoint 2: The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function (foo) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) backtrace #0 foo (a=1) at infcall-from-bp-cond-cycle.c:27 #1

________________________________________

Intel Deutschland GmbH

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany

Tel: +49 (89) 99143-0

www.intel.de

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.