This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: 'conditions' on a breakpoint should default like 'commands'
- To: Jason Molenda <jason-swarelist at molenda dot com>
- Subject: Re: 'conditions' on a breakpoint should default like 'commands'
- From: Fernando Nasser <fnasser at redhat dot com>
- Date: Mon, 10 Sep 2001 08:53:12 -0400
- CC: gdb at sources dot redhat dot com
- Organization: Red Hat Canada
- References: <20010909225921.A16335@shell17.ba.best.com>
I couldn't agree more.
Fernando
Jason Molenda wrote:
>
> The "commands" command in gdb will assume the most recently set
> breakpoint if no breakpoint number is provided. The "condition"
> command in gdb requires a breakpoint number. This seems unnecessarily
> inconsistent. My best guess as to the thinking of the original
> implementer was that users could set the condition on the breakpoint
> line directly, so they wouldn't often be putting a condition on
> the bp right after setting it.
>
> The difference in breakpoints.c is minor; commands_command reads
>
> p = arg;
> bnum = get_number (&p);
>
> Whereas condition_command reads
>
> if (arg == 0)
> error_no_arg ("breakpoint number");
>
> p = arg;
> bnum = get_number (&p);
>
> I checked back through the gdb v3.0 era releases, and these commands
> have always behaved this way--I can't find any historial reason
> for them to act differently. It was the case that get_number () didn't
> exist back then, so maybe that helped to shroud the similarity of the
> two commands.
>
> I'd like to make condition default to the most recent breakpoint
> if no argument is provided. If anyone agrees with this, I'll supply
> a patch to the code, the documentation, and a test case. I don't
> see this as causing problems for existing users -- typing "cond 5"
> will still set a breakpoint on bp #5; the only difference is that
> if you type "cond", gdb will do something whereas it used to return
> an error message.
>
> Thanks,
>
> Jason