From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105110 invoked by alias); 4 May 2018 18:46:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 104247 invoked by uid 89); 4 May 2018 18:46:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 May 2018 18:46:50 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 508478182D24; Fri, 4 May 2018 18:46:49 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id D296A2166BAD; Fri, 4 May 2018 18:46:48 +0000 (UTC) Subject: Re: [PATCH 3/3] gdbserver/Windows: crash during connection establishment phase To: Joel Brobecker , gdb-patches@sourceware.org References: <1525458603-33351-1-git-send-email-brobecker@adacore.com> <1525458603-33351-4-git-send-email-brobecker@adacore.com> From: Pedro Alves Message-ID: <8700c375-c37b-9e59-d069-d62b6043b112@redhat.com> Date: Fri, 04 May 2018 18:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1525458603-33351-4-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-05/txt/msg00130.txt.bz2 On 05/04/2018 07:30 PM, Joel Brobecker wrote: > On Windows, starting a new process with GDBserver seeems to work, > in the sense that the program does get started, and GDBserver > confirms that it is listening for GDB to connect. However, as soon as > GDB establishes the connection with GDBserver, and starts discussing > with it, GDBserver crashes, with a SEGV. > > This SEGV occurs in remote-utils.c::prepare_resume_reply... > > | regp = current_target_desc ()->expedite_regs; > | [...] > | while (*regp) > > ... because, in our case, REGP is NULL. > > This patch fixes the problem for Windows targets based on Intel > (x86 and x86_64). > > gdb/gdbserver/ChangeLog: > > * win32-i386-low.c (i386_arch_setup): set tdesc->expedite_regs. > --- > gdb/gdbserver/win32-i386-low.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c > index a242f72..fdb95ce 100644 > --- a/gdb/gdbserver/win32-i386-low.c > +++ b/gdb/gdbserver/win32-i386-low.c > @@ -442,6 +442,16 @@ i386_arch_setup (void) > > init_target_desc (tdesc); > > +#ifndef IN_PROCESS_AGENT > +#ifdef __x86_64__ > + static const char *expedite_regs_amd64[] = { "rbp", "rsp", "rip", NULL }; > + tdesc->expedite_regs = expedite_regs_amd64; > +#else /* __x86_64__ */ > + static const char *expedite_regs_i386[] = { "ebp", "esp", "eip", NULL }; > + tdesc->expedite_regs = expedite_regs_i386; > +#endif /* __x86_64__ */ > +#endif Won't all x86 ports have the same problem? I.e., don't nto-x86-low.c:nto_x86_arch_setup and lynx-i386-low.c:lynx_i386_arch_setup need the same treatment? Should we put those arrays in some shared i386 file? Thanks, Pedro Alves