Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] win32: bfd_cache_close after kill
@ 2004-05-24 10:50 Jerome Guitton
  2004-05-24 17:07 ` Jerome Guitton
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jerome Guitton @ 2004-05-24 10:50 UTC (permalink / raw)
  To: gdb-patches

When the inferior is killed, it is safe the release the different file
handles that BFD keeps open. It is particularly useful on Win32 (and
presumably on HP UX) to be able to recompile and restart a new debugging
session without quitting GDB...

Tested on i686 linux, no regression. I do not know if it is possible to write
a test for this feature with the DejaGnu framework...

OK to apply? Comments?

-- 
Jerome
Attachment:
inflow.c.dif
Description: Text document


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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-05-24 10:50 [RFA] win32: bfd_cache_close after kill Jerome Guitton
@ 2004-05-24 17:07 ` Jerome Guitton
  2004-05-25  9:24 ` Jerome Guitton
  2004-06-17 12:21 ` Jerome Guitton
  2 siblings, 0 replies; 12+ messages in thread
From: Jerome Guitton @ 2004-05-24 17:07 UTC (permalink / raw)
  To: gdb-patches

Jerome Guitton (guitton@act-europe.fr):

> OK to apply? Comments?

Not OK to apply, this patch is obviously incomplete ;-)
I will not have time to fix it today, I will do it tomorrow. In the meantime,
don't bother looking at it.

-- 
Jerome


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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-05-24 10:50 [RFA] win32: bfd_cache_close after kill Jerome Guitton
  2004-05-24 17:07 ` Jerome Guitton
@ 2004-05-25  9:24 ` Jerome Guitton
       [not found]   ` <40B4F5A2.9000708@gnu.org>
  2004-06-17 12:21 ` Jerome Guitton
  2 siblings, 1 reply; 12+ messages in thread
From: Jerome Guitton @ 2004-05-25  9:24 UTC (permalink / raw)
  To: gdb-patches

Jerome Guitton (guitton@act-europe.fr):

> 
> When the inferior is killed, it is safe the release the different file
> handles that BFD keeps open. It is particularly useful on Win32 (and
> presumably on HP UX) to be able to recompile and restart a new debugging
> session without quitting GDB...
> 
> Tested on i686 linux, no regression. I do not know if it is possible to write
> a test for this feature with the DejaGnu framework...

With the complete patch... Comments?

Attachment:
inflow.c.dif
Description: Text document


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

* Re: [RFA] win32: bfd_cache_close after kill
       [not found]   ` <40B4F5A2.9000708@gnu.org>
@ 2004-06-01  9:26     ` Jerome Guitton
  2004-06-08 19:49       ` Andrew Cagney
  0 siblings, 1 reply; 12+ messages in thread
From: Jerome Guitton @ 2004-06-01  9:26 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney (cagney@gnu.org):

> Hmm, unstead of waiting until kill should GDB simply do this when 
> finished processing each objfile?  Users also complain that they can't 
> rebuild their executable while GDB is debugging.

Agreed.

> BFD might also be ok with a new bfd_cache_close_all (void) method - 
> simplify the code needed to do the close letting us put calls in more 
> places.

That is an interesting idea, I will work on that. Where shall I submit BFD
patches? GDB and binutils mailing lists?

-- 
Jerome


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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-06-01  9:26     ` Jerome Guitton
@ 2004-06-08 19:49       ` Andrew Cagney
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2004-06-08 19:49 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches

> That is an interesting idea, I will work on that. Where shall I submit BFD
> patches? GDB and binutils mailing lists?

binutils (but cc gdb if you want I guess).  You could also include a URL 
to this thread to give it context.

Andrew



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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-05-24 10:50 [RFA] win32: bfd_cache_close after kill Jerome Guitton
  2004-05-24 17:07 ` Jerome Guitton
  2004-05-25  9:24 ` Jerome Guitton
@ 2004-06-17 12:21 ` Jerome Guitton
  2004-06-17 20:13   ` Andrew Cagney
  2 siblings, 1 reply; 12+ messages in thread
From: Jerome Guitton @ 2004-06-17 12:21 UTC (permalink / raw)
  To: gdb-patches

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


> When the inferior is killed, it is safe the release the different file
> handles that BFD keeps open. It is particularly useful on Win32 (and
> presumably on HP UX) to be able to recompile and restart a new debugging
> session without quitting GDB...

New implementation, using bfd_cache_close_all. No regression on i686
linux. OK to apply?

-- 
Jerome

[-- Attachment #2: inflow.c.dif --]
[-- Type: text/plain, Size: 1563 bytes --]

2004-06-17  Jerome Guitton  <guitton@gnat.com>

	* inflow.c (kill_command): release file handles in BFD.
	* Makefile.in: Update inflow.c's dependencies.

Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.22
diff -u -p -r1.22 inflow.c
--- inflow.c	28 Apr 2004 16:36:25 -0000	1.22
+++ inflow.c	17 Jun 2004 12:16:08 -0000
@@ -21,6 +21,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "bfd.h"
 #include "frame.h"
 #include "inferior.h"
 #include "command.h"
@@ -597,6 +598,8 @@ kill_command (char *arg, int from_tty)
       else
 	print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
     }
+
+  bfd_cache_close_all ();
 }
 \f
 /* Call set_sigint_trap when you need to pass a signal on to an attached
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.587
diff -u -p -r1.587 Makefile.in
--- Makefile.in	14 Jun 2004 20:40:39 -0000	1.587
+++ Makefile.in	17 Jun 2004 12:16:08 -0000
@@ -1964,7 +1964,7 @@ inf-loop.o: inf-loop.c $(defs_h) $(infer
 	$(event_top_h) $(inf_loop_h) $(remote_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
 	$(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
-	$(inflow_h)
+	$(inflow_h) $(bfd_h)
 infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
 	$(gdb_string_h) $(regcache_h) $(gdb_wait_h) $(command_h) \
 	$(gdb_dirent_h) $(gdbcore_h) $(gdb_stat_h)

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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-06-17 12:21 ` Jerome Guitton
@ 2004-06-17 20:13   ` Andrew Cagney
  2004-06-24 10:52     ` Jerome Guitton
  2004-07-29 14:04     ` Jerome Guitton
  0 siblings, 2 replies; 12+ messages in thread
From: Andrew Cagney @ 2004-06-17 20:13 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches

>>When the inferior is killed, it is safe the release the different file
>>> handles that BFD keeps open. It is particularly useful on Win32 (and
>>> presumably on HP UX) to be able to recompile and restart a new debugging
>>> session without quitting GDB...
> 
> 
> New implementation, using bfd_cache_close_all. No regression on i686
> linux. OK to apply?

Can it now go in the symbol-table reader that opened the file?

Andrew



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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-06-17 20:13   ` Andrew Cagney
@ 2004-06-24 10:52     ` Jerome Guitton
  2004-07-29 14:04     ` Jerome Guitton
  1 sibling, 0 replies; 12+ messages in thread
From: Jerome Guitton @ 2004-06-24 10:52 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney (cagney@gnu.org):

> >>When the inferior is killed, it is safe the release the different file
> >>>handles that BFD keeps open. It is particularly useful on Win32 (and
> >>>presumably on HP UX) to be able to recompile and restart a new debugging
> >>>session without quitting GDB...
> >
> >
> >New implementation, using bfd_cache_close_all. No regression on i686
> >linux. OK to apply?
> 
> Can it now go in the symbol-table reader that opened the file?

Andrew,

sorry for this late answer, it's hard to find some time these
days... The problem is that I tried to do the change in the
symbol-table reader, but I have several regressions that I need to
investigate before submitting a patch. I am afraid that I won't have
much time to look at them in the coming days, but I will ASAP.

In the meantime, maybe we can integrate the easy part (kill). I think it is
worth it, the documentation already refers to this feature:

"The kill command is also useful if you wish to recompile and relink
your program, since on many systems it is impossible to modify an
executable file while it is running in a process. In this case, when
you next type run, GDB notices that the file has changed, and reads
the symbol table again (while trying to preserve your current
breakpoint settings). "

-- 
Jerome


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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-06-17 20:13   ` Andrew Cagney
  2004-06-24 10:52     ` Jerome Guitton
@ 2004-07-29 14:04     ` Jerome Guitton
  2004-07-29 20:02       ` Andrew Cagney
  1 sibling, 1 reply; 12+ messages in thread
From: Jerome Guitton @ 2004-07-29 14:04 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

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

Andrew Cagney (cagney@gnu.org):

> >>When the inferior is killed, it is safe the release the different file
> >>>handles that BFD keeps open. It is particularly useful on Win32 (and
> >>>presumably on HP UX) to be able to recompile and restart a new debugging
> >>>session without quitting GDB...
> >
> >
> Can it now go in the symbol-table reader that opened the file?

I finally had time (at last!) to complete the implementation. New patch in
attachment. Still no regression on i686 linux. OK to apply? 

-- 
Jerome

[-- Attachment #2: bfd_cache_close.dif --]
[-- Type: text/plain, Size: 2706 bytes --]

2004-07-29  Jerome Guitton  <guitton@gnat.com>

	* inflow.c (kill_command): release file handles in BFD.
	* exec.c (exec_file_attach): release exec_bfd file handle.
	* symfile.c (symbol_file_add_with_addrs_or_offsets): release
	bfd file handle.
	* Makefile.in: Update inflow.c's dependencies.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.596
diff -u -p -r1.596 Makefile.in
--- Makefile.in	23 Jul 2004 10:33:36 -0000	1.596
+++ Makefile.in	29 Jul 2004 13:48:09 -0000
@@ -1974,7 +1974,7 @@ inf-loop.o: inf-loop.c $(defs_h) $(infer
 	$(event_top_h) $(inf_loop_h) $(remote_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
 	$(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
-	$(inflow_h)
+	$(inflow_h) $(bfd_h)
 infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
 	$(gdb_string_h) $(regcache_h) $(gdb_wait_h) $(command_h) \
 	$(gdb_dirent_h) $(gdbcore_h) $(gdb_stat_h)
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.38
diff -u -p -r1.38 exec.c
--- exec.c	26 Jul 2004 14:52:59 -0000	1.38
+++ exec.c	29 Jul 2004 13:48:09 -0000
@@ -270,6 +270,8 @@ exec_file_attach (char *filename, int fr
       if (deprecated_exec_file_display_hook)
 	(*deprecated_exec_file_display_hook) (filename);
     }
+  if (exec_bfd)
+    bfd_cache_close (exec_bfd);
 }
 
 /*  Process the first arg in ARGS as the new exec file.
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.22
diff -u -p -r1.22 inflow.c
--- inflow.c	28 Apr 2004 16:36:25 -0000	1.22
+++ inflow.c	29 Jul 2004 13:48:09 -0000
@@ -21,6 +21,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "bfd.h"
 #include "frame.h"
 #include "inferior.h"
 #include "command.h"
@@ -597,6 +598,8 @@ kill_command (char *arg, int from_tty)
       else
 	print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
     }
+
+  bfd_cache_close_all ();
 }
 \f
 /* Call set_sigint_trap when you need to pass a signal on to an attached
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.135
diff -u -p -r1.135 symfile.c
--- symfile.c	26 Jul 2004 14:53:05 -0000	1.135
+++ symfile.c	29 Jul 2004 13:48:10 -0000
@@ -894,6 +894,7 @@ symbol_file_add_with_addrs_or_offsets (b
   if (deprecated_target_new_objfile_hook)
     deprecated_target_new_objfile_hook (objfile);
 
+  bfd_cache_close (abfd);
   return (objfile);
 }
 

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

* Re: [RFA] win32: bfd_cache_close after kill
  2004-07-29 14:04     ` Jerome Guitton
@ 2004-07-29 20:02       ` Andrew Cagney
  2004-07-30 12:08         ` [commit] " Jerome Guitton
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2004-07-29 20:02 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches

> Andrew Cagney (cagney@gnu.org):
> 
> 
>>>>> >>When the inferior is killed, it is safe the release the different file
>>>>
>>>>>> >>>handles that BFD keeps open. It is particularly useful on Win32 (and
>>>>>> >>>presumably on HP UX) to be able to recompile and restart a new debugging
>>>>>> >>>session without quitting GDB...
>>>
>>>> >
>>>> >
>>
>>> Can it now go in the symbol-table reader that opened the file?
> 
> 
> I finally had time (at last!) to complete the implementation. New patch in
> attachment. Still no regression on i686 linux. OK to apply? 

Just a few tweaks.  Assuming there are still no regressions it's ok for 
mainline.

> 2004-07-29  Jerome Guitton  <guitton@gnat.com>
> 
> 	* inflow.c (kill_command): release file handles in BFD.
> 	* exec.c (exec_file_attach): release exec_bfd file handle.
> 	* symfile.c (symbol_file_add_with_addrs_or_offsets): release
> 	bfd file handle.
> 	* Makefile.in: Update inflow.c's dependencies.
> 
> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.596
> diff -u -p -r1.596 Makefile.in
> --- Makefile.in	23 Jul 2004 10:33:36 -0000	1.596
> +++ Makefile.in	29 Jul 2004 13:48:09 -0000
> @@ -1974,7 +1974,7 @@ inf-loop.o: inf-loop.c $(defs_h) $(infer
>  	$(event_top_h) $(inf_loop_h) $(remote_h)
>  inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
>  	$(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
> -	$(inflow_h)
> +	$(inflow_h) $(bfd_h)

"defs.h" includes "bfd.h" so this shouldn't be needed (same for the 
added #include "bfd.h" further down.


> Index: exec.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/exec.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 exec.c
> --- exec.c	26 Jul 2004 14:52:59 -0000	1.38
> +++ exec.c	29 Jul 2004 13:48:09 -0000
> @@ -270,6 +270,8 @@ exec_file_attach (char *filename, int fr
>        if (deprecated_exec_file_display_hook)
>  	(*deprecated_exec_file_display_hook) (filename);
>      }
> +  if (exec_bfd)
> +    bfd_cache_close (exec_bfd);

Just call bfd_cache_close_all ()?

>  }
>  
>  /*  Process the first arg in ARGS as the new exec file.
> Index: inflow.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/inflow.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 inflow.c
> --- inflow.c	28 Apr 2004 16:36:25 -0000	1.22
> +++ inflow.c	29 Jul 2004 13:48:09 -0000
> @@ -21,6 +21,7 @@
>     Boston, MA 02111-1307, USA.  */
>  
>  #include "defs.h"
> +#include "bfd.h"

See above.

Again bfd_cache_close_all()?

> +  bfd_cache_close (abfd);

Andrew



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

* [commit] win32: bfd_cache_close after kill
  2004-07-29 20:02       ` Andrew Cagney
@ 2004-07-30 12:08         ` Jerome Guitton
  2004-07-30 13:28           ` Andrew Cagney
  0 siblings, 1 reply; 12+ messages in thread
From: Jerome Guitton @ 2004-07-30 12:08 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney (cagney@gnu.org):

> Just a few tweaks.  Assuming there are still no regressions it's ok for 
> mainline.

Thanks. I have taken your comments into account and I have checked in the
following:

2004-07-30  Jerome Guitton  <guitton@gnat.com>

	* inflow.c (kill_command): release file handles in BFD.
	* exec.c (exec_file_attach): Ditto.
	* symfile.c (symbol_file_add_with_addrs_or_offsets): Ditto.

Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.38
diff -u -p -r1.38 exec.c
--- exec.c	26 Jul 2004 14:52:59 -0000	1.38
+++ exec.c	30 Jul 2004 10:42:35 -0000
@@ -270,6 +270,7 @@ exec_file_attach (char *filename, int fr
       if (deprecated_exec_file_display_hook)
 	(*deprecated_exec_file_display_hook) (filename);
     }
+  bfd_cache_close_all ();
 }
 
 /*  Process the first arg in ARGS as the new exec file.
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.22
diff -u -p -r1.22 inflow.c
--- inflow.c	28 Apr 2004 16:36:25 -0000	1.22
+++ inflow.c	30 Jul 2004 10:42:35 -0000
@@ -597,6 +597,7 @@ kill_command (char *arg, int from_tty)
       else
 	print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
     }
+  bfd_cache_close_all ();
 }
 \f
 /* Call set_sigint_trap when you need to pass a signal on to an attached
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.135
diff -u -p -r1.135 symfile.c
--- symfile.c	26 Jul 2004 14:53:05 -0000	1.135
+++ symfile.c	30 Jul 2004 10:42:36 -0000
@@ -894,6 +894,7 @@ symbol_file_add_with_addrs_or_offsets (b
   if (deprecated_target_new_objfile_hook)
     deprecated_target_new_objfile_hook (objfile);
 
+  bfd_cache_close_all ();
   return (objfile);
 }
 


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

* Re: [commit] win32: bfd_cache_close after kill
  2004-07-30 12:08         ` [commit] " Jerome Guitton
@ 2004-07-30 13:28           ` Andrew Cagney
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2004-07-30 13:28 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches

Ya!

thanks, Andrew


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

end of thread, other threads:[~2004-07-30 13:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-24 10:50 [RFA] win32: bfd_cache_close after kill Jerome Guitton
2004-05-24 17:07 ` Jerome Guitton
2004-05-25  9:24 ` Jerome Guitton
     [not found]   ` <40B4F5A2.9000708@gnu.org>
2004-06-01  9:26     ` Jerome Guitton
2004-06-08 19:49       ` Andrew Cagney
2004-06-17 12:21 ` Jerome Guitton
2004-06-17 20:13   ` Andrew Cagney
2004-06-24 10:52     ` Jerome Guitton
2004-07-29 14:04     ` Jerome Guitton
2004-07-29 20:02       ` Andrew Cagney
2004-07-30 12:08         ` [commit] " Jerome Guitton
2004-07-30 13:28           ` Andrew Cagney

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