This is the mail archive of the gdb-patches@sources.redhat.com 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/rfc] Fix step/next across signals


I've checked this in.

Andrew

Hello,

The attached fixes a bug with step/next across signals. Given:

    Breakpoint at 10 hit
    10    while (!done);
    (gdb) next

when there was a signal pending (that set DONE), GDB would:

Attempt to step of the breakpoint at "10":
- pull all breakpoints
- PT_STEP (to get off the BP instruction)
- get back the signal instead

Attempt to skip the signal handler:
- add a step_resume_breakpoint at "10" the signal return addr
- PT_STEP delivering the signal
- insert all breakpoints (including step_resume)
- PT_CONTINUE the inferior
- get back SIGTRAP from the step_resume breakpoint
- delete the step_resume bp

Go back to doing the next:
- PT_STEP the inferior (breakpoints including "10" still inserted)
- re-hit "10"

the problem is that GDB forgot that it was, at the time of the signal, trying to step off a breakpoint.

The attached patch fixes this, it notes if/when it was stepping off a breakpoint, so that it can return to that task once the step-resume-breakpoint is hit.

I've tested it on a my patched PPC/NetBSD kernel and it KPASSes 1757; and a vanila rhel3u2 system with no test changes.

Since the 1757 KFAILs pass, I've removed them as `obvious'.

comments?
Andrew



Index: testsuite/ChangeLog
2004-08-26  Andrew Cagney  <cagney@gnu.org>

	* gdb.base/sigstep.exp (breakpoint_over_handler): Remove kfail
	gdb/1757.

Index: ChangeLog
2004-08-26  Andrew Cagney  <cagney@gnu.org>

	Fix PR breakpoints/1757.
	* infrun.c (struct execution_control_state): Replace
	remove_breakpoints_on_following_step with
	step_after_step_resume_breakpoint.
	(init_execution_control_state): Update.
	(handle_inferior_event): For signals, when stepping off a
	breakpoint, set step_after_step_resume_breakpoint.  When
	BPSTAT_WHAT_STEP_RESUME, do a single-step off the breakpoint.
	(keep_going): Delete code handling
	remove_breakpoints_on_following_step.



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