Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: [committed] [rfc] Call init_wait_for_inferior before get_offsets
Date: Thu, 23 Jun 2011 15:09:00 -0000	[thread overview]
Message-ID: <4E035732.4060704@codesourcery.com> (raw)
In-Reply-To: <201106231446.20827.pedro@codesourcery.com>

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

On 06/23/2011 09:46 PM, Pedro Alves wrote:
> Your patch is okay ...
> 
>> > +      init_wait_for_inferior ();
>> > +
>> >        get_offsets ();          /* Get text, data & bss offsets.  */
> ... with a small comment above the init_wait_for_inferior call
> mentioning the reason it is called before get_offsets.
> 

Thanks for the review.  Comment is added new patch.  Committed.

http://sourceware.org/ml/gdb-cvs/2011-06/msg00140.html

-- 
Yao (齐尧)

[-- Attachment #2: 0003-move-init_wait_for_inferior-forward.patch --]
[-- Type: text/x-patch, Size: 1954 bytes --]

	gdb/
	* infrun.c (start_remote): Move call init_wait_for_inferior to ...
	* remote.c (remote_start_remote): ... here.
	* monitor.c (monitor_open): ... here.
---
 gdb/infrun.c  |    1 -
 gdb/monitor.c |    2 ++
 gdb/remote.c  |   11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 67a74cc..3d39080 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2128,7 +2128,6 @@ start_remote (int from_tty)
 {
   struct inferior *inferior;
 
-  init_wait_for_inferior ();
   inferior = current_inferior ();
   inferior->stop_soon = STOP_QUIETLY_REMOTE;
 
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 95e6a63..4775011 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -838,6 +838,8 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
 
   monitor_printf (current_monitor->line_term);
 
+  init_wait_for_inferior ();
+
   start_remote (from_tty);
 }
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 50e671d..f329f20 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3422,6 +3422,17 @@ remote_start_remote (struct ui_out *uiout, void *opaque)
       /* Always add the main thread.  */
       add_thread_silent (inferior_ptid);
 
+      /* init_wait_for_inferior should be called before get_offsets in order
+	 to manage `inserted' flag in bp loc in a correct state.
+	 breakpoint_init_inferior, called from init_wait_for_inferior, set
+	 `inserted' flag to 0, while before breakpoint_re_set, called from
+	 start_remote, set `inserted' flag to 1.  In the initialization of
+	 inferior, breakpoint_init_inferior should be called first, and then
+	 breakpoint_re_set can be called.  If this order is broken, state of
+	 `inserted' flag is wrong, and cause some problems on breakpoint
+	 manipulation.  */
+      init_wait_for_inferior ();
+
       get_offsets ();		/* Get text, data & bss offsets.  */
 
       /* If we could not find a description using qXfer, and we know
-- 
1.7.0.4


      reply	other threads:[~2011-06-23 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20  5:12 Yao Qi
2011-06-22 15:08 ` Tom Tromey
2011-06-23 10:35   ` Yao Qi
2011-06-23 10:39     ` Pedro Alves
2011-06-23 13:20       ` Yao Qi
2011-06-23 13:46         ` Pedro Alves
2011-06-23 15:09           ` Yao Qi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E035732.4060704@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox