Re: [rfc] Call init_wait_for_inferior before get_offsets

Yao Qi
2011-06-23T10:35:02Z

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

On 06/22/2011 11:07 PM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
>
> Yao> 2011-06-20 Yao Qi <yao@codesourcery.com>
> Yao> * infrun.c (start_remote): Move call init_wait_for_inferior to ...
> Yao> * remote.c (remote_start_remote): ... here.
>
> I don't know anything about this code, but I did notice that
> start_remote is also called from monitor.c. So it seems like this
> either needs some justification or another change.

monitor.c should be changed as well. Sorry for missing this chunk of
change in patch. Here is a new one.

Regression tested on x86_64-unknown-linux with board file
native-gdbserver.exp. Some new FAILs/PASSes appears in
gdb.mi/mi-nsmoribund.exp, but it is not caused this patch, IMO.

--
Yao (é½å°§)

[-- Attachment #2: 0003-move-init_wait_for_inferior-forward.patch --]
[-- Type: text/x-patch, Size: 1369 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 | 2 ++
3 files changed, 4 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..559039d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3422,6 +3422,8 @@ remote_start_remote (struct ui_out *uiout, void *opaque)
/* Always add the main thread. */
add_thread_silent (inferior_ptid);

+ 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