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

Re: [RFC] Clarification for source command execution


> GDB online document says that while source command executing
> command in a file and an error in any command terminates
> execution of the command file, but in case enable, disable,
> enable count, enable once, delete, delete trace and enable delete
> doesn't terminates execution.

Looking at the code, the "No breakpoint number xxx" is not treated
as an error.  This explains why the script does not terminate in
this case.

> 
> See the list of commands in cmd file.
> 
> $ cat /home/waqas/cmd
> enable 1
> disable 1
> enable once 1
> enable count 1 2
> enable delete 3
> delete 1
> delete trace 1
> echo should not reach this line\n
> commands 1
> info thread
> end
> echo should not reach this line as well\n
> 
> Now GDB behavior.
> 
> (gdb) source ~/cmd
> No breakpoint number 1.
> No breakpoint number 1.
> No breakpoint number 1.
> No breakpoint number 2.
> No breakpoint number 3.
> No breakpoint number 1.
> No breakpoint number 1.
> should not reach this line
> No breakpoint number 1.
> ~/cmd:9: Error in sourced command file:
> No breakpoints specified.
> (gdb)
> 
> 
> Execution should stop or not? after 1st line by saying that
> No breakpoint number 1
> ~/cmd:9: Error in source command file:
> One or more breakpoint not found.

Good question. I'm not sure. Perhaps we should simply document
that the commands above do not trigger an error if one of the
breakpoint numbers is invalid. Or, rather than just printing...

        No breakpoint number 1.

... we should perhaps turn it into a warning proper:

        warning: No breakpoint number 1.

That way, we'd maintain the current behavior, but be clear about
the fact that it's not an error.

Just my thoughts, looking forward to hearing other people's.
-- 
Joel


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