public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: gdb@sources.redhat.com
Subject: Proposal: New command "begin"
Date: Thu, 01 Apr 2004 20:37:00 -0000	[thread overview]
Message-ID: <20040401203716.GX888@gnat.com> (raw)

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

             reply	other threads:[~2004-04-01 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01 20:37 Joel Brobecker [this message]
2004-04-06 21:40 ` Andrew Cagney
2004-04-07  7:40   ` Joel Brobecker
2004-04-16  3:44     ` Joel Brobecker
2004-04-07  2:23 Michael Elizabeth Chastain
2004-04-16 15:12 Michael Elizabeth Chastain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040401203716.GX888@gnat.com \
    --to=brobecker@gnat.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).