Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Do not call read_pc in startup_inferior
@ 2009-04-28 16:37 Ulrich Weigand
  2009-04-28 19:28 ` Daniel Jacobowitz
  2009-05-05 13:28 ` Ulrich Weigand
  0 siblings, 2 replies; 9+ messages in thread
From: Ulrich Weigand @ 2009-04-28 16:37 UTC (permalink / raw)
  To: gdb-patches

Hello,

a while ago, I committed a patch to avoid calling wait_for_inferior
in startup_inferior, so as to avoid accessing inferior register state
at a time where the target's actual register layout has not yet been
determined (via target_find_description).

However, startup_inferior still contains a read_pc call to retrieve
the initial value of stop_pc -- this of course runs into the same
problem.

The patch below removes the read_pc call from startup_inferior, and
instead determines the initial stop_pc value in post_create_inferior,
after the register layout has been finalized.

Tested on powerpc64-linux.

Any comments or objections to this?   Otherwise, I'm planning on 
committing this patch within the next couple of days.

Bye,
Ulrich


ChangeLog:

	* fork-child.c (startup_inferior): Move setting stop_pc ...
	* infcmd.c (post_create_inferior): ... to here.


Index: gdb-head/gdb/fork-child.c
===================================================================
--- gdb-head.orig/gdb/fork-child.c
+++ gdb-head/gdb/fork-child.c
@@ -530,8 +530,6 @@ startup_inferior (int ntraps)
 
   /* Mark all threads non-executing.  */
   set_executing (pid_to_ptid (-1), 0);
-
-  stop_pc = read_pc ();
 }
 
 /* Implement the "unset exec-wrapper" command.  */
Index: gdb-head/gdb/infcmd.c
===================================================================
--- gdb-head.orig/gdb/infcmd.c
+++ gdb-head/gdb/infcmd.c
@@ -391,6 +391,9 @@ post_create_inferior (struct target_ops 
      don't need to.  */
   target_find_description ();
 
+  /* Now that we know the register layout, retrieve current PC.  */
+  stop_pc = read_pc ();
+
   /* If the solist is global across processes, there's no need to
      refetch it here.  */
   if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

end of thread, other threads:[~2009-05-05 21:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28 16:37 [rfc] Do not call read_pc in startup_inferior Ulrich Weigand
2009-04-28 19:28 ` Daniel Jacobowitz
2009-04-29 12:33   ` Ulrich Weigand
2009-04-29 13:07     ` Pedro Alves
2009-04-30 14:27       ` Ulrich Weigand
2009-04-30 15:55         ` Pedro Alves
2009-05-04 17:40           ` Ulrich Weigand
2009-05-05 21:43             ` Pedro Alves
2009-05-05 13:28 ` Ulrich Weigand

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