Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [RFA/RFC] New command: ``start''
@ 2004-05-18 20:21 Michael Elizabeth Chastain
  0 siblings, 0 replies; 31+ messages in thread
From: Michael Elizabeth Chastain @ 2004-05-18 20:21 UTC (permalink / raw)
  To: brobecker, mec.gnu; +Cc: eliz, gdb-patches

jb> Some programs contain an elaboration phase where some startup code is
jb> executed before the main program is called.  This depends on the
jb> languages used to write your program. In C@t{++} for instance,
jb> constructors for static and global objects are executed before
jb> @code{main} is called.  It is therefore possible that the debugger stops
jb> before reaching the main procedure.  However, the temporary breakpoint
jb> will remain to halt execution.

It works for me!

Michael C


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: [RFA/RFC] New command: ``start''
@ 2004-05-18 19:30 Michael Elizabeth Chastain
  2004-05-18 19:45 ` Joel Brobecker
  0 siblings, 1 reply; 31+ messages in thread
From: Michael Elizabeth Chastain @ 2004-05-18 19:30 UTC (permalink / raw)
  To: brobecker, eliz; +Cc: gdb-patches

Uh, sorry I didn't throw in my two cents earlier, but I am
confused by one clause in this paragraph:

  Some programs contain an elaboration phase where some startup code is
  executed before the main program is called.  This depends on the
  languages used to write your program. In C@t{++} for instance, class
  constructors are executed before @code{main} is called.  It is therefore
  possible that the debugger stops before reaching the main procedure.
  However, the temporary breakpoint will remain to halt execution.

I don't think 'class constructors' is right here.  It's more like
'constructors for static and global objects'.

Other than that, the new doco looks great to me.

Michael C


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [RFA/RFC] New command: ``start''
@ 2004-05-18  2:47 Joel Brobecker
  2004-05-18  6:32 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Joel Brobecker @ 2004-05-18  2:47 UTC (permalink / raw)
  To: gdb-patches

Hello,

As briefly discussed on gdb@ and gdb-patches@, here is a first proposal
for the addition of a new command: ``start''.

I handled the language-dependent issue by adding a new method to the
language vector. I returns a newly allocated string that tells GDB
where to insert the breakpoint. I named it "main_program_name" because
I would expect it to always return the name of a procedure. However,
it can actually return any location expression. So a language could
use a different approach and return something like "*0xdeadbeef" or
"source.c:10" for instance.

The other decision I made was to allow this new method to be undefined
(NULL). In that case, we use "main" as the location where to insert the
temporary breakpoint. I am not too sure about this approach, but I
selected it because it avoids a xstrdup ("main")/xfree sequence.
On the other hand, forcing the method to always be set would make the
implemention clearer, I think, just at the expense of an unnecessary
xstrdup/xfree sequence. I can add a procedure default_main_program_name
that would return a xstrdup of "main". The other option I thought about
was to still allow a NULL method, and then provide a procedure in
language.[hc] get_main_program_name (void) (or should maybe take a
language as argument) that would return the name of the main procedure
name based on the value of the new method (NULL => "main", otherwise
return string from method call).

I am also adding the documentation for this new command.

2004-05-17  Joel Brobecker  <brobecker@gnat.com>

        * language.h (language_defn): New field, la_xmain_procedure_name.
        * language.c (unknown_language_defn): Set new field to NULL.
        (auto_language_defn): Likewise.
        (local_language_defn): Likewise.
        * ada-lang.c (ada_language_defn): Likewise.
        * c-lang.c (c_language_defn): Likewise.
        (cplus_language_defn): Likewise.
        (asm_language_defn): Likewise.
        (minimal_language): Likewise.
        * f-lang.c (f_language_defn): Likewise.
        * jv-lang.c (java_language_defn): Likewise.
        * m2-lang.c (m2_language_defn): Likewise.
        * objc_language (objc_language_defn): Likewise.
        * p-lang.c (pascal_language_defn): Likewise.
        * scm-lang.c (scm_language_defn): Likewise.
        * infcmd.c (kill_if_already_running): New function, extracted
        from run_command().
        (run_command): Replace extracted code by call to
        kill_if_already_running().
        (start_command): New function.
        (_initialize_infcmd): Add "start" command.

2004-05-17  Joel Brobecker  <brobecker@gnat.com>

        * gdb.texinfo (Starting): Document new start command.

Tested on x86-linux.
Comments? OK?

-- 
Joel
Attachment:
start_cmd.diff
Description: Text document
Attachment:
start_doc.diff
Description: Text document


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2004-05-24 23:57 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-18 20:21 [RFA/RFC] New command: ``start'' Michael Elizabeth Chastain
  -- strict thread matches above, loose matches on Subject: below --
2004-05-18 19:30 Michael Elizabeth Chastain
2004-05-18 19:45 ` Joel Brobecker
2004-05-18  2:47 Joel Brobecker
2004-05-18  6:32 ` Eli Zaretskii
2004-05-18 17:05   ` Joel Brobecker
2004-05-18 18:42     ` Eli Zaretskii
2004-05-18 19:03       ` Andrew Cagney
2004-05-19  5:39         ` Eli Zaretskii
2004-05-18 19:22       ` Joel Brobecker
2004-05-18 21:47 ` Daniel Jacobowitz
2004-05-18 22:27   ` Joel Brobecker
2004-05-18 22:41     ` Daniel Jacobowitz
2004-05-19 15:36       ` Joel Brobecker
2004-05-19 15:42         ` Daniel Jacobowitz
2004-05-19 16:10           ` Joel Brobecker
2004-05-20  1:01           ` Joel Brobecker
2004-05-20  5:29             ` Eli Zaretskii
2004-05-20 13:46             ` Daniel Jacobowitz
2004-05-20 16:03               ` Joel Brobecker
2004-05-20 17:14                 ` Daniel Jacobowitz
2004-05-20 20:33                   ` Paul Gilliam
2004-05-20 22:12                   ` Joel Brobecker
2004-05-21  0:26                     ` Daniel Jacobowitz
2004-05-21  1:31                       ` Joel Brobecker
2004-05-24 22:24                         ` Daniel Jacobowitz
2004-05-24 23:57                           ` Joel Brobecker
2004-05-19 14:30 ` Andrew Cagney
2004-05-19 15:39   ` Joel Brobecker
2004-05-19 20:02     ` Eli Zaretskii
2004-05-21 18:57       ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox