public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* -nx and .gdbtkinit
@ 2005-11-18 12:19 Andrew STUBBS
  2005-11-18 22:44 ` Keith Seitz
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew STUBBS @ 2005-11-18 12:19 UTC (permalink / raw)
  To: insight

Hi all,

The GDB -nx option currently causes Insight to ignore the .gdbtkinit (or 
gdbtk.ini) file.

This is a problem for me because I need to disable .gdbinit, but wish to 
continue using .gdbtkinit.

Why is it done this way? I am told .inputrc is always read, no matter what.

Would it be acceptable to totally remove this 'feature'? Or at least 
unhook it from -nx somehow?

I had posted an alternative solution (-nx-except-gdbtkinit) to 
gdb-patches here 
http://sources.redhat.com/ml/gdb-patches/2005-11/msg00233.html, but that 
suggestion has not been met with much approval.

Any other suggestions?

Thanks

Andrew Stubbs

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

* Re: -nx and .gdbtkinit
  2005-11-18 12:19 -nx and .gdbtkinit Andrew STUBBS
@ 2005-11-18 22:44 ` Keith Seitz
  2005-11-18 23:36   ` Bruce Korb
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Keith Seitz @ 2005-11-18 22:44 UTC (permalink / raw)
  To: Andrew STUBBS; +Cc: insight

Andrew STUBBS wrote:

> The GDB -nx option currently causes Insight to ignore the .gdbtkinit (or 
> gdbtk.ini) file.

Correct.

> This is a problem for me because I need to disable .gdbinit, but wish to 
> continue using .gdbtkinit.

Eeew... Ummm... Hmmm...

> Why is it done this way? I am told .inputrc is always read, no matter what.

Because insight is gdb. :-)

> Would it be acceptable to totally remove this 'feature'? Or at least 
> unhook it from -nx somehow?

Yeah, I think you should be able to do something for insight. The 
problem is adding new command-line options to gdb for insight will be 
problematic (to be polite), since gdb still greedily hoards all options 
processing. [I once started building a patch to separate this out...]

> I had posted an alternative solution (-nx-except-gdbtkinit) to 
> gdb-patches here 
> http://sources.redhat.com/ml/gdb-patches/2005-11/msg00233.html, but that 
> suggestion has not been met with much approval.
> 
> Any other suggestions?

There are three options that come to me immediately. First is what 
you've proposed (new startup option to gdb), which probably isn't going 
to get accepted.

Next is a new environment variable (GDBTK_FORCE_READ_PREFERENCES or 
something or other). Add a check to prefs_read in prefs.tcl.

Finally, just disable the check for ignoring preferences in the same 
procedure (prefs_read in prefs.tcl).

I wish I could be more helpful. Sorry.

Keith

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

* Re: -nx and .gdbtkinit
  2005-11-18 22:44 ` Keith Seitz
@ 2005-11-18 23:36   ` Bruce Korb
  2005-11-19  0:14     ` Bruce Korb
                       ` (2 more replies)
  2005-11-21 11:56   ` Andrew STUBBS
  2005-11-29 11:12   ` [PATCH] INSIGHT_FORCE_READ_PREFERENCES Andrew STUBBS
  2 siblings, 3 replies; 12+ messages in thread
From: Bruce Korb @ 2005-11-18 23:36 UTC (permalink / raw)
  To: insight; +Cc: Keith Seitz, Andrew STUBBS, insight

What is the processing order of these files?

Another way of putting it: could not the ``-nx'' option be
added to the .gdbtkinit file and cause it to inhibit .gdbinit?
I stubbed my toe on this some time back and it did take some
bother to "get it right".....

Cheers - Bruce

On Friday 18 November 2005 02:44 pm, Keith Seitz wrote:
> Andrew STUBBS wrote:
> 
> > The GDB -nx option currently causes Insight to ignore the .gdbtkinit (or 
> > gdbtk.ini) file.
> 
> Correct.
> 
> > This is a problem for me because I need to disable .gdbinit, but wish to 
> > continue using .gdbtkinit.
> 
> Eeew... Ummm... Hmmm...

> > Would it be acceptable to totally remove this 'feature'? Or at least 
> > unhook it from -nx somehow?
> 
> Yeah, I think you should be able to do something for insight. The 
> problem is adding new command-line options to gdb for insight will be 
> problematic (to be polite), since gdb still greedily hoards all options 
> processing. [I once started building a patch to separate this out...]

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

* Re: -nx and .gdbtkinit
  2005-11-18 23:36   ` Bruce Korb
@ 2005-11-19  0:14     ` Bruce Korb
  2005-11-19 16:01     ` Keith Seitz
  2005-11-21 19:35     ` Andrew STUBBS
  2 siblings, 0 replies; 12+ messages in thread
From: Bruce Korb @ 2005-11-19  0:14 UTC (permalink / raw)
  To: insight; +Cc: Keith Seitz, Andrew STUBBS, insight

What is the processing order of these files?

Another way of putting it: could not the ``-nx'' option be
added to the .gdbtkinit file and cause it to inhibit .gdbinit?
I stubbed my toe on this some time back and it did take some
bother to "get it right".....

Cheers - Bruce

On Friday 18 November 2005 02:44 pm, Keith Seitz wrote:
> Andrew STUBBS wrote:
> 
> > The GDB -nx option currently causes Insight to ignore the .gdbtkinit (or 
> > gdbtk.ini) file.
> 
> Correct.
> 
> > This is a problem for me because I need to disable .gdbinit, but wish to 
> > continue using .gdbtkinit.
> 
> Eeew... Ummm... Hmmm...

> > Would it be acceptable to totally remove this 'feature'? Or at least 
> > unhook it from -nx somehow?
> 
> Yeah, I think you should be able to do something for insight. The 
> problem is adding new command-line options to gdb for insight will be 
> problematic (to be polite), since gdb still greedily hoards all options 
> processing. [I once started building a patch to separate this out...]

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

* Re: -nx and .gdbtkinit
  2005-11-18 23:36   ` Bruce Korb
  2005-11-19  0:14     ` Bruce Korb
@ 2005-11-19 16:01     ` Keith Seitz
  2005-11-21 19:35     ` Andrew STUBBS
  2 siblings, 0 replies; 12+ messages in thread
From: Keith Seitz @ 2005-11-19 16:01 UTC (permalink / raw)
  To: Bruce Korb; +Cc: insight, andrew.stubbs

Bruce Korb wrote:
> What is the processing order of these files?
> 
> Another way of putting it: could not the ``-nx'' option be
> added to the .gdbtkinit file and cause it to inhibit .gdbinit?
> I stubbed my toe on this some time back and it did take some
> bother to "get it right".....

You may be right!

When -nx is passed to gdb, gdb's option processing simply set the global 
inhibit_gdbinit (in main.c). The next thing that happens is that 
gdb_init is called (which I believe will call gdbtk_init in gdbtk.c 
eventually).

It is here that ::GDBStartup(inhibit_prefs) is set. When insight is done 
initializing (including reading preferences), it goes back to 
captured_main (in main.c), and gdb will eventually check inhibit_gdbinit 
and read preferences.

So, yes, you could add a preference to insight & .gdbtkinit/gdbtk.ini to 
   inhibit reading gdb preferences (aka, set inhibit_gdbinit in main.c).

Good catch!
Keith

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

* Re: -nx and .gdbtkinit
  2005-11-18 22:44 ` Keith Seitz
  2005-11-18 23:36   ` Bruce Korb
@ 2005-11-21 11:56   ` Andrew STUBBS
  2005-11-28 18:50     ` Keith Seitz
  2005-11-29 11:12   ` [PATCH] INSIGHT_FORCE_READ_PREFERENCES Andrew STUBBS
  2 siblings, 1 reply; 12+ messages in thread
From: Andrew STUBBS @ 2005-11-21 11:56 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

Keith Seitz wrote:
> There are three options that come to me immediately. First is what 
> you've proposed (new startup option to gdb), which probably isn't going 
> to get accepted.

As you say, I already tried that without success.

> Next is a new environment variable (GDBTK_FORCE_READ_PREFERENCES or 
> something or other). Add a check to prefs_read in prefs.tcl.

OK, that would solve my problem quite nicely. What do others think?

> Finally, just disable the check for ignoring preferences in the same 
> procedure (prefs_read in prefs.tcl).

This would also work for me. Does anybody use -nx to disable .gdbtkinit?

Thanks

Andrew Stubbs

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

* Re: -nx and .gdbtkinit
  2005-11-18 23:36   ` Bruce Korb
  2005-11-19  0:14     ` Bruce Korb
  2005-11-19 16:01     ` Keith Seitz
@ 2005-11-21 19:35     ` Andrew STUBBS
  2005-11-24 18:54       ` Andrew STUBBS
  2 siblings, 1 reply; 12+ messages in thread
From: Andrew STUBBS @ 2005-11-21 19:35 UTC (permalink / raw)
  To: Bruce Korb; +Cc: insight, Keith Seitz, insight

Bruce Korb wrote:
> What is the processing order of these files?
> 
> Another way of putting it: could not the ``-nx'' option be
> added to the .gdbtkinit file and cause it to inhibit .gdbinit?
> I stubbed my toe on this some time back and it did take some
> bother to "get it right".....

This might be useful for others, but it would not solve the problem for 
me - I would need a different '-nx' solution for gdb and insight, which 
is not what I want.

Thanks for the suggestion though.

Andrew Stubbs

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

* Re: -nx and .gdbtkinit
  2005-11-21 19:35     ` Andrew STUBBS
@ 2005-11-24 18:54       ` Andrew STUBBS
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew STUBBS @ 2005-11-24 18:54 UTC (permalink / raw)
  To: Bruce Korb; +Cc: insight, Keith Seitz, insight

Bruce Korb wrote:
> What is the processing order of these files?
> 
> Another way of putting it: could not the ``-nx'' option be
> added to the .gdbtkinit file and cause it to inhibit .gdbinit?
> I stubbed my toe on this some time back and it did take some
> bother to "get it right".....

This might be useful for others, but it would not solve the problem for 
me - I would need a different '-nx' solution for gdb and insight, which 
is not what I want.

Thanks for the suggestion though.

Andrew Stubbs

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

* Re: -nx and .gdbtkinit
  2005-11-21 11:56   ` Andrew STUBBS
@ 2005-11-28 18:50     ` Keith Seitz
  0 siblings, 0 replies; 12+ messages in thread
From: Keith Seitz @ 2005-11-28 18:50 UTC (permalink / raw)
  To: Andrew STUBBS; +Cc: insight

Andrew STUBBS wrote:
> Keith Seitz wrote:
>> Finally, just disable the check for ignoring preferences in the same 
>> procedure (prefs_read in prefs.tcl).
> 
> 
> This would also work for me. Does anybody use -nx to disable .gdbtkinit?

I do use that occasionally...

Keith

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

* [PATCH] INSIGHT_FORCE_READ_PREFERENCES
  2005-11-18 22:44 ` Keith Seitz
  2005-11-18 23:36   ` Bruce Korb
  2005-11-21 11:56   ` Andrew STUBBS
@ 2005-11-29 11:12   ` Andrew STUBBS
  2005-12-04  0:01     ` Keith Seitz
  2 siblings, 1 reply; 12+ messages in thread
From: Andrew STUBBS @ 2005-11-29 11:12 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

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

Keith Seitz wrote:
> There are three options that come to me immediately. First is what 
> you've proposed (new startup option to gdb), which probably isn't going 
> to get accepted.
> 
> Next is a new environment variable (GDBTK_FORCE_READ_PREFERENCES or 
> something or other). Add a check to prefs_read in prefs.tcl.
> 
> Finally, just disable the check for ignoring preferences in the same 
> procedure (prefs_read in prefs.tcl).

1 and 3 do not seem possible. The GDB maintainers are not happy with a 
new option for this and some people do use -nx to disable .gdbtkinit.

Therefore, here is a patch for option 2.

I have used the variable name INSIGHT_FORCE_READ_PREFERENCES. I prefer 
INSIGHT to GDBTK because users will know what that means.

If the patch is OK, will I be permitted to check it in myself? I have 
'write after approval' permission for GDB, but I know that doesn't 
extend to other projects (GCC, Binutils etc.) but I'm not sure about 
Insight. If not, it would be easier for somebody else to commit this one 
little patch for me.

Thanks

Andrew Stubbs

[-- Attachment #2: force_read_prefs.patch --]
[-- Type: text/plain, Size: 798 bytes --]

2005-11-24  Andrew Stubbs  <andrew.stubbs@st.com>

	* library/prefs.tcl (pref_read): Read preferences file if environment
	variable INSIGHT_FORCE_READ_PREFERENCES is set (regardless of -nx).

Index: src/gdb/gdbtk/library/prefs.tcl
===================================================================
--- src.orig/gdb/gdbtk/library/prefs.tcl	2005-11-24 17:56:46.000000000 +0000
+++ src/gdb/gdbtk/library/prefs.tcl	2005-11-24 18:43:48.000000000 +0000
@@ -50,7 +50,8 @@ proc pref_read {} {
     set prefs_init_filename ".gdbtkinit"
   }
 
-  if {!$GDBStartup(inhibit_prefs)} {
+  if {!$GDBStartup(inhibit_prefs) \
+      || [info exists env(INSIGHT_FORCE_READ_PREFERENCES)]} {
     set file_opened 0
     if {[file exists $prefs_init_filename]} {
       if {[catch {open $prefs_init_filename r} fd]} {

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

* Re: [PATCH] INSIGHT_FORCE_READ_PREFERENCES
  2005-11-29 11:12   ` [PATCH] INSIGHT_FORCE_READ_PREFERENCES Andrew STUBBS
@ 2005-12-04  0:01     ` Keith Seitz
  2005-12-04  0:53       ` Andrew STUBBS
  0 siblings, 1 reply; 12+ messages in thread
From: Keith Seitz @ 2005-12-04  0:01 UTC (permalink / raw)
  To: Andrew STUBBS; +Cc: insight

Andrew STUBBS wrote:

> Therefore, here is a patch for option 2.

Looks good.

> I have used the variable name INSIGHT_FORCE_READ_PREFERENCES. I prefer 
> INSIGHT to GDBTK because users will know what that means.

Yes, I really should switch all the GDBTK_* ones over, too. :-)

> If the patch is OK, will I be permitted to check it in myself? I have 
> 'write after approval' permission for GDB, but I know that doesn't 
> extend to other projects (GCC, Binutils etc.) but I'm not sure about 
> Insight. If not, it would be easier for somebody else to commit this one 
> little patch for me.

AFAIAC, having write privileges to gdb is good enough. You should check 
in your patch. Don't forget to update the environment variables section 
in the README.

Thanks!
Keith

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

* Re: [PATCH] INSIGHT_FORCE_READ_PREFERENCES
  2005-12-04  0:01     ` Keith Seitz
@ 2005-12-04  0:53       ` Andrew STUBBS
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew STUBBS @ 2005-12-04  0:53 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

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

Keith Seitz wrote:
> AFAIAC, having write privileges to gdb is good enough. You should check 
> in your patch. Don't forget to update the environment variables section 
> in the README.

Thanks. I have committed the attached.

Andrew Stubbs

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2101 bytes --]

Index: gdb/gdbtk/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/ChangeLog,v
retrieving revision 1.372
diff -u -p -r1.372 ChangeLog
--- gdb/gdbtk/ChangeLog	11 Nov 2005 17:19:06 -0000	1.372
+++ gdb/gdbtk/ChangeLog	29 Nov 2005 10:58:48 -0000
@@ -1,3 +1,9 @@
+2005-11-29  Andrew Stubbs  <andrew.stubbs@st.com>
+
+	* library/prefs.tcl (pref_read): Read preferences file if environment
+	variable INSIGHT_FORCE_READ_PREFERENCES is set (regardless of -nx).
+	* README: Mention INSIGHT_FORCE_READ_PREFERENCES.
+
 2005-11-11  Keith Seitz  <keiths@redhat.com>
 
 	From Spencer Oliver <spencer.oliver@anglia.com>:
Index: gdb/gdbtk/README
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/README,v
retrieving revision 1.3
diff -u -p -r1.3 README
--- gdb/gdbtk/README	12 Sep 2005 16:00:36 -0000	1.3
+++ gdb/gdbtk/README	29 Nov 2005 10:58:48 -0000
@@ -72,6 +72,9 @@ install and the source trees.
 	GDBTK_DEBUGFILE		Filename to send debug output
 	GDBTK_TEST_RUNNING	Testsuite variable. See gdb/testsuite/gdb.gdbtk/README
 				for more information.
+	INSIGHT_FORCE_READ_PREFERENCES
+				If set, read .gdbtkinit (or gdb.ini on windows)
+				even when -nx is passed to GDB.
 
 All of the environment variables for controlling Insight are well documented
 in gdb/gdbtk/library/main.tcl. Search for "env" to find them all.
Index: gdb/gdbtk/library/prefs.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
retrieving revision 1.30
diff -u -p -r1.30 prefs.tcl
--- gdb/gdbtk/library/prefs.tcl	27 Aug 2004 23:13:14 -0000	1.30
+++ gdb/gdbtk/library/prefs.tcl	29 Nov 2005 10:58:48 -0000
@@ -50,7 +50,8 @@ proc pref_read {} {
     set prefs_init_filename ".gdbtkinit"
   }
 
-  if {!$GDBStartup(inhibit_prefs)} {
+  if {!$GDBStartup(inhibit_prefs) \
+      || [info exists env(INSIGHT_FORCE_READ_PREFERENCES)]} {
     set file_opened 0
     if {[file exists $prefs_init_filename]} {
       if {[catch {open $prefs_init_filename r} fd]} {

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

end of thread, other threads:[~2005-11-29 11:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-18 12:19 -nx and .gdbtkinit Andrew STUBBS
2005-11-18 22:44 ` Keith Seitz
2005-11-18 23:36   ` Bruce Korb
2005-11-19  0:14     ` Bruce Korb
2005-11-19 16:01     ` Keith Seitz
2005-11-21 19:35     ` Andrew STUBBS
2005-11-24 18:54       ` Andrew STUBBS
2005-11-21 11:56   ` Andrew STUBBS
2005-11-28 18:50     ` Keith Seitz
2005-11-29 11:12   ` [PATCH] INSIGHT_FORCE_READ_PREFERENCES Andrew STUBBS
2005-12-04  0:01     ` Keith Seitz
2005-12-04  0:53       ` Andrew STUBBS

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).