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

Proposal: New command "begin"


Hello,

There is a command that we have been using for quite a while for Ada,
which could be useful to all languages, so I am proposing the addition
of this command for all languages. The purpose of this message is to
start a discussion regarding this command, whether it would be desirable
as a command available for all language, and if yes, then what its
user interface and effect (semantics) should be. The actual
implementation will be discussed separately.

New command: ``begin''
======================

<<
Depending on the language, the name of the main procedure can vary.
With languages such as C or C++, the main procedure name is always
main(), but other languages such as Ada do not require a specific
name for their main procedure. The debugger provides a convenient
way to begin the execution of the program and to stop at the beginning
of the main procedure, depending on the language used.

begin

    Does the equivalent of setting a temporary breakpoint at the
    beginning of the main procedure and then performing run. Some
    programs contain an elaboration phase that will be performed before
    the main procedure is reached, and it is possible that the debugger
    will stop before reaching the main procedure. However, the temporary
    breakpoint will remain to halt execution.

It is sometimes necessary to debug the program during elaboration. In
these cases, using the begin command would stop the execution of your
program too late, as the program would have already completed the
elaboration phase. Under these circumstances, insert breakpoints in
your elaboration code before running your program.
>>

So, for a language such as C, this command would only be a shortcut
for "tbreak main; run". I am not completely sure on how elaboration
is performed in C++, but I think it's done before procedure main()
is called, so "begin" would also be the equivalent of "tbreak main;
run" as well. How about Objective-C? Fortran? What should we do
for Asm? For Ada, we use that command to search the executable for
the name of the main program name, and then insert a breakpoint
there.

For the "minimal" language and "asm", I would suggest that we do the
same as in C, which is to tbreak on main and then run.

Opinions?
-- 
Joel


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