Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] regcache fix
@ 2002-03-19 18:29 Martin M. Hunt
  2002-03-20 12:41 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Martin M. Hunt @ 2002-03-19 18:29 UTC (permalink / raw)
  To: gdb-patches

Currently build_regcache is called 3 times, once at initialization, 
before any architectures are registered, once when the host is 
registered and once when the target is registered.  I don't see 
any reason for the first call, and in some non-multiarched 
targets it can cause core dumps.  
-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-03-19  Martin M. Hunt  <hunt@redhat.com>

	* regcache.c (_initialize_regcache): No need to call
	build_regcache() at this time; it gets called whenever
	the gdbarch changes.

Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.32
diff -u -u -r1.32 regcache.c
--- regcache.c	2002/02/06 03:16:38	1.32
+++ regcache.c	2002/03/20 02:24:33
@@ -802,8 +802,6 @@
 void
 _initialize_regcache (void)
 {
-  build_regcache ();
-
   register_gdbarch_swap (&registers, sizeof (registers), NULL);
   register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
   register_gdbarch_swap (NULL, 0, build_regcache);


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

* Re: [RFA] regcache fix
  2002-03-19 18:29 [RFA] regcache fix Martin M. Hunt
@ 2002-03-20 12:41 ` Andrew Cagney
  2002-03-20 18:16   ` Martin M. Hunt
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-03-20 12:41 UTC (permalink / raw)
  To: Martin M. Hunt; +Cc: gdb-patches

> Currently build_regcache is called 3 times, once at initialization, 
> before any architectures are registered, once when the host is 
> registered and once when the target is registered.  I don't see 
> any reason for the first call, and in some non-multiarched 
> targets it can cause core dumps.  

(the second time is for bfd's default architecture)

Yep, ok!  There is no longer a need to do this, and other similar, 
calls.  Will make understanding things a little bit easier.

Thanks for testing this on non-multi-arch as well.

--

This change got me thinking again about your other post about 
initialization order and a race condition.

You're right, there is one.  All the gdbtype info needs to be created 
before anything else vis:

	o	create base architecture
	o	create gdbtypes from architecture
	o	initialize everything else (like regcache).

otherwize, as you were seeing with regcache, there isn't that guarentee 
that the type info is available.

enjoy,
Andrew



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

* Re: [RFA] regcache fix
  2002-03-20 12:41 ` Andrew Cagney
@ 2002-03-20 18:16   ` Martin M. Hunt
  0 siblings, 0 replies; 3+ messages in thread
From: Martin M. Hunt @ 2002-03-20 18:16 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Committed.

On Wednesday 20 March 2002 12:41 pm, Andrew Cagney wrote:
> > Currently build_regcache is called 3 times, once at initialization,
> > before any architectures are registered, once when the host is
> > registered and once when the target is registered.  I don't see
> > any reason for the first call, and in some non-multiarched
> > targets it can cause core dumps.
>
> (the second time is for bfd's default architecture)
>
> Yep, ok!  There is no longer a need to do this, and other similar,
> calls.  Will make understanding things a little bit easier.
>
> Thanks for testing this on non-multi-arch as well.


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

end of thread, other threads:[~2002-03-21  2:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 18:29 [RFA] regcache fix Martin M. Hunt
2002-03-20 12:41 ` Andrew Cagney
2002-03-20 18:16   ` Martin M. Hunt

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