Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>, Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch, doc RFA] New command-line option -na.
Date: Wed, 15 Dec 2010 01:40:00 -0000	[thread overview]
Message-ID: <AANLkTi=EMyuiERbXYuD=1fQf8ErxrFDGH7c_5Le9p_tz@mail.gmail.com> (raw)
In-Reply-To: <83ei9o209o.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2456 bytes --]

Note: I have removed -na.

On Sat, Dec 11, 2010 at 12:15 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> +Loads any auto-loaded scripts provided by the program being debugged.
>> +@xref{Auto-loading}.
>
> In addition to the same rewording as above, this sounds inaccurate:
> aren't these scripts loaded only as part of loading the debuggee's
> executable file?  If so, we should mention that here, because (AFAIU),
> invoking GDB without any program as the argument won't trigger any
> auto-loading.

Reword per suggestion, but I kinda like the original wording.
The context here is startup, e.g. shared libraries aren't read at this point.
If you wish a different wording, can you provide one?  Thanks.

>>  @table @code
>> -@kindex maint set python auto-load
>> -@item maint set python auto-load [yes|no]
>> -Enable or disable the Python auto-loading feature.
>> -
>> -@kindex maint show python auto-load
>> -@item maint show python auto-load
>> -Show whether Python auto-loading is enabled or disabled.
>> +@kindex set auto-load
>> +@item set auto-load [yes|no]
>> +Enable or disable the auto-loading of scripts.
>> +
>> +@kindex show auto-load
>> +@item show auto-load
>> +Show whether auto-loading is enabled or disabled.
>>  @end table
>
> If we are going to leave this section inside the Python chapter, then
> we should say "auto-load Python scripts" etc. elsewhere, because this
> feature is limited to loading Python scripts, right?

I like what it's in the patch.
There's no reason why one couldn't have non-python auto-loaded
scripts, and there's no reason at the moment for having a different
option to control them.
So I don't want "python" in the option name.
Having it the Python section of the manual is fine for now since
that's all we currently support.

Ok to check in?

2010-12-10  Doug Evans  <dje@google.com>

        Rename "maint set python auto-load" to "set auto-load-scripts".
        * NEWS: Mention it.
        * python/py-auto-load.c (auto_load_scripts): Renamed from
        gdbpy_auto_load.
        (load_auto_scripts_for_objfile): Update.
        (gdbpy_initialize_auto_load): Rename "maint set python auto-load" to
        "set auto-load-scripts".

        doc/
        * gdb.texinfo (Startup): Document auto-loading of scripts during
        startup.
        (Auto-loading): Delete "maint set python auto-load on|off".
        Add "set auto-load-scripts on|off".

[-- Attachment #2: gdb-101214-auto-load-2.patch.txt --]
[-- Type: text/plain, Size: 5858 bytes --]

2010-12-10  Doug Evans  <dje@google.com>

	Rename "maint set python auto-load" to "set auto-load-scripts".
	* NEWS: Mention it.
	* python/py-auto-load.c (auto_load_scripts): Renamed from
	gdbpy_auto_load.
	(load_auto_scripts_for_objfile): Update.
	(gdbpy_initialize_auto_load): Rename "maint set python auto-load" to
	"set auto-load-scripts".

	doc/
	* gdb.texinfo (Startup): Document auto-loading of scripts during
	startup.
	(Auto-loading): Delete "maint set python auto-load on|off".
	Add "set auto-load-scripts on|off".

Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.414
diff -u -p -r1.414 NEWS
--- NEWS	10 Dec 2010 20:33:44 -0000	1.414
+++ NEWS	15 Dec 2010 01:29:46 -0000
@@ -8,6 +8,9 @@
 -data-directory DIR	Specify DIR as the "data-directory".
 			This is mostly for testing purposes.
 
+* The "maint set python auto-load on|off" command has been renamed to
+  "set auto-load-scripts on|off".
+
 * GDB has a new command: "set directories".
   It is like the "dir" command except that it replaces the
   source path list instead of augmenting it.
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.779
diff -u -p -r1.779 gdb.texinfo
--- doc/gdb.texinfo	7 Dec 2010 17:26:03 -0000	1.779
+++ doc/gdb.texinfo	15 Dec 2010 01:29:47 -0000
@@ -1263,6 +1263,23 @@ to the program you are debugging, in the
 @value{GDBN}.
 
 @item
+Loads any auto-loaded scripts when programs or shared-libraries are loaded.
+@xref{Auto-loading}.
+
+If you wish to disable the auto-loading of scripts from a program
+specified on the command line, you must do something like the following:
+
+@smallexample
+$ gdb -ex "set auto-load-scripts off" -ex "file myprogram"
+@end smallexample
+
+The following does not work because the auto-loading is turned off too late:
+
+@smallexample
+$ gdb -ex "set auto-load-scripts off" myprogram
+@end smallexample
+
+@item
 Reads command files specified by the @samp{-x} option.  @xref{Command
 Files}, for more details about @value{GDBN} command files.
 
@@ -23114,13 +23131,13 @@ debugging commands and scripts.
 Auto-loading can be enabled or disabled.
 
 @table @code
-@kindex maint set python auto-load
-@item maint set python auto-load [yes|no]
-Enable or disable the Python auto-loading feature.
-
-@kindex maint show python auto-load
-@item maint show python auto-load
-Show whether Python auto-loading is enabled or disabled.
+@kindex set auto-load-scripts
+@item set auto-load-scripts [yes|no]
+Enable or disable the auto-loading of scripts.
+
+@kindex show auto-load-scripts
+@item show auto-load-scripts
+Show whether auto-loading is enabled or disabled.
 @end table
 
 When reading an auto-loaded file, @value{GDBN} sets the
Index: python/py-auto-load.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-auto-load.c,v
retrieving revision 1.5
diff -u -p -r1.5 py-auto-load.c
--- python/py-auto-load.c	22 Sep 2010 20:00:53 -0000	1.5
+++ python/py-auto-load.c	15 Dec 2010 01:29:47 -0000
@@ -34,7 +34,7 @@
    This is true if we should auto-load python code when an objfile is opened,
    false otherwise.
 
-   Both gdbpy_auto_load && gdbpy_global_auto_load must be true to enable
+   Both auto_load_scripts && gdbpy_global_auto_load must be true to enable
    auto-loading.
 
    This flag exists to facilitate deferring auto-loading during start-up
@@ -82,10 +82,15 @@ struct loaded_script_entry
 };
 
 /* User-settable option to enable/disable auto-loading:
-   maint set python auto-load on|off
-   This is true if we should auto-load python code when an objfile is opened,
-   false otherwise.  */
-static int gdbpy_auto_load = 1;
+   set auto-load-scripts on|off
+   This is true if we should auto-load associated scripts when an objfile
+   is opened, false otherwise.
+   At the moment, this only affects python scripts, but there's no reason
+   one couldn't also have other kinds of auto-loaded scripts, and there's
+   no reason to have them each controlled by a separate flag.
+   So we elide "python" from the name here and in the option.
+   The fact that it lives here is just an implementation detail.  */
+static int auto_load_scripts = 1;
 
 /* Per-program-space data key.  */
 static const struct program_space_data *auto_load_pspace_data;
@@ -404,7 +409,7 @@ auto_load_new_objfile (struct objfile *o
 void
 load_auto_scripts_for_objfile (struct objfile *objfile)
 {
-  if (gdbpy_auto_load && gdbpy_global_auto_load)
+  if (auto_load_scripts && gdbpy_global_auto_load)
     {
       auto_load_objfile_script (objfile, GDBPY_AUTO_FILE_NAME);
       auto_load_section_scripts (objfile, GDBPY_AUTO_SECTION_NAME);
@@ -471,14 +476,15 @@ gdbpy_initialize_auto_load (void)
 
   observer_attach_new_objfile (auto_load_new_objfile);
 
-  add_setshow_boolean_cmd ("auto-load", class_maintenance,
-			   &gdbpy_auto_load, _("\
-Enable or disable auto-loading of Python code when an object is opened."), _("\
-Show whether Python code will be auto-loaded when an object is opened."), _("\
-Enables or disables auto-loading of Python code when an object is opened."),
+  add_setshow_boolean_cmd ("auto-load-scripts", class_support,
+			   &auto_load_scripts, _("\
+Set the debugger's behaviour regarding auto-loaded scripts."), _("\
+Show the debugger's behaviour regarding auto-loaded scripts."), _("\
+If enabled, auto-loaded scripts are loaded when the debugger reads\n\
+an executable or shared library."),
 			   NULL, NULL,
-			   &set_python_list,
-			   &show_python_list);
+			   &setlist,
+			   &showlist);
 
   add_cmd ("section-scripts", class_maintenance, maintenance_print_section_scripts,
 	   _("Print dump of auto-loaded section scripts matching REGEXP."),

  reply	other threads:[~2010-12-15  1:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-11  0:47 Doug Evans
2010-12-11  8:16 ` Eli Zaretskii
2010-12-15  1:40   ` Doug Evans [this message]
2010-12-15  6:05     ` Eli Zaretskii
2010-12-15  6:26       ` Doug Evans
2010-12-15  6:58         ` Eli Zaretskii
2010-12-15  7:09           ` Doug Evans
2010-12-13 18:55 ` Jan Kratochvil
2010-12-13 19:28   ` Doug Evans
2010-12-13 19:36     ` Doug Evans

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='AANLkTi=EMyuiERbXYuD=1fQf8ErxrFDGH7c_5Le9p_tz@mail.gmail.com' \
    --to=dje@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@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