From 6e586cc56592f85535f788391b4f48025311b465 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 23 Jun 2011 15:08:01 +0000 Subject: [PATCH] 2011-06-23 Yao Qi * infrun.c (start_remote): Move call init_wait_for_inferior to ... * remote.c (remote_start_remote): ... here. * monitor.c (monitor_open): ... here. --- gdb/ChangeLog | 6 ++++++ gdb/infrun.c | 1 - gdb/monitor.c | 2 ++ gdb/remote.c | 11 +++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2ff7ffdf6d..e17e37025fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-06-23 Yao Qi + + * infrun.c (start_remote): Move call init_wait_for_inferior to ... + * remote.c (remote_start_remote): ... here. + * monitor.c (monitor_open): ... here. + 2011-06-23 Andrew Burgess * gdbtypes.c (append_composite_type_field_aligned): Fix diff --git a/gdb/infrun.c b/gdb/infrun.c index 8616f99bd46..a656cbf4bbb 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2246,7 +2246,6 @@ start_remote (int from_tty) { struct inferior *inferior; - init_wait_for_inferior (); inferior = current_inferior (); inferior->control.stop_soon = STOP_QUIETLY_REMOTE; diff --git a/gdb/monitor.c b/gdb/monitor.c index 79fa1ba88d8..90f36d9e721 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -844,6 +844,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 8cdf79e2f91..19cc0b67488 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3280,6 +3280,17 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p) /* 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 -- 2.30.2