This is the mail archive of the gdb-prs@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]

breakpoints/2544: Assertion failure in insert_single_step_breakpoint in breakpoint.c


>Number:         2544
>Category:       breakpoints
>Synopsis:       Assertion failure in insert_single_step_breakpoint in breakpoint.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 27 16:48:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     ARC International
>Release:        6.8
>Organization:
>Environment:
Linux
>Description:
The function insert_single_step_breakpoint may be called twice from the architecture-specific software_single_step function: once to set a breakpoint after the instruction that is to be stepped, and once to set a breakpoint on the instruction that is the destination of that instruction, if it is a branch.

If the second breakpoint set attempt fails (e.g. because an invalid target address has been given), the first breakpoint is left set; if insert_single_step_breakpoint is then called again twice from another invocation of software_single_step, it tries to use the array element single_step_breakpoints[1] twice (as element [0] is non-NULL), and the assertion "single_step_breakpoints[1] == NULL" fails on the second attempt.
>How-To-Repeat:

>Fix:
Change the code in the insert_single_step_breakpoint function from

   if (*bpt_p == NULL)
     error (_("Could not insert single-step breakpoint at 0x%s"),
            paddr_nz (next_pc));


to

   if (*bpt_p == NULL)
     {
       if (single_step_breakpoints[0] != NULL)
         remove_single_step_breakpoints ();

       error (_("Could not insert single-step breakpoint at 0x%s"),
              paddr_nz (next_pc));
     }

>Release-Note:
>Audit-Trail:
>Unformatted:


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