From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67469 invoked by alias); 4 Mar 2020 18:15:26 -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 67447 invoked by uid 89); 4 Mar 2020 18:15:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=day X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Mar 2020 18:15:15 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 49F191E508; Wed, 4 Mar 2020 13:15:05 -0500 (EST) Subject: Re: [PATCH v2] Implement debugging of WOW64 processes To: Hannes Domani , gdb-patches@sourceware.org References: <20200304171216.28885-1-ssbssa.ref@yahoo.de> <20200304171216.28885-1-ssbssa@yahoo.de> From: Simon Marchi Message-ID: <83b2886f-55c7-f8e6-e127-34bc0fe07165@simark.ca> Date: Wed, 04 Mar 2020 18:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200304171216.28885-1-ssbssa@yahoo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-03/txt/msg00094.txt On 2020-03-04 12:12 p.m., Hannes Domani via gdb-patches wrote: > @@ -1879,6 +2110,21 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) > clear_proceed_status (0); > init_wait_for_inferior (); > > +#ifdef __x86_64__ > + ignore_first_breakpoint = !attaching && wow64_process; > + > + if (wow64_process) > + { > + windows_set_context_register_offsets (i386_mappings); > + windows_set_segment_register_p (i386_windows_segment_register_p); > + } > + else > + { > + windows_set_context_register_offsets (amd64_mappings); > + windows_set_segment_register_p (amd64_windows_segment_register_p); > + } > +#endif The other place where windows_set_context_register_offsets and windows_set_segment_register_p are called is in _initialize_i386_windows_nat and _initialize_amd64_windows_nat. I'm thinking that since we are calling them here, it's no longer relevant to call them in the _initialize_* functions. I think it would be simpler to keep just the calls here. You could probably do like you do elsewhere: #ifdef __x64_64__ if (!wow64_process) { windows_set_context_register_offsets (amd64_mappings); windows_set_segment_register_p (amd64_windows_segment_register_p); } else #else { windows_set_context_register_offsets (i386_mappings); windows_set_segment_register_p (i386_windows_segment_register_p); } #endif They day somebody will implement multi-inferior support for Windows, the calls in the _initialize_* functions will have to go anyway, this it will be an inferior property anyway (I suppose you could debug one WOW64 and one non-WOW64 process at the same time). Simon