This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] deleting breakpoints inside of 'commands' (again)
- To: Don Howard <dhoward at redhat dot com>
- Subject: Re: [RFA] deleting breakpoints inside of 'commands' (again)
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Tue, 06 Nov 2001 10:50:13 -0800
- CC: Fernando Nasser <fnasser at redhat dot com>, gdb-patches at sources dot redhat dot com
- Organization: Red Hat
- References: <Pine.LNX.4.33.0111060938060.2672-100000@theotherone>
Don Howard wrote:
>
> On Mon, 5 Nov 2001, Michael Snyder wrote:
>
> [snip]
> > > Good point - I should have caught that. In place of the strncmp()
> > > calls in the previous patch, I've added a call to this:
> > >
> > > /* Walk a list of struct command_lines and try to determine if any
> > > command deletes breakpoints */
> > >
> > > int bpstat_actions_delete_breakpoints (struct command_line * cmd)
> > > {
> > > for (; cmd; cmd = cmd->next)
> > > {
> > > int i;
> > >
> > > if (strncmp (cmd->line, "dele", 4) == 0 ||
> > > strncmp (cmd->line, "clea", 4) == 0)
> > > return 1;
> > >
> > > for (i=0; i<cmd->body_count; i++)
> > > if (bpstat_actions_delete_breakpoints (cmd->body_list[i]))
> > > return 1;
> > > }
> > >
> > > return 0;
> > > }
> > >
> > > Comments?
> >
> > Much better. I'm ready to say let's give it a go. ;-)
> > Michael
> >
>
> Should I take that as an approval?
>
> Also, I'd like to trim the strncmp checks to the shortest match:
>
> if (strncmp (cmd->line, "del", 3) == 0 || /* delete */
> strncmp (cmd->line, "cl", 2) == 0) /* clear */
>
> Is there any problem with that?
I'm not sure -- what if a user-defined command matches that?