Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Setting up GDB init files broken in DJGPP
@ 2009-04-14 17:32 Eli Zaretskii
  2009-04-17 17:41 ` Jerome Guitton
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2009-04-14 17:32 UTC (permalink / raw)
  To: Daniel Jacobowitz, Jerome Guitton; +Cc: gdb-patches

AFAICS, this change:

    2009-01-28  Daniel Jacobowitz  <dan@codesourcery.com>
		Jerome Guitton  <guitton@adacore.com>

	    * configure, config.in: Regenerated.
	    * configure.ac: Add --with-system-gdbinit.
	    * main.c (get_init_files): New.
	    (captured_main): Use get_init_files.  Load system gdbinit before
	    $HOME/.gdbinit.
	    (print_gdb_help): Print location of init files.

broke the DJGPP port, in that it now looks for ~/.gdbinit rather than
~/gdb.ini.  (The former is an invalid file name on DOS filesystems.)
So all the gdb.ini files, such as the ones generated while building
GDB and Emacs, are no longer sourced.

The problem is that the change not only introduced a new function
get_init_files and moved the code that looked up the gdbinit file(s)
there from captured_main, but it also caused the code which looks for
these files to be run _before_ initialize_all_files (which is called
inside gdb_init).  In fact, it moved the code even before the
command-line arguments are parsed and acted upon.  The DJGPP build
overrides the default value of gdbinit, assigned in top.c from
GDBINIT_FILENAME, inside init_go32_ops, but that is called in
initialize_all_files, which now is too late.

I've re-read the discussion about this change back in last December,
and I couldn't find anything there that would explain why the order of
the code execution was changed.  Can someone tell whether there were
such reasons, and if so, what they were?  If not, perhaps simply
moving the code after the call to gdb_init is all that's needed to fix
this.

TIA


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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-14 17:32 Setting up GDB init files broken in DJGPP Eli Zaretskii
@ 2009-04-17 17:41 ` Jerome Guitton
  2009-04-17 19:10   ` Eli Zaretskii
  2009-04-22 19:38   ` Joel Brobecker
  0 siblings, 2 replies; 7+ messages in thread
From: Jerome Guitton @ 2009-04-17 17:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Daniel Jacobowitz, gdb-patches

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

Eli Zaretskii (eliz@gnu.org):

> AFAICS, this change:
> 
>     2009-01-28  Daniel Jacobowitz  <dan@codesourcery.com>
> 		Jerome Guitton  <guitton@adacore.com>
> 
> 	    * configure, config.in: Regenerated.
> 	    * configure.ac: Add --with-system-gdbinit.
> 	    * main.c (get_init_files): New.
> 	    (captured_main): Use get_init_files.  Load system gdbinit before
> 	    $HOME/.gdbinit.
> 	    (print_gdb_help): Print location of init files.
> 
> broke the DJGPP port, in that it now looks for ~/.gdbinit rather than
> ~/gdb.ini.  (The former is an invalid file name on DOS filesystems.)

Sorry about that. I confirm that the fix that you suggest is OK:
moving get_init_files before gdb_init was obviously an error. I've
tested the patch in attachment, it works fine and the testsuite showed
no regression on x86-linux. Can you confirm that it fixes the problem
you are seeing?

2009-04-17  Jerome Guitton  <guitton@adacore.com>

	* main.c (captured_main): Move gdbinit lookups after gdb_init.


[-- Attachment #2: main.c.diff --]
[-- Type: text/plain, Size: 1216 bytes --]

Index: gdb/main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.73
diff -u -p -r1.73 main.c
--- gdb/main.c	28 Jan 2009 15:01:00 -0000	1.73
+++ gdb/main.c	17 Apr 2009 17:24:35 -0000
@@ -357,8 +357,6 @@ captured_main (void *data)
 	}
     }
 
-  get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
-
   /* There will always be an interpreter.  Either the one passed into
      this captured main, or one specified by the user at start up, or
      the console.  Initialize the interpreter to the one requested by 
@@ -694,6 +692,11 @@ Excess command line arguments ignored. (
      control of the console via the deprecated_init_ui_hook ().  */
   gdb_init (argv[0]);
 
+  /* Lookup gdbinit files. Note that the gdbinit file name may be overriden
+     during file initialization, so get_init_files should be called after
+     gdb_init.  */
+  get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
+
   /* Do these (and anything which might call wrap_here or *_filtered)
      after initialize_all_files() but before the interpreter has been
      installed.  Otherwize the help/version messages will be eaten by

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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-17 17:41 ` Jerome Guitton
@ 2009-04-17 19:10   ` Eli Zaretskii
  2009-04-22 19:38   ` Joel Brobecker
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2009-04-17 19:10 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: drow, gdb-patches

> Date: Fri, 17 Apr 2009 19:41:13 +0200
> From: Jerome Guitton <guitton@adacore.com>
> Cc: Daniel Jacobowitz <drow@false.org>, gdb-patches@sourceware.org
> 
> I confirm that the fix that you suggest is OK:
> moving get_init_files before gdb_init was obviously an error. I've
> tested the patch in attachment, it works fine and the testsuite showed
> no regression on x86-linux. Can you confirm that it fixes the problem
> you are seeing?

Yes, it does.  Thanks.


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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-17 17:41 ` Jerome Guitton
  2009-04-17 19:10   ` Eli Zaretskii
@ 2009-04-22 19:38   ` Joel Brobecker
  2009-04-22 20:22     ` Jerome Guitton
  1 sibling, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2009-04-22 19:38 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: Eli Zaretskii, Daniel Jacobowitz, gdb-patches

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

> 2009-04-17  Jerome Guitton  <guitton@adacore.com>
> 
> 	* main.c (captured_main): Move gdbinit lookups after gdb_init.

This looks fine, but I propose we move this call further down, past
the blocks that do an early exist if --version or --help is specified,
as well as past the interpreter initialization. If those fail, no point
in spending time computing these files. That also corresponds better
to what used to be done before.

I'm testing the attached patch... (Jerome is supposed to be on holiday)

-- 
Joel

[-- Attachment #2: gdbinit.diff --]
[-- Type: text/x-diff, Size: 1064 bytes --]

commit 9493d644c2a2cb3464cf139515be528a6e140ffe
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Wed Apr 22 12:35:50 2009 -0700

        * main.c (captured_main): Move gdbinit lookups further down,
        making sure it's not called until the basename of the gdbinit file
        has been set.

diff --git a/gdb/main.c b/gdb/main.c
index 86607d3..2f6cd75 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -359,8 +359,6 @@ captured_main (void *data)
 	}
     }
 
-  get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
-
 #ifdef RELOC_SRCDIR
   add_substitute_path_rule (RELOC_SRCDIR,
 			    make_relative_prefix (argv[0], BINDIR,
@@ -778,6 +776,8 @@ Excess command line arguments ignored. (%s%s)\n"),
   quit_pre_print = error_pre_print;
   warning_pre_print = _("\nwarning: ");
 
+  get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
+
   /* Read and execute the system-wide gdbinit file, if it exists.
      This is done *before* all the command line arguments are
      processed; it sets global parameters, which are independent of

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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-22 19:38   ` Joel Brobecker
@ 2009-04-22 20:22     ` Jerome Guitton
  2009-04-22 20:26       ` Joel Brobecker
  0 siblings, 1 reply; 7+ messages in thread
From: Jerome Guitton @ 2009-04-22 20:22 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Eli Zaretskii, Daniel Jacobowitz, gdb-patches

Joel Brobecker (brobecker@adacore.com):

> > 2009-04-17  Jerome Guitton  <guitton@adacore.com>
> > 
> > 	* main.c (captured_main): Move gdbinit lookups after gdb_init.
> 
> This looks fine, but I propose we move this call further down, past
> the blocks that do an early exist if --version or --help is specified,
> as well as past the interpreter initialization. If those fail, no point
> in spending time computing these files. That also corresponds better
> to what used to be done before.

Look out, this should be done before the printing of the help message.
The help message tells the user which gdbinit files will be sourced.


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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-22 20:22     ` Jerome Guitton
@ 2009-04-22 20:26       ` Joel Brobecker
  2009-04-27 10:25         ` Jerome Guitton
  0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2009-04-22 20:26 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: Eli Zaretskii, Daniel Jacobowitz, gdb-patches

> Look out, this should be done before the printing of the help message.
> The help message tells the user which gdbinit files will be sourced.

Ah - I understand, now. Thanks for catching this. Your patch is OK
to commit.

-- 
Joel


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

* Re: Setting up GDB init files broken in DJGPP
  2009-04-22 20:26       ` Joel Brobecker
@ 2009-04-27 10:25         ` Jerome Guitton
  0 siblings, 0 replies; 7+ messages in thread
From: Jerome Guitton @ 2009-04-27 10:25 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Eli Zaretskii, Daniel Jacobowitz, gdb-patches

Joel Brobecker (brobecker@adacore.com):

> > Look out, this should be done before the printing of the help message.
> > The help message tells the user which gdbinit files will be sourced.
> 
> Ah - I understand, now. Thanks for catching this. Your patch is OK
> to commit.

Now commited; thanks.

About the help message, I was actually wrong: get_init_files could be
moved after the handling of --help. print_gdb_help calls
get_init_files as well, and this function would compute gdbinit
locations if they have not been computed yet.  So if you feel that the
call to get_init_files should be moved past the interpreter
initialization, you can go ahead.


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

end of thread, other threads:[~2009-04-27 10:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14 17:32 Setting up GDB init files broken in DJGPP Eli Zaretskii
2009-04-17 17:41 ` Jerome Guitton
2009-04-17 19:10   ` Eli Zaretskii
2009-04-22 19:38   ` Joel Brobecker
2009-04-22 20:22     ` Jerome Guitton
2009-04-22 20:26       ` Joel Brobecker
2009-04-27 10:25         ` Jerome Guitton

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